|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( v' k1 n& ]1 \
- [code]EDMA sample test application* X$ x# b) a! `1 ^
- /*
G! r0 I! A, Q* r6 O! B1 S$ o - * edma_test.c
$ A' [8 Q l, I4 J& X% _ - *
1 a; p% B4 P4 g' c4 l - * brief EDMA3 Test Application& v0 h( I* O. y$ z
- *" G# t+ {" t! t# ?9 D: q
- * This file contains EDMA3 Test code.0 y; c, L* s# Z# r- F
- *1 r9 n/ Y5 i# U0 V) S j; E) N
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 R H+ e8 Z# D0 T- T7 b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ n' n) S& T$ ?6 X
- * TO CHANGE., |2 p" b! q4 V0 W0 s w3 j
- *; |- l! ]" k U; Z1 A) A0 k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ a: r0 ]) s2 H: U7 B- k* J: @ - *- p, _9 r( f/ f5 n
- * This program is free software; you can redistribute it and/or( h1 Y/ _# Z1 B
- * modify it under the terms of the GNU General Public License as' f' w) z+ Y2 O }+ ~
- * published by the Free Software Foundation version 2.! M) |3 {* G* c2 Y
- *+ Z) c( h' g. P6 X" m7 b; M& Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ L. _4 j7 A+ _4 e5 t& P7 a
- * kind, whether express or implied; without even the implied warranty) v* R& \$ ?/ T4 | u* n% E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 h* w' K8 p" Y: T& X
- * GNU General Public License for more details.
- B2 |) d8 B+ y+ V2 @' M# S - */
4 f- ]' Z1 l' M- O4 U - 1 O: w0 j1 S9 \3 ?) Q) q
- #include <linux/module.h>: A' t% x# k2 V2 C8 \
- #include <linux/init.h>5 H- T* L1 |9 S' t6 _
- #include <linux/errno.h>" q; l) Z) m% Y
- #include <linux/types.h>- d( y2 g4 z- e/ M* X3 B
- #include <linux/interrupt.h>: d3 R( [/ M6 e9 K! Q) o- g( `1 `+ I
- #include <asm/io.h>/ N+ j* J2 N! @' G
- #include <linux/moduleparam.h>
* v r$ b7 q- I8 v - #include <linux/sysctl.h>
/ q. O8 I$ d5 L$ i3 h3 J - #include <linux/mm.h>
O) I+ k9 I2 s6 B - #include <linux/dma-mapping.h>
& C$ h* \" o& Z( e- H& r3 _9 c
( }. c3 L( h- a- {2 o) P' H- #include <mach/memory.h>
, G# @6 \8 R- K) X - #include <mach/hardware.h>
; v1 b! _9 r3 ?# Z" l - #include <mach/irqs.h>" b6 S& ?, e4 y+ T; ]# y% `' l% B
- #include <asm/hardware/edma.h>. w& ^7 {/ _5 I$ Z- N1 C4 Y
- 6 ?4 k% o) u# }+ q% j* X; x& j
- #undef EDMA3_DEBUG, s! u4 A- Q3 _8 T: y& c
- /*#define EDMA3_DEBUG*/7 j1 K$ `; S7 q8 |' n# {2 O; r3 r
" w/ F( t9 } V, _7 @7 g1 `/ {- #ifdef EDMA3_DEBUG7 O/ q4 L% o$ `9 I4 W& t9 f6 G! s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, N) N$ i+ M1 d0 T1 o7 ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' M/ q; o# D4 f- H# X9 H8 Y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& H0 [' B: t0 R4 B5 v
- #else
w* R( _3 k- L1 L3 L+ P! S# a" N l - #define DMA_PRINTK( x... )
" I) Z! h2 |0 W1 I+ G - #define DMA_FN_IN
8 r) L& t4 I8 o$ h& H - #define DMA_FN_OUT
) R! W4 @4 [; [# ] - #endif
7 d" I" ` `; N8 V; p0 ?$ k4 U$ O - . K/ o0 ?5 q! d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) g6 E- Y) S& H. [ - #define STATIC_SHIFT 30 r) ^ e# c3 D
- #define TCINTEN_SHIFT 20. p; a% y+ G. u, u2 ]/ D
- #define ITCINTEN_SHIFT 21% {- L9 { ]; Q- k
- #define TCCHEN_SHIFT 22
" T5 R( m7 p' S - #define ITCCHEN_SHIFT 23
, A d# j Y) C8 `. K' U
& P- d* j0 T/ b! q) Y+ o3 x) ~ j- static volatile int irqraised1 = 0;- g2 ^1 B/ t. k! @9 q
- static volatile int irqraised2 = 0;
$ n3 y$ ^/ m# B* J: q - + o0 t/ w0 i: C! E! |0 y; E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( q5 n- }9 O' @: G$ | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" [. Y/ P g' s
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! J( w. V, m% K6 }& P0 E, [6 \ - 9 J4 o @% b) d+ ]
- dma_addr_t dmaphyssrc1 = 0;
5 W3 x3 w" _; Q/ x- { - dma_addr_t dmaphyssrc2 = 0;
: C- r* x3 w2 Z$ b - dma_addr_t dmaphysdest1 = 0;
$ h' N' C* a+ A% P - dma_addr_t dmaphysdest2 = 0;
3 d& h5 A- J, o, D6 |. \6 z - 3 f! d2 X2 b# C' O5 }4 U
- char *dmabufsrc1 = NULL;. i5 ]$ [% R! D9 p O0 @4 i( H
- char *dmabufsrc2 = NULL;
( N: F* ~- o# H - char *dmabufdest1 = NULL;4 r( x9 \: e( s- m( v
- char *dmabufdest2 = NULL;5 s. r6 q4 s: I4 F, ]& p5 _
' }/ ^/ P; M+ m: G- static int acnt = 512;9 J! {8 M+ A. X V
- static int bcnt = 8;9 z- k% h# x3 v+ a2 P# H/ c
- static int ccnt = 8;% s' l: r9 `/ B3 u P
- + H( H0 [+ P# J* }( F
- module_param(acnt, int, S_IRUGO);1 [$ l+ ~: p7 @' j
- module_param(bcnt, int, S_IRUGO);
4 s( c; I& x1 k5 @ - module_param(ccnt, int, S_IRUGO);
复制代码
5 C- ?3 {/ r. Q3 ]/ F0 m
8 V( o2 ~& T: r0 @$ r$ ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 D9 s, ~ p# c2 u/ ~: g: b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 E% m) z8 l9 C$ F; O# V$ D0 ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ D9 c. Q* R8 W4 A! |* v: Y
0 `: G# _- i& J& f8 z1 G. J9 K& X/ A
3 s# t, B1 f7 u$ M |
|