|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, A4 X3 w) v2 J1 H' ?4 I$ S" w- [code]EDMA sample test application
" h' O5 l" @) u& p/ J6 t - /*
3 w7 R0 R. ]7 s/ `* A- G! b - * edma_test.c
% [* V* |6 d9 `4 ]: Q1 L* y+ L - *
8 E$ H; p* x1 Q8 `) j- b7 B - * brief EDMA3 Test Application9 q/ C- z3 k! l; ]: S0 v
- *
' R0 x. l/ T$ ~9 ?7 C - * This file contains EDMA3 Test code.8 G# J# @( f( q: z* W
- *- K1 R7 s+ o. ]1 U: V5 y$ D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* A8 _' X6 V, Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 Q/ _% W3 o$ _ x \3 a
- * TO CHANGE.
4 I# r( W& Z3 a0 c9 G5 N) N/ w - *
& q. {$ c% A" g3 M1 S3 g - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ w# d7 f1 M7 z8 k: G7 l
- *+ D' U+ Y5 I2 X `# r. _& A( Y
- * This program is free software; you can redistribute it and/or
3 t9 v3 c: j1 R( x - * modify it under the terms of the GNU General Public License as5 X8 w3 s% r: ]0 u3 Z' W
- * published by the Free Software Foundation version 2.
- G$ C K. D" L# }- \6 K - *
% _) P3 i! S- }. k$ g( u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ s5 q7 I2 i) P' x; A
- * kind, whether express or implied; without even the implied warranty
; \9 X1 k6 n6 F. Q0 s - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 R- G$ c5 O4 S8 Z; @% \ - * GNU General Public License for more details.
$ \' e3 L) C8 K0 J* d, l% C! a - */
p8 P9 K7 t1 t) ?* K4 S- b4 q7 k
3 h. ?) Y+ _: i3 W. o- #include <linux/module.h>
4 N+ ]+ T8 D% c) Z( }8 I+ \/ k - #include <linux/init.h>
' s) H2 |& X& w2 f5 m - #include <linux/errno.h>: }. \9 ]4 `' p' b, y
- #include <linux/types.h>
) p: Q+ O- @& ^! B3 z" d/ ~8 k - #include <linux/interrupt.h>
A7 J: M7 K: Q d* X - #include <asm/io.h>' W: X, P4 M8 U$ X5 `+ Q8 _
- #include <linux/moduleparam.h>6 X2 s% ^1 K' g$ K: \ o5 Q
- #include <linux/sysctl.h>6 K' Q; B c' i1 q u4 W- P
- #include <linux/mm.h>) a2 }7 X- b5 L
- #include <linux/dma-mapping.h>
2 X0 o7 A9 R) g/ Z
. I0 A# ?6 R9 i* F. v- #include <mach/memory.h>
, c# }2 Y3 V( n2 @: `9 w - #include <mach/hardware.h>. g, d# x; z; a4 b+ s
- #include <mach/irqs.h>+ G/ c- U* O) [. P' |* V
- #include <asm/hardware/edma.h># U- R1 p5 q: \8 W
- & K: O4 G2 E5 k& n" t& ~7 R
- #undef EDMA3_DEBUG
\6 H" E, Z! P) s# ~ - /*#define EDMA3_DEBUG*/
1 X$ a- ~* d4 h1 i& q1 l3 ^" ? - ) _6 u2 K6 o* S9 C: m; M& c2 L
- #ifdef EDMA3_DEBUG
; b- z; c( { v: W# O! { - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" C- @3 m, Q( A3 O$ ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); ~. N0 O r, {* ^+ x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ }; V. H* h, k; e7 g; \
- #else
5 N: M5 ? L& z O! B - #define DMA_PRINTK( x... )
5 d* E9 l+ l; d- P2 I: I - #define DMA_FN_IN; L' h T# `' J- c6 Q
- #define DMA_FN_OUT1 \) o) q, z' I2 ?, l
- #endif
: E' d7 V7 d- a( o0 i9 O! d
' W+ n: g9 |) X" u" L: `) `3 A& c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 {. Z* l" y& k: ?1 a - #define STATIC_SHIFT 3
; C2 t! F- ^0 V - #define TCINTEN_SHIFT 20
8 ]2 _2 C& b8 J1 S! L8 Q - #define ITCINTEN_SHIFT 21
$ t# h5 i2 G4 L8 l+ L; N - #define TCCHEN_SHIFT 22) L4 i8 t$ U0 x) u8 V+ D+ \! n
- #define ITCCHEN_SHIFT 23
& z' L4 J5 ^* R; I; {$ w - & B2 g* s0 l0 M
- static volatile int irqraised1 = 0;
0 `1 @- i6 S: ~3 S3 n2 h2 \ - static volatile int irqraised2 = 0;% O; ] g0 |0 w' z6 k) [+ M
- / J! j h8 R0 N1 _ ^5 w
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" J5 M5 l8 m+ N* @0 I+ g - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& q2 A& W; B2 n. ?9 k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; }7 E7 [; v; | C& }6 M2 g - : k7 ?* o5 i2 A$ F7 l
- dma_addr_t dmaphyssrc1 = 0;
+ {0 E1 ^' v% c* l - dma_addr_t dmaphyssrc2 = 0;
, T7 X4 s& d1 |* v8 ]! n- ] - dma_addr_t dmaphysdest1 = 0;1 B( z8 ~) }( r% h: r) K
- dma_addr_t dmaphysdest2 = 0;
4 ^% m( b/ H; _" f# ~1 y - $ O) Z2 r6 w9 a& S
- char *dmabufsrc1 = NULL;" S- b% q$ r0 i; B& L
- char *dmabufsrc2 = NULL;
0 v4 ]: V3 o$ F; T0 R9 I4 [* c - char *dmabufdest1 = NULL;
w* z! d5 |7 A# W - char *dmabufdest2 = NULL;
/ k3 l. D* F1 I5 p( j
( q* a5 n2 q1 L ?3 f- static int acnt = 512;
1 p w! m: S+ g' y8 t - static int bcnt = 8;1 T' T1 e8 c: V4 H
- static int ccnt = 8;2 X; }) a h' {
- ) D' @ T2 J0 J" Z; f) Z$ x
- module_param(acnt, int, S_IRUGO);) v) p) g( G8 }
- module_param(bcnt, int, S_IRUGO);; G7 h q) a2 q- `+ V2 e
- module_param(ccnt, int, S_IRUGO);
复制代码
# R- |& N0 ] o( W$ ]3 W+ b+ ~1 l ]# |. S
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 N/ h+ d7 y/ c4 F$ W: w
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. }$ t7 |3 x ~6 H; X* V& D- t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 Q8 [+ n0 K) s2 i
0 _7 C) ?/ \5 k: L$ b5 C6 I( i7 f3 ]
|
|