|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! X+ w1 Y. f) u9 Y6 N% W) H- [code]EDMA sample test application) f5 h$ R+ j! c0 X, Z# ?
- /*4 ~& [1 p& f* f* x9 O
- * edma_test.c" F5 B( y" k# \6 p
- *, d/ t, O. d$ p$ u7 T3 L4 F$ J
- * brief EDMA3 Test Application
j: @9 ~7 J2 X- ]0 C - * V) q4 k! l; F3 {0 i8 P
- * This file contains EDMA3 Test code.
, q6 T8 e1 e( L) I! y' O0 Z - *
! ~, ` T; n( }) s* S4 x o) W0 ? - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; ]1 @: X. @! C2 r- j' u2 W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; z* l& y( U0 ?: a, L8 |8 z
- * TO CHANGE.9 {2 H! ?9 z: X& }! g4 L. P
- *
" e0 }1 a; S" r/ V7 u x9 } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 T0 D* A4 D' f2 |9 }" X
- *
! P( P5 R/ a+ `8 d - * This program is free software; you can redistribute it and/or
1 v0 ]: f/ c5 s. z - * modify it under the terms of the GNU General Public License as2 Z# E9 t5 s: K9 w
- * published by the Free Software Foundation version 2.
u" X, Z% e* G# Q7 \ - *
* o" |. ?( D0 y. |8 t+ e) \ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; L5 S- h+ X g
- * kind, whether express or implied; without even the implied warranty
9 |8 a* w4 \$ `9 y+ \% j - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: ?. O. k/ K" S4 Y1 l
- * GNU General Public License for more details.8 O$ p$ n6 w, B+ S4 v4 F
- */" D) x8 j# b0 F7 H
- ( ?' j( T, ] R, p5 R8 t
- #include <linux/module.h>
% o Z% q9 D: ~7 e - #include <linux/init.h>
5 B0 U( ]/ l, t4 w/ n) @( @ - #include <linux/errno.h>$ K( x# X1 J" ^6 P7 m6 s8 Z
- #include <linux/types.h>( X- i; ^5 r/ P! J; K$ u/ E9 m
- #include <linux/interrupt.h>
6 T% P C; a# Z- m7 N8 W2 r - #include <asm/io.h>; Y: a) m5 q: N6 |% O1 ~. _
- #include <linux/moduleparam.h>. t5 g) l/ F' I: r/ J
- #include <linux/sysctl.h># \6 R* V6 X8 q" r( i' v% |
- #include <linux/mm.h>: z/ ?( \4 R A8 P; Z/ B6 `6 l) K
- #include <linux/dma-mapping.h>6 F' V8 [1 W8 W a- f4 @
- # T0 e1 D$ ]8 j: p% w: c0 s& k9 c, L
- #include <mach/memory.h>
5 T, Z, i1 D8 t" d - #include <mach/hardware.h>! i6 g, Q3 M) a$ a# B* a* P4 U
- #include <mach/irqs.h>/ C" X/ Z4 }% T2 _% q' W
- #include <asm/hardware/edma.h>% @* z, p, o5 o* ~6 d; H
3 B# j/ p) f& ?7 J+ j- q; y$ \- #undef EDMA3_DEBUG- {+ \4 x- I1 F) P
- /*#define EDMA3_DEBUG*/
4 s5 X8 H3 d/ R# j5 [# _ - 0 R. X( x9 s2 V3 `- o) m
- #ifdef EDMA3_DEBUG( t$ f- r7 v5 n o/ \* A7 }
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- s) H, r9 n2 C; G" L5 X& s& G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 Q9 d3 p( R/ z8 w% H - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ o5 I1 t* V- {" F" t% N2 y - #else
5 i9 [7 a, I z7 H4 t0 R2 K - #define DMA_PRINTK( x... )' i; Y: c4 T. T6 q3 |
- #define DMA_FN_IN0 T. r! I) ?5 M. K; @; j9 m
- #define DMA_FN_OUT e6 s5 N" I9 _0 c$ {- s% H
- #endif4 G& t% i0 M7 l) H
3 |) C; z' N" z4 Z! g% e. ^( D- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% U% c# h( q+ z" X% b, N, h
- #define STATIC_SHIFT 3. E' E, Y5 d$ v( q u& n7 a' U
- #define TCINTEN_SHIFT 200 G* Q: f. |7 P9 I
- #define ITCINTEN_SHIFT 21. c4 j) y) i. l2 `) _/ [/ n1 g
- #define TCCHEN_SHIFT 22
. j5 F5 L- R" A6 \: {+ b - #define ITCCHEN_SHIFT 23
7 Q# l: k, g( C7 i0 d0 I M - 1 l& Q0 P9 G3 ^1 x# f$ x" B
- static volatile int irqraised1 = 0;
8 e; F- V$ l7 q/ [, `2 Z - static volatile int irqraised2 = 0;
. c2 a$ W/ z. h- @/ g - # F/ P1 Q" R% J2 ]- i
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; c4 N/ I* x) w, n# {$ P6 {
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% L8 [4 }, l0 R0 t2 a; d) Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 h' F3 U" g, k3 D! y8 ^$ l - ! N" y0 j9 `8 y5 C. n0 O r) O
- dma_addr_t dmaphyssrc1 = 0;
: ^3 S4 H9 q4 u) f( @- P' ?+ ~- y - dma_addr_t dmaphyssrc2 = 0;
8 k3 `8 w! P: s, W: i* D/ z - dma_addr_t dmaphysdest1 = 0;7 M, v/ F2 Z1 @* } L { H9 T s
- dma_addr_t dmaphysdest2 = 0;
- G3 c# D$ h( b7 k
' y. m6 ^& c3 _1 x2 Z3 c- x- char *dmabufsrc1 = NULL;
1 b3 F. _8 n& ?7 V - char *dmabufsrc2 = NULL;9 x+ A' ^. V# _
- char *dmabufdest1 = NULL;7 k/ t5 X% j% F8 C. Y. ~
- char *dmabufdest2 = NULL;
2 c& [* K" P; R- _/ Q' ]' c2 g - ! o3 {$ T$ D; c7 V- k7 q" Z
- static int acnt = 512;" G0 L& J' h: F5 K
- static int bcnt = 8;
6 |- W5 P- O3 [* X. |! w; A - static int ccnt = 8; r. E; |/ x6 N5 F$ a
- 5 A3 P8 \4 p) F3 M1 i
- module_param(acnt, int, S_IRUGO); A: |- c6 o9 T _: W
- module_param(bcnt, int, S_IRUGO);
5 q4 s( J8 e* G' Z6 k - module_param(ccnt, int, S_IRUGO);
复制代码
( K9 R% x6 X, A8 w' O. Q, ]! x: U* V* [( j4 F `; b6 _( L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, Q/ j% l7 O. ^3 W5 \; U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 |9 N9 a/ B! u+ t- l, h0 H
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% s" r7 d/ h- f0 n+ w7 }7 p
* E* [' h: z$ ?8 \4 ]: I% d( ~
! C1 M" S7 C2 u; p$ C6 F* L. u |
|