|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( s v2 _6 L6 N W# f3 q: O
- [code]EDMA sample test application
0 Q4 s- @3 X: S, C$ q - /*
/ `, |. S3 s% H U - * edma_test.c. I1 k8 L0 {, c2 p. v/ A1 e
- *3 g0 ~, C' ?0 T
- * brief EDMA3 Test Application
4 e+ E- w+ W' u4 Y( k# ~+ y - *4 Q+ I# Z% G: A: v( R5 z
- * This file contains EDMA3 Test code.
, Z! R% k5 c6 r; F - *- V7 O3 ?# l0 N* l
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, m v2 b+ j* k0 b* j( M) k. f
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. E( ]4 i* m, a$ ^. I9 F! X
- * TO CHANGE.
; p9 G1 c2 [1 l8 `% t/ N5 Y8 p" D - *
8 V3 O+ m5 w8 \' H - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ t- w e! z9 j7 {9 K: v# D
- *3 O) ^* K, l, |
- * This program is free software; you can redistribute it and/or u; C8 o1 ^ h3 O. T
- * modify it under the terms of the GNU General Public License as5 t: ?( u! \$ x
- * published by the Free Software Foundation version 2.
$ m: e2 }, `" @1 b: t. F( }+ K - *' E* ?* b" s) f1 e4 L) Z4 ^7 f L* u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 Y w- E' d4 p/ o! e$ O
- * kind, whether express or implied; without even the implied warranty
- n7 S4 W3 k' T& m! Q+ L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& p( a8 `* D1 m - * GNU General Public License for more details.
* a) S1 V8 X9 z8 p+ l. f8 z - */
2 F3 P: ~# i+ K/ ~
. [# y- Q( `. V; ]6 t- #include <linux/module.h>
* n) x; A3 h- m - #include <linux/init.h>
+ ?% [" K( O1 t$ R* @ - #include <linux/errno.h>
+ M$ a9 q* m* n8 F- d2 L. k2 T, ? - #include <linux/types.h>' Z% i% K7 a1 @; q& D* I5 f# x
- #include <linux/interrupt.h>
' z/ z5 E# `# a4 A5 D - #include <asm/io.h>
/ p1 y5 Z E/ q' B7 s' J1 I' B - #include <linux/moduleparam.h>
! o+ {1 w( m) i6 f9 b! ^ - #include <linux/sysctl.h>' X2 I. p7 ^% {" j( x
- #include <linux/mm.h> C, _1 f7 b# t9 H; m2 L% F
- #include <linux/dma-mapping.h>
- K4 i- g3 s, N
. X3 u( ?4 o1 G) g% T6 f' ^- #include <mach/memory.h>
1 B3 ~+ Z1 _6 ]) J* r - #include <mach/hardware.h>! {/ N, ]5 e% z$ p9 B9 @
- #include <mach/irqs.h>; F& B# u" G ~+ x; f4 N
- #include <asm/hardware/edma.h>( E' q9 Q$ ?' \) B' q2 N
' y/ I& _+ } i4 b) K4 N, L/ W- y- #undef EDMA3_DEBUG: A; y- f: J1 M$ ]: y- A
- /*#define EDMA3_DEBUG*/4 P- }0 p+ G" G+ h( W* N) G5 U/ R4 v1 d
- 2 o2 E6 o/ S J! o5 p: O+ P
- #ifdef EDMA3_DEBUG8 M1 h7 |- e' o& B% m2 ~; C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 `" l$ i8 ]; f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ A) ~& ]7 c+ r; M& o3 b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 Z4 ?9 q4 D+ K1 Y) P/ q
- #else
8 x2 ?6 Y' V" L - #define DMA_PRINTK( x... ), |# P% c% V. Y* K( w% C* |# ]
- #define DMA_FN_IN5 j7 w& K- Q+ e- h- z
- #define DMA_FN_OUT! Y# f$ W6 u- D( L' b: F
- #endif
- s( I( b& Z6 K/ B - $ _/ M5 u$ m+ }+ A- D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! Q/ T. Z/ Z9 u' @7 W
- #define STATIC_SHIFT 3
* @. t6 A) D8 y0 S4 a( p; J" f& N! R - #define TCINTEN_SHIFT 205 a( b* L0 d2 [+ e% [' h% M
- #define ITCINTEN_SHIFT 215 e+ ~, z/ j" l" j5 U/ @9 I) b
- #define TCCHEN_SHIFT 22
) R& O. D$ {0 K' F - #define ITCCHEN_SHIFT 23
/ s0 Z/ v% g) ~* t; W, t! L
/ @; ~6 v6 ]( g1 P8 m9 [- static volatile int irqraised1 = 0;: n* t9 a& S( s$ C# a* n4 S
- static volatile int irqraised2 = 0;# ^: q0 ^' d) }& V' b# R% k
( U* H# r! A+ S/ U# S% s7 R. j- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, A Y' m7 F) j; e9 Q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% L/ y, e( U, H0 m( T: W/ P9 S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ r4 ^7 x8 {* u) K3 X# K
- # J o: u1 e1 G9 ]
- dma_addr_t dmaphyssrc1 = 0;
+ j, j( a2 d/ z9 u# K - dma_addr_t dmaphyssrc2 = 0;
% }$ A \3 H) A( A3 j3 o2 ~ - dma_addr_t dmaphysdest1 = 0;
8 u( m" X& G/ S0 I6 ]2 e; W - dma_addr_t dmaphysdest2 = 0;$ l0 ]4 ?0 A! q3 l* e3 p* E+ o
, q) R" r* s n" d- char *dmabufsrc1 = NULL;7 A' O$ r; @" K% I L; `) Y3 b
- char *dmabufsrc2 = NULL;
* y9 P8 {7 v+ k - char *dmabufdest1 = NULL;
8 P( c8 v/ k: t8 } - char *dmabufdest2 = NULL;3 h8 G( z- x3 i! _1 Y8 W) h! V
- 2 L6 v5 Z8 [5 \7 X
- static int acnt = 512;
3 H8 K) l- R7 G4 P" T - static int bcnt = 8;
5 @" x4 l1 w9 `& I - static int ccnt = 8;
/ J" e0 f! O2 B3 U1 X& ` - 1 x& |* u5 @0 _) X" @0 S. G) ]
- module_param(acnt, int, S_IRUGO);. r" _2 J' s6 G% A/ Z
- module_param(bcnt, int, S_IRUGO);. z3 Q5 A- X3 P* U
- module_param(ccnt, int, S_IRUGO);
复制代码
7 r1 S2 j+ J0 \$ k4 G; p% d2 W: ?' x& @$ ?* ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( c; j* P. v j. Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: S$ s, k% P8 z) P; D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, v; K. t5 @& m" |' ?& K
, T; A5 c$ @/ c |* ^! u+ ?
0 ]: E" V$ O6 y$ V+ N$ O" F9 S( T |
|