|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! [0 G. `" X1 f, I
- [code]EDMA sample test application. i: T# W$ r2 N+ t
- /*8 L2 O- |+ a7 k. l. ~( Z* q8 f
- * edma_test.c
2 f6 u, v$ m9 ^8 a, [ - *8 r! }! g9 x9 C5 l
- * brief EDMA3 Test Application" z) @% k0 f) V
- *" V9 v- r0 p! ^1 V6 s" i5 `3 f
- * This file contains EDMA3 Test code.+ m5 \: h3 i' y- w! ]
- *
' t9 M. }/ L! {! k2 U, i1 ^3 V8 n w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 u, }9 j* A$ d0 Q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 v' Y; ^( K9 p3 _4 V - * TO CHANGE.' w& `0 c' o$ X+ C; d i, o
- *
, d, b. n6 |, q1 I) w - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% l: W* a2 U1 o
- *1 a! N6 j7 Y7 \9 ]% M1 q" L6 i
- * This program is free software; you can redistribute it and/or" K7 {' e; J1 X: a
- * modify it under the terms of the GNU General Public License as1 n; N( V4 j! ]3 C( ?. e! }
- * published by the Free Software Foundation version 2.
% P c$ Q. b" d7 J) w5 {; y - *
7 `% c# E6 g* [$ G; [+ d1 ]6 w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any: e" g( z4 `1 U) G: o
- * kind, whether express or implied; without even the implied warranty! B2 y$ o# j6 m- j) n1 q8 L, d3 p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& t2 k6 i, |$ n) O' P: { - * GNU General Public License for more details.
6 b- O4 P( q) O6 }- K7 X" S - */1 O% V% i) g& B7 X
: y$ t* }' e- B6 d# K- #include <linux/module.h>
: {+ Q/ m+ `+ P5 h. X - #include <linux/init.h>" r! b7 `! d4 _! F2 i
- #include <linux/errno.h>
$ D# j' m# @ K. n3 T6 X9 m - #include <linux/types.h>
8 m/ L( M; s5 l- O! C - #include <linux/interrupt.h># L4 c/ ^7 }1 a% Y
- #include <asm/io.h>
# i9 Y- C* f5 b) H) f4 r - #include <linux/moduleparam.h>" g: p( A9 Q% ^0 H
- #include <linux/sysctl.h>$ ]% _7 `& H1 ]( }. ^8 Z! d" Z- ]
- #include <linux/mm.h>
4 u! b: D3 a0 w# L7 }) A6 s - #include <linux/dma-mapping.h>0 {6 t) G: `3 K' k) Z$ b3 G6 M2 Q
5 j9 F# F, f2 b! K* q$ h* h4 y- p$ H- #include <mach/memory.h>
# x2 ^1 G* s( H7 A2 T/ D. a) [0 I - #include <mach/hardware.h>
( R* W! ~0 `( Z/ z @ - #include <mach/irqs.h>
) Y3 e1 |. ]/ c- A - #include <asm/hardware/edma.h>6 S! k, x) b8 s) a0 f( Z1 ^8 j8 u
5 R0 X$ [% ~2 m4 B+ w. r- #undef EDMA3_DEBUG. f3 R, x1 M1 ^6 A1 Y( d
- /*#define EDMA3_DEBUG*/
- v7 B( x9 U# R0 Y; u5 S
/ |8 E' M- K: o: {0 D- #ifdef EDMA3_DEBUG& S3 H$ m! C- z6 t+ O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: q' y) m9 r6 Z9 }+ B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* d# R5 {2 `! Y" M- l: d - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 _' X; S+ F3 @6 r/ B3 x1 H - #else# J) g: D! [. E5 r7 h
- #define DMA_PRINTK( x... )
* _- M( L8 }) a d) j6 l8 ^! S - #define DMA_FN_IN+ }2 T2 y1 ~3 x: k8 c9 ~! P
- #define DMA_FN_OUT; j8 f) P# Q# b, c) ~+ O
- #endif+ I. K0 M5 \) p( ^7 d
- * A6 l1 p8 t' b% K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): N1 w8 Q; m$ M9 w
- #define STATIC_SHIFT 3
' [$ V' T& o7 ?2 B* p - #define TCINTEN_SHIFT 20
- O% x- ?0 t- o4 j" f. y7 x - #define ITCINTEN_SHIFT 21
2 X5 i7 l ]# |6 |! H! s6 ~ - #define TCCHEN_SHIFT 22
# F0 [& T9 t# b& Y' \ - #define ITCCHEN_SHIFT 231 O7 q+ ] X A& e' K
. e8 D$ M% g5 r2 B& U/ _- static volatile int irqraised1 = 0;
M+ C1 i8 ]' l( V - static volatile int irqraised2 = 0;' z$ z3 E+ `% x3 p& n. t8 E- n
- & @- `2 t1 v6 d4 R7 A8 ^" t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- J; z, U3 C& ?6 U# T. T/ ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* b/ h. g( q+ f* _
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 A8 r8 l5 r5 |+ p2 d
- # w7 G c/ b( V9 W) k
- dma_addr_t dmaphyssrc1 = 0;
5 b- ]0 O7 h5 Z( R - dma_addr_t dmaphyssrc2 = 0;
: _, H }' r: ]+ l8 ~9 U6 O+ s! d - dma_addr_t dmaphysdest1 = 0;
+ ]; @7 y( `4 D3 ]+ _ - dma_addr_t dmaphysdest2 = 0;
$ j+ ]# r2 u; N% L* ]* u - # }5 r0 @& h8 ?
- char *dmabufsrc1 = NULL;
3 P$ X5 n; ~+ R" z* | g - char *dmabufsrc2 = NULL;0 |% r2 M: D8 g
- char *dmabufdest1 = NULL;8 v* a& m2 y& y- T# G5 Q) W
- char *dmabufdest2 = NULL;
- i6 s( S& k. X0 M. x$ B* m
( r+ S. O) x- a7 N. f# c- static int acnt = 512;3 y; G, n I4 t2 A7 i% t
- static int bcnt = 8;/ A4 _& z C: j7 b# w
- static int ccnt = 8;
r/ [( B0 J+ x0 F - # N. Q$ ~! N6 k% f/ A% ~. L
- module_param(acnt, int, S_IRUGO);2 O8 t: Q( N0 ^% ^- |
- module_param(bcnt, int, S_IRUGO);
0 A" D1 o+ ^! j% {6 D - module_param(ccnt, int, S_IRUGO);
复制代码 & Q! v: X5 }* G. o' n- b9 n
5 ~( Z0 D4 n' }1 ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 R, O7 e8 [3 _2 A; Aarm-none-linux-gnueabi-gcc -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 W2 K. f. e8 g0 G/ E# z- C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 u; ~2 l/ _) i7 N1 l8 f. \" b/ o
. A9 j8 Z: p4 R- U
* v& k* a2 E$ `: I a F |
|