|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. \1 `4 N' |" Z# _8 `- [code]EDMA sample test application# s" V) S! n/ r& m$ y1 W: c
- /* i; {) V% V; D, p* Y1 A0 R3 f
- * edma_test.c) h% V4 q9 g" t5 X1 c3 V
- *7 ~9 W$ ~- E" } C: ]& e
- * brief EDMA3 Test Application
- `7 [: c" {" b7 N; _) p - *
4 ?& s6 _% N; U% F' q3 n2 q" H - * This file contains EDMA3 Test code.
& O3 B& J. B0 g - *- f1 r* Q7 J$ u( T! ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 S2 f1 R( e- z8 v" f; w - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- m: n/ t& J2 s. Q2 f - * TO CHANGE.
- i- e$ y9 G2 O! b. K; `: t - *
7 r/ N# q. k5 s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! H; l! M) o: u. j0 C - *
- I0 s( X7 V' F: [ - * This program is free software; you can redistribute it and/or
8 e8 \4 ~8 g; D. A, q - * modify it under the terms of the GNU General Public License as$ r$ g" V7 I' }! z2 t9 l; g6 P, ?
- * published by the Free Software Foundation version 2.
* v/ A, \2 M4 w - *
4 y6 z- B8 U! D, B+ A7 J - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ a2 I& n5 p- \5 P - * kind, whether express or implied; without even the implied warranty
. H+ I: q& `9 H; P5 U) } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 H K# K' I' l - * GNU General Public License for more details.# b, O0 H: m8 M }
- */
: j' O2 N1 F1 T# O& c+ H7 F: h6 S( P - 5 F- Z" \) T$ R* q/ y# w* v
- #include <linux/module.h>
1 L. Z" L/ [) U; |6 j/ M - #include <linux/init.h>
2 H, p* g; _: N - #include <linux/errno.h>% V. Y1 l5 e y1 a' J* ?- t0 p
- #include <linux/types.h>( T) y' m* E; I" T5 Z
- #include <linux/interrupt.h>
. b' N) b0 M5 ~9 y - #include <asm/io.h>
1 n$ ^6 {1 @: V7 z - #include <linux/moduleparam.h>
* W: K4 {' |/ e: x4 b% O - #include <linux/sysctl.h>
4 V0 a. f) u+ y - #include <linux/mm.h>
; I. W- _9 w3 F9 U - #include <linux/dma-mapping.h>/ _- M* w) o$ M& Z
8 f/ f2 ~2 u8 @: a+ B- #include <mach/memory.h>
2 r% Q4 s: y8 a0 s6 E! G - #include <mach/hardware.h>) D+ A5 q; [) G2 [: t' e9 c1 r
- #include <mach/irqs.h>
2 w0 G, x* Y" P' w P. ?( F. ~5 v - #include <asm/hardware/edma.h>
9 R0 n1 |) ~" y) w$ G* |3 z& T; ` - " Y8 h( H% {1 C7 g
- #undef EDMA3_DEBUG& @3 q4 A4 A1 F( |* y
- /*#define EDMA3_DEBUG*/
) Z, i/ M! g( j5 f8 x; v1 C
7 L' @7 t" A, L& k7 ]6 S$ X0 a! O- #ifdef EDMA3_DEBUG V) u2 c$ Y: V$ H+ Y2 b7 \- _/ Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- ?* k$ e: c" X9 H! @
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' s$ s4 B4 W1 j) E5 @, ] - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) G8 g8 y- f' i( l8 i% N( Y - #else
" V" w* P- |) ?1 s4 x - #define DMA_PRINTK( x... )1 ~% ?( X3 d- A6 q# }
- #define DMA_FN_IN
/ G& g* i/ y6 J4 I% E. J - #define DMA_FN_OUT
! c$ _, B9 O3 M: K7 k - #endif
( Y2 h. }- s* `/ j9 N% @
9 K# y8 w7 E8 ~+ u0 J9 B- #define MAX_DMA_TRANSFER_IN_BYTES (32768) F6 O0 i* y( y @: y$ l, F: O. _
- #define STATIC_SHIFT 3
4 z1 _ r& p0 ^/ B+ C - #define TCINTEN_SHIFT 20) T* r. ?( S( l+ ^- N2 T0 h0 I; @
- #define ITCINTEN_SHIFT 21
( y& _' [+ \' D& W. v6 q! T: x- Y - #define TCCHEN_SHIFT 22
. e5 l; n& q J5 z - #define ITCCHEN_SHIFT 232 E6 l# m1 X' y, I8 R) J7 [0 L
$ O. q* _* h7 k- j9 Y" D- static volatile int irqraised1 = 0;
2 B3 `2 x9 `$ v' W0 i n; x8 s9 C - static volatile int irqraised2 = 0;0 A A3 r" q1 m1 a& J/ H: R" A
- , r7 F' R+ E3 s. G' V- F8 E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
D( \1 J, Y# W* |! m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' c ?$ {( [4 L. t; F R - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& R2 l5 C _. w. R5 |& x - " H1 u' _' F7 ^! _3 n
- dma_addr_t dmaphyssrc1 = 0;6 D3 W' D4 A; m
- dma_addr_t dmaphyssrc2 = 0;
) Z9 Y; Y0 D: v3 [4 W% L& U" p4 H - dma_addr_t dmaphysdest1 = 0;" K6 K9 ]4 B8 s' |
- dma_addr_t dmaphysdest2 = 0;5 W6 b* Z/ {. h* S0 q: W: m* j
7 ?# L+ Y4 d+ `+ { @9 K- char *dmabufsrc1 = NULL;
6 t! B% k: V" t. k& H5 a - char *dmabufsrc2 = NULL;( p* H$ j$ k' A$ R& u% ]7 x3 O; j( ?
- char *dmabufdest1 = NULL;
/ _5 y' [! v2 v) x; B - char *dmabufdest2 = NULL;
2 U& b1 M3 }: t" h1 j% F0 ` - 4 d5 b3 u8 y, b: U9 {+ R' j) h
- static int acnt = 512;1 _0 @. W5 g* f5 L& X. C" F
- static int bcnt = 8;
5 J j4 ^" ]& m+ ]) n5 Q, U - static int ccnt = 8;
. d/ u9 ?$ h$ C8 H; V' V9 m - ; D+ t4 ^; ` U$ ~5 q% U; G+ k n* q
- module_param(acnt, int, S_IRUGO);
8 k9 J7 k% k7 _. D9 F- G5 I: i' M' A - module_param(bcnt, int, S_IRUGO);
' x% R+ X2 |3 S0 p, b; S0 ~/ Q" o - module_param(ccnt, int, S_IRUGO);
复制代码 1 u9 M' ~7 L9 Y. X! j
2 q/ E; E# t7 e' c 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( S9 ~9 {" Q0 w% k4 U- Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: b$ T6 a V; y6 @3 w
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! F' I% L6 F* d9 I$ f4 m
' M) s0 A* v) \4 ~% {8 c) i2 A, A
7 D; k- k v7 J% p. e
|
|