|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 S: W# v9 B) ]+ q0 F+ {: L, F5 F @
- [code]EDMA sample test application" ?! M/ E/ _* s8 t8 i/ s& T
- /*
9 Z0 U: X$ J1 w - * edma_test.c
, t5 d0 t$ W8 q3 l - *3 K% k8 B1 K$ k
- * brief EDMA3 Test Application2 v: [: L% K5 ^
- ** v! a- d. q4 N, @5 L
- * This file contains EDMA3 Test code.( \" E, i$ d6 a
- *3 ^7 f0 a8 E8 f9 L9 p" ^
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 O9 k$ _) t& G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& L- @* ]& D2 X' U, o) o. O - * TO CHANGE.
# ?6 B& }2 Y1 C3 c/ a+ {' i - *1 L- H4 U4 y9 j/ W, y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
W H0 @( ~$ w' `2 [ - *
1 V- a9 i! P# p/ `5 g& t - * This program is free software; you can redistribute it and/or
2 u$ O+ I4 @4 S) G. B2 K - * modify it under the terms of the GNU General Public License as
$ F" L9 O- T) B - * published by the Free Software Foundation version 2.: M x' p3 s! g/ F7 X6 H
- *
7 ?3 A. b( }0 H* s4 p - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 B; @% y, H7 X4 b - * kind, whether express or implied; without even the implied warranty% l( r* `& d. k0 X* @ k1 a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ P( P8 K+ v8 F8 A! @ - * GNU General Public License for more details.
) n0 p! u; y) i) a( D - */
/ {* G. n+ j4 I3 s7 q6 z5 a9 g
7 w0 {4 [( o* A5 ~* N# j: _- #include <linux/module.h>
0 K/ y1 {7 [: } I5 G, e, h - #include <linux/init.h>
s. j" o$ x3 C: Y6 A - #include <linux/errno.h>
% P* |8 g' w7 G2 s3 p3 S% W - #include <linux/types.h>
. K% e# T' ]: l5 g+ U+ F - #include <linux/interrupt.h>
* a/ f1 i! V! v o - #include <asm/io.h>* _5 F1 h. l0 s+ u* p
- #include <linux/moduleparam.h>3 `2 m/ H; m" Z7 D) U' D
- #include <linux/sysctl.h>7 _# x' }, w# \! m6 `& ]+ S4 e
- #include <linux/mm.h>
: u1 y6 z; g, S8 f* J! P* }' w. m - #include <linux/dma-mapping.h>: b4 R& P3 ?( U( v! N4 o) g
% y+ V5 W1 L0 S' o9 {5 K. ?- #include <mach/memory.h>; e: Z+ ?( S, L7 {* C1 h0 V% f4 H
- #include <mach/hardware.h>
7 l3 a7 M( ]- I9 V$ I- I - #include <mach/irqs.h>
. Y) B" }" _/ n o$ G9 ~ - #include <asm/hardware/edma.h>
. x0 N- Z3 [4 \% \. g
0 T8 v N# r( w3 c( H2 ]- r- #undef EDMA3_DEBUG( G; _8 Y6 P0 h) J
- /*#define EDMA3_DEBUG*/! X( v; H4 z. {$ d, p) D
$ s5 V/ w9 I$ N* ~* b3 h7 y- #ifdef EDMA3_DEBUG- y: K6 {( U( f2 L) x
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), |' U( j! Y. W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, `3 h/ `# a) l7 E3 X( H) g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 [/ x% x- m# S! K0 r
- #else" o- ?' o, i8 }- ?- M; t4 C
- #define DMA_PRINTK( x... )
% `! P. j: g6 l4 {+ u# T7 a - #define DMA_FN_IN
( x, t8 p e) X! x; v$ J - #define DMA_FN_OUT
# s: N/ a' A" G5 ^ - #endif" q! d1 F% W: ^" d" B
- 8 N0 t2 a$ A7 j3 S, G2 G: k
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ O, b; _* k$ I- m/ j* G
- #define STATIC_SHIFT 3) K9 g" l- U# `% R
- #define TCINTEN_SHIFT 20
- K- N$ q: M/ P1 {% g4 N( u! A( _ - #define ITCINTEN_SHIFT 21
: c- ~, R( K# Y6 [1 M3 O- y! ^# a! u - #define TCCHEN_SHIFT 22
4 ^! }: |) X+ B9 w0 e2 ?7 \5 S - #define ITCCHEN_SHIFT 23- J6 K; O; G, \. ?/ T( B& x# v
& q, |8 ?& k$ [9 k, t, D- static volatile int irqraised1 = 0;* X3 o$ `$ m# B) w0 {1 f
- static volatile int irqraised2 = 0;# ^5 y* j/ E7 u% p; G# Q$ \5 Y
' `+ x$ A& G6 A+ n5 E- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 {6 Z# v3 L7 D1 t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ c: G( C; S7 r% z7 Q0 U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" a) b9 Y- M5 z
1 Q6 ]0 k4 R3 k, J: Z/ \- dma_addr_t dmaphyssrc1 = 0;
0 o9 y) a6 T7 V) }! \+ _% [ - dma_addr_t dmaphyssrc2 = 0;$ h1 } m5 d$ o% D6 l, V- C3 r
- dma_addr_t dmaphysdest1 = 0;
1 K% g. F% y- ?% D L6 T( X - dma_addr_t dmaphysdest2 = 0;
' G8 t% O/ v, Q, W( n+ S+ B
( s+ J- z( M* r/ x! w. ?" R. m. x- char *dmabufsrc1 = NULL;
' g6 z( ?: n% h: q5 Y" `% ~* Q - char *dmabufsrc2 = NULL;
) E3 H6 h* T% w) s - char *dmabufdest1 = NULL;
8 g! I* m" `, N/ O8 e - char *dmabufdest2 = NULL;* B7 h3 C; i$ c3 V
- ! T/ W7 e3 r7 N2 ~# n5 R
- static int acnt = 512;- E- n$ c. {3 T2 I
- static int bcnt = 8;% F5 G( a) M$ @8 s5 g
- static int ccnt = 8;6 R* [/ W( x$ u% L8 ^
- & i9 ~8 `6 Y% m- S7 p
- module_param(acnt, int, S_IRUGO);5 f" g# T! O& n
- module_param(bcnt, int, S_IRUGO);
1 _ P7 X! R3 n! D - module_param(ccnt, int, S_IRUGO);
复制代码
1 `) T. K: i$ S M7 g$ Z8 N6 E0 E+ I% }/ H$ Z* O6 ?
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" y; m# w! A8 y \/ y9 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: I* b' j1 K0 ]% w( ] ?. W& Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ x3 Y4 L9 N! J% o3 v5 v" l6 t
) c8 [ I. ]: G; Z6 N8 b3 j, ?# _
$ |: n' e: K4 u3 t. g: ^ |
|