|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : r% ~. [8 {1 F9 o
- [code]EDMA sample test application
! j! x1 J$ ~( H h5 y5 T - /*
" X! z. P" f: h$ J - * edma_test.c1 v5 P5 Q! W7 M' v6 t! { f$ G d) F
- *& G4 U; l. d6 N5 r' e
- * brief EDMA3 Test Application: ?9 h# v8 B( M5 R. I* K7 T1 C
- *' T3 M$ A* @# |7 r( s/ Q: z- {
- * This file contains EDMA3 Test code.2 ~7 k6 z0 w% E: Q
- *7 X* n( D8 s6 T/ w4 F# v: A$ u
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* X0 k) @, [9 l F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 C, p% Y2 V4 f) S5 g$ Z ^2 B - * TO CHANGE.
) L6 \; {7 z9 B6 c" d9 ~+ L+ U - *
Z. O0 q0 I q! V1 K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- M$ z$ \/ }% g - *
3 J( N( W/ }$ ^' h - * This program is free software; you can redistribute it and/or: T; G0 j' a9 d( g
- * modify it under the terms of the GNU General Public License as
& h) H4 T' y5 H, D' ^9 W9 N+ y - * published by the Free Software Foundation version 2.% ?1 D. u" I& Z
- *3 Z! d0 W5 p# w7 e/ A
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; r1 s! ?3 D9 x; f" V& Y) P' }
- * kind, whether express or implied; without even the implied warranty) a: l" N6 s+ `8 s8 I4 `4 `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: [, e' d+ ?( o \# W. |/ T; R
- * GNU General Public License for more details.
; c J* u- S4 g% R - */8 a3 Y" ?- C, |' p8 V
- 4 p/ Z3 X9 q o
- #include <linux/module.h>
& }: u% u2 G( g( o9 g _1 C - #include <linux/init.h>
5 n5 H1 ?2 K, J3 C" [ - #include <linux/errno.h>
* q- h/ e) C+ E - #include <linux/types.h>. o! Q( E7 ?2 O
- #include <linux/interrupt.h>9 `* ]* l, t% x8 D2 X% n2 |$ I9 ~
- #include <asm/io.h>( I. n9 {# b ]7 ]
- #include <linux/moduleparam.h>
; H2 a+ _. E0 y6 Z - #include <linux/sysctl.h>
R+ C ]" T' U( Z. H - #include <linux/mm.h>
5 }. b1 Z' s3 [3 z7 N2 S - #include <linux/dma-mapping.h>$ T5 {$ W* r/ s6 U: h
/ E5 P, ^4 o6 M( ~- #include <mach/memory.h>6 d8 w+ h: `4 D% R3 H" o
- #include <mach/hardware.h>
7 o' G7 ]( x: v$ H: N: O& b5 D$ } - #include <mach/irqs.h>+ |% n U: I' l9 J9 ]8 e
- #include <asm/hardware/edma.h>. e! T5 l+ K, `- ?. [7 o8 o
! n( v8 N5 a* _3 J B4 J- #undef EDMA3_DEBUG7 Z, x: t7 c; s% u9 ?
- /*#define EDMA3_DEBUG*/* ] E9 ~* k# _0 O' C
- ! ]: i7 U6 ~% _1 D% [5 y. m2 R+ h
- #ifdef EDMA3_DEBUG6 R0 A) V) O- a7 Z" v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): M* `# ^5 q" U& ]" b9 D. ?7 j8 W" ]9 j% ]
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ V6 m4 |* G4 c$ A; e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) t- g! M& b. u% u" V3 \ - #else5 H/ P/ {$ c7 F A; p
- #define DMA_PRINTK( x... )- u; `# g6 U1 D- O* q( b
- #define DMA_FN_IN
7 v; x) l3 N; l( \' P& m9 |% L - #define DMA_FN_OUT
9 F+ z" e( p3 T+ y( _# h6 ^ - #endif
9 |: K, O" @9 P" ?$ T5 b& M+ Y
$ t) W' K. ?% F/ u4 s. q5 y, L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. o8 k! ~ ?: R( \9 M r( \8 Z+ {/ D - #define STATIC_SHIFT 35 I4 r/ a" B- k2 l" o% C5 M/ a, p
- #define TCINTEN_SHIFT 20# m! G5 x# a; a
- #define ITCINTEN_SHIFT 21
& P3 O5 t. I9 @' o - #define TCCHEN_SHIFT 22
) C% I7 C5 j6 I - #define ITCCHEN_SHIFT 23
* n) p- e `8 Z# R
|2 _6 x! a1 ^; e- static volatile int irqraised1 = 0;% J$ P0 o6 c3 W
- static volatile int irqraised2 = 0;
' L; w# ~, K c6 ?. p6 D - r0 ]. ]2 J6 l* ~, V h9 m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 {6 |- `! ]- D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& D, U: t) A9 `$ j$ n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 o0 e" J+ ^6 k8 C/ e4 W
4 l# ~+ ^* @% ^# x: e- dma_addr_t dmaphyssrc1 = 0;* o x: D4 f( K8 h$ @
- dma_addr_t dmaphyssrc2 = 0;# t: V7 i4 V$ ^2 h" V
- dma_addr_t dmaphysdest1 = 0;
2 M7 t1 \+ O+ r7 h, G% h: V% i - dma_addr_t dmaphysdest2 = 0;
5 h( }2 z( ~# c4 B: e0 ~/ L - 6 m# s5 e* Y Z0 j- b
- char *dmabufsrc1 = NULL;
1 G+ k0 X- G2 ?1 M) K& D* z - char *dmabufsrc2 = NULL;2 B9 [/ R( h l. k
- char *dmabufdest1 = NULL;( q j4 M8 F c/ l( b
- char *dmabufdest2 = NULL;
% a O1 |3 H0 t9 v
6 t! m$ F0 `$ `9 ?. w. i9 t" n1 ?- static int acnt = 512;
5 o/ t [& _* _* Z - static int bcnt = 8;& ~" `4 D- G1 v G9 z: j, i1 F
- static int ccnt = 8;
9 ^0 Z" D) b4 s9 ]
0 r c4 f' P J' n7 k4 n* l/ u8 H- module_param(acnt, int, S_IRUGO);
5 E5 E6 ]" K( G# ~* \7 x, Z - module_param(bcnt, int, S_IRUGO);8 H) K9 L% W9 ^
- module_param(ccnt, int, S_IRUGO);
复制代码 3 @1 {5 J* v+ K% o A1 ]( _
6 Z. }2 R$ B& M* U8 u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( z) ^4 y2 G4 k5 Q# k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: J( m5 [, j# F
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ J3 P5 l+ Y( }3 I/ d" T4 a( u0 X" O7 P
. v% q6 z# W8 u: Q1 g |
|