|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ Z! s9 G1 H4 O9 l- [code]EDMA sample test application) p: N! G, @* m' B6 m0 I
- /*
& h/ l- ]9 g+ j/ c# F - * edma_test.c
: C9 Y: A8 M2 ^4 X - *
$ {! G/ Y! K7 b' d5 ] - * brief EDMA3 Test Application$ Y1 L$ @. b- W
- *
' ?" p# _+ R: @/ g8 Y0 E - * This file contains EDMA3 Test code.
1 c }, W: K+ { - *+ h# }- ]3 H" `* F C J$ s+ O
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 u5 ]) e5 v; S" Q7 K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 |$ N- b# ?& Z2 N- ` - * TO CHANGE." a* v3 {. }; M) z
- *9 c* y9 |4 V6 {6 K1 t7 `- B. Y2 y/ B
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 x) U! R+ K2 M7 y( A
- *. w6 }% S, ~+ y* q
- * This program is free software; you can redistribute it and/or
& f' b( e0 C3 Z1 D: {1 p& i - * modify it under the terms of the GNU General Public License as
, o$ x4 m4 s# Z# ~: Q2 @( j% M - * published by the Free Software Foundation version 2.
( i" c* i. O g/ \5 v - *# d) A* d* \5 ~& c1 k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" M/ r5 O8 V1 F) u* K1 t
- * kind, whether express or implied; without even the implied warranty
! ~1 h+ w3 L! C+ @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" k: P. O! m( H( _) ~; C+ b - * GNU General Public License for more details.' u( `/ P( F+ ^: H2 B0 D
- */
* Z7 I9 j5 q/ {8 f
, y+ V2 B4 o6 @- #include <linux/module.h>
2 e8 \% a; G2 T7 A - #include <linux/init.h>; i1 u: }6 G6 E
- #include <linux/errno.h>4 E: U5 m' ]1 e. \& ^7 Y
- #include <linux/types.h>( R2 p* p j, M& J, V+ I5 V
- #include <linux/interrupt.h>% Y, J+ Y [9 g
- #include <asm/io.h> H1 Q) s- ]) ^% w$ C, [/ B
- #include <linux/moduleparam.h>( o- b2 I4 Q" {$ {( C2 b
- #include <linux/sysctl.h>
. O$ |# v5 i n- Z9 x' f - #include <linux/mm.h>- _' e4 p, E" ~& L1 N! S7 F
- #include <linux/dma-mapping.h>; B: y: R, r! J
% ~( a' d9 `4 P& X: k3 v, t: V- #include <mach/memory.h>
8 ^, }, j! r* j6 O, A9 U - #include <mach/hardware.h>8 \0 @: E4 T0 k h. x0 H" L4 n5 A
- #include <mach/irqs.h>
- r$ Q/ P6 e: D8 W4 R: ]4 Y: u - #include <asm/hardware/edma.h>
) s w2 q7 a5 _0 N2 q# r
/ p/ {* _& e' @- |* C- #undef EDMA3_DEBUG
' W4 M5 O. \2 j) g - /*#define EDMA3_DEBUG*/ D: X7 G% S+ Q$ n
' M0 [* H b! S- #ifdef EDMA3_DEBUG
- l9 K4 d7 V0 g$ p3 L0 U" U2 J, B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 z. n$ q9 r# |% I% h8 ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( Y2 s0 R7 Y) T0 v& W1 | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) }8 b; v) a- U, L \1 Y) h3 K - #else
% T7 L; ?- J" b* Z% I# T$ G/ d; u - #define DMA_PRINTK( x... )
4 O) ^, x% B" H. l1 L - #define DMA_FN_IN
2 F) s) x3 p4 O) T% _# ?! @ - #define DMA_FN_OUT
. p5 y! m& ^. \+ L. B. F$ B/ k - #endif
+ P5 J5 ]' j1 I9 e) c. R) ] - 2 Q* N* [' S, p( d; V. L; M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 f) p+ u% |, q
- #define STATIC_SHIFT 3
" n$ T1 _ z- o5 w% m6 { - #define TCINTEN_SHIFT 20
0 l: P4 X+ D& i' k& I0 @ - #define ITCINTEN_SHIFT 21, A% `6 A- j+ u8 o1 O; L
- #define TCCHEN_SHIFT 226 Z' F" B. R; H: k7 }
- #define ITCCHEN_SHIFT 23$ w# y2 }1 B: M
- ! H' b! W6 y# k$ H! }4 l9 Y' W
- static volatile int irqraised1 = 0;2 u7 L( W5 y3 A1 p
- static volatile int irqraised2 = 0;, G ]4 G3 o% X, T" Q n* w$ h. d; c
# ~+ s7 x9 e b4 q# q: T1 i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 K+ v! Q# v2 B2 l! A
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 C0 i# h4 H+ s1 D% p( B2 g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; o4 L& o8 B* U0 V, _: ?, d$ s - c. x: j( {9 ^/ G. S% i
- dma_addr_t dmaphyssrc1 = 0;: E7 z. J3 r5 u- W4 \8 U! M& {
- dma_addr_t dmaphyssrc2 = 0;- G# z: I5 R/ ^* k, v
- dma_addr_t dmaphysdest1 = 0;# U% Z( I5 T3 J1 a. {# p7 f& i
- dma_addr_t dmaphysdest2 = 0; e( j( Z$ T5 |& j( q
/ h& X2 \1 |) N2 i8 \/ x! g: H- char *dmabufsrc1 = NULL;7 ~3 q/ i' B3 Z& k0 Y
- char *dmabufsrc2 = NULL;
2 a. Z% H& [% Y3 |3 s9 V - char *dmabufdest1 = NULL;
/ H8 B3 O: ~) |& U - char *dmabufdest2 = NULL;1 g* t; w0 Q3 r0 e v( K) R0 g* S
* g* a1 j3 Y D6 ?9 `( y- static int acnt = 512;0 T; L" c8 C1 ~) ]! |
- static int bcnt = 8;
' B8 ]5 t+ ~3 U4 \7 m$ A: [* r5 w7 E B - static int ccnt = 8;( Q3 y; z! q7 M2 S
5 q v4 P' g' }- y4 a' c* Y- module_param(acnt, int, S_IRUGO);# l' p0 t( |: `" D) Q& m5 d
- module_param(bcnt, int, S_IRUGO);3 R, X8 y4 n2 }7 O4 G
- module_param(ccnt, int, S_IRUGO);
复制代码
+ [% j7 d( ?! A# G+ S8 h+ x: I" L5 \3 p* y, Y x& U9 g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 h2 b8 ~* h7 W: Z* i2 ^: Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, K+ @3 n6 ^8 \, ~4 I8 E
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: Z+ D' V/ r( G2 |
, x' ^0 b& ]1 Y; w# n9 o" _6 w0 a3 ^2 P* Y& w. ^/ N
|
|