|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 g4 n# s. U8 v6 y) t% y- [code]EDMA sample test application6 B5 \5 ^$ v: c( z- O) _
- /*
' l( s8 x6 E5 S Z7 e6 V - * edma_test.c) C: X/ V; f. ^2 G% B
- *5 g4 l1 z6 q1 A, H0 u5 ]; h( R' J
- * brief EDMA3 Test Application8 f3 O# x2 E+ u; l7 x
- *
3 Z5 M& f5 j8 w# W - * This file contains EDMA3 Test code.
3 N w& K' j0 K - *
* x( N8 K) d' S$ o" v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! f/ z! e3 y4 n# s, n+ J! a# E) f8 Q. S
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! V! @& _7 M3 Z8 W) J1 v! ]7 F
- * TO CHANGE.
; V" i8 h7 s$ f! c) h( | - *' U7 i3 Z: S- [2 E3 }( l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: L2 I/ z; }. \6 F& i% E
- *
+ u9 i; Z4 I& s3 [2 \0 u - * This program is free software; you can redistribute it and/or
, O( U! O3 m Z - * modify it under the terms of the GNU General Public License as
- C/ A' o* f. ]/ W$ Q - * published by the Free Software Foundation version 2.
8 l7 ` A6 T; ~( o: Q; i* M( A - *& b0 u, ~& ^/ S
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 d! x3 O/ m4 Z1 _ - * kind, whether express or implied; without even the implied warranty
! m7 R K* l' i/ E$ P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# p* y4 s' v( u, L% t - * GNU General Public License for more details.
0 s0 N6 \% J+ J! r3 ` - */
; ~8 X( r- ^- L% ~! f) m - * k# R9 O* r# b
- #include <linux/module.h>
# l2 w. B0 l4 F/ w2 C) I - #include <linux/init.h>
; J3 W/ X* ?0 R) i8 b* D2 ^& t, F - #include <linux/errno.h>" W8 i3 L @# X4 n( t6 ]& r
- #include <linux/types.h>
( I3 C* a( H5 l6 U* p8 |$ G - #include <linux/interrupt.h>
2 y* C% Z, a' h- a - #include <asm/io.h>
. b! k. K6 W; f4 @ - #include <linux/moduleparam.h>9 m/ X6 J0 W1 Z" k# f/ [( o$ J3 G
- #include <linux/sysctl.h>
' e# a& ^* F! Y& G! K: c4 Z7 f - #include <linux/mm.h>
Q+ M# p9 g$ ?. u: V) c1 k9 f: Z* B - #include <linux/dma-mapping.h>9 b6 B" i6 P$ \" ]# d Q! B( S6 J
- 5 L6 Q) |2 G5 L9 Y2 O+ T) y6 w$ ^
- #include <mach/memory.h>
5 @3 @0 v6 ~/ s: P8 \5 j6 t - #include <mach/hardware.h>. e$ L5 z# O0 ?- X2 n/ V! R
- #include <mach/irqs.h>
; c, R. b, n) n/ l& n - #include <asm/hardware/edma.h>
) y$ d$ j, N5 k9 Z; v - 0 _1 j8 Z9 `7 z- P
- #undef EDMA3_DEBUG( e) a( ^& d3 Z5 \! j$ ^5 `3 l
- /*#define EDMA3_DEBUG*/
: k: m" o G6 C7 { - 4 |+ L1 b% ?- @8 H+ C, g$ S% B
- #ifdef EDMA3_DEBUG$ s% `2 d) c0 z( r5 }/ M6 M( r/ ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); R4 [3 k; c+ |1 E; r. [( H6 V7 c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# {$ O* p# {1 h( ], V - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 [. i1 n. m, H - #else4 ~% ]/ x5 E2 Q* g9 s
- #define DMA_PRINTK( x... )
! x8 _' k! N* @- l, p. t - #define DMA_FN_IN
' U) F( _0 P4 h8 U# |+ v0 ] - #define DMA_FN_OUT
* q4 I4 ?8 \% c$ k1 ]: n, w# O - #endif r. G8 ]9 d7 V8 z, m2 _5 F
+ ~0 n# l2 C# \' T- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 H! _4 {+ {( f) L1 {2 N2 o- j
- #define STATIC_SHIFT 30 s0 u# {) G7 K% u7 H% E: v
- #define TCINTEN_SHIFT 20
: W# Z, E' l9 P- R# x- _ - #define ITCINTEN_SHIFT 21
( x. c, Z B3 S - #define TCCHEN_SHIFT 22
) [+ K( l2 h/ [; W9 M - #define ITCCHEN_SHIFT 23
/ c8 G. r* Q! j' l* X+ l5 Z
# J) m/ ]4 _- p% u& ]3 C7 G4 ~, V- static volatile int irqraised1 = 0;& }) R0 c5 V6 y9 k; X" t
- static volatile int irqraised2 = 0;
8 i: {+ u0 g0 U) Q' j! h* i - " U. I$ X; W) k* o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 j7 K) O: r) F( D4 t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# z4 m2 \/ R* S( ]; ]7 s6 e% Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 \# D' C7 M1 w1 B - 8 {5 r C6 T; b" C# m4 b
- dma_addr_t dmaphyssrc1 = 0;5 {" |( K2 p) }( s6 o
- dma_addr_t dmaphyssrc2 = 0;1 _3 l( Y: Q4 t/ p; U/ M( z6 ?
- dma_addr_t dmaphysdest1 = 0;. Q2 L1 `1 Q& s) j
- dma_addr_t dmaphysdest2 = 0;
- n9 U$ _* l* S$ k' S4 E - 4 O8 \6 R- h& K2 ]% c' t5 T4 {5 w! t N
- char *dmabufsrc1 = NULL;
0 W, g* l# b ] - char *dmabufsrc2 = NULL;
0 U }3 D8 g* t8 Q8 e% m% u: D - char *dmabufdest1 = NULL;
$ H; V0 u9 v+ Q: x7 Q6 s - char *dmabufdest2 = NULL;
! J* g+ n+ p3 U# o1 ?4 |6 S - 5 ^ y+ T/ p7 S% r0 |6 K$ _
- static int acnt = 512;
% r2 [3 y" }: \' R; e - static int bcnt = 8;. N3 J, I! p& i$ L& W* R0 n( y/ v
- static int ccnt = 8;& E9 q4 T O$ @8 O2 B
- " J: H- z! z0 z) V' l4 ~
- module_param(acnt, int, S_IRUGO);
E+ l! K* D! p6 g$ y$ H } - module_param(bcnt, int, S_IRUGO);
7 m7 r3 H( W# {6 s, G - module_param(ccnt, int, S_IRUGO);
复制代码
. k9 W r# b/ e# p- U% F
2 Q4 \0 h- v9 ^2 C* V 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& T! j9 @% L. n+ x' n. B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 T/ ]8 ?! D: w+ F# n! ~, ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 |4 \) |! w' Z m' g4 m4 W& w2 A7 y. y0 b
& j4 r- K: U' r# W |
|