|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ c# [+ h) M7 Z) r- [code]EDMA sample test application, H$ r, ?: |" x# g! f
- /*6 Z: [% Z" ]6 o, y1 p- R, b
- * edma_test.c
7 n* T9 k$ t4 k5 D/ g q - *3 C4 ~1 r1 D! l% S) j( l1 \3 L: f
- * brief EDMA3 Test Application
7 T: Y0 b+ I1 @: X5 G5 n" S - *
4 F0 E L _) E - * This file contains EDMA3 Test code.
' Q9 v& h! v1 l! V# |6 E' y: O* _ - *- j$ v5 }: ` e1 V; J2 \1 s$ D4 p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, |* C% Q* w- u5 _ `& K2 Z* N# L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ T, V7 X6 x: V v+ c8 N* Q
- * TO CHANGE.
7 W. I# d( G5 p1 \ - *
7 v* V# J0 W K# u3 h$ l) m( c/ o8 t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% A$ I4 j+ w, Y* a% Z; r1 a9 s# u
- *
& {4 @! C7 L4 V7 z - * This program is free software; you can redistribute it and/or
4 p- X2 A3 R; h' J- `5 @ - * modify it under the terms of the GNU General Public License as
: {9 d- j6 m" R5 A" S - * published by the Free Software Foundation version 2.
" g+ q/ ~! a0 d$ D; G - *4 {7 v" ?- W* W% m# k" G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any Y- D6 \' h h8 p* m
- * kind, whether express or implied; without even the implied warranty
/ Z2 B% `3 s# W' z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 u8 q8 a5 W; N! f0 X - * GNU General Public License for more details.
9 u. c) g& [7 i! g - */
1 d9 r% M; Y. P# G6 G( _ - $ g( a, [* ^$ m b7 e
- #include <linux/module.h>4 p2 ?# e9 R% \6 U' E0 u6 r- i
- #include <linux/init.h>$ a9 P/ c! r) x' j% o
- #include <linux/errno.h>
9 ^9 P; f% W0 m/ y. J$ G - #include <linux/types.h>
/ ]& ]% d& ]$ p, [ - #include <linux/interrupt.h>
0 U0 G: _ d9 q5 H - #include <asm/io.h>/ l: V; h0 K1 ~% t
- #include <linux/moduleparam.h>8 d4 x) t6 N( b" B2 f8 o& b3 N+ `
- #include <linux/sysctl.h>) h3 i& W; {/ h0 t5 z( C
- #include <linux/mm.h>5 b2 S7 M$ L/ M/ ` d! \- i
- #include <linux/dma-mapping.h>: h3 s/ D" P/ O9 C
- ( V& V3 {! Q) Y8 c( x2 W
- #include <mach/memory.h>7 N, \7 Q/ A( Q* z* i
- #include <mach/hardware.h>. _; S' [- s- y5 [
- #include <mach/irqs.h>
: p4 R& g; [. B6 B, u: ^& d# y) ~ - #include <asm/hardware/edma.h>
9 m& W. D4 n& S. ?
% u: x6 i; I* l0 Q+ R4 Q3 f2 z- #undef EDMA3_DEBUG. ?8 a9 I# [. h4 L- C0 Q1 Z& o
- /*#define EDMA3_DEBUG*/; P. |* ]; R% I! }! z, F3 Q$ b
- 2 u; t4 s2 o; a b6 {/ Y9 V, H
- #ifdef EDMA3_DEBUG2 z4 q5 N3 W, Q7 Y, B
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 K+ Z+ W; ~) e2 z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
R5 [" ]( x c- K6 j - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 N1 L" ^/ F. a% X0 e - #else
4 b$ _/ J/ s$ ]' R% e - #define DMA_PRINTK( x... )4 W0 w2 o& u* l5 w! H3 @
- #define DMA_FN_IN
2 y9 _; a m. g' A - #define DMA_FN_OUT
) {, u3 P: T7 H - #endif5 c3 J/ \9 a/ t; e4 Q( Q
2 {) E; {1 ]# K( c- U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* n+ A& O) A+ l1 x1 }. i5 z( n K
- #define STATIC_SHIFT 3
3 u/ J5 O" S5 d; [2 u* z+ c: i - #define TCINTEN_SHIFT 209 `' J5 b8 z2 Q& ?
- #define ITCINTEN_SHIFT 21
9 e% w; y6 L$ I2 P( [ - #define TCCHEN_SHIFT 22
0 t M( \' M. _% @. C' ^; C4 [ - #define ITCCHEN_SHIFT 23
9 [/ g) _7 H& l; R0 ?, w% B7 s
: V: }: ^. Q' G) D# I( r$ [7 c- L- static volatile int irqraised1 = 0;/ m% j0 `5 U% j6 O# |7 b7 r
- static volatile int irqraised2 = 0;& |6 |2 O4 \8 r; B# B; O! {
- 5 H# G, q8 B- X! B% i% d0 N
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 ]( E) |" y, Y. P' e8 i' I$ P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( S# m. n1 G1 Q2 q, l2 G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' b% @! i+ n" L& P8 d
* n7 t* e4 C& ?- y# c- dma_addr_t dmaphyssrc1 = 0;# k- C4 R2 o+ w
- dma_addr_t dmaphyssrc2 = 0;! ^7 O6 o& Z1 y+ J
- dma_addr_t dmaphysdest1 = 0;
: V# C0 ^7 \. m/ f5 T - dma_addr_t dmaphysdest2 = 0;; Q3 M* a" h) @6 @- i% u2 t
$ H6 j' z6 z: t$ i4 F+ E7 t0 U- char *dmabufsrc1 = NULL;
9 ]' m M4 l9 z" U4 M# _ - char *dmabufsrc2 = NULL;% O6 f( t# W6 i+ Q7 L0 ^
- char *dmabufdest1 = NULL;: ~! b9 y1 m9 A7 P! T
- char *dmabufdest2 = NULL;
8 y/ E2 u, d, r& G4 | - . k. |( e7 K$ _4 S
- static int acnt = 512;5 u+ p; T+ O6 s2 F8 q$ f$ d
- static int bcnt = 8;
* G1 L3 u. o7 L5 e - static int ccnt = 8;
2 \5 _. A3 x* R% K2 {) | - ; X" a0 ]. v( K/ m2 l+ }3 z
- module_param(acnt, int, S_IRUGO);; e$ J2 R* G* U) R9 i
- module_param(bcnt, int, S_IRUGO);
' ]! z/ @ t8 u. c" B - module_param(ccnt, int, S_IRUGO);
复制代码
" I' g! }0 Y1 H
9 Z( a8 w. Z) `- H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) ~) z. t3 d: l0 n7 z+ \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ G7 H! p7 U( a# C& `; T 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 u6 T+ m# w9 K# b, j+ u6 A. e* o! O" u- J* K
# E5 P) q7 c$ a/ r$ R8 f+ H l$ R
|
|