|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 o t- d/ M, s. F; v/ D7 g* D4 Y
- [code]EDMA sample test application s! }+ V) n+ ]# V2 d! b) b$ U
- /*
+ d, {% D# C! l9 K - * edma_test.c+ N s1 _, f1 _: M/ n; M; I8 P
- *
. i6 f0 _( Q+ ] - * brief EDMA3 Test Application
* V8 v& v: K; {6 p/ ~ - *
- T/ S5 N1 m( k5 T5 A- \ - * This file contains EDMA3 Test code.
3 @) c7 S8 z+ i& N) H1 X+ X2 }* W - *
, F5 ^2 r6 E# \8 n - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ Y2 O N% ?# a7 M3 E0 h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* F& @( @" \$ |; A. }/ C4 r - * TO CHANGE.
# Q o! a" S$ q. m3 D - *
+ l; w6 M$ |8 `/ | ` - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 O" L0 }3 J# S% d9 A2 [- m( F - *
1 @- J$ j1 Y. D9 k. T1 Z7 X - * This program is free software; you can redistribute it and/or: |1 V2 o6 c/ ~9 @ s6 l- F4 J
- * modify it under the terms of the GNU General Public License as( k$ h7 N7 p+ s ~
- * published by the Free Software Foundation version 2.
# ^4 t6 H* w5 r0 @; j - *
, F/ M% ]0 ?" i - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. k6 Q$ R2 q& K - * kind, whether express or implied; without even the implied warranty( K* j$ \- y2 ^/ _( Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: O9 n5 Y5 @: V# L! `- q - * GNU General Public License for more details.3 M% S4 [1 m) K5 w( y# x
- */! i7 D" D1 u" x; C* o+ I3 |! a
- 7 R/ W! E) r% c" @
- #include <linux/module.h>) v. g. q0 t( e+ i
- #include <linux/init.h>
, Z( v! Y- b& o7 F1 ^5 k9 G. Q& R3 [ - #include <linux/errno.h>
# J( b% B: q# {3 F+ [ - #include <linux/types.h>
8 l+ F$ g+ Y. X9 o3 L( M4 b7 l - #include <linux/interrupt.h>
& e& s' p/ P& }% b5 A - #include <asm/io.h>
: H* R9 ~, I) N \ - #include <linux/moduleparam.h>
: U7 L0 {' E( T4 T u4 o& g4 l1 T - #include <linux/sysctl.h>2 e7 @' E- c6 i& u" I. A" F
- #include <linux/mm.h>
1 k& k, b0 Y$ H4 J$ t - #include <linux/dma-mapping.h>9 X" \; i" ~$ O+ Z2 P9 E
* f4 q% ]3 P$ q0 v# @/ j4 p4 \6 K- #include <mach/memory.h>' Z: ?' |! J5 f8 h! ?2 u$ x
- #include <mach/hardware.h>
. N/ y" ]! ?6 ?) y- m - #include <mach/irqs.h>
0 p$ D) g) Q* K8 V6 T# M; J& I8 m - #include <asm/hardware/edma.h>
5 Z9 _7 a: f! w1 {% m$ P - . [2 h; W* |/ d: r
- #undef EDMA3_DEBUG3 ^7 O; I% m$ k- h& M! z
- /*#define EDMA3_DEBUG*/+ {+ C; ?! S- c8 z
6 b8 @& L K+ e7 }- k- #ifdef EDMA3_DEBUG
7 i( ` L4 d9 y$ p N6 A/ E' F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 Z2 f# |: F6 X3 d6 O- F$ V7 t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; D, l, P+ O& i0 G) M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): ?0 L. x# F$ D+ F4 p/ B
- #else' c P/ n N5 Y- C3 p) E1 N
- #define DMA_PRINTK( x... )' T9 o# J- O7 M0 ?$ q2 h1 d; f: x6 u
- #define DMA_FN_IN8 `( }% f: q3 `" F9 Q8 y# f9 g3 `
- #define DMA_FN_OUT
* O2 {! D+ Z1 n1 ] - #endif1 ~4 e8 Y M6 l0 |; Z
- : T( n: I* v6 L4 w* `1 I e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; l) u# K! _1 w2 i - #define STATIC_SHIFT 3
4 |! z Q% A/ @. A* e) d - #define TCINTEN_SHIFT 205 e1 T& J. Z: f) r0 |
- #define ITCINTEN_SHIFT 21
* g$ ~9 `1 j& D" u8 y- X0 ^ - #define TCCHEN_SHIFT 22
% y3 o `8 i/ n% k9 h& p - #define ITCCHEN_SHIFT 23. q" v- ^, F; U, s# S9 b7 X% |
) c- h/ j) H3 d! A+ m- static volatile int irqraised1 = 0;
4 k2 D" D: J: h6 r0 M. [* }1 e - static volatile int irqraised2 = 0;, c( S( I+ y$ H5 z+ F& ~
- 3 f* a, y0 j8 W4 m1 _
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* x& {& s4 N( a' \1 ]% Z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 t1 y3 X4 N+ a: n
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& o4 R% a2 g7 J& q. L! O& Q. s* ?& L
4 J; ]: N# t- A& w4 g) f& P- dma_addr_t dmaphyssrc1 = 0;
$ m" k \4 K% `2 F( {5 j! ? - dma_addr_t dmaphyssrc2 = 0;* H I3 A) s! w) a7 }
- dma_addr_t dmaphysdest1 = 0;
& r; A, F' U# o }/ | - dma_addr_t dmaphysdest2 = 0;
1 P! l3 K, A' z* S, K. z
@! v3 ^) i% H! ^$ s" u- char *dmabufsrc1 = NULL;
4 P5 l% v- a- Q! u - char *dmabufsrc2 = NULL;) K. u2 W F! z: i/ m
- char *dmabufdest1 = NULL;" J7 e% p$ W: ?( {
- char *dmabufdest2 = NULL;9 `1 I) D, z1 t: Q0 v
6 R) g9 U. I2 v' T9 s7 g6 E/ i2 P- static int acnt = 512;. o) t6 H$ _" P1 o
- static int bcnt = 8;- i! a7 u2 ~5 }& d( T
- static int ccnt = 8;! n+ S. P& s' W4 ]- _8 F+ w
- : G& ?0 r7 s: f7 b3 z% h/ S% K
- module_param(acnt, int, S_IRUGO);: [5 X: a5 y2 S, w( l( ?
- module_param(bcnt, int, S_IRUGO);5 q1 B( A4 [& x3 t0 J/ T
- module_param(ccnt, int, S_IRUGO);
复制代码
3 t6 u( q; @6 E* ?/ m k' L! E9 J' R5 D4 i' o
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
`4 }; y5 k# S% ]1 h1 o) _- farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 _% \& [7 Z1 a/ S! f$ y, q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 w0 s& t! i; z3 y. A
: v% A2 ]0 h* R
9 [3 i1 M1 E8 ]5 @8 l0 a6 i |
|