|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 }* ^7 {2 J& ?
- [code]EDMA sample test application$ z+ k! \. K# F% [# K" B& i- ^
- /*/ O. q1 W" m% A; N5 S- Q5 H" x
- * edma_test.c" O2 I5 I$ D* u( Z) K
- *
2 N; t q; [9 e - * brief EDMA3 Test Application
% w0 Q, s& ~% |: O% [* d4 J3 O - */ q- q. G( } E2 o
- * This file contains EDMA3 Test code.
4 ?+ |6 Z2 _3 Y0 Q$ C# E - *8 n" C) O: `" |: t! q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ i# |/ Y4 h% p2 t1 `( X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& `: J# m2 ^9 R: H! w7 v/ i9 B$ z' u - * TO CHANGE.
# E1 I7 k: h- A' F4 ]4 Z - *
% ]# [ v3 V9 S# i# F. _: l8 n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' |5 N( U% f' `( j% H( \$ L - *
4 X# p( T- G, _5 q' d5 L - * This program is free software; you can redistribute it and/or
6 z0 b' t' P, E. H- J - * modify it under the terms of the GNU General Public License as$ n# V/ P" E6 z) V
- * published by the Free Software Foundation version 2.7 J. |8 w& Y3 P- Y7 L- x. M9 ^
- * `/ `$ U8 s" Q) C
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" `3 Y& P7 D' Z - * kind, whether express or implied; without even the implied warranty' H" B" ~1 S5 N8 w9 Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' M- [- h, T1 |/ ^% { - * GNU General Public License for more details., `0 Y, g# x) }1 X% a2 N1 K4 z
- */! |8 e4 o+ [+ H$ N5 v7 l- X
0 d: J9 F0 w! J2 p) i9 J; [- #include <linux/module.h>+ M+ U1 j. o$ [! ?+ J' a$ T3 Y8 [$ A; O
- #include <linux/init.h># P. r$ F, L8 S# u* Y4 `# _
- #include <linux/errno.h>
+ ]4 j& S8 p6 H# I3 U - #include <linux/types.h> R3 K# A) G. Q- E+ ~1 x" ]# Q$ x
- #include <linux/interrupt.h>( a o% P; ]. d9 f1 n3 a
- #include <asm/io.h>
+ J* Z6 E7 T8 N3 u" |( c - #include <linux/moduleparam.h>$ {% K8 a5 v; M* ]) N+ @/ d% O
- #include <linux/sysctl.h>& x: ?" [9 V% ]- w5 }
- #include <linux/mm.h>2 d4 x: k4 b- `% \
- #include <linux/dma-mapping.h>' s l- b- q, K6 C& `
, o3 C# n' D3 z+ I, ^! `- #include <mach/memory.h>0 _4 j7 r3 u7 ~/ f3 w
- #include <mach/hardware.h>
% @" x6 D1 X) x5 Q c7 V - #include <mach/irqs.h>+ G, ]3 M$ Z. U8 @; |9 y9 Y
- #include <asm/hardware/edma.h>8 i+ O1 u& v; W) f H7 f" ~
- 4 o8 z2 G, |4 z
- #undef EDMA3_DEBUG0 u2 q3 j& w: \1 l
- /*#define EDMA3_DEBUG*/$ K/ y( d( a1 L' |" I+ u
/ N* u2 N, L; z; I L- #ifdef EDMA3_DEBUG/ r: U, D# X# F$ h/ K m' ^# W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 B3 l& B" H- x2 A' O* L4 x - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 A& u6 f$ @/ K8 M1 q% r; }+ X - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 A- }3 h$ }6 G - #else! p: V R! L, b" E. Q2 \
- #define DMA_PRINTK( x... )( _7 {1 R3 n5 ^9 ^& Q( U
- #define DMA_FN_IN
( n7 [0 q |6 V* k* u - #define DMA_FN_OUT, ^/ W3 `6 x5 c6 u
- #endif; @5 W. L# q- u& g
; t b/ N2 N% U* r6 c8 y# h, W- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. m/ q/ l/ ?$ H, F: H. S* c - #define STATIC_SHIFT 3
$ ?6 J, i" j" t3 k) y - #define TCINTEN_SHIFT 20
9 Z( L, e+ T. D8 ]0 Z9 K5 J6 t - #define ITCINTEN_SHIFT 21: n+ m4 B, U5 X+ p
- #define TCCHEN_SHIFT 228 Q* m: z7 {# W
- #define ITCCHEN_SHIFT 23* G/ D, `& C, q
- - T; ]' g; k& \7 G) X' h% ^& t q! f
- static volatile int irqraised1 = 0;- G$ j- a& }( P
- static volatile int irqraised2 = 0;: l8 b; O1 l+ ?- e$ K8 i7 m0 }( J
- . x& _/ n6 z$ Y9 B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 b+ K1 O5 o% H" s$ x" T
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# z* S/ l: i, {5 D8 N7 G* ]# I
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 ~0 M' t, p5 |7 O
- & }% E* L3 R1 s/ I# {9 i' g3 I
- dma_addr_t dmaphyssrc1 = 0;
7 _4 k8 c) b7 x2 t - dma_addr_t dmaphyssrc2 = 0;
' O) u1 X- q% _; W5 w - dma_addr_t dmaphysdest1 = 0;
( s& c! r8 O8 S; n) v - dma_addr_t dmaphysdest2 = 0;0 U& R- R+ V, R) q& V
; z8 K5 v( f! s: b, m- char *dmabufsrc1 = NULL;8 l. z" G) D) q+ s: Y1 ?
- char *dmabufsrc2 = NULL;
2 l" ]3 \7 e; Z& Y. v - char *dmabufdest1 = NULL;; `7 P( J$ {; b' E* h) Z- B- v
- char *dmabufdest2 = NULL;
x* a$ {, L! p$ z
+ M t8 w! w; e. c W) s; o) r- static int acnt = 512;" l4 q, s m; O
- static int bcnt = 8;
t" f2 @& B" l7 l$ a - static int ccnt = 8;
9 }. W4 y" W! i; @
% i* Z% C% c, t- module_param(acnt, int, S_IRUGO);: ?7 O; t6 ~, l& F( [9 b5 l
- module_param(bcnt, int, S_IRUGO);+ r! t8 Y$ `1 }/ L2 N* ~
- module_param(ccnt, int, S_IRUGO);
复制代码
# ?. ^# w8 [9 T. {9 P
+ E" U% {! n0 {. G9 R 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 C. _: p; w7 S9 ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! m3 f# \& A0 F7 m% F5 a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* x c( I4 K% h9 u5 ?7 V! Q
+ ?: z4 y6 N" S( _; L7 N& Z0 g* o( v9 K+ s$ Q+ E& d1 f1 _7 H
|
|