|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 @* F+ ~ H6 C4 ]8 E- [code]EDMA sample test application* ^8 [) |5 a* N+ u/ Z
- /*
+ y7 s# C. n( o) ?' J7 ? - * edma_test.c
0 ?0 x8 D" r) G7 W$ e - *3 J8 P1 }: {, y! E( W8 s2 ?! f4 |
- * brief EDMA3 Test Application
- O; D( L9 u' z" a0 Q, x - *
z$ t& y4 v- d0 a - * This file contains EDMA3 Test code.
$ E- ?$ W- ^9 ]. ~% g - *
* N+ Z. `# q4 C% }" U2 o9 w/ P - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 _- b% T/ N! e3 t! Y2 P8 j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: V/ r6 d5 t. C7 e4 _
- * TO CHANGE.% g; T( B9 `( b) _
- *8 P! o3 X. l) N1 a, [2 O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* A: r$ m( H( b# t - *. [2 o" l3 r& ]
- * This program is free software; you can redistribute it and/or' J1 s; u( s0 Z2 V }: T3 I* `. ~
- * modify it under the terms of the GNU General Public License as
* [" v/ Y: t" ^% m! h. r6 b - * published by the Free Software Foundation version 2.% v+ y: ]' J1 L0 p6 Y
- *
0 X1 N5 h% D1 L2 w. u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 B! U0 P" O" l" N2 z% r: f6 G - * kind, whether express or implied; without even the implied warranty* |; q2 t9 `) q6 b
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 e1 \) l! _! |, T7 N- k
- * GNU General Public License for more details.# G& o5 q! h6 \# D7 g
- */( L s! C9 L7 @3 Q0 j5 ]1 ]
- 9 K& Q/ ?2 F$ g$ x3 o
- #include <linux/module.h>
( P6 n+ Y0 ~0 d! ` - #include <linux/init.h>0 K' E l/ I) P0 G! i% B
- #include <linux/errno.h>" a) ^. s* k+ p4 C: D4 F2 b4 V
- #include <linux/types.h>
3 x% ^1 \3 c, Y: I3 J, f/ n - #include <linux/interrupt.h>
5 ]$ p7 t+ U# I - #include <asm/io.h>- l6 x2 V, T) E" K9 b1 L
- #include <linux/moduleparam.h>
* f: M7 G. M% U% S2 H) h$ I - #include <linux/sysctl.h>* m# t0 z) |% c! K" J7 ?+ Z
- #include <linux/mm.h>
9 f. u1 P1 K+ ~7 R - #include <linux/dma-mapping.h>7 U3 a$ J/ ]. P; @4 Z: i! C+ d0 P v
- * _6 g/ } Z# t( A6 \
- #include <mach/memory.h>
# ?. v j, e X - #include <mach/hardware.h>
) B3 g+ `" \ u# k - #include <mach/irqs.h>
7 Y6 K: a& ~4 U! ^, m) H- S - #include <asm/hardware/edma.h>: k4 {! X O" y& w0 d& g4 j; Z( j
- * H; N: C: @# t2 s; V
- #undef EDMA3_DEBUG3 g9 v6 o4 V, B: K$ S' O: p$ l# f
- /*#define EDMA3_DEBUG*/0 O( A2 b( u7 q8 L- z7 d
- 6 |! R e4 W% }9 T, B' g
- #ifdef EDMA3_DEBUG C; i* v) f4 f+ i. p# L' z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
T" P- a6 ]2 i/ s, P2 F* z/ @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' I; O# ~* }1 G9 o2 ] - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 @- k8 R! L8 X0 \5 {* t1 B - #else
" r0 X5 U9 I5 w' ], B! r - #define DMA_PRINTK( x... )
( L6 O! L1 u$ I& B8 \( U - #define DMA_FN_IN
1 L2 U4 J; u, V7 w3 V - #define DMA_FN_OUT
. z, K0 c6 m T$ s! t; |8 q% \9 S - #endif! c! h* R i; D8 H6 F) y9 x
; ]! b& Y7 p K7 Y' U4 O# x; S9 J0 [' m. |- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# \) f0 }/ w8 g: W
- #define STATIC_SHIFT 37 g9 H l% _% A7 s
- #define TCINTEN_SHIFT 20
* z+ f5 B- k3 a( j - #define ITCINTEN_SHIFT 21* \5 u' M8 Y1 C( x. O
- #define TCCHEN_SHIFT 22
( t7 @( M' X4 z! |6 r+ P - #define ITCCHEN_SHIFT 23
4 i8 C( M6 A; x" `. Q8 o& S. L* P - ! x& C3 u) M0 l2 W! N6 r- K
- static volatile int irqraised1 = 0;$ X. _, ?0 R5 b, j
- static volatile int irqraised2 = 0;
% j2 T4 `9 K; B$ }1 D* l
1 H! V; @: j# l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 K9 \: c! ^1 L7 {( f - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& z. I8 [5 u* X- ]7 s9 Z2 @! h - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% T: V- V, H. M: w F3 g% r1 j
9 k9 r. _9 L8 s0 _* s- dma_addr_t dmaphyssrc1 = 0;
{3 {# W0 H/ z n3 M( o m6 n - dma_addr_t dmaphyssrc2 = 0;+ z8 Q" o. Y3 l2 }
- dma_addr_t dmaphysdest1 = 0;
2 y9 s$ r& `. R( S g - dma_addr_t dmaphysdest2 = 0;
/ x7 W/ z4 W; Q5 x - ! m/ r. _3 ]0 ?+ B
- char *dmabufsrc1 = NULL;! k$ o" t( F! f, y+ y$ J; @
- char *dmabufsrc2 = NULL;/ z) \/ D$ ~) b3 _) U; {1 T! [
- char *dmabufdest1 = NULL;0 Z. d( r% r: q7 m5 Z
- char *dmabufdest2 = NULL;7 P- b/ h4 A( K6 q _5 m8 M
9 {. f7 Z0 G- W0 q/ c# Y- static int acnt = 512;# W' _9 E, _8 u" P" Y9 R
- static int bcnt = 8;
/ l# j% s l# T; W4 a5 Z - static int ccnt = 8; @7 R$ v2 [8 J8 E
, Y7 v& N1 M# ~$ s1 x$ F- module_param(acnt, int, S_IRUGO);
+ D( A% M* `' \/ ` - module_param(bcnt, int, S_IRUGO);3 R9 y: }- e) l/ |, ^
- module_param(ccnt, int, S_IRUGO);
复制代码
( Q8 o- H4 |3 b8 Z, \/ K3 m2 i; K/ ~4 A. E8 X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 _/ u1 V3 V" M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% l. p0 L R7 d* B J* D
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' ~! e/ I* G4 ^6 X. S7 g% J
* {5 D% b5 t. ?/ ~+ r0 W2 S' ]- s; K$ i! s
|
|