|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" h4 F; \+ z j, m- q$ a- [code]EDMA sample test application$ O4 w% g, x: B: U' m0 A
- /*4 u$ P: o+ }1 q6 i5 o* X
- * edma_test.c( h9 x* {% ?- k- ^3 u9 r
- *
/ R- H! @% J9 V! v6 U. A - * brief EDMA3 Test Application
4 q0 @5 _( d# I - *% M) |) Q! ]# k# {% q8 N$ ~' j
- * This file contains EDMA3 Test code.1 c# C, a! ?5 N% }+ B* n
- *7 j% a2 A9 o: Q8 z$ s# D+ [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! Q2 @ ^, ]: [. i" w- u8 w. m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 K5 k0 N4 U# \- D9 P
- * TO CHANGE.- a# L, d }2 S1 ?, ?
- *
: l9 z9 |2 d: n* S1 o* w - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; @+ |3 F- d! B% u/ n l
- *
6 |3 t/ S6 f& c6 u" x* Q - * This program is free software; you can redistribute it and/or2 X: m% I6 k2 G: F
- * modify it under the terms of the GNU General Public License as
' s0 ^' P/ E. V/ P - * published by the Free Software Foundation version 2.
J/ @9 ]( r w8 t( y4 N* G3 \% p- Q - *
: J# ~! [* h# i5 y! Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 n, C8 c2 f7 a7 a; c0 M
- * kind, whether express or implied; without even the implied warranty
) e) c* x0 F& ]1 H5 k& u! @ Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- b# ]% o8 T/ N' |3 ^8 Y4 r - * GNU General Public License for more details.. U9 J9 W& x! j0 ?6 }/ M
- */
0 P$ L2 r f& t* n+ j - + U x! ]( I5 `/ x
- #include <linux/module.h>
" h) n6 [2 X6 @ c; z& e - #include <linux/init.h>
! j& Y- _; {2 E4 g- K5 y - #include <linux/errno.h>; m% o I" L7 q& ], l' y
- #include <linux/types.h>9 ^- z/ L) s. X y
- #include <linux/interrupt.h>9 D# |, `% L9 U' `- f
- #include <asm/io.h>
3 g5 _6 q' v% a$ G' W6 E - #include <linux/moduleparam.h>/ h9 v* G r1 A" B
- #include <linux/sysctl.h>& G) A" ]5 d, x4 ^$ q" }3 @
- #include <linux/mm.h>
$ p! S8 J! z- i+ J1 L) c5 |. \) m, m- T - #include <linux/dma-mapping.h>
: l9 |# ]8 U n- X0 G9 b- ? - 1 J$ P ^) Q/ _$ a7 G: u; i
- #include <mach/memory.h>
8 R* ?: x4 D# \& C! l6 O - #include <mach/hardware.h>
3 |; X( O+ v! F3 i - #include <mach/irqs.h>
" h' Y) R5 K6 O }& m! A - #include <asm/hardware/edma.h>
+ B7 R4 a& i% l J2 |$ K6 q+ ` - 0 E- G; q& I. g9 V0 ?) [5 x
- #undef EDMA3_DEBUG( Y- m4 F& K" u
- /*#define EDMA3_DEBUG*/
3 e# z( {, h' c5 }9 o& O0 Z" [ - 5 d! G' x# a3 {
- #ifdef EDMA3_DEBUG% I7 c9 N2 M! D) S% H
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 e# S- Q' S: e2 a6 i: r E$ z. ^3 H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 X' _' y4 B2 [$ V# ?# k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( |3 o6 P# P$ t. g! H: k - #else
1 n; u r0 @ e' ?! \ - #define DMA_PRINTK( x... )
0 z3 x% X) L' K7 H0 |, u/ B3 P! F - #define DMA_FN_IN
; r( C8 f5 \1 Q c! ~ h - #define DMA_FN_OUT
/ j! Z% w( @& J0 m - #endif
% x" E$ Z$ b: F5 P+ k3 u - " H3 N! X( \% B! a5 d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 O7 p6 _9 h6 r8 |8 y2 Z
- #define STATIC_SHIFT 3
1 c9 H' A# p' J9 }7 ` - #define TCINTEN_SHIFT 20
3 U7 I* N7 v, u7 u4 S5 u: J0 K - #define ITCINTEN_SHIFT 21- P* V/ C/ v( Z* N3 g* h8 D
- #define TCCHEN_SHIFT 22
% X$ i0 W1 S# v& o* W" c# H7 d - #define ITCCHEN_SHIFT 23
8 x j0 r1 Y3 z2 X) x5 L9 Y
% r" s1 r5 H/ l- static volatile int irqraised1 = 0;8 Z+ G. e, ~ s0 h8 ], ~9 q5 X- T
- static volatile int irqraised2 = 0;, X$ h* M* L# B8 s) b/ e
) O4 L. v1 A0 l, m3 ^( m4 g9 ~( O; w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ J; X* T3 M" K/ r- c
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. Z- A: A: i/ q2 o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 {9 _6 f8 a/ l' Z+ V& v - - Q/ e$ G# b) N
- dma_addr_t dmaphyssrc1 = 0;$ N. P' V% z% K5 X1 w0 m
- dma_addr_t dmaphyssrc2 = 0;4 k o0 V, P; i* y& s1 Q6 j
- dma_addr_t dmaphysdest1 = 0;% r" G9 \) ^2 E" l9 z1 ?* ]1 X H* W+ f
- dma_addr_t dmaphysdest2 = 0;) Q% k. G6 ?' i0 ~+ _. j2 n
- 9 u! t2 A4 v9 q! U% r; ~3 d4 j: g
- char *dmabufsrc1 = NULL;+ E$ x0 D2 B! x4 d1 S+ T
- char *dmabufsrc2 = NULL;* h6 p5 F2 { E7 o, B& z+ M
- char *dmabufdest1 = NULL;
, L% }% N \" h9 h - char *dmabufdest2 = NULL;
6 J3 u" ^4 t. A
/ g/ j0 o* q+ m( v0 b- static int acnt = 512;
1 s J( n* w5 p! F - static int bcnt = 8;
5 r1 m9 {3 Q; u7 r+ o1 h - static int ccnt = 8; n/ s) ]$ E) |
" j' b9 j' X9 D: Q9 w- module_param(acnt, int, S_IRUGO);* m& s/ R7 b1 f: D# Z
- module_param(bcnt, int, S_IRUGO);" R' z4 U) m1 x& K# H* O# g. H
- module_param(ccnt, int, S_IRUGO);
复制代码 ; |7 y; v. y6 Q- Q
4 Y U- ^) v- d; S; G
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ s0 {5 _' u- v6 j( t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 i- H) V8 C. |/ {2 I0 l( M K1 N
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 l4 A4 S& {) ^) M: p/ r
3 ]9 Z, e) a M7 \! p& w; l p! Z2 J/ {* J8 e- p
|
|