|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % F$ V8 H9 ^ w3 ~
- [code]EDMA sample test application
% V: ^6 u; O- x# ~9 f F2 s - /*
0 Z T# j z$ J, c* J& m9 K2 J - * edma_test.c0 Q; z( t' K1 I7 s# n* s% r
- *8 A; j* e2 F; o) O& C
- * brief EDMA3 Test Application
2 @6 _4 ?# r) l- t/ S9 F; z) @. E1 h6 H - *2 Y/ k2 S& }0 t& C8 ^5 j3 W Q8 a D
- * This file contains EDMA3 Test code.
1 n( {, C: Y2 u$ |- d) T1 r3 Z% e - * J P5 J3 y& Z& G' `# t5 C2 ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ ]* G; Z. B: o! Z8 } E
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( D1 ~+ N5 B9 q2 `! C( a
- * TO CHANGE.5 C: \; E- q* e( F E( l
- *5 w' t9 k! A5 `6 N; G$ A6 }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* q9 ^$ Q1 c. p G3 ]. w! x
- *, r( r7 Z" Q5 S: \
- * This program is free software; you can redistribute it and/or
% u( Y2 K7 P( Q( }* X6 T$ Q - * modify it under the terms of the GNU General Public License as' [1 L: x( {9 ]& X6 V6 X
- * published by the Free Software Foundation version 2.
0 M3 V3 T; t# F. L- C2 _$ Y& G - *1 e: r; ~" z: w v. ]9 I, s& R
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) N/ O) y, o# k' y3 {% L8 H* y
- * kind, whether express or implied; without even the implied warranty
, |2 A( y! l! y; M2 R - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- `; T$ |6 R. e
- * GNU General Public License for more details.
|/ F. w( M& C7 ~! f4 Z: ? - */
/ a9 ~2 C8 `! n1 }( I+ Z+ ^
7 `. Q4 b7 J, P# J7 a4 q1 l- #include <linux/module.h>
7 B6 d. t3 L7 v( M. @ - #include <linux/init.h>5 ~2 s/ C# {" b/ p
- #include <linux/errno.h>
z8 r2 n$ }1 l3 G; J - #include <linux/types.h> [ a+ O9 Q7 @2 {7 ~- B6 r
- #include <linux/interrupt.h>7 f9 }% G: ~5 r3 S' J
- #include <asm/io.h>" }0 D% P \: c% j4 C% t) o. o
- #include <linux/moduleparam.h>5 h' |( T- l6 [- l
- #include <linux/sysctl.h>
' b. o( d8 ?5 }' N, h9 u - #include <linux/mm.h>
# v0 U# ^6 `6 M( z1 r0 `# E+ Q- E - #include <linux/dma-mapping.h>% {# E* s1 b' R) D* m+ i/ a$ G/ \
- 7 X& g$ k. n7 W0 Z4 n7 l2 h9 q
- #include <mach/memory.h>) s1 m; b' G- T
- #include <mach/hardware.h>5 k6 H6 q$ G: B9 V5 ~
- #include <mach/irqs.h>
) Z5 e0 v% F2 M - #include <asm/hardware/edma.h>) T$ k E3 A$ x% j
- 0 }2 z( Z; u; y3 Q
- #undef EDMA3_DEBUG
; s1 G6 p3 j* c, b0 h - /*#define EDMA3_DEBUG*/
; b) `, p! o" j! T+ S _ - ( r1 L6 ~ [# n( m8 t
- #ifdef EDMA3_DEBUG. P( m" C9 y" T: e# w2 a0 g( s1 t' p
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 A3 u# g0 h+ ]% M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 }+ ]4 W2 s% m: A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# K6 Y% p& S' S; [* x
- #else8 A9 V6 ?$ N* y0 N9 M
- #define DMA_PRINTK( x... )
& g: _: U" _: Q* f* x$ z - #define DMA_FN_IN: B+ d' u2 K5 k5 l2 V) m$ @) A
- #define DMA_FN_OUT
: [7 x5 u1 I( s& p) b - #endif4 c+ k' S: w7 k* f& g9 a
- ! E7 K9 |0 k; D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), X3 v; s: V& p, p( f, g
- #define STATIC_SHIFT 3
7 s* l2 ?) M# v8 j& K, p0 l3 J - #define TCINTEN_SHIFT 20
7 d4 ]* ~% ^' |% u - #define ITCINTEN_SHIFT 21
2 ~5 ~" a( l! C- }( s: E* p - #define TCCHEN_SHIFT 229 J l+ J$ K+ w9 E8 H4 [+ ^+ `3 g- E
- #define ITCCHEN_SHIFT 231 t3 H+ k! d& c# E
- " |" S; m& j/ \3 C# ^" C9 L
- static volatile int irqraised1 = 0;! S& K/ y7 Q- v i
- static volatile int irqraised2 = 0;
& D$ P" j, q e. M7 t+ t3 F
2 o7 T( [% y6 i6 s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
x* s' U" ~* C7 D! `& ^6 \" V7 S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 b1 c! i$ R/ _, l; L w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 S; I1 q( c+ m7 M$ c
( {; v6 P. J/ Z- dma_addr_t dmaphyssrc1 = 0;
) H, f" [; T# c! \; r7 c. j - dma_addr_t dmaphyssrc2 = 0;% Y q3 R. c3 B* x
- dma_addr_t dmaphysdest1 = 0;
J/ W; G6 f% u; U# B1 [) Q$ E - dma_addr_t dmaphysdest2 = 0;
+ Z/ r3 B1 T7 }' {
Q6 _, @+ U) G, [- J- char *dmabufsrc1 = NULL;
% y3 u3 B' B1 y. F - char *dmabufsrc2 = NULL;* X$ N1 ?9 M( N9 ?
- char *dmabufdest1 = NULL;) p7 l# z. e. N) n2 C3 E
- char *dmabufdest2 = NULL;
1 Q3 L, ^4 @' }& k7 s" u - ( T& Y6 q3 @" O$ _- H' e, t( M
- static int acnt = 512;& N8 g, D1 D/ t e. F9 Q8 c
- static int bcnt = 8;! o6 o& m. W2 M+ x
- static int ccnt = 8;
' a9 c( D8 x1 W1 L: S. B& e! \ k
4 M5 B3 Z k, w/ I* K- module_param(acnt, int, S_IRUGO);
6 X& Y. W ]+ e0 F U) ~* c - module_param(bcnt, int, S_IRUGO);
) H2 `% S7 c% c. P1 W& a; t `, v6 Q - module_param(ccnt, int, S_IRUGO);
复制代码
5 C" v; g J$ O6 Q, w9 D
1 n; b9 N: p4 q! B 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ j) A6 ~( J: c9 n0 \# L( Y$ `; Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 f. [ W, G, Q: m6 d; S& i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 q6 U, D. T6 g' d% t
x% b |7 B) @
/ R' ]* C) {( {2 O6 b0 {6 a9 r |
|