|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: P+ V) h: p$ Q- [code]EDMA sample test application+ Y+ o! b. w% V
- /*
$ K; t2 J$ q) u, r T. J - * edma_test.c& E2 u2 F$ ]8 K# S" y: w2 q! j
- */ [$ {( y- l7 d. E+ y
- * brief EDMA3 Test Application
2 G3 T2 Q$ d8 U) @ - *
- V R" A" L# ` l/ W3 q1 }. @ - * This file contains EDMA3 Test code.
a w$ X7 \6 R1 m6 { - *0 d( O* x/ G# y3 U. ?+ z. U; f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
V, R) I% s/ W/ L. W. C- _& e - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 k1 Q3 W% Q' Q/ G6 A
- * TO CHANGE.9 J6 I- D; |. |1 l: \: l- j
- *
9 X7 G3 v& q& ]- z; t, Z7 ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ }& P- Z2 K8 `, Z. b - *
7 {1 r8 ~1 X% |5 J2 i4 K; v" x - * This program is free software; you can redistribute it and/or- Q4 i7 [; G# ^. b
- * modify it under the terms of the GNU General Public License as
( n: V7 \# f7 a, Q7 ? - * published by the Free Software Foundation version 2.( a5 S4 N( c! @' [6 O8 S
- *& f) h* x4 S$ n* q. x1 d
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 Y2 {8 x/ J7 I b - * kind, whether express or implied; without even the implied warranty# Q/ w, m1 g' o1 v x6 ?5 `$ s h& F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 V5 o& Z2 I0 x7 M; i5 c7 w$ H - * GNU General Public License for more details.5 d q. O" A8 i5 b3 s
- */9 }( D } R/ k- E; O" L1 X! Q' v
4 d4 M8 K5 }, U7 B, L- #include <linux/module.h>2 N( M* Y' V( A% z( q2 I9 @
- #include <linux/init.h>; E. F9 D" N4 s# x; d
- #include <linux/errno.h># I& T @. z! p& V4 y
- #include <linux/types.h>
; V& O0 J; I* k9 [$ Q; e - #include <linux/interrupt.h>
D3 }" c5 l, A, T' ` - #include <asm/io.h>
- V2 m9 F) h# ^3 n ]8 D - #include <linux/moduleparam.h>$ _* F: V6 c7 |4 i+ p
- #include <linux/sysctl.h>* p$ F! a" T2 R1 l
- #include <linux/mm.h># w. H# |+ a. m9 H S
- #include <linux/dma-mapping.h>
, `6 ^7 W% U; [2 D - V7 i8 U5 d& }, F
- #include <mach/memory.h>/ Q: Z, n+ N& x6 V
- #include <mach/hardware.h>
0 ]+ I% l6 P. ~5 J - #include <mach/irqs.h>
; P; z4 T% o: M6 M" N0 X' d - #include <asm/hardware/edma.h>
3 \4 G; y$ u1 k9 [6 k) A - # o) N8 S* u. z# f
- #undef EDMA3_DEBUG
& A9 R' Q9 Y0 ^% L' x k% P2 z& R - /*#define EDMA3_DEBUG*/ M2 x" w( }5 H7 L( @1 r
- 0 E. {9 G5 Z4 q" K
- #ifdef EDMA3_DEBUG' Q2 R1 r: c# U% H' k% Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 b( I+ I/ ~/ [7 `! f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! C) e% M8 {0 {+ U6 l, T5 N6 G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ a6 `6 H6 t# ?
- #else
1 j2 R2 y& W( I - #define DMA_PRINTK( x... )
/ Z5 C8 e( W$ x5 Z; X - #define DMA_FN_IN
4 ^. N$ _' R* W" W5 U a, V - #define DMA_FN_OUT
; n, M; ^4 M8 c2 x4 }8 } - #endif
) T/ c V5 I5 }
. B/ _4 d$ \* Z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, e% c% ]2 ~7 q' s7 v) K K - #define STATIC_SHIFT 32 V5 Q) a% ^4 l' E, ?9 X- r* A( R
- #define TCINTEN_SHIFT 20
; M& X1 o+ Y: q; C, e( P! D- p- d - #define ITCINTEN_SHIFT 21 l. V+ W% H. r' j7 ?5 j9 d
- #define TCCHEN_SHIFT 22
: T- b6 V/ x( D5 E+ k e - #define ITCCHEN_SHIFT 23
# D! f- ^6 j! T; f( X# Q q, n - 8 m, I4 X; h! S4 r) x; s+ z: k
- static volatile int irqraised1 = 0;
, v; Y, o( e! w3 V2 V - static volatile int irqraised2 = 0;5 T" j8 N7 f4 I
- 9 V- N5 ~! f: |- F6 I0 u5 s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
K: Q ?: d/ j/ }* {* v, K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 j9 ?# q" q6 T# S
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; \ Q, c/ }9 \& O: V+ T; j - ' c, H6 z Z4 _% Z3 X! ~; @8 v2 O
- dma_addr_t dmaphyssrc1 = 0;
a5 A% L" g6 `: b) r, h, }# ` - dma_addr_t dmaphyssrc2 = 0;
+ E; O$ {5 G2 {* H - dma_addr_t dmaphysdest1 = 0;
7 ~# [2 _5 q4 H* _0 s - dma_addr_t dmaphysdest2 = 0;
7 F$ G3 q# s8 u - 2 r# Q0 f4 K# U
- char *dmabufsrc1 = NULL;
+ }$ z9 B, I, Q5 L1 T - char *dmabufsrc2 = NULL;
6 a1 F% @: Q. X" L - char *dmabufdest1 = NULL;
e' i3 _6 p& o/ w9 h2 C - char *dmabufdest2 = NULL;
, C* P# [" k! M+ v4 q
5 b! N# w; n$ l4 o- static int acnt = 512;* C" W5 B0 w1 \) G7 Q2 E
- static int bcnt = 8;# I, h8 p3 @' y1 i* F6 e: h
- static int ccnt = 8;
, A c$ f5 D5 V& P: k& z* q
0 {/ u# ^/ _9 R+ {! Q$ s n4 f- module_param(acnt, int, S_IRUGO);2 o$ U8 W8 A' ~) S! N! U! @$ Y1 p
- module_param(bcnt, int, S_IRUGO);, _6 w$ B; }, j" ~7 m6 X( C
- module_param(ccnt, int, S_IRUGO);
复制代码
0 g- x6 m& X( ]8 S7 g/ v. k* J7 _, I" j' P( u/ `/ h! E2 L* d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% A! _+ K0 K4 a; ~' q. o- Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 b% Z4 s5 P% o& P
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 w( X; G; V" H# u
' ]7 q7 Q% o% K5 V8 E9 @0 A5 O
* ?1 |+ [6 R/ C3 p! N5 J |
|