|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 F# r: s/ y7 a* ~7 W
- [code]EDMA sample test application4 Y5 l/ e8 p) {
- /*5 k2 E: R$ u1 e* N) N7 q6 n
- * edma_test.c3 R: f5 j" \; ]+ ?! s% G a
- *1 o4 ~/ I6 A2 b e4 N+ e
- * brief EDMA3 Test Application, K) A0 u" t% e
- *
, O+ C. T8 Z$ R3 M' I. ~ - * This file contains EDMA3 Test code.8 M$ L( r- R& Q" m
- *
+ I! ~ B% `4 M1 { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) m; v) V" w5 C5 b. b0 K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# j8 i" Z# L3 u p4 N - * TO CHANGE.
: a8 S7 V! F ~* F5 Y9 } - *
$ g3 N, W8 i U& |, k - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 D8 p3 w+ s8 p' w
- *
3 ^$ t" g; ~% f; [ - * This program is free software; you can redistribute it and/or
- n3 {$ x1 q" | @& |4 U2 t - * modify it under the terms of the GNU General Public License as. L2 @5 Z6 f* n# C$ b
- * published by the Free Software Foundation version 2.# j: o/ A3 D) ]9 j& K; F
- *6 B$ Q2 V7 _3 P" u o
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) F7 e; q8 s# T% e9 m - * kind, whether express or implied; without even the implied warranty' Q5 {& I0 _0 u1 l3 h" v* N
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 @4 p6 v) Z* h3 [; {2 l& I - * GNU General Public License for more details.! f* \1 G p; A9 D, Y- o6 C
- */4 E9 i9 C) i* S# l' \+ a
! w4 y" j- f/ N7 W% K- #include <linux/module.h>
5 O0 w; V& C5 `4 c: n8 ^/ l - #include <linux/init.h>
9 s% T' p- a) M - #include <linux/errno.h> e: j* r/ f0 ?" q5 Q) s% Q" a
- #include <linux/types.h>
( k$ g7 o/ i2 V: h - #include <linux/interrupt.h>
7 C+ A# w, p6 w, _$ G0 N - #include <asm/io.h>
2 ^4 P; ^- ^% \; G8 ~ p# l - #include <linux/moduleparam.h>* s0 ^, B+ s5 }- F/ X
- #include <linux/sysctl.h>
& W' U$ d8 E% g' s2 |+ Z" m$ q% J - #include <linux/mm.h>5 v7 R: m8 [, u5 |* k% ~
- #include <linux/dma-mapping.h>
, x+ X, I ]# {: N( Z2 L6 Z - + O, E m- R, D
- #include <mach/memory.h>
! S4 T: m E( X' q - #include <mach/hardware.h>( d, K( _! a1 c" S. A( ^" k, g
- #include <mach/irqs.h>
! R& L, p7 r! P! d4 @0 z- U' T - #include <asm/hardware/edma.h>
2 T1 e) @9 h8 E7 F0 u - ' _* d9 v* X: f6 R. }1 e2 r% W
- #undef EDMA3_DEBUG1 G7 Z n0 [6 r0 m$ k0 `
- /*#define EDMA3_DEBUG*/% ^8 U9 F! W% n* q
- 2 J* X# W( ]% g5 y2 m
- #ifdef EDMA3_DEBUG& N# Y- }) V3 K! x
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! _6 f+ g( z& m- o8 {& E
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ b& u) P7 r: \2 ~, Q% h; q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' ^" r* E. e# s" j- k' Z9 i- f3 ] E - #else) l+ @# r1 V+ J; B3 w
- #define DMA_PRINTK( x... )
6 a6 S( W7 [( z' \# z3 O - #define DMA_FN_IN
# `+ j3 H1 O, A' M! V8 z0 F# W - #define DMA_FN_OUT1 q2 z7 }' U0 U& m, G. M
- #endif
5 c, E, _) g$ S - - f2 s" g; F% E! z, l! u2 ?
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) {8 ~% ]7 t5 ^8 I9 ~8 \
- #define STATIC_SHIFT 35 w6 S7 n0 L3 A. x+ }
- #define TCINTEN_SHIFT 20
5 c1 v- G3 T) S( y; N8 I' H+ Y+ Y - #define ITCINTEN_SHIFT 217 a3 c# O+ k, s* T* O! r4 d
- #define TCCHEN_SHIFT 22
% c. j+ I, Y# m. i3 j; R - #define ITCCHEN_SHIFT 23
K# Z8 G5 @0 F% k1 s5 c - 9 ]1 R: F7 g' F) ^7 Q ?
- static volatile int irqraised1 = 0;2 x( z, P& H/ `, r) d% {4 y: M+ @
- static volatile int irqraised2 = 0;
3 p v; w0 Z1 F
8 ]; e/ E9 O, s* _, M, }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. v9 c" Z7 \6 ~* E A2 b3 @3 B: s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 O: a: D9 \2 d0 h# W0 R0 Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* m3 {5 u; i" i/ E0 o
8 h, O/ |' O& r. ^: J6 y6 G/ S! ~$ @- dma_addr_t dmaphyssrc1 = 0;
+ {( }3 N0 S, [( _! d$ `0 f - dma_addr_t dmaphyssrc2 = 0;
6 o; g3 N; [! t, i3 h7 Z - dma_addr_t dmaphysdest1 = 0;) H5 Z" I$ c/ Z5 ?' ^
- dma_addr_t dmaphysdest2 = 0;: z* Z1 Z. n9 f
- , z3 ~& ^" m9 Z$ d) P
- char *dmabufsrc1 = NULL;
3 F$ u' \/ l8 n; y* h9 z: F6 f* f - char *dmabufsrc2 = NULL;* _6 ]8 U9 ~: V* X/ D* [. q/ t
- char *dmabufdest1 = NULL;! }, f$ S( @% K, a7 v
- char *dmabufdest2 = NULL;9 ^+ C2 u- _4 C- a. s4 l* `# s% l
- 5 P0 C1 V8 x$ m5 O
- static int acnt = 512;
. Q2 ?! y- g/ t& u! x# G - static int bcnt = 8;7 w6 i0 q# ?9 o
- static int ccnt = 8;
' ~) m0 F* C* R( n
n ]6 I# x0 k4 n- module_param(acnt, int, S_IRUGO);
8 {1 b6 L: y) N# j& G. G - module_param(bcnt, int, S_IRUGO);! T! K, R" D% [
- module_param(ccnt, int, S_IRUGO);
复制代码 # M" R }' Z$ o( B" X& r
. T+ \1 D3 A; [4 `0 r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' u7 n8 e. ^ ]! M' @+ o( ^2 d: J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ n! n7 L1 a/ @% a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) {' M" }" s+ i' i
) `: Q4 n6 F/ Q% I- Z" P/ p5 L4 L2 z9 c
|
|