|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # }" `$ L9 v* }8 m0 z$ h
- [code]EDMA sample test application( N, u$ M+ ?/ E3 u& A+ ^7 b
- /*
* r, E+ o' S( q7 [ - * edma_test.c8 V" E9 X2 J- g* @6 {* ~
- *8 k& q) t. K9 k ~$ X
- * brief EDMA3 Test Application+ S- y2 m# O, e) K. W; c" D
- *
; r2 c% w( Y) M - * This file contains EDMA3 Test code.
( Q" a* U0 e8 j7 V& X - *
* r5 Z' U8 H* K' n8 H - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 L8 }2 k! s7 F' f& V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 I3 _. E: k/ D- L* ?' @% o% O - * TO CHANGE.
: x% \; @) I9 m- m; n - *8 z, q" O9 Y$ L" Z, _- }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ F$ G! u& x7 D0 M9 o
- *' {7 w( R, `& ~/ n
- * This program is free software; you can redistribute it and/or! B0 v9 D8 P3 i: S; \% }+ B
- * modify it under the terms of the GNU General Public License as
9 r) K9 h- p7 @ - * published by the Free Software Foundation version 2.
$ o" V2 [; `0 L1 R3 i - *3 c" f: k0 {$ E& y3 D. Y, g
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; y/ J( V( K1 V7 U
- * kind, whether express or implied; without even the implied warranty
- s. j" h# n' n& q' \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. X4 ], i. M% [
- * GNU General Public License for more details.
7 w" c' R7 o2 S* U& H6 c. u - */
+ [, c6 D5 A1 G) D0 O: I
+ n! @8 n Q$ l+ E' e- #include <linux/module.h>
/ K0 x* V7 p; K8 q - #include <linux/init.h> d2 f' I7 z8 H
- #include <linux/errno.h>- L/ O$ p9 U, U) W
- #include <linux/types.h>
3 ?* v8 b3 X, L0 t* l$ E/ g. w) S - #include <linux/interrupt.h>: u5 _4 C2 R# g4 l
- #include <asm/io.h>) W1 C, U+ n8 x. Z2 f
- #include <linux/moduleparam.h>% |: l" D1 y- w8 U6 \
- #include <linux/sysctl.h>* Q$ m% D: f; Y" k* t
- #include <linux/mm.h>) y5 x2 |* @* t6 m# ?! c
- #include <linux/dma-mapping.h> M, m8 {/ T. ?1 ?: N7 Y# Y! ~
- 9 I6 G% l& ]! s3 ]
- #include <mach/memory.h>4 r( W: [1 [5 C. l8 Y3 B8 y' h
- #include <mach/hardware.h>9 j( @4 S" I, ]& ^* ~. |6 }
- #include <mach/irqs.h>
3 f- B9 ?) }5 b8 D2 _, c) } - #include <asm/hardware/edma.h>8 W3 t1 e) w. U. N; F- `" w
% G/ ] ?3 r/ D2 D- #undef EDMA3_DEBUG1 l \3 N$ l+ x# u( J" a) k
- /*#define EDMA3_DEBUG*/
% t" U+ l* m d9 ~' f9 b9 k _ - ' d0 f: @" }1 F" ?. U
- #ifdef EDMA3_DEBUG
& \0 x$ A, A& J: M- j7 `! Q) L - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ f: s9 T9 R, f0 S+ V: a( E# x3 N
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* h; }! U2 W E5 X) K T7 V9 Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 C0 I/ Y+ `# L9 P1 ?
- #else5 s) a) H# |' o6 |6 R; a
- #define DMA_PRINTK( x... )
; {2 f+ `4 f) _: E2 j* ] - #define DMA_FN_IN
7 v0 K/ X* N: c4 G7 { - #define DMA_FN_OUT$ w# b, r# L; y. _( s" ^+ W5 s
- #endif
' s& M r3 E9 ], i8 o - ! P1 _* t/ j0 f4 E6 d2 ~
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: i4 ^; c. n1 A - #define STATIC_SHIFT 30 R% x3 o- K# @7 M5 K
- #define TCINTEN_SHIFT 206 M6 E. I; P- R# r0 `4 S- U
- #define ITCINTEN_SHIFT 21
( X2 d; j" R6 K4 ]. a8 Z( \ - #define TCCHEN_SHIFT 22
( w$ q `( S- K) N& H - #define ITCCHEN_SHIFT 23
7 ?* `* [4 X5 o" h+ E
( z7 Q8 V7 d* H' L( o) m- static volatile int irqraised1 = 0;/ a# u, v2 K# }9 `8 n- q
- static volatile int irqraised2 = 0;
0 S& X W) C g2 Z1 w# _& `/ E
# f* l4 ]! ^3 A `' ~' m- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 I( C* w& k( N3 E U" G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! X0 U9 ^. i4 I+ T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 R4 `5 E H9 N* a4 }$ J
" m2 s I0 V( ^$ K5 f- dma_addr_t dmaphyssrc1 = 0;
4 w) M, R, x* n) z1 {' K0 l) X" W - dma_addr_t dmaphyssrc2 = 0;. u7 q8 R ]2 ]: b: S' c
- dma_addr_t dmaphysdest1 = 0;: G/ v1 N8 `# i6 N3 N
- dma_addr_t dmaphysdest2 = 0;
% k" d% f3 Z4 _3 m - 1 j8 H J2 {& Z# L* u6 L1 q
- char *dmabufsrc1 = NULL;
' g- l- ]; b7 n1 T) [ - char *dmabufsrc2 = NULL;
; R: G: J/ z* z2 X1 v0 f2 A( W - char *dmabufdest1 = NULL;
" z9 U' Z9 s$ K( o - char *dmabufdest2 = NULL;
& [# Q1 C* U5 }8 W/ {
" [/ e* x' l& o- static int acnt = 512;
w W+ X5 g2 ~! P4 m - static int bcnt = 8;
% V, Y$ _1 @0 A+ y- s& N' a" V! i - static int ccnt = 8;: h: v4 W& Q0 Z, n) R1 B3 Q* n
- % [2 } \. A0 ] I
- module_param(acnt, int, S_IRUGO);
& L% m& ^6 `. s z* N4 P - module_param(bcnt, int, S_IRUGO);% c- b8 Y6 \% c1 ^( I- z6 @
- module_param(ccnt, int, S_IRUGO);
复制代码
) L* |5 u! @) i/ I/ P9 |: Y" x$ N
' j8 P- }) V R4 Q Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- W) f$ I/ M5 w* 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 e E" `( T: S0 W) z* K 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' s7 W* C" X) e4 a
/ z, R; v" t9 J( m: y; u
( M8 U0 g j" N% Y( b( q; f9 Z
|
|