|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 e$ o2 k6 Q3 k' b1 ]1 p5 P
- [code]EDMA sample test application
, q+ |3 t0 m! Y1 Z - /*# U+ @$ K0 `$ R, Y9 f2 `1 w2 z
- * edma_test.c% O/ ^, t6 E! d. P, R& L. e
- *& C- i/ `8 ^& ?/ b; s
- * brief EDMA3 Test Application' ?; Y( U* J" s2 ~/ D
- *
6 \! r3 g. I7 V, w - * This file contains EDMA3 Test code.
+ ~3 m' y7 C$ m1 k% K - *! h6 |3 V/ w* Z8 L! L
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ b4 k; V( K8 K J% E - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 I& @' J- H/ N: {7 \7 Q" X
- * TO CHANGE.
% U3 i7 D- E' H/ \* }" `7 g - *
2 B: ?2 B# N, s L4 T% G9 C# F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ B4 o) m' G0 ?6 Z7 s* A i
- *
" y1 Q K+ c |; |$ s& q5 T% u" T - * This program is free software; you can redistribute it and/or t, v, N# x" y
- * modify it under the terms of the GNU General Public License as" s, S; C& ]: w; f$ O
- * published by the Free Software Foundation version 2.- h5 e) ~& s9 V2 P- m5 I
- *6 S: ^ q# b& G) r8 h% w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: c& P5 T6 Z k+ R& i" ?: ^5 I
- * kind, whether express or implied; without even the implied warranty
$ V3 W/ m& Y5 E6 S( T4 a9 H - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( z" ]: b5 R! O. _# u
- * GNU General Public License for more details.7 @, ^+ {4 N5 o8 c
- */
9 m/ V4 F% H; s1 ^! o" L2 F - - Q W% Y# E& z! p9 f
- #include <linux/module.h>
+ C6 H8 v$ r* q' a# Z* O - #include <linux/init.h>
* w: G' c6 c/ d2 \# K+ ^ - #include <linux/errno.h>- z. \4 |/ F% g2 V5 I" e( @' U5 ?
- #include <linux/types.h>
6 e" |9 d9 E5 U1 _5 g i - #include <linux/interrupt.h>, X- }& B, g7 I: u% |
- #include <asm/io.h>
# f6 G7 i% ^3 ~& ]/ M; P. K% I5 W - #include <linux/moduleparam.h>
, b! U6 m6 k- ]0 `5 n5 s( I - #include <linux/sysctl.h>
5 d) j) f5 l9 F: `2 ] - #include <linux/mm.h>
) {, W; ?& W$ L! T1 D4 u& e w! L3 C/ h - #include <linux/dma-mapping.h>; q" n1 ]# f3 y# H Z+ s. w
1 n- L, g4 |! X; a3 U- #include <mach/memory.h>1 g+ Y3 F7 c) x m8 j6 c
- #include <mach/hardware.h>
% a) ?; H$ I$ u- E - #include <mach/irqs.h>
4 D I; S! L& s- V1 j/ z! Z - #include <asm/hardware/edma.h>
. {+ j L& E6 G. p - 0 q! h/ Y3 t7 x0 z$ O% G
- #undef EDMA3_DEBUG
) m5 v& A$ u$ }5 H0 y# o - /*#define EDMA3_DEBUG*/+ c+ w7 e) G# P/ O2 S
- s Y6 Z+ L) X
- #ifdef EDMA3_DEBUG
! l* M$ F6 h* C/ c- E' Z! z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& Y' q O/ P, k! X3 J" S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& U) ~- q, |; ~7 { - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* \0 z, N' u q0 B9 R9 y" @ - #else8 b/ n2 g, V, @6 N
- #define DMA_PRINTK( x... )
, p, ~/ p9 A: i3 b7 Z% t - #define DMA_FN_IN/ y" g& y: x2 o- d
- #define DMA_FN_OUT
' J: R* p& I# V" Y% ^6 ~1 L - #endif g- S2 z" `$ r( @. B6 f
$ y5 [/ g% F$ m* M- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 B$ H3 ^9 T4 Z+ h) @ - #define STATIC_SHIFT 3
! i8 Q( X2 v8 n" m - #define TCINTEN_SHIFT 204 b5 w2 D" d0 y' ]: B2 B
- #define ITCINTEN_SHIFT 21
- g0 P2 u) M6 L' ]1 k% H, y& \, |& B - #define TCCHEN_SHIFT 22! G* Q: K% w; a& z' d1 ^8 L" A
- #define ITCCHEN_SHIFT 23- a3 a% L+ F9 T* L" E' j$ X- g
- / B# M2 }# T: `" O3 q3 Q. g
- static volatile int irqraised1 = 0;# A1 V) E# }! I, D/ }8 Z. g
- static volatile int irqraised2 = 0;, ^" F& s6 `7 S) B$ \1 p. R7 p1 ?4 ^* \
) g1 ]: ?6 p ]: b& l' T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' a$ D |: y& w8 T- g - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: @/ J; w% I4 r j+ S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! C& ]) f8 L7 J. D Y
: X" U6 W/ l6 ^6 }- dma_addr_t dmaphyssrc1 = 0;! ~% Z1 b$ i5 P& y# T0 t
- dma_addr_t dmaphyssrc2 = 0;
0 M8 c/ q( a5 N+ Z, ` - dma_addr_t dmaphysdest1 = 0;4 ~* U+ f# c9 w, {6 w- G
- dma_addr_t dmaphysdest2 = 0;! K* f9 C1 y0 y
" i f0 U' ^: \8 t- char *dmabufsrc1 = NULL;
?; R" u3 J; i! B1 }) A! R - char *dmabufsrc2 = NULL;+ A& N( p3 J/ p) z& y0 V. [) N1 [$ ]
- char *dmabufdest1 = NULL;) \" o; x) O2 _% c& E
- char *dmabufdest2 = NULL;1 ?: S2 M! v# G% u3 [3 y# v
; s2 I) N f4 I0 Z) R7 t- static int acnt = 512;
% w' ~1 R$ k3 \* ?8 C8 z - static int bcnt = 8;
6 L f' L0 a' K# J' t, k7 ?) \8 w - static int ccnt = 8;) C* J" |& v. K* U) S$ D9 V. K
- ; u( L. W" n% }( V. h) S# {
- module_param(acnt, int, S_IRUGO);
/ m$ c- O! L: o- ? - module_param(bcnt, int, S_IRUGO);' U9 K8 O' c- I3 ~4 ]
- module_param(ccnt, int, S_IRUGO);
复制代码 ! J, l$ ^3 g' o
9 F- Z9 p. Y7 ], E# ] 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ g) Q) p! P% A0 r9 m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* ~' b( g# H2 }4 l* @) R& e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 ?3 c& ~( M ?$ _" Y$ _ Q; ^
) y6 N1 z- }, @1 }3 l! e# V; I
2 [: q, f1 c D' K( l& g |
|