|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 f9 }3 X; |3 R( ^4 Z2 s; |8 N: S1 h- [code]EDMA sample test application
9 S3 D$ j2 T8 t - /*6 I) s$ _# p* L7 i0 s% h" X0 N
- * edma_test.c
5 I* `; v3 e3 M- y5 S$ ] - *, \1 q3 c. o3 ~+ ~" q* d z; p
- * brief EDMA3 Test Application
$ T% C$ p4 d1 {1 M5 t9 u. s - *
3 f& v: y$ C. g1 B% h0 ?- u - * This file contains EDMA3 Test code.' k L% w; _3 D
- *9 h* t+ G/ b# W2 v( N; O
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 [- G4 m2 \3 Z3 E) N3 g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 S5 ]: U' t0 G/ C: j% t8 ?7 t7 ~2 z
- * TO CHANGE.
" N* D- o. d5 M3 s# S9 _ - *
: C4 P1 P% H e/ }5 y( G0 N# k - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// {$ `4 ]2 M, I" d( D, r
- *
( X5 u! a8 S |" p( Q" p - * This program is free software; you can redistribute it and/or N" X/ a9 f* e, {; g. C5 ?
- * modify it under the terms of the GNU General Public License as
3 [' V% ]0 E- Q# P - * published by the Free Software Foundation version 2.
8 E7 n5 L4 H" l# g - *
+ S. w) J; R1 F: R$ ]2 o6 ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ R- X: f5 \1 n/ ~
- * kind, whether express or implied; without even the implied warranty
# D. r1 n, h5 ?5 {( I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 g% Z( T7 j3 Y5 Q - * GNU General Public License for more details.
) v9 F; d+ a! K/ u& E. P9 D - */
/ |7 o/ T9 a( D8 v0 v
. R& x6 v+ z2 L& r y/ B( V- #include <linux/module.h>
4 Y5 |9 g, |2 c - #include <linux/init.h>
1 [8 y% b& w' @: } - #include <linux/errno.h>$ ~9 o: h Z" K* g2 e
- #include <linux/types.h>2 Q$ O/ Q5 l+ T% x! h% L
- #include <linux/interrupt.h>
. u7 L- K- c# U! Y - #include <asm/io.h>
2 H/ l0 O( `! s$ B7 C - #include <linux/moduleparam.h>
9 j' U- o2 ^* H3 V - #include <linux/sysctl.h>
6 c5 V$ D8 S% v - #include <linux/mm.h>; N1 r" r4 w; U! B1 s0 ?
- #include <linux/dma-mapping.h>% J; W+ l% _/ B3 E
- * m' F. `: z4 c9 `. T7 _$ P
- #include <mach/memory.h>
5 E$ `3 g2 W; I: H P - #include <mach/hardware.h>
/ g- ~' N, l% R4 ?. L - #include <mach/irqs.h>8 V d0 O! d: k! g
- #include <asm/hardware/edma.h>( ?+ {& w1 o, \9 s7 T
; ]: n- a" g8 r( s) b- #undef EDMA3_DEBUG* d5 p+ U3 N/ w1 W" |/ w( {' Z
- /*#define EDMA3_DEBUG*/) z# Q- k5 {: q: J5 j" [2 v
- - F; j+ F# r0 O# M* t$ T
- #ifdef EDMA3_DEBUG, U* [- Y' a' a. N
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 |7 ^% l8 M/ q; `8 C' y8 L" a' s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). O" q) G3 `0 ?; e* I1 y6 n5 u/ |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' m8 r/ }& n; g0 M+ { - #else+ S3 |7 B$ V1 w7 V0 h
- #define DMA_PRINTK( x... )
- ]& |3 q8 N1 c - #define DMA_FN_IN: L$ L" s0 m8 X: G) w/ f/ d6 M
- #define DMA_FN_OUT& R6 N, M: i1 r7 u
- #endif
. y9 ^, F6 o) m7 u. \
( n2 \5 \; Z" Q2 \# p2 B# H- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. r3 L8 \. }+ K% T2 [* ?/ x - #define STATIC_SHIFT 30 k. K+ L, l. H; c6 X
- #define TCINTEN_SHIFT 20
# ^) S3 I8 x- G& ^& U - #define ITCINTEN_SHIFT 21, l! w9 z) q6 P& \9 f
- #define TCCHEN_SHIFT 22) G& Q+ Q7 b5 b: ^. W1 j& z
- #define ITCCHEN_SHIFT 232 K& X' p' [: t1 n
- . Z$ [6 n% H' _4 L. m3 q# C2 y ~3 v
- static volatile int irqraised1 = 0;
) c/ D2 T+ W0 ^5 r9 I5 m; \ - static volatile int irqraised2 = 0;. {4 E* |% x8 z
* Y! L, p; E1 o8 }- w- B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 d6 M) p& ]" z5 n7 \3 d+ F - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. g# f# f6 K; w+ U. E- {6 f0 p - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, Z( v; c$ H0 M2 j' H v
- 3 d3 u) G- y- Q7 i* ^3 a* A
- dma_addr_t dmaphyssrc1 = 0;" w5 k( _. @" m6 l0 N E Y
- dma_addr_t dmaphyssrc2 = 0;
/ k' \" g' n3 B a/ w1 } - dma_addr_t dmaphysdest1 = 0; K9 c/ P7 Y7 F7 N; l
- dma_addr_t dmaphysdest2 = 0;
* Q) F) c" F5 M" y - / h7 Y& E, e$ F+ T/ L# K. ]
- char *dmabufsrc1 = NULL;
* o1 G" ~ H C8 U2 @& W6 n& z% S9 y - char *dmabufsrc2 = NULL;2 j z9 |# q2 K) X3 \- v G
- char *dmabufdest1 = NULL;0 B' Y: P( Q6 c: J! c8 X2 Z& j
- char *dmabufdest2 = NULL;
* e* Z1 l" Z ]/ O6 g' w% F& Q - f9 q+ t/ K+ _4 k
- static int acnt = 512;+ C- e" X' I( _: h7 P& w9 x) s
- static int bcnt = 8;
, z) R- G( {8 ` - static int ccnt = 8;
* c* a. |. f% k9 D5 [4 p
# h2 Z1 ^3 t( V/ `( g% A' p/ c- module_param(acnt, int, S_IRUGO);1 t* ]' j" D" G5 ~7 g
- module_param(bcnt, int, S_IRUGO);
7 l- l: H$ z9 f2 y3 ]1 p5 s5 [ - module_param(ccnt, int, S_IRUGO);
复制代码
) ~2 F9 j6 [3 M9 A G! g% _# s2 W: I, `* _2 y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 e+ M$ j8 z: Q- x+ f9 x9 i
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 f P4 o f" ] t) X# B$ B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ h+ N, P* y& g) b$ ?4 ?2 [; _# y! h; a. w; z1 ~1 m$ H6 V- O0 b
' ]% J( F# H9 @3 d& f( L
|
|