|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" r! ^; A) Y4 p+ q. Z. x- [code]EDMA sample test application) ~- d) C' p7 v j
- /*
& M) |9 l+ e4 c - * edma_test.c
/ F v% q; Z3 D - *
$ v- u; o; L! v$ V) H - * brief EDMA3 Test Application
4 Q+ ^1 Y# M l0 E4 [ - *# l1 ~% }% w. r% |+ M/ T3 D
- * This file contains EDMA3 Test code.2 W; X. e8 u5 }- e0 x0 o
- *
8 c$ \" m& X) I( b. z1 ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ N2 y) T) |9 j4 w: b* n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ j5 \: h' r3 i0 p - * TO CHANGE.
0 y7 @4 w% m0 j - *- ?3 ?3 M* D6 w& }# i
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 i- f/ L7 G4 e3 @5 u! y/ n2 q
- *
, _$ B8 c. v/ Y1 s2 A - * This program is free software; you can redistribute it and/or
( T: J6 T1 Y+ j: q4 D( e - * modify it under the terms of the GNU General Public License as
5 @' Q0 n U: G2 f, W) e - * published by the Free Software Foundation version 2.
; k- o ]% t/ Z" O1 E5 W - * a4 C9 `6 ~3 _! ]$ w+ J3 H0 {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# t H* J* \: w" b3 N4 M1 X) p - * kind, whether express or implied; without even the implied warranty+ o& L6 z7 r. j7 g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 b( E. U/ H6 ^9 ^- l$ w
- * GNU General Public License for more details.
& W! M% g' ]9 Q# M" c - */: d: N* O. m5 d; @1 E
, T8 v+ P( @) s6 \# [; t+ W- #include <linux/module.h>
! n* V7 d+ I: x" j - #include <linux/init.h>7 c% o' }5 f* W! \; ^
- #include <linux/errno.h># H& W5 y. a4 e
- #include <linux/types.h>
3 H* D ?2 q4 p; f) w - #include <linux/interrupt.h>% |2 @1 R5 \% _! `) `; {5 G+ Z& ^
- #include <asm/io.h>
5 T- y4 X3 B8 n# n$ R$ r - #include <linux/moduleparam.h>
2 [, q$ x* i: F+ @4 p2 z - #include <linux/sysctl.h>7 M9 ~4 L8 d$ l+ \! V
- #include <linux/mm.h>7 {4 j f, J/ a" w+ d$ ~9 N+ J$ W
- #include <linux/dma-mapping.h>) S* ?* w. ^, v
' Z7 ? p* e" ]- #include <mach/memory.h>
* S. [& L, u$ s - #include <mach/hardware.h>0 f& |- r$ h7 R. U$ {. p, D6 {
- #include <mach/irqs.h>
" z& |$ P7 r5 l, z - #include <asm/hardware/edma.h># X1 G! Z. V& M' b9 c+ A
- 1 q$ O" d. i' i. B7 v
- #undef EDMA3_DEBUG9 f7 O7 g0 k N3 e( {2 f
- /*#define EDMA3_DEBUG*/( b$ q. ]" d) L* c! K/ T: h
- # E1 m- v! @) n+ X$ T8 i5 |+ e
- #ifdef EDMA3_DEBUG+ X( D" ]+ P0 [8 k6 b
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ c2 S& r& a2 b; ^) \7 z0 x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 y3 g k3 B; }; e( h5 X$ { - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 f5 r/ n0 v) ~. E7 \ - #else9 z/ [% h# c$ e, ]' z+ V# A
- #define DMA_PRINTK( x... )
0 c% a8 x$ g" n - #define DMA_FN_IN
7 }( U$ ^, N' i8 Q. o$ l - #define DMA_FN_OUT1 j- N8 C6 a5 D. G. j. ]5 r
- #endif
1 ]- Z: R/ J1 n7 d6 H; Y: C$ y
( [( f: P/ x" R# F; o, I) \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 f$ H8 Q0 o. b' k0 }, h+ ]
- #define STATIC_SHIFT 3
5 _; O2 u: Z/ K6 Q: c1 v# ~ - #define TCINTEN_SHIFT 200 w. T1 B# p* G! {( g
- #define ITCINTEN_SHIFT 21
3 p7 h# _) v' _- Y. m! x- B - #define TCCHEN_SHIFT 22) g& h) T$ c! G! Z6 @
- #define ITCCHEN_SHIFT 230 E0 y5 h5 ^1 I8 t+ k
- 0 M5 R. ~) d: S. P6 K% [' E
- static volatile int irqraised1 = 0;- V/ e! }3 W1 I% J+ ]
- static volatile int irqraised2 = 0;
* U. g* L' W. @
2 _! T% E* l+ r) v" N3 K- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 o+ P+ _/ a' k Q- V6 Q% d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- B& D8 c( n' c# W# Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# n! T7 W+ ^- L# J9 N9 K' M
- ; K7 F0 u/ L: K/ Y' O v6 l a
- dma_addr_t dmaphyssrc1 = 0; Z/ m, }4 ~) d2 b0 U
- dma_addr_t dmaphyssrc2 = 0;
8 A6 j% o; Q0 i0 h' P3 M - dma_addr_t dmaphysdest1 = 0;4 ?3 Z0 k+ s# U0 |$ i0 x) M. I
- dma_addr_t dmaphysdest2 = 0;) q3 c6 Y9 R4 x) \$ U+ T: Z0 Z
! \8 R+ {: C# L6 K+ S, ]- char *dmabufsrc1 = NULL;- ^- e! s% `4 i
- char *dmabufsrc2 = NULL;0 O* j& w* y' I' V: t8 Y
- char *dmabufdest1 = NULL;1 U& C+ S* S$ n
- char *dmabufdest2 = NULL;. ^: r, t( Q0 p5 F' f" b8 o7 H: y
- + i2 t* Z3 G) P8 A( `# z1 y
- static int acnt = 512;
) Q6 y) p- v0 h - static int bcnt = 8;( f# x$ G, B0 ]! ` M
- static int ccnt = 8;
' i3 b' n8 A- b; j" m4 D% ~
) p }1 } N8 e% C0 [9 u/ x- module_param(acnt, int, S_IRUGO);
+ e+ s4 f8 {; u( C - module_param(bcnt, int, S_IRUGO);
: n1 L- [& P( q/ T - module_param(ccnt, int, S_IRUGO);
复制代码 [* e t' ^3 F& E2 i" `1 _) s6 J
! F" m, p/ i* L, D d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; @! B, i" V V$ Z1 }7 {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- L9 b3 T0 A4 K T# n$ S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- Z) ]/ ~0 p; c6 v/ J' |; K; w5 t# R+ b& s/ D! G* |# Z
6 c+ P5 [( I7 @3 X. ^5 E8 W |
|