|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , }) Y t" v s, o2 k n
- [code]EDMA sample test application
) N5 R8 W. h. H- u* x5 i' C9 u7 h - /*
' Y% M. w V, F - * edma_test.c# S3 X" [, E- G
- *4 X. |! B2 a f, @& {8 a
- * brief EDMA3 Test Application
& L# l8 i+ |. R) V0 p, M. ~ - *2 ]" P' [) F4 |$ F* ~- D2 |3 @: u
- * This file contains EDMA3 Test code.1 ]( K# u( {" z1 J
- *
) b: `" O: f6 A4 e; x; t% D4 q$ i - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& l/ j9 @$ U6 k- C B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! _) R' }0 [- N8 R9 r4 c# U
- * TO CHANGE.& X3 u6 ~8 g: P) ^* V
- *
/ s2 b6 s- f6 U: B9 x; ^/ t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 s- h8 Z8 L. H" z$ a# L. q3 `( s: n - *
% o5 b& y6 z, q$ c8 n' I - * This program is free software; you can redistribute it and/or
: b! H' F1 Y7 E9 p4 L: Z - * modify it under the terms of the GNU General Public License as
- V8 P' z) j/ e& }4 t/ o0 T - * published by the Free Software Foundation version 2.
: Q) w1 u/ ^8 k/ `$ S& \ - *1 [/ _( a- p3 \$ ?) d( {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- ~ k4 i/ z8 \% H" { - * kind, whether express or implied; without even the implied warranty
4 x9 ?0 Y/ F' e/ m - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 [+ j" L; J* V5 [8 H. O - * GNU General Public License for more details.
$ }( h. \* _* p D - */
5 k1 T: s% _& t" P- R
$ o0 o2 S! \2 k. F- #include <linux/module.h>
" ~7 l5 ?+ o; i - #include <linux/init.h>! Y- o7 D7 k8 K! U' O+ c1 i8 `
- #include <linux/errno.h>
& ]; p* l% A& j9 q3 I - #include <linux/types.h>% ?2 v' K5 d; b3 J& a# X( g9 Z
- #include <linux/interrupt.h>; x5 N8 @4 d9 j6 k, a' w8 @
- #include <asm/io.h>
2 t @2 n: m+ h% B - #include <linux/moduleparam.h>- N1 K0 M8 ]; m0 Y
- #include <linux/sysctl.h>
8 O0 t8 }' |% t% i: o. ]: p - #include <linux/mm.h>
- |3 Q/ i6 P3 \* b- k - #include <linux/dma-mapping.h> C, ~' [1 e+ X) k
1 j7 c& g6 w7 G8 s: C- #include <mach/memory.h>0 a' U0 H% O4 `! g( E0 C n
- #include <mach/hardware.h>4 [8 g, x1 w- a( Q- o
- #include <mach/irqs.h>
r+ b! R* l$ I0 h% E$ `$ S; M - #include <asm/hardware/edma.h>
) K) C- k7 R$ l+ K8 Z a - 0 D9 P3 E, l+ s& v$ G5 U
- #undef EDMA3_DEBUG
* M3 Q" e0 f5 |' S% n5 B - /*#define EDMA3_DEBUG*/
9 ^8 G" T5 H& n4 U9 l
0 k1 {; `. A$ O+ T) W; V$ t- #ifdef EDMA3_DEBUG! |! }; h7 z6 r( p
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) `" T( p3 a* `3 w) Y, D
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) M" l3 j4 A, n4 F( n4 O# B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 z9 C0 s' z$ m1 _
- #else
8 _1 C0 U# p9 y9 {/ r) s9 ] - #define DMA_PRINTK( x... )4 s! y9 u; `" y( c' R4 D- h' R
- #define DMA_FN_IN3 @0 l: n9 a; ~
- #define DMA_FN_OUT2 z* N5 `( h/ v9 G5 ^" ^
- #endif* f. p1 M8 q; v: r9 {
1 F( M" F0 o4 G- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 n$ F/ S/ U$ m( q; B - #define STATIC_SHIFT 3
: j, x5 P( L) A2 ^ - #define TCINTEN_SHIFT 20
! w! b6 @; J. w8 u2 _2 E. P, M - #define ITCINTEN_SHIFT 21
6 H$ v; n/ h3 l M% M% ] - #define TCCHEN_SHIFT 22
2 R9 e; y/ Q2 f - #define ITCCHEN_SHIFT 23$ C8 B- ~( f4 o9 g
- 5 V. U7 o+ [4 V) L2 s, r* H3 s% b
- static volatile int irqraised1 = 0;6 @& x, q# O2 c0 h. @! Q7 \( i
- static volatile int irqraised2 = 0;9 Z, w! t# Z$ |2 W. s. R! `# ?
- ' W p9 v' w4 A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 v4 b: Q2 o! V9 r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ y1 V( v- y' _( Y. `& p7 X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ S2 [) @4 ~: K+ a6 o+ Q6 X1 x - ; \4 e1 N) R+ o) F* |) i* z- |
- dma_addr_t dmaphyssrc1 = 0;6 H E# P$ p; [3 i, [
- dma_addr_t dmaphyssrc2 = 0;
6 f( | ^# q. D - dma_addr_t dmaphysdest1 = 0;
5 o$ Y8 e5 C& p8 ? - dma_addr_t dmaphysdest2 = 0;
# i( f! j( x/ _7 R) [: G2 V
# p: A1 n6 k5 e3 V. R. @" X# L- char *dmabufsrc1 = NULL; E4 s+ k( z r
- char *dmabufsrc2 = NULL;
1 [# |8 {, W1 D; n" ] - char *dmabufdest1 = NULL;* F9 c5 X# T# o
- char *dmabufdest2 = NULL;6 l. w* B4 w- b9 L5 i# F4 J
- 9 U/ q5 H/ f, O) V. q4 @
- static int acnt = 512;; [& w) j* ?2 s% q0 k6 t9 l3 {
- static int bcnt = 8;
4 `2 E( o+ A; R: v3 S! K+ f7 a - static int ccnt = 8;
* b, g: ], w9 ^ - 7 U$ k5 n0 |0 m: L* B7 C
- module_param(acnt, int, S_IRUGO);
/ P ^2 D5 Y: [- }& O. D# j# B# h - module_param(bcnt, int, S_IRUGO);6 H, @, g: Z1 J- p4 \) `& E3 |( k
- module_param(ccnt, int, S_IRUGO);
复制代码 * T6 L9 ?8 i+ g$ `2 F) y! M
. }. t: T) J# ]! n7 v" U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ W% O" O1 t+ @2 [9 J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 s5 ^5 X& u ?* r7 A* M
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 d! Z) z- Y; N9 `
/ F. b4 }* c# O1 T; K5 s% _( [9 K) W; Y: P# m/ H& C: U& Z9 r/ t
|
|