|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 ^5 Q S& e3 G- [code]EDMA sample test application
s( S- f5 ~1 ~ - /*
& r6 E2 K) k5 N6 Q/ h - * edma_test.c% Q* f9 `: F( k6 }# w# p! q- `
- *
9 O! s. W" I% s* f - * brief EDMA3 Test Application2 o$ C, n; p3 m) O
- *& I: ~6 Z1 O7 q& {
- * This file contains EDMA3 Test code.
( Q# o' o1 `" I: K! @ - *' l+ t5 c" _% H! I" \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- l+ i; U. P% P( y' O3 X4 Q, X
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 I- X0 U6 q+ H4 s7 J
- * TO CHANGE.% i4 o1 _" T: F q( Y; `
- *
! r. w7 G2 m/ f2 E" i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ E* I9 {, Z* B. D- f6 g - *1 ?4 {( _# L% Y5 R) e; u5 x2 P
- * This program is free software; you can redistribute it and/or
W1 X; @$ [5 W6 o c" i. p - * modify it under the terms of the GNU General Public License as1 u4 X# |) g2 C9 T [) s0 c
- * published by the Free Software Foundation version 2.
2 ?! r3 u! ^2 u2 ?1 k" b$ s- c9 m5 U - *8 e) X) M6 W3 J2 B% \. s) i; s1 ~
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 ^3 ?( Q5 {. v9 G; H3 V+ K3 M
- * kind, whether express or implied; without even the implied warranty8 {2 u3 ]! o) l" t1 R: ?& P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 I; T. T m: ]3 H
- * GNU General Public License for more details.
9 \! p3 T# r2 `" \ - */) h- S- \5 G+ ~1 B# b) k
- % f+ h: f; W+ B6 f$ M f/ J4 k
- #include <linux/module.h>
( h$ O. |7 p' i6 U! q0 M' H, x6 n V - #include <linux/init.h>" j2 I: @: Q4 K8 y/ g E: z+ ~
- #include <linux/errno.h> l4 e) [8 M* Q9 s
- #include <linux/types.h>
! q9 a) V) I" N6 E$ `% T5 P( U, j* i - #include <linux/interrupt.h>
: F% T5 ~$ w- c4 l - #include <asm/io.h>0 d/ Y3 T4 v( O
- #include <linux/moduleparam.h>
, i5 ~: ?. E, Y - #include <linux/sysctl.h>
0 @8 Z& t. C7 O2 @8 V* y - #include <linux/mm.h>, g. r1 Y0 O0 l: h2 `
- #include <linux/dma-mapping.h>2 s+ f3 e/ h; u
- / V* B; W/ G# c3 g
- #include <mach/memory.h>; M2 C2 ]7 f; D9 S
- #include <mach/hardware.h>
# \6 Z' }$ f. k' `& g - #include <mach/irqs.h>- ]1 D- _5 P6 q3 ~* F
- #include <asm/hardware/edma.h>
) D# A$ e/ o5 A& T( {3 k - 0 g0 t/ S! M+ l
- #undef EDMA3_DEBUG2 }+ \9 S9 K9 o. ?9 y
- /*#define EDMA3_DEBUG*/
- e4 j- T( w- K! [/ M& j: K0 i9 i
+ _6 r& z z7 @6 r0 W- #ifdef EDMA3_DEBUG
# `9 q# ?& \8 [! j7 n% ]- c - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 D6 W% [; U k - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) m7 h. O% H, ^
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
M+ l( E' G6 _6 R7 s" } - #else
" u U. a* f5 ~- ~ l6 b4 y3 k - #define DMA_PRINTK( x... )% H8 K( S: `, D4 k
- #define DMA_FN_IN
0 S4 n6 b, [ `* K: w - #define DMA_FN_OUT
; c0 Q2 v) v; x- \4 C - #endif$ \5 V% X& q4 t% [: v5 N2 B
- # O8 j# u* c- G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% O) Y& E1 P8 d) t
- #define STATIC_SHIFT 37 E, j' ~3 r2 U6 n
- #define TCINTEN_SHIFT 209 }& Q0 }9 R; N6 N( J) i: B1 I5 T
- #define ITCINTEN_SHIFT 21, M. _% }0 {5 ?$ W
- #define TCCHEN_SHIFT 22
7 T/ q1 q1 u" n8 l( O0 v - #define ITCCHEN_SHIFT 236 ?, d1 `. N/ ?. N- {
- + Q4 E, h+ G0 w( |+ u" q6 c1 O/ [
- static volatile int irqraised1 = 0;1 z4 B5 D H8 ~- a
- static volatile int irqraised2 = 0;/ Y& x* ~' q3 S, z
8 c' J7 k& p4 J1 w! v' i% g- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) Y6 Z G4 W9 p% q4 n8 V8 d7 a - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% [$ k4 ]/ Q- Z4 O - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 P3 k' r3 Q) [7 f' A/ R0 w - 2 d7 y$ j! Y, @7 _, ?6 p6 \* }0 Q
- dma_addr_t dmaphyssrc1 = 0;
5 A& R' {$ o7 }9 Q5 _ - dma_addr_t dmaphyssrc2 = 0;/ y( @% S) d6 d8 Y2 D8 g7 o% d
- dma_addr_t dmaphysdest1 = 0;. Y9 u4 x: O9 D
- dma_addr_t dmaphysdest2 = 0;
' Z: r7 g' I! m2 b2 e
) o/ W G: t: S6 D5 e$ o- char *dmabufsrc1 = NULL;
5 w- G; q2 F3 S# N: z - char *dmabufsrc2 = NULL;: w2 e/ U% o7 p
- char *dmabufdest1 = NULL;
% m& `+ `7 ]* {: s4 @! F2 a- G - char *dmabufdest2 = NULL;
% q% B3 |8 @- q: T. F4 U+ ~
2 x: ~( n6 Z$ V F* F: d( O# O- static int acnt = 512;8 G# K; U' w: M0 g+ k% V
- static int bcnt = 8;. z0 B* b- D" o6 v& B
- static int ccnt = 8;
) N3 _9 r8 R& y) A& R
6 n- \4 N) H8 B- module_param(acnt, int, S_IRUGO);# e. |- R5 J% d8 e6 \& I
- module_param(bcnt, int, S_IRUGO);
! w# B, T* y1 u# K( |. V5 A! L9 Q - module_param(ccnt, int, S_IRUGO);
复制代码 , S8 a# E) a R( s8 N5 I+ i' y. \0 |
# J- G8 r0 Z+ y! W1 B
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 g& }+ s8 W0 ]' p. k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
a5 F7 t- y3 C8 G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 e. S" A% [+ d
* l, W1 v9 _* D/ M4 B+ f9 K
4 T" V# }7 V2 K9 _5 l1 y( G |
|