|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: A+ O5 }" s) e" H- [code]EDMA sample test application: Z8 z$ Z: l A+ J- P# B
- /*1 i9 N6 ]( ]3 l, d/ e2 o6 c
- * edma_test.c' v7 x3 l0 G& z4 ^- e' Q4 m0 E, C
- *2 D9 A. i/ [# E
- * brief EDMA3 Test Application
+ q* r3 J" i: `2 Y% m - *
. u" H$ T$ j+ ]2 O# M8 Z" G, H - * This file contains EDMA3 Test code.
0 j9 O7 \* a& R+ ~/ X6 k: }1 w - *
1 G; g1 [* I/ W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 a4 ~# r( T3 K e. |' V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 I4 H, G# }. N& e& f - * TO CHANGE.+ w& q& n- z9 B: j
- *
. ?; R7 w, H. M$ N& W+ K+ k - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 K. N7 E# s9 _/ Z, x2 j. Q4 C
- *
6 E% ]1 a1 n1 R, T0 q - * This program is free software; you can redistribute it and/or1 F) R2 u: B% N/ {& L: g2 a2 x
- * modify it under the terms of the GNU General Public License as
/ Q! ~" v% P7 y9 g, F* c. t - * published by the Free Software Foundation version 2.
( }% a; N/ }) N c+ m3 W - */ r, l- V* Q# G6 ]- V0 ]& a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. ~% Z# U& c: O1 R, L
- * kind, whether express or implied; without even the implied warranty
* g5 n" {( B* G, w6 u - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 F5 h q2 T* b- F - * GNU General Public License for more details.2 F# Y- ?3 k' _" J) C6 r" \" H! m6 _
- */# A0 v3 Z9 x) K3 q' E
2 K8 y+ o& R$ t" R& J$ R- #include <linux/module.h>
/ z/ o. N4 p4 S! h5 g - #include <linux/init.h>7 Y K5 v/ p. ^5 M: Z) ~
- #include <linux/errno.h>
2 B7 S5 Q; L, ]- q# F6 [, } - #include <linux/types.h>6 O0 e& j' l1 c# f+ D
- #include <linux/interrupt.h>
. ~: s+ i: B( ]/ T4 Q6 {* q8 G - #include <asm/io.h>
3 h& V4 k, A- t$ s* w; u - #include <linux/moduleparam.h>
! u; A2 G0 I* |5 }3 { - #include <linux/sysctl.h>
$ s+ V8 X G6 U5 _ - #include <linux/mm.h>
) {/ P* O' F$ t7 P - #include <linux/dma-mapping.h>' F" L5 _! b9 D8 c% k6 r( z/ Y7 u
- * \2 u" l5 b, T7 ~
- #include <mach/memory.h>
1 l1 ?7 c, J$ \& c+ O - #include <mach/hardware.h>) p9 g4 }) M' m. E( g4 q
- #include <mach/irqs.h>
' U: }8 ]2 x' L, h - #include <asm/hardware/edma.h> w) d& q, ]6 b0 J8 U* L( K
! B7 ^* R0 z8 d- #undef EDMA3_DEBUG
! G- @" {" E- d. [. y - /*#define EDMA3_DEBUG*/4 q$ Q/ x2 ]% }7 ^! }* G; p5 v; o& c
0 i8 D7 u1 B; {& p, k7 r, C+ B- T- #ifdef EDMA3_DEBUG
1 V F+ N# ~" Z7 `& Q( k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 z. X- F8 T+ k7 l# b2 r/ s E
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 @4 H) l: k' b5 Z) M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); M3 T2 j: s) Q6 ^" }! G
- #else
9 r: N9 _+ P( G4 [* V0 O - #define DMA_PRINTK( x... )2 S6 g4 K) i5 D" Q/ g" e7 S
- #define DMA_FN_IN& J1 u, W/ N1 h( a; Q) r; w& S7 u
- #define DMA_FN_OUT
2 Y& i% u- w* @ - #endif
1 H( m" `& F/ G- B0 @
& ^+ R- B7 J, [- \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 A5 \3 i2 }+ m# l2 f - #define STATIC_SHIFT 3/ a/ s; o3 M/ g# s& W
- #define TCINTEN_SHIFT 206 t$ C* P" h* M* U
- #define ITCINTEN_SHIFT 21
4 ]. ]4 N6 Z; Z& e' y& b/ P; \; S - #define TCCHEN_SHIFT 22$ y, X$ \$ ?0 q1 j' o' Y& {
- #define ITCCHEN_SHIFT 23
( p; K2 u3 P' V4 y6 M - 5 v3 S! o0 d: V; I9 ^7 I8 b4 b
- static volatile int irqraised1 = 0;$ R% K/ b0 G; A+ ?2 J5 u
- static volatile int irqraised2 = 0;
' k3 e, x1 Q/ ]* b
) ]8 s! H' }6 e1 ~/ y4 }( Z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 N& Q3 `7 g, ^% ?0 S; N0 n4 O* y1 ^2 _ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% |/ y4 k& s' i w1 [, Q# m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" [9 W+ U0 N7 _9 |1 e E
; S6 D* R' U: [/ `+ J& N- dma_addr_t dmaphyssrc1 = 0;
2 L# _- x' P' |5 T - dma_addr_t dmaphyssrc2 = 0;
: W4 w; \/ A5 X0 C3 D( x - dma_addr_t dmaphysdest1 = 0;
" X# l/ r- f7 h - dma_addr_t dmaphysdest2 = 0;
! g# y* t2 y/ x9 b; w - , c" c B2 \, x& ]
- char *dmabufsrc1 = NULL;
/ J J; l; Q }, y& C$ j% P - char *dmabufsrc2 = NULL;
3 x0 F, B5 y+ T1 D4 L4 k% @% O9 G - char *dmabufdest1 = NULL;
* `" \6 _* f2 f# I - char *dmabufdest2 = NULL;% v8 }1 z7 ]: E' m7 @9 I! c8 {0 H6 M2 h
- $ D6 w! s- ]. Z' p) N, W& l
- static int acnt = 512;, ]0 L" j x9 I$ H6 y
- static int bcnt = 8;
/ l G. I+ H/ Z7 [ - static int ccnt = 8;
& n3 x( f2 z' K* W3 { - ; C+ p) p4 X: g. m0 I2 E
- module_param(acnt, int, S_IRUGO);
) }) `3 }1 W) o ^ - module_param(bcnt, int, S_IRUGO);
* K# m- x% ~6 w, y, c$ R, t - module_param(ccnt, int, S_IRUGO);
复制代码
1 M4 x5 G) d# r' _- W2 C1 d
4 B; y4 B( u( O5 b& v, K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! g& Y5 e: `/ c8 R- e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 x3 v6 R. r" |$ e9 [, p
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 y, ]" Q2 x3 ?7 I$ J
8 N' N% Z1 J( Z2 l( V7 X3 w; @5 v Z6 m
|
|