|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; @0 H' ]( t. L7 J, x ?5 Y- [code]EDMA sample test application* P. v/ k( q2 C! i# e! q6 I
- /*
$ @& ^; i7 U( L% X8 {5 K - * edma_test.c) o6 [' B8 b( [- x9 c
- *
2 K2 o4 Z. p3 H - * brief EDMA3 Test Application
; e7 {% {; j9 {: W; c$ T - *
8 b( s/ w5 E+ [9 u - * This file contains EDMA3 Test code.9 E/ ], g9 I( J6 Q, ]* n, j
- *
) P O9 F- J4 c) k( O( j2 b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" K- k$ {& N- V r& i! i3 K - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 T5 @- b+ W: ]8 Y% N" }7 E% K
- * TO CHANGE.( C, v9 |: m# b; W: s
- *
s8 Y/ I3 @! e) j! x - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- w5 W+ S' ~* C, ?! |! }
- *
( ` w# @9 ?$ t9 \, k1 |+ v - * This program is free software; you can redistribute it and/or
5 O5 R3 T6 G* a2 c7 ~, K - * modify it under the terms of the GNU General Public License as
' ?1 J! ]- l! I* n! e0 T6 F+ u- t - * published by the Free Software Foundation version 2.
. Z- g$ V" ]" e& w. @ - *. v, S+ N$ ~1 d% r$ N7 ~2 H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 Q O5 \6 M2 U) e - * kind, whether express or implied; without even the implied warranty
8 {7 K' ^. \- h- i, k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) G, C [1 [1 T) {% W6 z# p( U" X( a
- * GNU General Public License for more details.
+ \- e$ C G& u5 V' c2 w2 W - */
' \; s% A# z4 ` - / c2 T, |2 P! Y D! B
- #include <linux/module.h>5 P# ]' \& f5 @* `6 B) v) p
- #include <linux/init.h>3 T1 c- M+ \- d; D( B: L2 Q
- #include <linux/errno.h>
: Y; H) \9 N0 T3 _! n - #include <linux/types.h>
; X3 _+ ?8 W7 l6 b2 z: i' L - #include <linux/interrupt.h>
~7 _6 s( s/ S - #include <asm/io.h>3 Y8 [, |$ ?! }; f+ w2 W: k1 q
- #include <linux/moduleparam.h>* @8 L" B |& v# u
- #include <linux/sysctl.h>
5 J8 |: t0 ~( B4 A% S - #include <linux/mm.h> f0 y b0 I* l7 j- J9 V' L0 D
- #include <linux/dma-mapping.h>. i1 B! H( C5 C# V [% E/ H9 I
0 h& ^7 A4 K j! U2 R$ s* X6 R5 I3 a* ?- #include <mach/memory.h>+ k; r% x) i [
- #include <mach/hardware.h>7 G1 V/ }5 r( M3 F4 o
- #include <mach/irqs.h>9 L; |# N2 P- n1 m
- #include <asm/hardware/edma.h>0 w' R+ o' W4 B# ^! k
- 5 ^6 d; |0 Z# r% |+ Q8 Z
- #undef EDMA3_DEBUG, Q4 c& X: [( j5 A2 @* z s- I
- /*#define EDMA3_DEBUG*/
" r) c0 d7 w. p7 i2 }& N" [1 w
1 j G0 d) u7 y& h- #ifdef EDMA3_DEBUG
1 |8 n; O$ ^3 x/ L# u3 p - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' @& ^& r2 \+ V! v. \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 k$ i) T6 Q& t& H
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 C6 `0 `8 Y5 l& a' L' G - #else9 D! l9 _. `+ ^1 E0 [8 i$ A3 a
- #define DMA_PRINTK( x... )
, E$ b, X/ u/ r: A* r - #define DMA_FN_IN
3 V2 U) i8 _6 {. x - #define DMA_FN_OUT
, e4 r9 }1 C, @" c- E- W - #endif
5 ^- b! e U( v1 j3 A; V9 L8 u
8 _9 d0 b: u- t9 O8 f4 d4 e8 ]! g- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 d9 }" }* c7 j) n g' M0 C( Z9 M3 u - #define STATIC_SHIFT 3; ^: i$ N2 n3 Y' e2 M( }3 H2 I
- #define TCINTEN_SHIFT 20
: f8 R3 s0 u& E7 [6 R+ e, t - #define ITCINTEN_SHIFT 21
2 E% y) k1 a% I3 ~5 j8 u - #define TCCHEN_SHIFT 22% f x4 D9 A( h
- #define ITCCHEN_SHIFT 230 B: @- u% i/ [* e
1 X! a7 F. `+ A- static volatile int irqraised1 = 0;
$ H( s- I" n# { U) k" \9 N - static volatile int irqraised2 = 0;! m; ?- P! \8 `4 P1 h9 T# u# X
: j( ?7 T6 f- f. o; }) O" o7 V. N" t- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 N! e! L, P" K3 }5 o. `$ T' H8 \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 k/ r. R' B2 N% o6 x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! K" i7 ]% n+ p/ B9 O; \ - . q0 J& b( r4 [! F5 R. i3 x
- dma_addr_t dmaphyssrc1 = 0;
; |5 A5 V6 ^7 W7 T - dma_addr_t dmaphyssrc2 = 0;
# i. s0 j9 G# c& T; q) s5 K - dma_addr_t dmaphysdest1 = 0;
* |6 C4 k$ O/ h6 V# ^( a8 h - dma_addr_t dmaphysdest2 = 0;$ o9 V7 f% ?) q6 g
- 0 x+ j1 a/ L8 e* [0 U# P. w
- char *dmabufsrc1 = NULL;& \) ~' z+ y7 }9 x9 l% p, F- w. J# m/ u
- char *dmabufsrc2 = NULL;0 e/ M+ B2 Q' G: f8 b
- char *dmabufdest1 = NULL;
b) ]- |3 c# h$ m - char *dmabufdest2 = NULL;( b9 C0 N. U" _7 e, w8 }# k1 k# |0 P& n
1 P3 C& \# F! E" [# @: q$ i- static int acnt = 512;' W @ f- r# O, P) w
- static int bcnt = 8;
- |& F5 p/ k+ W" n1 O - static int ccnt = 8;% r2 b/ x; ?( B* U; @+ z9 I3 g
- ) a! ]) [) c9 Q9 c* W
- module_param(acnt, int, S_IRUGO);
& m+ Q& C7 A {1 B( h& |% x - module_param(bcnt, int, S_IRUGO);
6 C- d5 j0 Y- F! t9 _9 L' x - module_param(ccnt, int, S_IRUGO);
复制代码
}; r& M: A* N0 K5 q& G) C6 c6 J' p3 q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 C# i3 x& }. n4 j# }4 g; c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. H6 t: Z s7 p9 q O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% i4 s; y5 I& m/ ]/ k. A. y6 |
9 y" } o5 R& w/ p; [$ Z' i, B- @: ^' j# t0 d4 H: @
|
|