|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , P7 F9 [; m$ ?+ Q
- [code]EDMA sample test application# g8 d7 \$ l& M% o+ \/ A
- /*
- f; ]; f# g( A8 q, V9 ~ - * edma_test.c& r) q8 {9 g- c0 ?0 I& C7 K# R8 ]
- *
1 h3 `& z9 }. L1 e/ E - * brief EDMA3 Test Application8 G# l5 Z) _6 O2 l Q- F0 Q1 O: `) a
- *. f: u7 T3 [2 [! \+ C1 r/ u
- * This file contains EDMA3 Test code.- R% o% [0 |! k, e& t/ M
- *
/ q, v6 ?) g1 m8 ~) A6 F% s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 x! [1 D( _# X1 ~: M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT T: u) D# a* X0 W- C7 P
- * TO CHANGE.' C" w% L0 E. T9 q+ g4 ]
- */ N: N) `7 l: e+ e4 b. a
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) W7 ]! A$ d& w K( ?
- *
1 _6 f+ P5 x+ T& m6 b( u8 ?" g - * This program is free software; you can redistribute it and/or
; T( P- X' f" T - * modify it under the terms of the GNU General Public License as3 ^. G. Y. S0 ^' o% W
- * published by the Free Software Foundation version 2.
8 Q8 r. v# b i: Q+ w; i - *6 { f% V/ T2 e0 }: B L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 N' n3 |8 [, m - * kind, whether express or implied; without even the implied warranty$ [5 A$ t: a" z# J" z0 w4 }
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( d* |5 P9 y- I/ V2 i- q
- * GNU General Public License for more details.3 c& _5 ?, n5 V9 n" H% W2 b1 \) _1 L
- */
+ ^! N1 P) x# h- [8 I7 b4 X" d
+ M; r! n2 p# N7 H. \- #include <linux/module.h>
$ n5 c e$ A6 j7 s( p( }6 ~* Y - #include <linux/init.h>
5 L% j4 g% X2 K! l% ]' x - #include <linux/errno.h>
) e0 O+ i) _. i) x5 M/ q - #include <linux/types.h>/ P2 `* i( _8 M5 f. C
- #include <linux/interrupt.h>
+ H: p3 Z' V$ s, P, D5 T - #include <asm/io.h>. y+ g' e8 d4 K6 O& m; b- i8 o# K
- #include <linux/moduleparam.h>! }8 [- M* v+ K4 B5 ?' s+ ^+ c
- #include <linux/sysctl.h>
6 S5 ]5 Q) O6 u% u3 g0 Q% ? - #include <linux/mm.h>
- k- M- U; p: Y) d& k0 t! S - #include <linux/dma-mapping.h>' {& ?8 P( l/ P- g
- . w; Y& N" v* ^0 K$ ~
- #include <mach/memory.h>& O; o. Z: v! G! u3 I' f" A) v! X
- #include <mach/hardware.h>8 T; N7 y: P- s \* d- P( i0 _
- #include <mach/irqs.h>) [) p3 J* F- F! u
- #include <asm/hardware/edma.h>* }9 j9 h( X+ c: M6 l V+ ~
; D" \" v) q! ]( h1 c- #undef EDMA3_DEBUG
* t5 }) f2 X8 B ~! B8 ?* ^ - /*#define EDMA3_DEBUG*/4 ^6 C2 s% G _% x0 Q0 r6 w1 c8 ?
- - {9 E0 o# W- x6 n0 r0 G6 e
- #ifdef EDMA3_DEBUG
: \( P5 ~: x7 `1 R( a( o# A - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( _+ H4 n4 i# @1 {: Q n5 Q" N9 S
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& X4 Y N; m+ N: P$ n - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 |, a [! o9 V6 e5 s8 g - #else
2 O$ j0 E' A( Y t$ L8 G - #define DMA_PRINTK( x... )
+ |( `2 o1 T: W; F0 a- L - #define DMA_FN_IN; I7 @+ `# O, g, Z- @! U
- #define DMA_FN_OUT" h3 F! `& f* e/ Z
- #endif0 H4 z8 j% T- y/ x2 Z
- / \8 A& b' ?7 c
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) a. I$ s( U- q! X8 G6 \" M: @1 x
- #define STATIC_SHIFT 3
4 @1 F4 g- p1 g( J - #define TCINTEN_SHIFT 209 F2 y1 t L2 e3 x: n
- #define ITCINTEN_SHIFT 21
( G, p, K6 z/ `8 T$ l+ c - #define TCCHEN_SHIFT 22
1 ^5 j$ J4 i- G3 ?/ Z; x3 D - #define ITCCHEN_SHIFT 23
: b. ~. e, N6 U. i7 {7 P+ Q9 T# H+ z6 P
+ T' Q6 Q P+ Y8 d9 Q4 d7 G: |- static volatile int irqraised1 = 0;' t$ L1 S! B- A9 A. y
- static volatile int irqraised2 = 0;* v5 h, c# N+ U9 n. F2 \
+ p. C2 T% W, r/ y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ } h9 |/ |$ j+ P% u3 H6 E
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 k' s+ I! l2 A0 ]! r* J2 s
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 S5 Y1 R- T c; i" o# O, F - - i, i: ?0 s2 g
- dma_addr_t dmaphyssrc1 = 0;/ {- {1 f8 x- N' `6 \' x1 I) r/ A
- dma_addr_t dmaphyssrc2 = 0;
$ s$ y; |! K! f$ X2 k - dma_addr_t dmaphysdest1 = 0;
4 B" D. O- \$ n! a m1 z0 `3 S - dma_addr_t dmaphysdest2 = 0;8 R/ d" E5 L# Y3 e: Q5 R+ `
- ' W0 t% Y+ s3 a3 g2 _1 ]: |5 F
- char *dmabufsrc1 = NULL;( ~2 y( b! S. O" q9 m
- char *dmabufsrc2 = NULL;
2 L& v$ p1 |7 [0 M - char *dmabufdest1 = NULL;: l2 C8 I/ T0 R! d$ m/ ?, Q( ?' c
- char *dmabufdest2 = NULL;: m, Y! z( X! V% |
. Y/ M o0 R" ^- static int acnt = 512;3 a& e' F; `+ _, T) j1 f
- static int bcnt = 8;
5 F9 e7 v+ m9 s4 V - static int ccnt = 8;" G- }( V) ]- _* h, [
- 4 P5 t% I) y5 p
- module_param(acnt, int, S_IRUGO);6 h2 K/ Z* t' d5 n1 V; k
- module_param(bcnt, int, S_IRUGO);
2 k: \' j) s' ^( `8 m2 V - module_param(ccnt, int, S_IRUGO);
复制代码 * w. T8 Z8 S; W* R2 O2 U
' T- e. s! C4 v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 s; W- @- J% T! f4 Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 C# k$ g4 w7 q) t) |. E
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 ~& b7 y! {0 a7 w4 ^( Q' i, d X3 Y4 z3 `9 r4 `, V
3 C. `4 \6 {! e* m& z |
|