|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; c) a* W3 ?9 d+ I" o
- [code]EDMA sample test application3 W. E- m, t% f7 E2 G s
- /*6 K3 t: V' ^! b% G0 \6 S$ u+ e
- * edma_test.c
( i: l, b/ o" k, f; U+ o - *1 @, g" h1 l* [
- * brief EDMA3 Test Application
5 j8 p0 u" P/ A' [1 @. |3 b' e - *" _6 `% z7 J" T" B6 Z
- * This file contains EDMA3 Test code.
( W7 }* t% V+ F9 W5 e - *4 p" Y) U# F) p8 m2 j* D$ q! w8 l
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ t6 z! j5 _0 L# M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; S" K) z7 m6 M, E2 h# G* H
- * TO CHANGE.# b: Y* d: L5 l6 c
- *1 U- p( K( ]% G O: t0 \ W2 {
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 F* c9 L. _1 h: V - *
: J$ |& i( Q& k - * This program is free software; you can redistribute it and/or/ p' K3 l. f" A- [( Z/ a0 v
- * modify it under the terms of the GNU General Public License as
3 [1 a1 U) R8 G# j' \( C2 T+ ^7 X - * published by the Free Software Foundation version 2.: V" {8 B j7 i5 g( s( b
- *, G2 c$ s: c% w9 B1 i! l5 Q* D
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* R) x5 s2 d. ^7 E) d {' } - * kind, whether express or implied; without even the implied warranty: U4 Y* x# d7 n& F1 O
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- }. {7 s+ o' \ - * GNU General Public License for more details.
9 W3 J: C0 @1 E8 R8 I# Z - */$ N2 _3 Q2 v. h# F6 V0 ], `+ b
- 9 N) G* P3 M" \2 e( w( \. S/ v
- #include <linux/module.h>: _( h# ?: Q5 ^: F8 ]- n9 C! G: \
- #include <linux/init.h>
7 T2 O) |# R7 }2 H1 Z2 O) J& | - #include <linux/errno.h>
/ ~2 \' w! ^( o! A$ e - #include <linux/types.h>
: I0 l0 t# E6 z1 e* J5 \6 K/ D1 } - #include <linux/interrupt.h>
- ~, g6 U8 i6 {3 M( W% w - #include <asm/io.h>6 I6 u% Z7 R0 g9 M
- #include <linux/moduleparam.h>
0 Q/ N+ l$ J% X2 w" u - #include <linux/sysctl.h>, W; r# c8 \' E* ?( L: M# b3 _ g @! {
- #include <linux/mm.h>
. p2 s/ K/ v/ B. m4 x - #include <linux/dma-mapping.h>
# \$ l) R2 h9 P, ?+ v$ }
+ C; l; _( s T/ i- #include <mach/memory.h>
4 n% I/ J5 y: b( J; \7 g, F' V) } - #include <mach/hardware.h>
- `& n& b/ B6 C2 v7 t c0 a: \ - #include <mach/irqs.h>
& y2 j( N, O3 E$ o( O0 O& ] - #include <asm/hardware/edma.h>7 ^4 T- `8 }9 C3 S2 V- {
) H1 H# s' m+ P; P/ g' Y- #undef EDMA3_DEBUG
& Y& \- D4 J$ u) ]( a - /*#define EDMA3_DEBUG*/
# v7 u! a3 I/ x3 I, s9 x9 o/ J9 S) ~$ s
- Y" Z# g0 l( j% Y1 i% D- #ifdef EDMA3_DEBUG
# ~$ ]+ J0 d* o' d* p& `% U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) s c$ v1 A7 @0 s( Q* ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 m5 T0 k; l i# s v4 `' A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 t1 ?1 m, b8 r5 u6 t7 e, x% i8 V
- #else9 x' a; O% ^: a, V; U
- #define DMA_PRINTK( x... )
/ E; w8 \2 @3 d3 O% } - #define DMA_FN_IN
0 w% j% J5 S" S+ x- o: \ - #define DMA_FN_OUT0 |7 U! ?1 P/ @3 G% n
- #endif
/ K2 N1 A2 J( B1 P6 V( S( i - ; U( Q& F9 b8 p. ~$ Y0 y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 p* b( s. X1 c
- #define STATIC_SHIFT 3
4 n. B; v, E- X8 z0 O8 \5 S _ - #define TCINTEN_SHIFT 207 p* S9 F0 a2 ~
- #define ITCINTEN_SHIFT 21
& c7 n4 q' }" J9 L - #define TCCHEN_SHIFT 22) R! u8 H# i9 h. P: K- G/ e+ \) H- B
- #define ITCCHEN_SHIFT 23: L9 \8 M6 P0 F/ `6 o. o) M$ t+ y
- ; t2 c; F9 \! a' S/ i. `+ w
- static volatile int irqraised1 = 0;
# R0 e2 q( M: k) i6 s0 K: O- w - static volatile int irqraised2 = 0;
* T. I4 _6 X+ m6 L- K
. {% u. a) v( B0 W, o5 {2 i. W' \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. z+ m* M( _4 N. F- t' t6 E2 t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) c/ Q) J( `$ l6 z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- ^: g, J* {$ O H1 \0 V& l
# U& G$ ]! J/ S; i3 b- S0 C' W- dma_addr_t dmaphyssrc1 = 0;) G( e* G( L5 P( O
- dma_addr_t dmaphyssrc2 = 0;
/ U; n( U+ o3 X, Z1 u$ B - dma_addr_t dmaphysdest1 = 0;- `1 r& e& C3 V1 [' F* j% n
- dma_addr_t dmaphysdest2 = 0;
8 O" }- j6 K6 H& h7 Z' T: k* j
' C! ^) {; n, x1 H) `$ b- char *dmabufsrc1 = NULL;& w1 P9 k0 V6 l0 j
- char *dmabufsrc2 = NULL;+ v5 Z% r2 h1 |
- char *dmabufdest1 = NULL;
& y, ?( v, g: ?4 v- ^ - char *dmabufdest2 = NULL;6 J o1 U) s5 ~
1 C! x6 G- u' T* q- static int acnt = 512;7 w1 |0 e# j3 E0 n; Q
- static int bcnt = 8;0 {* b' ~! i4 J5 B. f$ l! o
- static int ccnt = 8;
4 g, x; j7 Y) u# P, Y
$ m5 }2 c O( q; s* [% Y1 o" d: M- module_param(acnt, int, S_IRUGO);
* R* O4 D$ y8 k' u - module_param(bcnt, int, S_IRUGO);
: p, ]' A. c! ] a - module_param(ccnt, int, S_IRUGO);
复制代码
, L7 }" s; R* s4 V& Z; K8 C4 S2 K$ U/ t* ?: N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& T7 y( _# L6 E( F: K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) a' ]7 Q5 j1 V8 Z& z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ l; [2 k% E+ B9 F* ~. c: R1 C/ V' T1 N# c$ b
; A0 Q( q: J* l2 G |
|