|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: ~. a; @: e$ ]6 d9 x- [code]EDMA sample test application& b2 l g7 @7 k4 a! R
- /*
5 w d$ T* z* K: ?1 [( U" e - * edma_test.c# \/ g. N& ?; {
- *
0 h8 l7 l3 ?( R9 E- F' Z5 H# c* y - * brief EDMA3 Test Application
$ m' {. B* F; m' V, P, g+ a, K6 } - *
4 l& ^* {9 B: L" ]) n9 R - * This file contains EDMA3 Test code.
b" ]4 [' z3 }& T - *6 |0 r, U) r4 z, m4 T5 \0 @' H; Y- u
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 w9 y8 P$ j {% t/ x1 j$ t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 V+ r6 Q: T; z% k( ?8 O+ }
- * TO CHANGE.7 K6 B( E* F' R4 U: k. F& N4 [# e8 X
- *+ [* x" E8 L' Q" `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- |/ C- v" B; W3 Z! l& z - */ L, t8 k5 P N9 @/ a1 P
- * This program is free software; you can redistribute it and/or
# x6 z& w9 {, m - * modify it under the terms of the GNU General Public License as8 T! S* w& |! E- v4 G2 }/ x) G
- * published by the Free Software Foundation version 2.5 `4 U# {9 A) M, u0 Y
- */ |; M& b# }( I2 A' R4 C3 D! r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 S' Z2 [7 |5 E. Z
- * kind, whether express or implied; without even the implied warranty
* Y+ u: h3 |4 W& w! ?$ v4 U; e - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 f7 w: m2 H7 s3 ] - * GNU General Public License for more details.6 w" ^) Z* g7 B" I
- */9 a# Y! i: i6 f8 ~8 z3 F% D$ w
- # { O! G* f6 T2 A5 p( J
- #include <linux/module.h>
* _ `' `( y( Q' b3 {0 B - #include <linux/init.h>8 s' m6 ~; [; ?2 u
- #include <linux/errno.h>
) c+ B! [ M, K% ~# `) z `. D) H) | - #include <linux/types.h>
. D2 k5 N* C( ]: i+ Y - #include <linux/interrupt.h>
- ?6 t8 t( t9 ]/ t - #include <asm/io.h>
7 h! Y. B5 e, H1 Y" {; I5 c* D0 z - #include <linux/moduleparam.h>7 l$ U) l& ~1 ^- ]% o% i
- #include <linux/sysctl.h>8 ~" |$ K ]5 m) \9 a0 I" J
- #include <linux/mm.h>+ Q' w( d$ ]5 N+ B$ }" h7 \8 S: ~; ~5 h
- #include <linux/dma-mapping.h>( ? L0 C9 f2 \ e3 |# h+ b4 Q, p
- 8 V/ L3 x8 H7 }. O8 Q% Z
- #include <mach/memory.h>
) l$ J# ] A3 H - #include <mach/hardware.h>! L" ]- u( W& A$ |6 r+ ^
- #include <mach/irqs.h>( C. y* N, d+ l+ D, T Y
- #include <asm/hardware/edma.h>
% f- h$ a4 q$ a+ J - h5 X6 a, k% w
- #undef EDMA3_DEBUG
5 V* b" @9 q L9 e3 Z# _ - /*#define EDMA3_DEBUG*/
/ D( R4 U# h. C# [
0 ~% ]) D7 r/ ^: P6 [2 Y# B4 \" }- #ifdef EDMA3_DEBUG
! x% c( Y. l, }3 M3 Q) ] - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' { e" [) w+ m8 R1 q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- z+ O* i5 A O6 ]* r
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ q' H* o* H2 r+ V& D
- #else$ B0 S5 ~9 G" B( j! G
- #define DMA_PRINTK( x... ); ^; s* O/ M' w: Q5 t
- #define DMA_FN_IN, O& ~: N/ \4 H9 I
- #define DMA_FN_OUT1 p7 M1 r7 m8 n [: G3 k- M
- #endif
v6 Z- a4 v) ]: k( J - - b. E" Z6 L+ Z! G; M _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 C2 g* C2 k# S; S, x
- #define STATIC_SHIFT 3& @; K) J7 i- o# V& R% a
- #define TCINTEN_SHIFT 20
, e: q) t- U% D+ e) x - #define ITCINTEN_SHIFT 21
0 H$ Q4 q# ?! ?' Q4 f+ ]4 r - #define TCCHEN_SHIFT 22
* {2 G+ a/ r) S" P - #define ITCCHEN_SHIFT 23
* w v0 S5 l# P% ~ - $ |9 X1 | t2 N- ]+ @3 K
- static volatile int irqraised1 = 0;. Z: B+ A9 |3 w" H3 z, s
- static volatile int irqraised2 = 0;
" s( b5 r1 p. d$ j, c7 R# d( t - ! k* N$ |" A' R9 Q% L. ^
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 Q+ q' Y- ?0 { ?( o/ ~) B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( z' v- M c8 e4 b$ z6 `7 _: g
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' F0 e/ k8 z6 |% x
, \4 n' l2 K) q- dma_addr_t dmaphyssrc1 = 0;! s! i0 h6 e! E- ~' O
- dma_addr_t dmaphyssrc2 = 0;
3 B2 E& G; Z4 ?8 d7 q0 p - dma_addr_t dmaphysdest1 = 0;; ?# r) T( \: y) u5 U
- dma_addr_t dmaphysdest2 = 0;) j# E- r- V+ @9 X
" v% b _$ B) q; i- char *dmabufsrc1 = NULL;+ } B# _0 f: R
- char *dmabufsrc2 = NULL;
& ]( _# k( `: V& w& d - char *dmabufdest1 = NULL;) X+ c8 I( ^, C' O. w
- char *dmabufdest2 = NULL;+ m5 H: f/ `, y* Y3 c5 J, w
2 w& N& k0 _6 W( O- static int acnt = 512;
) P+ G, w1 ?" ^8 k6 y: } - static int bcnt = 8;5 }2 s2 r7 N, _6 B! I6 Q
- static int ccnt = 8;
# }5 o" P/ C' N: c' D( W - * |4 T, r4 U& d4 [, A, y
- module_param(acnt, int, S_IRUGO);, y7 C3 d/ R, N& }0 Q, h6 c4 T
- module_param(bcnt, int, S_IRUGO);
6 J7 Z+ z6 q( _2 J - module_param(ccnt, int, S_IRUGO);
复制代码 $ J U" k& `0 F1 }* D
& p2 A( Q# {6 N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 ~1 O" m1 r6 x, |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 R, {) j X) Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# I7 o" | D3 |& O( a7 O( K
+ u' u* e: }" P$ E. X. q2 v1 m$ j. e5 v8 D |
|
|