|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " g9 E B7 a! g& y% c0 L8 u
- [code]EDMA sample test application
# S; ?8 a+ D4 H$ G, ]8 S8 p - /*
3 }1 z- _, D& V* d - * edma_test.c
. t' p: _! Q$ `2 K6 v8 D - *
1 F5 I, F6 p2 K+ T) H5 g( b - * brief EDMA3 Test Application: F/ E$ c8 O' X* B; W
- *
2 D$ K+ ~" B) v& y/ m7 A - * This file contains EDMA3 Test code.2 w0 ~( ^! X5 n9 r0 l
- *3 {) i/ P z' P5 C% ?9 L/ p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ m) X# r- R9 S+ j1 w+ L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, r7 G2 ~! c1 e. m9 c( E. q- V - * TO CHANGE.
1 g3 {" C9 r* [' L( m& _ - *
/ G( d1 G$ \! \0 l* e# N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 G/ [$ K) J0 i) E3 o" `% {7 J: _. O
- *
; R; ^9 e8 f# o. O; N7 @: K! { - * This program is free software; you can redistribute it and/or
( c7 d6 ^) z7 p0 S - * modify it under the terms of the GNU General Public License as
; i5 r/ o* |& c% I; d - * published by the Free Software Foundation version 2.
( C1 g& `* f+ W0 E4 D - *5 P# i& Y/ l6 I; u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 O: w7 R, H# ?2 \ - * kind, whether express or implied; without even the implied warranty
' f7 Q7 p. L; N( ?0 Y( }; P- s - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 B2 S: S: `! M - * GNU General Public License for more details./ l6 Z8 D6 G8 x% q
- */
2 n+ C2 e0 ?! D. Q( J8 l( _$ \
' }' f7 }! q Q+ ]5 v3 U: y- #include <linux/module.h>
0 _ [2 v/ ^+ {+ F X d( C - #include <linux/init.h>: s _4 E) O3 K0 f g6 Q
- #include <linux/errno.h>
+ Q) F8 G/ q9 Z* h+ j- ~ - #include <linux/types.h>
8 W1 b5 g n. Z* p# J+ S - #include <linux/interrupt.h>8 i7 l1 g4 H- o( j
- #include <asm/io.h>
. O# h# j" Q$ T1 Q; {" R - #include <linux/moduleparam.h>
' m0 t5 B# G0 l) g4 r - #include <linux/sysctl.h>
# h9 \) ]" n$ ?: \0 G+ P1 A$ y - #include <linux/mm.h>
a1 W P8 ?! D- R2 V9 E$ A - #include <linux/dma-mapping.h>
6 ?3 E+ c% D# P - 6 |, v+ q, U# B3 M5 k
- #include <mach/memory.h>+ Q# u, s6 F; V* W& t$ S
- #include <mach/hardware.h>
# W0 g- u5 N" L. I - #include <mach/irqs.h>( B8 |9 |- d3 }1 I z: E
- #include <asm/hardware/edma.h>. Y3 b N1 _$ V
' B0 t( {' g* C- #undef EDMA3_DEBUG" N8 @$ S- \6 M/ I0 Q7 @
- /*#define EDMA3_DEBUG*/
* G) K' V% v1 Q* u/ |; Y - ! N8 d1 V" t/ A+ F- P! g2 B0 s2 w8 j
- #ifdef EDMA3_DEBUG
; V7 {( X) E" y, a- \5 I6 h7 H+ i - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
R- _0 B! [! I* [ _6 q8 R% E8 \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( ~* C1 Z! U8 L& @& D/ i
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ c8 \7 n4 g, _2 [( ^ - #else8 G g: L7 w- p" _) a2 ]/ E4 d/ E3 n
- #define DMA_PRINTK( x... )) |$ Q7 H/ w* ~4 \- D# s" L# ?
- #define DMA_FN_IN
; r6 U* H9 z) C; u8 p' h: e/ x - #define DMA_FN_OUT
) N( O. K$ |9 {1 m - #endif5 A% K5 b; ^; c" c
* N$ \' p2 e7 c. K( ~6 u- #define MAX_DMA_TRANSFER_IN_BYTES (32768); N4 {* t" h* E8 ~
- #define STATIC_SHIFT 3
% R0 Z% i3 g5 \$ d8 W - #define TCINTEN_SHIFT 20
6 A7 ]3 K/ S, z2 ] - #define ITCINTEN_SHIFT 21
& |- ~6 t# M4 N1 G - #define TCCHEN_SHIFT 22
, n" T4 b; X) t' }/ L. |8 c - #define ITCCHEN_SHIFT 23( N$ q% t# y0 x) i& [
- ! p2 o- Z% X6 O0 m0 f
- static volatile int irqraised1 = 0;
6 L' O2 X. M" S7 m - static volatile int irqraised2 = 0;1 ^; `8 |/ X I4 d7 ^: V/ v' ?3 F( t
/ y% Z# O6 @. h6 K1 l; c( a1 q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 [ u8 W6 e% Q+ d5 y0 T6 F6 \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( t, x* A/ N4 c9 p0 q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 a! C+ O5 H5 I* V' K& b
- 3 V7 `+ g$ k) i
- dma_addr_t dmaphyssrc1 = 0;
1 T& ?& e0 e" ~ - dma_addr_t dmaphyssrc2 = 0;0 T- i# N0 G6 ?! r( _5 l0 }
- dma_addr_t dmaphysdest1 = 0;$ ?. y+ W3 \7 y+ K p% F. d
- dma_addr_t dmaphysdest2 = 0;
0 j& K- ]& @2 z) C ^5 w
# c% \( [& u7 `( j( y9 C8 Q8 e& Y- char *dmabufsrc1 = NULL;
9 H( I6 U' |" {. k9 l; U) u - char *dmabufsrc2 = NULL;* @" ?/ B4 S. p" R
- char *dmabufdest1 = NULL;
( i2 s1 Y) ~7 q) Y* |, \! a. z - char *dmabufdest2 = NULL;& y; f- W! ^0 W/ _7 z
- 7 h7 ]2 k* Q# t# y
- static int acnt = 512;$ W# G, A8 T; a
- static int bcnt = 8;2 }% P0 o1 x5 }5 U
- static int ccnt = 8;
1 e6 A6 m$ c# j, J% c- n3 z, x - / h& A& x* ?5 ~) H0 B6 P* d
- module_param(acnt, int, S_IRUGO);% g& u8 i4 \' f1 L. \* Q
- module_param(bcnt, int, S_IRUGO);# }0 u1 B5 J- q! [
- module_param(ccnt, int, S_IRUGO);
复制代码
) @8 o7 J& Q a7 z3 o
. _+ O! ^/ {" V$ W1 |; x 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" `1 U% l1 t( W+ i' _8 Q6 f1 n; i7 Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ r, r+ U% X1 g2 k2 o" U. U3 ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! e3 ]6 A* Q. ?& z
: s6 { y, }, K* ~6 s
3 Q4 |- P/ w- C. Y4 Q j |
|