|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, J2 H: g) }& J% k+ ?& Q+ r- [code]EDMA sample test application9 y$ F( A! K |7 J# a
- /*
' v4 ?$ V6 e4 @0 V2 @4 m% Q# T - * edma_test.c$ v# W9 ^' T" ?# q3 Y# V
- *
& a9 Y: V% `$ ?! ?) ~ - * brief EDMA3 Test Application
$ j0 t' G, ] a - *4 m& v# o" R# P- {5 m, B+ m' q
- * This file contains EDMA3 Test code.5 q+ F& ~, G, r& W. Z
- * I4 j% D" V7 A4 f+ f' O
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ F6 P0 i* e" q$ h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; e, h, c0 Y( H/ @% p
- * TO CHANGE.1 S h! R N `5 c2 U
- *
4 _7 C( ~( l& q% @5 Q# ^7 i% {- o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) E& c! @7 W% p; ?' j - *+ g/ ^3 q& o4 F
- * This program is free software; you can redistribute it and/or
$ v- A' D9 O/ _& _/ v9 Y - * modify it under the terms of the GNU General Public License as. q* E% h) I# u* a9 i8 g8 k! ~6 c& T* t
- * published by the Free Software Foundation version 2.8 {( j* l2 S) [: m' s5 T
- *
5 o) a" [$ _) g( V8 H: Y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 w- x: J) }0 W: A - * kind, whether express or implied; without even the implied warranty' c& b. f- a( N1 w. e6 d3 `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 f* {, F! I7 C: d: X+ Y
- * GNU General Public License for more details." E( L# p8 o$ P. z
- */
+ e5 x# B( L" l) a! f$ ?1 u - 9 Z1 d3 M T4 O: D- ^7 {, P2 I; o% f
- #include <linux/module.h>/ z: B9 a9 q* I* P0 Z. k/ I
- #include <linux/init.h>
$ b$ |% n/ i- n# k0 A+ Y" R3 k$ Q - #include <linux/errno.h>
9 [2 k2 b3 }7 g+ |% x \ - #include <linux/types.h> B3 i1 Z0 M. }8 a* Z1 ]( [
- #include <linux/interrupt.h>. g' v8 k N) J, c/ A% u/ ^
- #include <asm/io.h>
' X( u3 p& R1 g* l/ m$ }' q2 } - #include <linux/moduleparam.h>
+ a6 k+ B c4 n( r! M9 M8 ~- L - #include <linux/sysctl.h>- ^" x: m" U8 \# H1 k& W9 A: N
- #include <linux/mm.h>
0 Z; O; ]$ A+ k* }. g+ r$ D: ] - #include <linux/dma-mapping.h>4 T C0 Q( S3 ~' m( R) X
- ! E" L- U3 n- i: C& }1 q
- #include <mach/memory.h>
( q$ g- j; ^7 |* h) e - #include <mach/hardware.h>
# \' H# j" b3 n. w6 @ - #include <mach/irqs.h>
% c, M* f! \4 p/ s! S$ q - #include <asm/hardware/edma.h>/ d, B: C+ P; L G" y- p" L6 }! T
: D% Q7 u( q1 a6 w; `( I# G% Y2 T- #undef EDMA3_DEBUG
+ j9 R# l# n; F6 N - /*#define EDMA3_DEBUG*/' Z# N3 t( q, V# g+ s3 X
6 g; u; M* Q) j& R$ y1 j- #ifdef EDMA3_DEBUG3 L" T5 Q \$ w" F' u8 G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- p/ }% C4 o0 {( z! m. A
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 v+ e# `3 a* K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 s' q, k- m5 i: ` - #else+ w* w* M# z3 ~4 ^" S
- #define DMA_PRINTK( x... )
! j+ P5 V- i, N - #define DMA_FN_IN9 B! w; J+ ~- r4 j$ u; W6 K6 i
- #define DMA_FN_OUT2 t4 Y; ^ t! n2 I
- #endif
0 c/ |/ ^7 }! ~
* C* [, P9 z' G0 h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: K1 s: W0 q; c( b - #define STATIC_SHIFT 31 V8 X: r* g0 b+ R
- #define TCINTEN_SHIFT 20, j A, f2 ^0 m; |- \$ x K
- #define ITCINTEN_SHIFT 21/ o! A1 y, J, ^4 X7 ~
- #define TCCHEN_SHIFT 22% z8 Q' N/ q$ L3 @7 O( X; U
- #define ITCCHEN_SHIFT 23
& B# l8 S1 l- N; K# Q( E2 D+ A
( _+ B* N) T9 ?+ B2 B- static volatile int irqraised1 = 0;
~! P3 [% W6 C# J6 X% H - static volatile int irqraised2 = 0;3 n3 w2 j' `% i. K
' I# i( r, P# }! S: H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 w+ F. O$ T$ z0 C+ f" T! [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; ?% E' k* f' f. z& f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
I% O: F$ {0 N- Z
9 A( e) M3 T8 K0 \5 A( S- dma_addr_t dmaphyssrc1 = 0; K7 o; G: Y t+ }8 L
- dma_addr_t dmaphyssrc2 = 0;: g9 q; w2 P, ]
- dma_addr_t dmaphysdest1 = 0;7 t+ G6 S7 ~9 W
- dma_addr_t dmaphysdest2 = 0; Q0 d8 X3 Y E6 i
- _5 m/ s2 J' d( O9 K h. i- char *dmabufsrc1 = NULL;+ K) t' h/ o0 ]8 g& l0 B7 ]* o# L
- char *dmabufsrc2 = NULL;
8 p: X: b# m" o0 j9 d6 w/ r" g - char *dmabufdest1 = NULL;1 a! U9 _8 k6 K$ F y+ _4 }* Y
- char *dmabufdest2 = NULL;: n: r5 u5 J. d$ ?' V
- , J+ b' O( c7 T' t* Q
- static int acnt = 512;! p/ O& K: z. @
- static int bcnt = 8;' Z2 k4 x& J; B& s! U% z
- static int ccnt = 8;
1 M; K. U2 U# J9 s) c( j+ |0 W
* Q# o( L+ b% K/ _' a4 k- module_param(acnt, int, S_IRUGO);
1 A2 p9 N4 f( p7 L - module_param(bcnt, int, S_IRUGO);
8 {" q7 j; X* K1 i - module_param(ccnt, int, S_IRUGO);
复制代码
1 j2 W, ?7 A3 d$ `6 p. O" v% D6 }( H3 p; M2 S+ J2 z& G: e2 q' j
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: _5 J. S( h. |) `! ?& Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! I* T1 }0 ]4 _: d! m6 n& ?' T
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ i" p1 r( s4 J
5 O7 ]3 U6 B4 x5 q8 k% h
- w6 Q8 p, ^6 Y5 Q9 f% f |
|