|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : x' n0 D1 |3 @
- [code]EDMA sample test application- Z+ H. M" C" a! ^" D
- /*
. b8 _: R3 x$ l+ d4 z' @6 W9 @6 \ - * edma_test.c: r' \+ d3 o( ~% f
- *1 f0 N& q/ J# }3 o/ E
- * brief EDMA3 Test Application
: h+ k) j0 a/ D) h - *% U& _6 f% O. b9 f7 A1 l( v
- * This file contains EDMA3 Test code.( z2 p$ U/ j$ y2 f: `
- *: k; ^! O! P; h: l
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* U& J* L1 O1 J( W* d2 ]) C
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ J1 L, o" p& Q) w9 }, C - * TO CHANGE.+ v+ K% R6 I l2 S. _: X4 _
- *) N1 N# k1 j' O# x1 a/ l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 [9 G* I3 t7 ~) B
- *
8 Q5 p& P* }7 `! L - * This program is free software; you can redistribute it and/or1 j: c4 Y, L- V, I- Z( ]4 U- ^+ s
- * modify it under the terms of the GNU General Public License as+ w0 ?0 h9 {/ I# p7 M
- * published by the Free Software Foundation version 2.
; o8 l! Q, o/ u% ]3 k! J7 m# @ - *
/ _3 m* A( O0 h {; k1 i0 @ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 w* X. B+ a; I. B
- * kind, whether express or implied; without even the implied warranty& W' S% F8 y% c. J, x2 v( o$ @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ R) w) d E( M: J' P
- * GNU General Public License for more details.) Z7 R% a6 g4 U; v5 }5 L
- */
! D0 z: @; T( j; ^" M1 n - 6 J3 d2 n3 Z) w7 e
- #include <linux/module.h>7 P9 \& J6 n# x7 J1 g' V
- #include <linux/init.h>) z; M' U; s* M
- #include <linux/errno.h>
2 S8 t9 C3 G9 d$ J5 w/ e3 M - #include <linux/types.h>, X: B* Z$ z g+ X0 t
- #include <linux/interrupt.h>0 b" F4 a' E C+ g; {5 r2 o
- #include <asm/io.h>+ r- l" |8 {/ W; u. c: ~* g* X% D% K+ T
- #include <linux/moduleparam.h>
& X' h# r; ]: e+ w/ ^ - #include <linux/sysctl.h>
6 U: C8 [7 _# e - #include <linux/mm.h>$ s* \4 N3 N% Y0 E% z( P$ s
- #include <linux/dma-mapping.h>
% N: J! Z2 f. d* a8 U - ( K7 T, I: i4 U: ]* W. t9 }
- #include <mach/memory.h>) l' Z" Z0 E+ p& k; q
- #include <mach/hardware.h>. [" X% N$ A. Y* J! h7 I' C
- #include <mach/irqs.h>
( {+ A& o7 F# X' Y - #include <asm/hardware/edma.h>
) o5 l; m9 U& i
G& [& ?/ R( [) A7 D- #undef EDMA3_DEBUG9 W5 x- i: k4 P2 Z9 q# Q
- /*#define EDMA3_DEBUG*/
) k! S4 W4 X& a) \+ t" A2 ~, j
8 t0 W- [ q. @7 y3 g% k- #ifdef EDMA3_DEBUG
! r9 @/ p7 W8 h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ k# X6 t: K0 i7 J) Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* g: Q5 h/ z1 x/ |; \' ` - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 \& v% |/ g+ V: G
- #else) O# j8 ?5 b0 k `) q
- #define DMA_PRINTK( x... )2 S, W5 R9 O1 P
- #define DMA_FN_IN
$ s& \9 q1 m2 L0 c% c) L - #define DMA_FN_OUT) q8 X7 ~- e1 I* w) ?7 I7 H& p
- #endif
) D& L0 e2 S: L a6 o2 {0 Z - 0 Y) _7 ]2 b8 w; ^: H r e+ G0 O7 v3 R
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 N$ @5 A0 E! O1 @* U0 K - #define STATIC_SHIFT 3+ t4 e ], Z7 W0 X( o; `
- #define TCINTEN_SHIFT 207 T, g, v, I( l, J; m6 P* [# X" Q& b
- #define ITCINTEN_SHIFT 21
) b8 G$ P0 R) K$ I3 I6 ] n. l! F - #define TCCHEN_SHIFT 22+ G) W ] m3 b1 @* @
- #define ITCCHEN_SHIFT 23
0 [6 W2 J5 Y, v; c - - a( B: j. u4 S6 R
- static volatile int irqraised1 = 0;
" z' L# ?/ I* Y9 e3 }) q - static volatile int irqraised2 = 0;
( Y$ Y( H6 [5 e - 7 `# M6 \% b6 x$ s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ R6 i, @* K, L- Q# J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* E7 W. R; L$ `/ W4 C" D" x/ i4 U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 }* X" _: U0 F" o- Q
- ; ]( b: d2 S9 e" U2 e
- dma_addr_t dmaphyssrc1 = 0;- ^% N8 E# x! U/ l
- dma_addr_t dmaphyssrc2 = 0;7 C z9 E6 b4 r$ j8 k$ m
- dma_addr_t dmaphysdest1 = 0;# v9 a6 u, X( u5 }; e1 c0 Y- l5 l
- dma_addr_t dmaphysdest2 = 0;
5 t& a+ j B& Z' k( _" x
# {7 T) u8 I% I* D7 E2 ]- char *dmabufsrc1 = NULL;8 i' V8 h8 y9 S/ R5 O
- char *dmabufsrc2 = NULL;
$ D6 A) o: c* d$ L9 ]0 v - char *dmabufdest1 = NULL;
* c: c& `7 h+ Z0 \) H6 d2 M - char *dmabufdest2 = NULL;; T* ?# \7 X4 e+ I7 n. q# ?
- - }3 \' p9 K1 v- `. S2 L! o. B
- static int acnt = 512;
! }* L! ~+ E$ B6 k- Y9 K - static int bcnt = 8;
! J3 q/ y0 k1 T6 J4 ` - static int ccnt = 8;" T! \; L% C' l$ G) Q( t+ R- v
3 E6 C: B+ P- p& i i: ]! G- module_param(acnt, int, S_IRUGO);
4 k% H, c7 ?, W3 i9 r - module_param(bcnt, int, S_IRUGO);
8 W7 l+ H; @; x - module_param(ccnt, int, S_IRUGO);
复制代码 6 f0 Y/ X2 Y: ^% l
; A4 q. N& t, ]# p! k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 K% `8 m- J& C$ i# l( j, _5 N ^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+ r7 o2 e: g& S# C; Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( q3 y7 ]* r. n
5 ?5 ?: `" t4 a9 s/ a6 m& u; {* @7 H! Y k B) ^6 g4 J/ [( k
|
|