|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; j2 y+ o8 V% W W }
- [code]EDMA sample test application
1 q4 s6 J) Q6 a/ r& Y( L - /*
, I( `' G1 M& `; _$ C - * edma_test.c; m+ w$ p% ] R1 W9 Q+ O
- *
% c: a8 Y7 w9 `$ F) D* Z: \" X/ H; X - * brief EDMA3 Test Application
3 p z% ?' n$ @) q( y - *
, u( h2 m0 S% d4 t% c$ Y - * This file contains EDMA3 Test code.$ B) h0 U2 @. u6 A' ~0 _
- *
. I2 C C# l2 r8 ~$ }; @& h8 ~# K - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" o# x- w! c1 b# ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 V4 e. H: z6 Z' ]+ X2 k+ z& ?
- * TO CHANGE.' D" Z" I2 I$ `# d6 g0 e6 _
- *
$ f% [7 i' H O - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// u5 [: ]' z' } h" W1 ` d
- *
* ^# r3 \0 e( }8 z% { - * This program is free software; you can redistribute it and/or
6 \/ I _* Z: u) s% o/ L: u - * modify it under the terms of the GNU General Public License as
6 b! E* p: o4 d5 ]; X - * published by the Free Software Foundation version 2.; _, o0 J% `" u( g' |
- *; u! }* O: { }! J& X4 @8 x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: a) h; C4 @, E; y6 h' U9 u
- * kind, whether express or implied; without even the implied warranty
5 p) u* k7 F3 o, ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: T4 Y8 z8 t# c2 S - * GNU General Public License for more details.
, f0 { t, |# \3 M - */9 `& x( }8 ]$ Q7 n+ Q- t# X' N
- 4 Y) _7 ?. m, w: e
- #include <linux/module.h>
& G2 u' T, w( J" K! n% x8 q, w - #include <linux/init.h>; O+ @) B7 V. @4 i) g
- #include <linux/errno.h>
5 {5 e9 o d' q2 O - #include <linux/types.h>; O/ D* ]6 Z9 ]5 ^$ c
- #include <linux/interrupt.h>
0 t/ N1 w8 F" l7 r, d - #include <asm/io.h>8 [+ I) B0 h5 }
- #include <linux/moduleparam.h>0 w& j4 X2 z/ i/ D
- #include <linux/sysctl.h>
4 H, N5 y% a& |% o9 r& | - #include <linux/mm.h>4 F0 I0 O# c( B; s0 ]0 s. _9 g
- #include <linux/dma-mapping.h>
! W" Z' ]/ E2 Q$ {
& S' w' W# |, x$ a; G V! n- #include <mach/memory.h>
$ I# h8 @1 h& B - #include <mach/hardware.h>
+ S! \1 ~) B( v% f7 O1 U8 m - #include <mach/irqs.h>, G, R5 k/ Q5 B4 R
- #include <asm/hardware/edma.h>, L) Z) C" G8 J, G0 ]0 K8 W! y
- 4 m( \: H# D! W4 B, K' a. z$ |9 ]
- #undef EDMA3_DEBUG
# C4 G t' x: n: |+ Q. P) ^ - /*#define EDMA3_DEBUG*/( F; n, M3 L; K( l
- " N; H. Y+ k% `4 d9 U' i
- #ifdef EDMA3_DEBUG+ _1 \# z7 T- p
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( X3 K9 H6 U1 n2 h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), R' E( Q+ j) u' K% b: ~. V- z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 I( D. ^5 y5 o# k T
- #else( G1 Z# n+ X! w( {1 y* h: f
- #define DMA_PRINTK( x... )
0 f1 F+ L- @- y - #define DMA_FN_IN" u' o2 t/ Q9 h" v* r8 c
- #define DMA_FN_OUT2 |7 o9 T4 w4 Q
- #endif }7 O# \. r6 g0 c) u: g
- 7 d0 S6 }1 h7 r# U5 z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( {1 V1 x F# Y( O Z - #define STATIC_SHIFT 3
0 M: B7 P/ S5 H1 x7 x, C8 c5 I' p - #define TCINTEN_SHIFT 20
: p! f8 K1 Z/ R! C) Z3 Q) a - #define ITCINTEN_SHIFT 21: S+ B( H+ G# P1 U; `( W& E4 o, u
- #define TCCHEN_SHIFT 22
4 Q+ W& M. M. ? v# g - #define ITCCHEN_SHIFT 231 ]! T5 V! D w3 D8 t/ s$ K
0 `% V1 P( f$ Z k" C- static volatile int irqraised1 = 0;& J, T2 d1 F. N. {7 h/ v! A7 @9 G# p( q4 c
- static volatile int irqraised2 = 0;
+ f4 L) A! x9 ?6 y, q) h& ?
) ~# D# @/ S ~- z% X8 m4 S4 X- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; N5 Y: n1 y5 _: F
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 }" x2 c6 [/ z8 j. m - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- R+ U8 G$ {7 Z4 y E0 w
( c( i6 ]; w3 Z. ~6 j7 I- dma_addr_t dmaphyssrc1 = 0;
1 h* S* ?9 h* d+ M- F - dma_addr_t dmaphyssrc2 = 0;6 T! J0 p. u6 O( J5 y
- dma_addr_t dmaphysdest1 = 0;) q' M' a' F1 @/ b7 H/ _+ _
- dma_addr_t dmaphysdest2 = 0;
: P9 Y# e! o5 p - 7 U! d( b3 v3 T! M/ ^
- char *dmabufsrc1 = NULL;5 w% W, H& n) K& P
- char *dmabufsrc2 = NULL;0 v2 S) n3 L/ [
- char *dmabufdest1 = NULL;
& E+ p, ?4 d9 b$ Y4 L - char *dmabufdest2 = NULL;# n( x, n$ y9 o
- " s3 w) M& d# Z/ K6 b) E
- static int acnt = 512;
% m& Z" _/ X9 _$ `3 a - static int bcnt = 8;
- v8 w& {; W1 a/ |1 F% }+ `. @ - static int ccnt = 8;
6 Y& Y7 E4 h+ [1 V/ d& D1 m% g
) s( Z; _: v" r- module_param(acnt, int, S_IRUGO);
7 W6 Q6 `" R: w' h - module_param(bcnt, int, S_IRUGO);
7 s9 I# y4 C/ E) W1 w - module_param(ccnt, int, S_IRUGO);
复制代码 5 a5 D6 }2 Q, T: n/ B1 r
6 a' [- x+ i$ x- g) G$ Y3 C/ F8 B 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- a$ o& Y" u, [8 K Y
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 r; E9 M! V. p" M/ n: E4 a5 O% v2 T0 Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 V+ j4 m, N$ H8 E: V- d
: L; S& m: r0 B6 w3 ?$ Q) M- a, d, R( \# \- z4 `. p
|
|