|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . Q' U+ X4 j2 [# T( `# V% C. M
- [code]EDMA sample test application
4 E6 U+ n t" C( p( O, I1 Z0 E - /*
/ j1 D+ H) K9 b - * edma_test.c
4 s( q0 Y6 V1 y6 u - *
6 |' e+ W9 ~3 O - * brief EDMA3 Test Application& C" s0 R6 S. c! W
- *
! s; B+ z' b# d$ l' ^2 _( r - * This file contains EDMA3 Test code.
) `# E$ }8 g) P2 [" T - *
* U) z' k8 b: ?0 W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 I; }' x; t3 ?- q$ { - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* x0 j$ L" _' |3 P& f7 L% ]: ^ - * TO CHANGE.' B9 Z3 [) X" b- n
- *- U* o% _& }/ ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! G9 L4 ]8 L, c" R7 V; _/ } X
- *0 m M) c! m0 N- j% I
- * This program is free software; you can redistribute it and/or
: D; P: p; l# E5 |+ r E' {7 F - * modify it under the terms of the GNU General Public License as4 h' |7 k4 e) a- E& X
- * published by the Free Software Foundation version 2.
- p, m- d5 F& v+ S/ X9 i+ f0 A2 c - *8 e2 [7 f9 z+ b# g% {2 h* f5 z1 }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 e% ^' n* _3 F& D3 @% c% m
- * kind, whether express or implied; without even the implied warranty
! h- c8 x/ O# ]1 ? - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& y# ?+ n- c8 j' j( k" L
- * GNU General Public License for more details.
& i: O0 j9 p: E! @1 y - */- F7 {- a$ C" _: L
5 P2 i5 a0 O7 _0 N; y; I/ [) U! Y- #include <linux/module.h>& K7 o% b; g* M; N/ N9 }) ~
- #include <linux/init.h>
2 k, R( W' r% R6 c/ p I - #include <linux/errno.h>
: ~1 h, R9 [, Q' t4 y - #include <linux/types.h>- W! w" Z( _8 L" f
- #include <linux/interrupt.h>
+ U& c9 Z+ a6 @$ r3 M2 S - #include <asm/io.h>6 j. K+ {) o0 b1 B! a- A# x$ Z
- #include <linux/moduleparam.h>
0 N3 Z% L. W% k4 L! D- t - #include <linux/sysctl.h>, w- N0 P3 C/ O4 l E- _! F
- #include <linux/mm.h>( o% ^% q6 V3 J0 B2 C7 ?
- #include <linux/dma-mapping.h>
5 \0 n/ s" a7 w3 M$ _- ^& c - 6 Z/ {% W6 J) a+ _# {+ K/ u3 l
- #include <mach/memory.h>$ H& c8 t7 u! l9 m
- #include <mach/hardware.h>
. q3 }) \/ q, N: `! O" j - #include <mach/irqs.h>
T% @% O$ s& E& i! ? - #include <asm/hardware/edma.h>) _3 ]( S2 V! \2 y( D
- # G) p; _3 n0 F7 i* N
- #undef EDMA3_DEBUG
^- {9 J. B3 q - /*#define EDMA3_DEBUG*/7 W" Y- r& h$ T x$ g' z9 V/ U3 m
- - s. f6 {7 |' L6 N. S( |
- #ifdef EDMA3_DEBUG+ O {. x4 I S! r4 H2 M
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), q2 {2 _' e# ^& u, E- j6 o- G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( S+ o# S& Y3 F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 ^1 H4 D3 Y+ n4 g4 F. i/ n+ ? - #else% y6 h' J' K r; C5 ^
- #define DMA_PRINTK( x... )
$ M9 W; J- F7 V/ A, \" x9 W5 ^ - #define DMA_FN_IN
% ] q* |; u \% |6 s9 f* B. [ - #define DMA_FN_OUT; Y" ?) R( Y$ m# V4 h/ J
- #endif( F. J: y! X t' v
/ V: O' [- y5 b- v- C- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 Y! m8 h% o: ]; c" D8 b1 Q( w
- #define STATIC_SHIFT 3
" u/ x/ R5 y- ?+ `5 ]$ H# Z% ?% y - #define TCINTEN_SHIFT 20
. v4 H$ c. p% H: w0 Z( U - #define ITCINTEN_SHIFT 21
. @0 p3 l6 m7 a7 a5 O9 u4 l - #define TCCHEN_SHIFT 220 }) Q" W9 x4 D# L& V9 I/ i
- #define ITCCHEN_SHIFT 23
( q2 s, N1 F0 h- B - 9 A! V/ `$ J$ V/ S, B
- static volatile int irqraised1 = 0;
; m4 T1 R' q& @" }2 p! E - static volatile int irqraised2 = 0;7 R7 T/ K4 M( a/ Z6 B
$ A" e( _ g6 O+ `# |1 R& u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* {$ H6 i& d1 ?7 w- K2 E
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 q5 L6 @7 e, _
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% t$ C% u- v0 x& V
- " p0 K O4 _( }, t9 D: _* n
- dma_addr_t dmaphyssrc1 = 0;
7 Y/ O' l: I0 v1 i, v- F - dma_addr_t dmaphyssrc2 = 0;
8 e8 r( @2 [" r& T1 M6 E - dma_addr_t dmaphysdest1 = 0;
' k1 p, x5 j W0 W/ t - dma_addr_t dmaphysdest2 = 0;
! a# X5 R( e+ e6 d" g8 f
+ _, Y/ g( F% y1 V. O& _) W- char *dmabufsrc1 = NULL;
! D# ?7 P' _( C1 }7 ?4 g' e! d - char *dmabufsrc2 = NULL;
$ _/ k8 M7 K$ e - char *dmabufdest1 = NULL;
) J. X: B9 {. ~: N( V+ u - char *dmabufdest2 = NULL;
( ]; }4 p' B9 |) H+ r
& ~: W9 w$ j/ Z- {- static int acnt = 512;9 z% T) D$ k8 @; {2 t8 g
- static int bcnt = 8;
* d3 t R- }5 G3 D$ p2 u! F - static int ccnt = 8;9 _$ v6 U& d- s" a! i! M
) m) G! B4 x+ E: p& L8 O- module_param(acnt, int, S_IRUGO);5 T5 u+ \5 c0 z
- module_param(bcnt, int, S_IRUGO);
9 \ ]- M! _0 e+ E) P4 x' l) c4 G - module_param(ccnt, int, S_IRUGO);
复制代码
4 k, p' F5 t& H: n- T8 M5 X4 I+ T% c2 w% ~! y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 |7 W" r1 p/ @0 X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 `& K W+ q( z4 J/ ?" r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% n$ a4 c/ {' C$ m6 D
o& L5 l) q+ C* [2 F; m3 x4 f4 s6 q8 h; Q3 Y
|
|