|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 \0 o. }' `: w a9 P- [code]EDMA sample test application" N+ D6 y1 P! ]# n# H, n% ~, L
- /*( |9 @$ Q, N! Q% j' b) W
- * edma_test.c
) n5 {" l' B* m0 V( ~+ a - *! c, G+ Z& C: A9 x! d
- * brief EDMA3 Test Application+ t* F- ?7 S$ [% y6 ]- d b
- *5 `- t( } O5 h+ {
- * This file contains EDMA3 Test code.* @- h/ c1 C6 Z1 I2 d& M2 A/ o5 O* U
- *# t& T9 f9 B W. t e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; E3 K( K% z8 A- Z2 ]9 H$ W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 o# j m6 |7 @0 j2 r5 u% ^
- * TO CHANGE.% g' I9 h( S( Y& i- E- e
- *. o( L1 C: D: y" _0 T+ M/ A
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 f% x6 d' s( n1 t1 C% a3 z" S
- *
5 x, J. M7 V' H0 ]8 v9 B/ p - * This program is free software; you can redistribute it and/or
3 a. O& D' I; t6 J+ F4 A- B6 a - * modify it under the terms of the GNU General Public License as
, O) Q0 T4 Z" U+ l* `2 @ - * published by the Free Software Foundation version 2.
6 l! U; z! u. N/ p% X9 x - *3 T* g' t% u$ S; f" F# `" ~$ K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, `- o1 f$ ^! y' e3 x6 c - * kind, whether express or implied; without even the implied warranty" j9 L; s2 Q- }# e! }1 R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! m( I$ B4 V& ?4 s! @ G9 o - * GNU General Public License for more details.
; \( N3 r7 P1 @ ~: \ - */
5 S; [0 i& ?' D1 x/ b
+ \2 a, N9 J( K6 e9 A- #include <linux/module.h>
2 n( Q# u# y& \ - #include <linux/init.h>
0 u+ p1 p9 B& b3 q$ L5 E - #include <linux/errno.h>
3 s- ]' l8 e9 P1 p - #include <linux/types.h>6 }5 R% C# g( [) |7 t# x
- #include <linux/interrupt.h>
$ U& ^# o' W; [ - #include <asm/io.h># }/ H* d8 d" W# L8 f
- #include <linux/moduleparam.h>
; s/ o. u: E z - #include <linux/sysctl.h>
; f) P0 f) x* }. p) G' J* u4 @0 V& F - #include <linux/mm.h>0 W! N' O( J& I j3 I1 N$ u# }
- #include <linux/dma-mapping.h>, t. O2 t% I2 @
- 6 n8 \/ {! i M3 ]$ \& `& ?
- #include <mach/memory.h>
0 I/ g% L3 B" D& B* p5 d - #include <mach/hardware.h>
* w" V: Y6 r! T3 g0 a% k- k - #include <mach/irqs.h>/ v2 c H4 m" W/ D2 j5 [8 d$ R2 ~/ f
- #include <asm/hardware/edma.h>
7 {7 Z8 _) P$ ^9 W - 9 e/ k8 n4 e1 J" o0 f. T
- #undef EDMA3_DEBUG/ M2 ~5 A- D ]8 H, a
- /*#define EDMA3_DEBUG*/
& h- E7 c9 r5 z% b. ]! A# V% K - $ g4 `; \; v6 R" ?# |% A# `" S
- #ifdef EDMA3_DEBUG
" D# b' e& \9 u - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& V1 Z* o |" d* B" \" d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 m z) V. Y. S+ T - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* u* x5 V9 z5 q! w3 i/ g6 K4 P" i
- #else
2 p, y/ T; y; e0 F8 u - #define DMA_PRINTK( x... )
1 p* o, ]/ A8 R1 d - #define DMA_FN_IN
: v3 p0 P6 x O - #define DMA_FN_OUT- g4 Y, @7 r% G
- #endif
6 s/ a- k# t b! ^
8 l/ u" `4 @" `" y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 q2 G' u; H Q- R, P - #define STATIC_SHIFT 3
- b. e' J6 V; k1 b2 M1 G - #define TCINTEN_SHIFT 20
* @' p* o" i1 A4 m - #define ITCINTEN_SHIFT 217 s6 \7 e z, u z$ P; O
- #define TCCHEN_SHIFT 22
$ X2 L2 n: r4 Y$ I! K - #define ITCCHEN_SHIFT 23
4 C0 h$ q: g d) ~
9 Q+ f7 X. h! Q- static volatile int irqraised1 = 0;& L4 T( \& _: o3 q# q+ I
- static volatile int irqraised2 = 0;. c: Y# M5 L7 L$ n; }1 e
" R. R& Z. j8 Z& Z; X( l/ ]# V7 {- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, A! }( P* P& z+ P - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 u! S4 [* K$ @5 G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& e- [/ w, m1 w% \& o
( n b5 P6 b) a! E+ l- dma_addr_t dmaphyssrc1 = 0;3 P/ n8 }1 Z5 r1 P2 N
- dma_addr_t dmaphyssrc2 = 0;: G3 g% |6 E/ S* p6 J* J; v- u
- dma_addr_t dmaphysdest1 = 0;& g5 Q5 @- {" T& O; A6 a
- dma_addr_t dmaphysdest2 = 0;
/ r( l% }* E. \9 r, F7 ^ e - 8 J2 i5 @3 Q0 T- T
- char *dmabufsrc1 = NULL;
7 `; F5 j% E$ j2 \' ? - char *dmabufsrc2 = NULL;
5 D8 h6 w' m3 V4 P' P& ^" } - char *dmabufdest1 = NULL;+ ~. N; u' B! p* |1 m. r! j
- char *dmabufdest2 = NULL;- n" P% k: d$ F$ i0 q, r
- . l9 B* v8 M: Z" F* H0 G
- static int acnt = 512;0 p3 T0 { Q0 w4 W, u8 [9 O
- static int bcnt = 8;% Y! B5 i: B$ O6 @. ~
- static int ccnt = 8;
% U$ j1 d# ]8 x- G4 k! a
) B- u: Y5 P' g- module_param(acnt, int, S_IRUGO);# x x4 L( h8 b
- module_param(bcnt, int, S_IRUGO);
! v5 ?# B8 L( b; G' d - module_param(ccnt, int, S_IRUGO);
复制代码
% U5 y; u6 h" a/ y! J+ h' C l$ M0 \- J4 T2 i/ Z! }) \
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. [3 K* Y0 Y& L- e( B _9 {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 x: X8 z5 n' e3 r3 L$ N2 L2 v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 W* o9 N2 z2 N! l0 ?2 s
& X5 H2 G. C4 ?4 k; v3 a
# Z0 a% B' e0 w- ]* X' y* q
|
|