|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ C* W1 b0 e$ w( Y& I. Z- [code]EDMA sample test application
' B/ K+ P* j& T - /*9 E+ y8 z' j* @
- * edma_test.c
) ?8 B4 y3 ?9 Z; G- X - *
* q2 @3 u' {% m" Q# K - * brief EDMA3 Test Application
% {3 m6 p) W* ~* M* _ - *; t* ~: |% U/ ?% S
- * This file contains EDMA3 Test code.# Y* Y. {1 ^* S3 N6 s
- *8 `9 _$ P' v' G2 x9 n) |4 Q8 ~5 e% B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 v. H! t: M% z' ] - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ a6 K% E" ?7 A' q) N- ~ - * TO CHANGE.) o5 M+ C! C: K+ t
- *& E7 l8 h$ o2 R- F" f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 {% `3 X! I/ E/ f$ l% ~0 \% s
- *: z c4 i$ L/ P: W5 R
- * This program is free software; you can redistribute it and/or
. ^. L# p1 n1 r - * modify it under the terms of the GNU General Public License as y. r6 r+ `; m+ b* |& S
- * published by the Free Software Foundation version 2.
8 `( @" U6 D a2 w4 C5 E; n! @ - *
9 T, r+ g5 }3 ]5 G4 F' W% n" [ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
O. v! \0 `3 k% A - * kind, whether express or implied; without even the implied warranty( I8 ~" Z' b& L" T* n* z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 B, c; u7 Y: p" G$ W
- * GNU General Public License for more details.: t9 L0 {3 o* ]# ?! S! \
- */
1 @7 g6 d# s" u8 `7 T$ _) ^
, D+ G0 J' H( v# I/ Y0 s; k- #include <linux/module.h>$ k) G& i7 Q8 ^- N4 ?3 A
- #include <linux/init.h>) ~ _1 _, P; [% e0 O, s1 M
- #include <linux/errno.h>
z" b( I9 ^) C; j* i. Y - #include <linux/types.h>
3 z0 c/ L& J# I+ k1 Z0 o - #include <linux/interrupt.h>( `/ {! y3 O" _. L
- #include <asm/io.h>
% @5 h1 n9 P* |1 A' S7 P - #include <linux/moduleparam.h>
- z! u( x: s: ]& b. j - #include <linux/sysctl.h>! E) ~6 u9 x: c0 Z! M" a
- #include <linux/mm.h>
/ n$ W7 b: }7 S4 x9 _0 n, V - #include <linux/dma-mapping.h>
4 a9 F* m) Q6 k* ^
- z: P5 ]# Z! Q6 U5 H- #include <mach/memory.h>
+ s6 e; {" }0 d8 |! H - #include <mach/hardware.h>
0 V) s" Y+ b1 W6 e" i) C" Y$ _) ^ - #include <mach/irqs.h>5 q) d: K8 G7 E
- #include <asm/hardware/edma.h>
. m: l1 A" G. {8 r6 g - ! H$ A# ~" u- w7 b
- #undef EDMA3_DEBUG. M+ c( o6 d8 I3 U3 C/ f
- /*#define EDMA3_DEBUG*/% n2 p. c3 f. U
- 7 f' v: N# d+ W4 B; |+ d! c5 ^
- #ifdef EDMA3_DEBUG
0 q3 c S$ p+ A8 F; u - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 v/ O3 @8 O4 P - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! K+ M1 C0 y& h) Z% m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 K0 X0 W6 K9 h7 P* s - #else3 L. O& n+ L7 u) y/ ]0 K/ u+ O
- #define DMA_PRINTK( x... ) a8 E& d% j" {* c' N
- #define DMA_FN_IN. s) j0 S0 O2 V+ X1 N
- #define DMA_FN_OUT
$ U' h" s- k* F( i8 v# l0 I$ r - #endif5 h9 R. N: ~" N+ l# u7 k4 h
! M% Z. U, r* z) g4 a) I$ _: L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ G4 Q) g. `! ?5 Z
- #define STATIC_SHIFT 3
3 v+ n! a" K8 y0 J6 v% D8 q - #define TCINTEN_SHIFT 20
9 ]/ @2 U! y: G( V$ F' m - #define ITCINTEN_SHIFT 215 o Q7 \4 @3 n m k
- #define TCCHEN_SHIFT 228 \9 `( I9 l) ?4 d; J* A
- #define ITCCHEN_SHIFT 23
* ~5 P* `: [ g Z& u - # D4 `& B. {' {" U% n
- static volatile int irqraised1 = 0;4 a0 m; U3 R9 Q# ?5 o6 O
- static volatile int irqraised2 = 0;
% y4 A" A6 W3 k7 L7 O6 Y0 x. O
0 ]2 }4 L* A/ _) @% M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) E* R$ H3 o7 H( e- ]5 ^2 \! N
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" U2 Q! `' v/ u, ?5 O: f
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- Q" V* v$ z# K, K, A; }% L
- 4 t1 l% `2 F7 C7 o% o$ Q* Y( P
- dma_addr_t dmaphyssrc1 = 0;: H* Y$ Q4 ~" A
- dma_addr_t dmaphyssrc2 = 0;% u3 b& I( V* M2 `) D) h' v
- dma_addr_t dmaphysdest1 = 0;8 Y1 c, _9 N3 W0 i/ a7 e+ R2 l
- dma_addr_t dmaphysdest2 = 0;0 k" k" T- h( ?" m3 X
- : \3 z1 R4 N9 ]# j- a9 |9 e
- char *dmabufsrc1 = NULL;
7 o: H' b' t2 i3 ~. x5 L% S - char *dmabufsrc2 = NULL;- _2 z# w/ k! ^( p. a( a% K
- char *dmabufdest1 = NULL;* {1 ~* |2 l( Z' r: s$ e) z6 @
- char *dmabufdest2 = NULL;
, j! L! V" a1 A+ U d
& O# C ~0 y o: C- static int acnt = 512;# k5 \. D, ~ j4 z h
- static int bcnt = 8;# j7 i/ a3 q# R$ R' s) `; f; n
- static int ccnt = 8;, B; D* o* Q, n) C" A$ _ o1 Z, p4 U1 g
- ; A4 j0 C& o( [' ?& D- g7 B
- module_param(acnt, int, S_IRUGO);+ M% {/ c r( D! d; v
- module_param(bcnt, int, S_IRUGO);) M9 @7 R8 V! K" d, b
- module_param(ccnt, int, S_IRUGO);
复制代码 $ I: O0 m4 u& \3 [
/ f; |, p) Y3 C' ^1 `0 g# k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 w; c/ D9 Y h. p0 W& R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 A3 u' m+ c+ P
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 s' u+ W4 l1 f+ A8 _4 e
% I. @' S" l5 _* x B
6 I/ Q/ n/ p& R5 v8 H7 S |
|