|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 u6 G5 C% E4 b, }
- [code]EDMA sample test application/ ]' y4 |1 s1 y
- /*
, K9 x6 ^% B4 l6 H% L' | - * edma_test.c5 x5 v/ T% i7 t5 K
- *
3 Y) w4 Y9 U; A: }% A - * brief EDMA3 Test Application/ N! [% z: N- C1 o! k! p
- *% N. \" h0 g- @. L% Y/ C
- * This file contains EDMA3 Test code.' C; r. y6 W0 y& p* o8 D
- *; H0 j' e: `6 J8 T
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ _- F- ~; P: T0 e$ h) \ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ |" R, b0 C E+ n% B/ N8 {" u+ d
- * TO CHANGE.4 L( H7 t& j& T" x; M8 ?
- *, c) E! y1 p3 b. h9 _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' A$ X2 }5 x# {4 ` - *) l$ E( R1 c& Q# |0 x
- * This program is free software; you can redistribute it and/or
1 u" T6 g) Y* B8 X7 d - * modify it under the terms of the GNU General Public License as! X" w2 R* p; \! S
- * published by the Free Software Foundation version 2." X& I" ^4 W- T/ t' S) Z
- *
4 l; v1 v) x. o4 J - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ U2 W$ `( o |4 f' t0 p* d9 J( ~# a
- * kind, whether express or implied; without even the implied warranty3 X, n# P4 ^3 f7 d" f2 S1 ]
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ o& P% ~ c+ A, j5 b0 Y, E - * GNU General Public License for more details.
( c; Y$ g# Z$ D4 o$ p8 k/ m+ R - */
/ n8 I. c. W. e! f5 b9 U$ u7 x* {" [
A* t' L" }& }# N" y8 ]9 ~# Y- #include <linux/module.h>
3 \' g" l3 J8 E9 y, y - #include <linux/init.h>
) j1 J8 w( I6 h# ] u6 L2 b, P - #include <linux/errno.h>; Q5 y$ Z8 A/ i
- #include <linux/types.h>9 X, m% a5 v5 [6 I
- #include <linux/interrupt.h>* c8 K/ j" } O4 n' K
- #include <asm/io.h>. v3 k2 X$ |4 b4 h" K7 @8 l# E) i
- #include <linux/moduleparam.h>
% Z3 `. G0 K& N. s - #include <linux/sysctl.h>, n1 J+ D. l* M0 k7 D
- #include <linux/mm.h>
( P( b' W K& Q. o: A - #include <linux/dma-mapping.h>
) I4 j+ `2 D" c1 S. n ] - - {; n$ ?/ j8 ?
- #include <mach/memory.h>! k' m. o3 ~# [* Q6 J2 p( P
- #include <mach/hardware.h>/ E; _5 J+ L1 `& o5 X: q
- #include <mach/irqs.h>
$ j- V) h3 i3 }: e% e - #include <asm/hardware/edma.h>8 ^) }5 F) p9 E3 z
- . H; i& @$ d; N- w
- #undef EDMA3_DEBUG
1 O5 V' M+ m" d( T4 ^6 h - /*#define EDMA3_DEBUG*/
: {' b& s7 Q) v. P - & E7 Q9 `7 x: ?
- #ifdef EDMA3_DEBUG
; O" B5 @8 o/ w( [7 M - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 x" D/ |7 C3 g6 I* s i4 g/ q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" H1 w$ U3 v. [) d1 W0 P
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& Z4 Q' m* D! A9 e8 n$ g5 l - #else
2 j9 x2 f" n) ]' [+ _ - #define DMA_PRINTK( x... )
. ?+ w$ e' A4 I, J8 \8 X - #define DMA_FN_IN- ?+ {& I% r( @: a4 W: B
- #define DMA_FN_OUT2 e0 a; S8 c j* Q
- #endif
* ~0 b4 [# f/ v
) v: g0 `, w* q7 t+ ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& i1 b- q& j. O- s( e) r3 H - #define STATIC_SHIFT 3
2 }5 J# k0 k* P: u- \! q - #define TCINTEN_SHIFT 20
: f$ Y1 ]: [( D1 ~ - #define ITCINTEN_SHIFT 21& w! L* p/ l1 E# b, _& ]6 I8 K
- #define TCCHEN_SHIFT 22: c: J+ B4 W8 q
- #define ITCCHEN_SHIFT 23, K0 {! u2 ^2 N# ^ ?2 p; ~# V. I3 W; [
6 E+ E& h5 P r" v3 w! p6 D7 @' T5 W: Y" N- static volatile int irqraised1 = 0;7 d" q/ o8 I. r& F% K
- static volatile int irqraised2 = 0;0 x2 ]" f$ E. L0 F/ F- w, q
' G+ \4 p: E+ \6 g, h$ P$ e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 e8 F% p3 f7 G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 M& k' g: b/ W) }; S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. G9 Z2 \2 `6 r3 d4 l) Z
% @3 S1 `4 q6 E& c- dma_addr_t dmaphyssrc1 = 0;: c: x2 v& J4 C: {( G8 g
- dma_addr_t dmaphyssrc2 = 0; j4 z P" ~! M+ j7 G& D
- dma_addr_t dmaphysdest1 = 0;2 d! d+ p; U1 V6 s3 q' Y% ]
- dma_addr_t dmaphysdest2 = 0;- t" } `0 m ^% V( |
- ' k+ x0 E1 u6 R8 k4 |6 Q/ o! R
- char *dmabufsrc1 = NULL;( }/ P4 z" S8 D' a* D5 o
- char *dmabufsrc2 = NULL;
- X% v' W* U4 q7 |) o p6 g4 A - char *dmabufdest1 = NULL;
3 n& h- b+ X/ C; {! ^" J$ h - char *dmabufdest2 = NULL;- H8 t; v8 I8 u! w3 Z' w
- $ j; N) H+ G: a K1 R
- static int acnt = 512;
7 U9 }* l8 t' j1 t - static int bcnt = 8;1 m# L9 I X9 D* _; D2 u
- static int ccnt = 8;
a; D; y: b7 `6 m/ \# B9 f - : G7 b5 v4 v8 \5 N' u7 K4 s
- module_param(acnt, int, S_IRUGO);
7 D( w& E$ M- Z( | - module_param(bcnt, int, S_IRUGO);+ a4 p e' J0 ~! a& ^$ H
- module_param(ccnt, int, S_IRUGO);
复制代码
# w( k+ R6 @% m9 z
0 `0 U& u0 V! D5 }$ L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' d+ q, M& i" J! ?- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ c; t' X# }/ c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) b, m( L; r, f8 n
) b( L5 C, S" Y' I
( }% Q3 ~1 t, m$ s# A |
|