|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 u7 s5 q4 t& w. [7 j2 T& s
- [code]EDMA sample test application
. f( m; `! d2 X - /*
, d' W$ z8 l3 [ X: H* [ } - * edma_test.c
/ ^ F2 x- L+ ?4 L9 ^ - *
% p, ]" z" Q1 i$ c) ]$ u! d# r$ ~ - * brief EDMA3 Test Application
9 [3 B6 D9 b( |; p - *, |7 q+ T P) N. b8 ?
- * This file contains EDMA3 Test code.7 c1 J# |+ z4 p, H. u! l
- *
9 R( @8 g, s% a8 V - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ M' m7 u6 k. K1 g& C- }
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; I6 _# S) G) p; t6 ]
- * TO CHANGE.
. y: A: `: R0 F0 T/ k: J- M9 ~& E - *: ?* o9 b1 j* e- P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" P2 W$ M5 m+ T/ M( t4 X5 E - *. e; W! K; V# b6 x1 L
- * This program is free software; you can redistribute it and/or, j! p: M8 i% r5 g: M9 p' _
- * modify it under the terms of the GNU General Public License as
: I3 q" ^' T& e; l5 T" E4 q7 U8 V - * published by the Free Software Foundation version 2.
' M* g$ a! v; c/ X5 y - */ l, r# A) B" i; U7 Y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: N5 |" m) p0 h3 w, ^ - * kind, whether express or implied; without even the implied warranty1 g. O7 }" Y$ n( {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 z3 X7 L, X1 C% |; p. Z - * GNU General Public License for more details.
* O# v2 d% O; v, a: k - */, e* U! L3 z- U
- & O) U# m' J# z4 J6 b7 a
- #include <linux/module.h>: `+ \' r+ P( M1 o$ T
- #include <linux/init.h>
8 H4 }& B8 d3 g - #include <linux/errno.h>$ f7 z0 X8 ]" Q
- #include <linux/types.h>0 A( R; F- T! K% ?
- #include <linux/interrupt.h>
+ C. x% O) T( }0 ]/ T$ r0 z - #include <asm/io.h>
( B/ B$ B7 q- \. V1 |$ n. G - #include <linux/moduleparam.h>4 w9 h" D, G+ B$ V1 L8 J# _/ Y: l
- #include <linux/sysctl.h>
5 i8 m8 V6 y- O2 X2 l& P6 d - #include <linux/mm.h>
& q/ Q/ ?- o# J9 V: S; x5 ~ - #include <linux/dma-mapping.h>
! w0 f, E4 ?. Z. E0 q* R
( E2 |6 I7 X, @6 `, s2 p- #include <mach/memory.h>$ Q" R- d$ H1 S# x
- #include <mach/hardware.h>
% D2 f( t+ ~9 s - #include <mach/irqs.h>
* R, c+ J4 Z. P3 O, Q7 `' D+ x - #include <asm/hardware/edma.h>
% y- o% V) ?; ?: x - 4 h4 H6 s ^1 S& p+ G* W- g
- #undef EDMA3_DEBUG# f* S+ S2 t7 k, z" I+ N
- /*#define EDMA3_DEBUG*/
; S' ]* E- G2 t! W; A* \ - - R( a/ ?2 f4 J0 g' C; A
- #ifdef EDMA3_DEBUG
0 @' s- z, T% ~2 l/ Y1 X! X! M - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 f1 `! D+ r, F7 F9 H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( l9 k& ^9 N; a, _2 H( K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 L, ?0 C) B; |4 ^3 B
- #else5 D+ ~/ r. ]* K
- #define DMA_PRINTK( x... ), Z) Y; A- m" y( d/ c8 U/ L7 |
- #define DMA_FN_IN
. t2 u/ P9 q0 U9 E! |- ]+ K - #define DMA_FN_OUT9 _1 m( W4 Q& _+ t% a9 u6 k
- #endif7 d: [+ z% q) b# D/ \! F: G
- 8 k4 p: r, G$ n; o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): d, x) a' G% y) m k
- #define STATIC_SHIFT 3
4 X% D2 @# B+ d- \- b - #define TCINTEN_SHIFT 20: y' g5 R6 D8 J2 _/ C
- #define ITCINTEN_SHIFT 21& [6 H8 l) ^/ h6 ~6 w
- #define TCCHEN_SHIFT 22
( N5 g. Z( ~% b! n& C! _& n) y - #define ITCCHEN_SHIFT 23
# S1 r7 P" a( b) s; b - ) U% D7 A; ^- p: Z- p# }
- static volatile int irqraised1 = 0;
# [; x8 `% u+ ? - static volatile int irqraised2 = 0;, K1 W5 K7 y# c) F; J7 v
8 r4 S ~5 Z. O5 W- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 [3 f9 l/ p: ~- d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: O! J7 F. X8 Q! w ^2 P
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 V7 {/ A1 W; G2 x, [6 O; x
! V) ^; w% k; d0 b( E, Z. j- u- dma_addr_t dmaphyssrc1 = 0;
, i3 i. {/ X5 D v - dma_addr_t dmaphyssrc2 = 0;, T9 h0 f/ I1 \8 H% Y- l @! \
- dma_addr_t dmaphysdest1 = 0;( h) ~' A. g4 E0 L% X! b* `
- dma_addr_t dmaphysdest2 = 0;, W$ T/ } ^& D' M& z
- ' j6 a1 C0 O0 ^5 o/ B8 X: F6 Z# Q
- char *dmabufsrc1 = NULL;
) d: K& n2 \# B7 p7 D- C1 ]% P - char *dmabufsrc2 = NULL;
7 h( c, y; V) q( r - char *dmabufdest1 = NULL;
! M2 U% s) l8 }1 m* c - char *dmabufdest2 = NULL;
c. \' g/ A% ?8 K9 M
& {% K# H. I7 J2 z8 B* x- static int acnt = 512;! o; t" ~0 t% n( H8 ~8 e- \6 w
- static int bcnt = 8;4 w* ?3 x. ~8 l! b3 G
- static int ccnt = 8;
1 |7 t6 j7 T+ V- }1 O$ p9 E
$ S7 Y9 U' P$ | S/ ^7 p. `4 w- module_param(acnt, int, S_IRUGO);( O$ q3 c/ U& m, j) M5 O; |+ I
- module_param(bcnt, int, S_IRUGO);5 S' j$ d' H! g* c* K, @; M: _
- module_param(ccnt, int, S_IRUGO);
复制代码
* D3 r( U; E& b. R* k+ B1 x b
! f* d: [! l, _1 s4 o 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 F# H$ C7 y+ ]( @& T- _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 m) @0 a7 y, o; M
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' J9 [- G! [5 n; v: v
) u; Y$ h. O' M3 X: j7 F# _( t K9 H8 Y# E( V+ w Z. \
|
|