|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + ?1 t9 S4 A: O$ t2 {& S
- [code]EDMA sample test application
; ^$ k) Z2 Y% A& h3 U - /*7 ]8 b& o/ c: C% I/ S& r; }
- * edma_test.c
: b& E# K4 n9 O: Z' A: J. A+ _ - *: |9 A4 Q# Z9 i
- * brief EDMA3 Test Application
% P- y8 y6 m$ l) u: f - *; E0 b, D6 y( n! c" f
- * This file contains EDMA3 Test code.8 Q/ C( ]) @ q6 E4 f0 D- U6 s
- *
& F* l& l/ |2 x! R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 y+ j8 w$ I2 p" @) d' o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( P* }! u& E" m+ h8 l9 n" j/ o
- * TO CHANGE.3 @' o5 @0 z: i( N
- *% g: H$ P$ A. \* D: z N! c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! L C) u$ l" Y+ G: Z3 t7 M - */ y7 L0 r) q C/ a
- * This program is free software; you can redistribute it and/or
& ~) o) w: r/ y" V8 v# ~ e2 E - * modify it under the terms of the GNU General Public License as
5 k6 c% z% N+ o" ?* N4 O& \ - * published by the Free Software Foundation version 2.* ~) k/ Z( P2 L! a2 l9 O; s' Q4 x
- *+ r* z# ~* J8 p1 S$ d6 O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% p/ J0 H0 E, y D9 t
- * kind, whether express or implied; without even the implied warranty" @8 v7 u9 Z+ e% }9 |3 R8 ^5 Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \! |) P) W0 j; E
- * GNU General Public License for more details.
# h! f( `; n% {2 H - */
/ m7 i( e) n# q7 t2 t, e3 V
: [" x6 F( u5 a }) P+ n$ V- #include <linux/module.h>
9 W o D8 I( N: ~7 c5 [8 k4 | - #include <linux/init.h>
; M/ f B& N) h - #include <linux/errno.h>* |- k$ x( G6 T8 a2 k
- #include <linux/types.h># ^: { P. Z# N4 U- y* ~0 F
- #include <linux/interrupt.h>, } J0 ? @. b
- #include <asm/io.h>
: B6 k! H4 c$ R3 ^2 D/ t6 P* {$ X - #include <linux/moduleparam.h>+ i+ u9 q2 c( |( h
- #include <linux/sysctl.h>0 v1 {2 f" b7 x9 M# A1 r4 C( H: v
- #include <linux/mm.h>
- a8 l* ~! k: P5 h, x, K/ L - #include <linux/dma-mapping.h>
6 i- E2 _7 n5 s6 k# w - " e5 H0 e2 c5 a4 z5 o
- #include <mach/memory.h>
0 a3 u& j: w- m, r4 T9 c4 Z% X/ _: O8 | m - #include <mach/hardware.h>
7 f7 U+ H# D0 A5 p8 T - #include <mach/irqs.h>
, i$ O: E8 [* N$ h6 w/ t( @: q( e8 | - #include <asm/hardware/edma.h>* r. _0 @$ I' d$ U r8 Q
5 m3 y' ]. M: U5 a2 D. P* d/ Y- #undef EDMA3_DEBUG0 C' e( k- [8 U
- /*#define EDMA3_DEBUG*/3 W1 B% }5 p& e
; K7 J$ t: b" D- #ifdef EDMA3_DEBUG+ U: c, y& R1 c4 @3 a% M
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 O* o9 y* m4 A: M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) N ?3 _: d- J0 t2 v - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ N* u& n# `0 s% n+ ?
- #else
6 \" g% E8 ~( U6 z, f - #define DMA_PRINTK( x... ); I9 I% ?- e7 }, ?3 g
- #define DMA_FN_IN3 o+ c1 ^* F; L9 x6 F4 T J4 R
- #define DMA_FN_OUT; _& [' V$ v- ~, ^
- #endif
4 `( f* ` L5 Z8 p% s& m7 \
! \. N4 V7 h1 R5 J7 V3 e- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 @6 M# n9 }& b5 L& l( x
- #define STATIC_SHIFT 3
6 s: K! v2 z: }8 f. ~ - #define TCINTEN_SHIFT 20
: A9 t- r/ d& C) @1 x$ U - #define ITCINTEN_SHIFT 21
9 b$ n" k% M$ P3 }$ G1 } - #define TCCHEN_SHIFT 22! ~, ?6 \+ r$ Y. @2 y- p# {( d: Y3 v
- #define ITCCHEN_SHIFT 23
" S3 D) C8 b- r O
% g$ W0 A2 x, C* ?2 M% a* a- static volatile int irqraised1 = 0;0 |1 q* P8 Y* W9 A) s5 J; T5 u
- static volatile int irqraised2 = 0;
5 D% i1 j: T. p8 T3 E- _+ x
6 L: d; H/ |/ V/ \$ i$ `2 U8 r% @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" z% ^4 k% N1 {7 { - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- M5 y3 p- B6 x/ u1 H4 y7 J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: [5 `/ f. r5 _! u
- % D: ?! m- i# t! U2 L% p
- dma_addr_t dmaphyssrc1 = 0;
% L$ J0 H2 V% w: g: _# b" d0 o# G - dma_addr_t dmaphyssrc2 = 0;9 D# o g$ F2 M
- dma_addr_t dmaphysdest1 = 0;
4 G* @/ ^2 V' p- O - dma_addr_t dmaphysdest2 = 0;) p$ _0 Z) ]" Y# V* e
- ! b) B& O4 S$ Z' [, @
- char *dmabufsrc1 = NULL;
L! }/ g% p" Y; b' [& t - char *dmabufsrc2 = NULL;+ ^ w; {0 r+ P3 {2 N
- char *dmabufdest1 = NULL;
( k, h8 u1 e! U! @! {$ R - char *dmabufdest2 = NULL;6 |* l$ l: h: {. b
0 |) T* {/ V" o! ~# o3 m9 z- static int acnt = 512;
2 _/ P z" s* x% R - static int bcnt = 8;, F I4 u" e8 k
- static int ccnt = 8;( P0 D: D8 L" \1 g/ c
6 _3 r: ^( r8 w Y- module_param(acnt, int, S_IRUGO);
b" g1 w y- W* ]$ k! _ - module_param(bcnt, int, S_IRUGO);
9 N: S0 Z& U4 r5 L" `$ J - module_param(ccnt, int, S_IRUGO);
复制代码
( M+ m$ `9 E$ K! `& E7 r
( o- E3 Q2 h8 Q0 f, e2 ` 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% h7 T' V3 m! c# b2 H7 g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ H Z( N! H1 R. W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# j5 c8 G. N9 P2 F4 G
3 `% i$ a% b ^- x* F7 Q3 x4 Y' \1 w* D% Q4 ?0 ]5 y- C" w: Y
|
|