|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 y' X* f. v2 H+ i
- [code]EDMA sample test application
; t6 L, a Q( z$ \) n6 {! @ - /*
H# X4 R1 E) X1 U - * edma_test.c1 V8 i9 Q, |5 L/ a
- *5 p6 G9 o% ^& w: h* Q0 W
- * brief EDMA3 Test Application% r1 d, Z' V9 ?% h. A9 E; r7 W8 e
- *( Z( o# V( E2 V% T
- * This file contains EDMA3 Test code.
& Q! b' J, S. j2 H0 g. w2 \$ l6 G6 g - *
: K; U1 B" ~+ B# W$ d8 G - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: V/ \0 s1 V5 Y- E0 R j* c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% N! O9 B: D" D& k" \
- * TO CHANGE.4 C% \) W6 N2 g
- *
L! \+ R5 W3 W! C8 |& U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& ]$ C, K- h- o - *# p/ S0 `8 T8 h3 N5 w
- * This program is free software; you can redistribute it and/or
4 t8 S+ W# g, H$ T( S - * modify it under the terms of the GNU General Public License as4 N# H. w9 f6 p- b, J9 ^- w
- * published by the Free Software Foundation version 2. k7 C& q+ B. m. _
- *5 O5 \6 o0 n8 v6 x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' t) ?- ^ m6 y% ^8 T - * kind, whether express or implied; without even the implied warranty
/ c; z5 ~( y }6 w* q2 E: R) Z# z7 N - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* r3 p. F; b" g" F& Y6 ? s9 { - * GNU General Public License for more details.
: l0 h7 g9 M8 M K8 R! v - */
. m$ c# n i$ x - 0 a: f- ]- x) u0 x
- #include <linux/module.h>
3 } e n; b$ m1 ]2 [* K - #include <linux/init.h>% @) Q9 }! Q& K
- #include <linux/errno.h>
5 u# F' p2 q1 u# _* ~2 J - #include <linux/types.h>
% H7 M* {( A" k3 y% ?3 E9 v C - #include <linux/interrupt.h>
5 [9 B* ]) H2 W2 g2 { - #include <asm/io.h>
c6 h+ Q( V9 [8 R$ l - #include <linux/moduleparam.h>
4 Z( U( V5 m% P2 ~$ Y5 } - #include <linux/sysctl.h>0 K/ `9 \& o* f" E$ O
- #include <linux/mm.h>* U1 Q! L1 h4 X
- #include <linux/dma-mapping.h># @+ M; R P6 E
- : v2 K0 R$ F: C$ _" ?0 H% [( f. m
- #include <mach/memory.h>
6 A0 v: d5 B8 w: n- O - #include <mach/hardware.h>
6 h% I Z; x9 g3 h, V6 { - #include <mach/irqs.h>+ n: t5 B4 }/ V* ^
- #include <asm/hardware/edma.h>
4 @0 N: `' z8 P- x
+ Q) c) i- @. o$ h; J- #undef EDMA3_DEBUG- g' D6 G# d- V& E7 U( }9 ]
- /*#define EDMA3_DEBUG*/
; n% f. V7 A1 {' t - ) Y8 P$ I" x5 t4 X$ G
- #ifdef EDMA3_DEBUG1 n, B( d+ n* a7 Y) W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 L! g0 S* s6 G$ f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& g3 _( e1 i, r% A) a& }( d) G6 f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 m: ], o0 O" {4 }& v - #else
$ P2 g2 M2 j7 P3 I% y - #define DMA_PRINTK( x... )
$ f% G, ~- H6 h3 P7 A - #define DMA_FN_IN
% J0 K+ M4 r( P; {. T! D - #define DMA_FN_OUT
W, u4 | l. T* G - #endif
! m$ L' l5 f( Q- O5 E5 o
8 F: Y& g6 V9 v6 {6 T2 p% v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( Y* i- @0 F, _% I, P* ] - #define STATIC_SHIFT 3+ n1 }/ k& `2 T( I( a: d
- #define TCINTEN_SHIFT 20( D2 `$ F" s* R
- #define ITCINTEN_SHIFT 21
7 d* L: n# W3 X! a+ c, Y - #define TCCHEN_SHIFT 22
7 n2 y+ t/ N5 w' N7 C/ m" }- P - #define ITCCHEN_SHIFT 236 }8 h; o/ ?9 F
- 6 }, r- y1 E/ F
- static volatile int irqraised1 = 0;
% _& W9 G6 t& q( w - static volatile int irqraised2 = 0;* B3 D; Q+ f, n. |! z t
- 8 i. q) m. G4 Q5 [
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, Q8 P& b/ E, [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ x8 R0 ]& C% L) m9 ]: A - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! V: J6 |6 S% O: m; P
_$ U# J! q/ O* b: X- u( N- dma_addr_t dmaphyssrc1 = 0;2 X Z( ]7 J/ D' c8 D
- dma_addr_t dmaphyssrc2 = 0;
F, F _+ V- `/ Y - dma_addr_t dmaphysdest1 = 0;- B# L) I: Z& A$ L2 q" L: |
- dma_addr_t dmaphysdest2 = 0;2 m2 s8 e) T8 E4 V) | S
- 2 ^% J( Q! E' s3 g
- char *dmabufsrc1 = NULL;
$ ^+ h( o" Y( ?$ C9 j# u - char *dmabufsrc2 = NULL;
, U6 w0 ]8 B) o! ?/ S - char *dmabufdest1 = NULL;
. A9 c+ e/ o% Y/ M - char *dmabufdest2 = NULL;
- ?8 _, T8 t7 R q) q8 S' Y R - , w1 V2 S' O6 K2 J0 T4 f
- static int acnt = 512;- P% M5 W0 l; \4 Y1 n8 O
- static int bcnt = 8;
6 Y8 v' I3 |* l+ d5 r. } - static int ccnt = 8;
# B' o+ q$ G+ Q$ @4 K1 }3 L, L/ D! c
) f& k l7 L8 H" x/ _, U; @/ p# f- module_param(acnt, int, S_IRUGO);* X' L, k, X& ?' a2 W0 u0 U! p% R
- module_param(bcnt, int, S_IRUGO);6 ?4 ~$ H& i/ _
- module_param(ccnt, int, S_IRUGO);
复制代码
) B- O" v8 \; M) \+ o; H6 P& d+ D* p7 \' F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" e# _3 v9 E7 i5 A" e1 Z1 farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. f/ J2 H' s8 s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 F3 `, t) _. R1 X4 d: N* s; j. W
E7 L: i Y0 k0 |
" G# f$ k' x# g" W* w; Z |
|