|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. C) x- e- G6 D, l1 M# l5 n" C/ a* S- [code]EDMA sample test application
' I, M% j& C& j5 q" | - /*
* a \4 [( ~5 W0 q% j; J" j0 F - * edma_test.c
" z. n+ C- `6 _- }3 A - */ w) P; ]6 e2 B# o4 t- w, e
- * brief EDMA3 Test Application$ t: H& X0 `% v& D5 c l
- *
. y; _7 k! i8 J& U - * This file contains EDMA3 Test code.
: s- P' M1 J3 w" N - *
" G% Y1 G& @1 v0 i: U% h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 O% `* s% ?: _; X4 j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 t; K4 O0 `! U - * TO CHANGE.
' i/ J8 P: D3 @* z: T - *% m, X# l2 q7 y5 k \
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& a. s5 T; p6 r# L' \/ E! U6 Q# A2 a
- *3 c9 v, P8 ?4 @: T0 M, S/ z
- * This program is free software; you can redistribute it and/or C/ b3 z$ G' [1 k
- * modify it under the terms of the GNU General Public License as- h5 r! d+ D, [
- * published by the Free Software Foundation version 2.- E" d: o; f+ Y! R" j6 U) P" K
- *" C" X' v+ i1 s1 ]/ C2 x; t
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ p2 d6 C b2 C- H - * kind, whether express or implied; without even the implied warranty5 K' ~/ |- r( x* D7 @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: d! ` `# |) k0 r4 Z; X3 O
- * GNU General Public License for more details.
$ _8 R9 Q* I$ ~ - */
8 i/ g3 e! _4 ]1 c" [! ~% ~ - 2 V* G3 H0 S' y6 o9 b6 d
- #include <linux/module.h>
7 I7 s; V# g& s; R( { - #include <linux/init.h># @9 Q/ G+ o* @
- #include <linux/errno.h>0 {7 D m" S$ o( d) o
- #include <linux/types.h>* k' W$ P6 z! t$ Z6 _. L/ C7 _
- #include <linux/interrupt.h>
' h* _& s4 c9 o8 C$ R% S$ T - #include <asm/io.h>
& b1 ?7 x6 W( m5 W6 e1 B - #include <linux/moduleparam.h>
5 P1 ^& @6 o/ s7 ]" c" A - #include <linux/sysctl.h>
) M7 I# \7 O7 D8 L* K6 I. V - #include <linux/mm.h>
% a1 a$ m/ Z" X - #include <linux/dma-mapping.h>
# q* l. E6 F$ a6 ^; p - t! `6 k1 [$ Y6 m8 p" E6 a( ?# O
- #include <mach/memory.h>8 E/ f+ P& `! u& t) S9 a. `
- #include <mach/hardware.h>7 n5 r( F! U' i4 L' [; |
- #include <mach/irqs.h>& E' @, \3 Q" E
- #include <asm/hardware/edma.h>: l6 s7 i" ~4 T
: H* B! y6 q+ z2 o1 C/ Z- #undef EDMA3_DEBUG6 u2 Z1 w' f" m8 C1 u
- /*#define EDMA3_DEBUG*// d. B/ c: q- u+ E) R1 s- k$ l
. y! }' H& x9 d1 l6 @( s- #ifdef EDMA3_DEBUG
- x# m% k) h/ g l0 o) ~( M( j - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# o1 i# S7 i1 G h: O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% w4 g2 S3 I _' U, v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ ]* r8 B9 ~' ~& T! j: J9 y/ }* w - #else
6 D* V# R7 Q+ c/ K) d- x- ^# { - #define DMA_PRINTK( x... )9 v% ^6 m* J" x$ ]
- #define DMA_FN_IN
2 b4 {% N* F- g( }' C$ i$ Q - #define DMA_FN_OUT/ L3 w$ m& V6 i# U
- #endif
* j0 t( }% R8 z. U) W - # i, W% ?% |: b7 g4 {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 y) f3 x a0 Z1 q7 ?
- #define STATIC_SHIFT 3
4 M- h i- A' M; X! u - #define TCINTEN_SHIFT 20! @% U4 i- C% y9 A
- #define ITCINTEN_SHIFT 21
9 t) Z5 d' h, a& g4 h - #define TCCHEN_SHIFT 22* y; U7 @2 @; \
- #define ITCCHEN_SHIFT 23( Q' y2 j4 F$ y/ t
3 |4 L8 T+ f4 V& Y- static volatile int irqraised1 = 0;5 @2 |& ~4 f9 o3 Z
- static volatile int irqraised2 = 0;
3 Q8 S9 [ J8 M1 p$ Q" n/ U
% \5 f1 G1 H: u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 O& D- }( v2 [$ V" _5 Y2 Z8 Q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# o* v/ x2 s3 E! s7 b% V2 D - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' g7 ^3 V. U& u0 O/ b
- 8 t5 R. Q7 s( Y) _2 e
- dma_addr_t dmaphyssrc1 = 0; J( q2 {, ~" b9 U
- dma_addr_t dmaphyssrc2 = 0;2 P1 X) a0 W( w+ L. S* N, Q! r+ _: j
- dma_addr_t dmaphysdest1 = 0;, ^) N$ L1 j4 [/ H( E& H
- dma_addr_t dmaphysdest2 = 0;
+ R/ \' y9 c/ E3 m# G4 H - . A( J9 h1 P$ m3 S& t
- char *dmabufsrc1 = NULL;# x* R2 T6 o/ |9 Z$ F
- char *dmabufsrc2 = NULL;
( f0 L, B/ j; l/ n, i5 V3 J - char *dmabufdest1 = NULL;
1 O$ r1 h' t% T4 X1 X3 ] - char *dmabufdest2 = NULL;. F. e) x$ C( G$ N
- - r& z# e6 R) a2 L5 x: t! ~% H; L
- static int acnt = 512;& R8 x) _: ]5 \: T# l v$ C
- static int bcnt = 8;. d0 M9 L% v$ z2 X2 L+ r
- static int ccnt = 8;: S$ M" u* ?' ~
$ z& o; l5 L3 i6 Y4 ~- module_param(acnt, int, S_IRUGO);& L. q2 Z. y1 U. r9 Z
- module_param(bcnt, int, S_IRUGO);8 \* S. u3 e9 N) d+ \
- module_param(ccnt, int, S_IRUGO);
复制代码 * F& }( X/ l, U% b: Y
8 c: A* B) s: l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* }- D: M5 m! r# ]9 Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% N5 d$ s6 N7 c7 ^' c% v2 Y5 U% N0 G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ `" E' p1 a: Y$ r- b
5 G1 l7 ^$ k2 G8 D: U6 v& u
R* c) s/ H& O7 Q |
|