|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # G! R- Y0 h6 L: U: o
- [code]EDMA sample test application
+ y7 K; a4 d u6 B" U - /*
# f, n- [, B0 D5 e3 c - * edma_test.c/ L- b- {. V0 E: t* i: B
- *
; z7 {# \) b' t. f. K7 T, W - * brief EDMA3 Test Application
9 w# r+ V8 f: U+ Q - *( L' d2 ?3 d4 R3 e" i( f5 w
- * This file contains EDMA3 Test code.
2 Z1 G2 b, t. J' \6 J - *$ u3 l4 ^- R0 ^9 U. ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* a- V. u; Z' x7 \
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, z1 q/ e& A4 x4 ?! {- S3 G9 u
- * TO CHANGE.
- G+ D% ~6 m: e$ D8 B1 ^0 Z( j( `* n - *
$ D5 C5 N0 Z& X) h7 L! u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% W! }4 B, Z7 U0 r; U# Q8 s7 k; S - *
! m$ }5 x9 ]& D* O) R7 R - * This program is free software; you can redistribute it and/or" o) d2 o: n( M1 {
- * modify it under the terms of the GNU General Public License as
6 e: y" v3 O. r9 U - * published by the Free Software Foundation version 2.2 X6 r9 B, }/ ^9 I' i8 K
- *
6 ^. [1 K+ ^2 Z' @! {3 ^. Q# r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 x4 J% V+ r% f$ J$ y7 g, ]7 N - * kind, whether express or implied; without even the implied warranty* f0 R- k- P7 O2 q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 S5 R. {/ {8 [. u
- * GNU General Public License for more details.
( ?4 x N; ]9 h - */
* n, {- o' H0 ]" ?2 e( u1 O4 D- s& n
! A7 r: {1 K6 \& X) f- y- #include <linux/module.h>$ o+ j H4 U( j4 c
- #include <linux/init.h>
4 {: n: E; }2 I* I. F. s& E1 e - #include <linux/errno.h>" f7 ?( y$ O& B) a
- #include <linux/types.h> m5 O v* K- A/ s
- #include <linux/interrupt.h> o/ I: ?' i" Y4 F; G
- #include <asm/io.h>
4 W) z' d) u" S p3 s - #include <linux/moduleparam.h>% [ D& R+ J# ~3 }
- #include <linux/sysctl.h>
) p0 j) u' J8 X: U& G* R: b/ {) n - #include <linux/mm.h>
! ~$ p( v" [: q - #include <linux/dma-mapping.h>
' Z5 U# O% `5 m# m& b' @ - . b5 n$ }; n$ Z% E1 C2 y
- #include <mach/memory.h>
4 ~2 ^$ a( T' Q/ P - #include <mach/hardware.h>6 _5 B7 C, ~4 _& w+ s" ~
- #include <mach/irqs.h>
2 I+ F g, e; C x' S - #include <asm/hardware/edma.h>
5 L2 j* v. C: W! X3 ^' |8 z/ V( e, u1 A - 7 ?: L9 ]. X% X0 W
- #undef EDMA3_DEBUG
* x9 n8 O1 K! i% x& K - /*#define EDMA3_DEBUG*/
8 y9 @& I x9 L. K& B0 ~: D - ) c, H+ I7 I/ _0 y4 [5 n
- #ifdef EDMA3_DEBUG
1 u" h% r" Q/ O - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( v4 Y0 m1 B7 E* _0 B* s; v& S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 W. a( r& {* K - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ v z# c( S5 s7 Q- r$ g: j8 R
- #else
$ |0 o/ r* i8 ]8 h5 a P - #define DMA_PRINTK( x... )
/ N& }) z. {3 m+ w, E3 N- ? - #define DMA_FN_IN* w6 P5 \, t n8 n- Z6 j
- #define DMA_FN_OUT* U2 ~4 m1 P% y% ^( `: ^
- #endif2 R: y& o# M. [# U a
2 j1 L# F, y; G3 B4 V- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! d- ?& N: P) A: K: o - #define STATIC_SHIFT 3
, ~* I* {/ k% f" Q( X. h1 ^7 ~ - #define TCINTEN_SHIFT 20
* J/ e& B) t2 I! x7 V. c& @) ` - #define ITCINTEN_SHIFT 21
I% J! i7 i" Q1 M - #define TCCHEN_SHIFT 22
; o2 l- O7 O* b - #define ITCCHEN_SHIFT 23$ v# }0 T& F; g, Y+ H. L
- : Y" [1 [2 I$ {! z: _1 t
- static volatile int irqraised1 = 0;
1 Q% m1 a8 U; E2 R - static volatile int irqraised2 = 0;4 g: m2 w7 f/ y
- . E& j2 R% j% C8 i, E* x
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 g1 \3 `# A6 r' F) n - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! `! a! `/ _; {, M4 ?! @' T0 [# P
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 ^' S) j/ `% q! v - ( q2 O: {6 |. ]* s+ H: o' A9 v
- dma_addr_t dmaphyssrc1 = 0;* R3 Y" D& Z; A1 `
- dma_addr_t dmaphyssrc2 = 0;
5 }" D$ [) v5 r0 y - dma_addr_t dmaphysdest1 = 0;
# x6 E2 Q( w' |7 i' A7 [ - dma_addr_t dmaphysdest2 = 0;0 C4 ?) c; A" ?& X
1 r- N/ D+ J; X* f- char *dmabufsrc1 = NULL;
6 r7 N2 X$ N1 m T/ Q - char *dmabufsrc2 = NULL;% o5 q& V; ]: A9 h3 x
- char *dmabufdest1 = NULL;2 j/ Q0 u \6 b3 _2 Y
- char *dmabufdest2 = NULL;
1 G" J3 j* L! C4 ]" w y - @6 n I9 b/ _* P6 v0 P4 [4 q
- static int acnt = 512;/ w2 S. n" T9 f- ~
- static int bcnt = 8; W' K9 W! i$ q# J
- static int ccnt = 8;
) r0 e- ?9 S8 b5 x R3 P
+ [# h4 x$ p, x- module_param(acnt, int, S_IRUGO);
7 T# P( F8 e% @5 r' { - module_param(bcnt, int, S_IRUGO);
4 v( i2 c3 F( x0 ^! S - module_param(ccnt, int, S_IRUGO);
复制代码
/ M5 o1 g2 }- \7 G1 F \+ @
: p1 L" q+ L" M2 q& g- y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 Z; Q3 c& ]9 J$ R( x' V7 P$ [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# d+ e) o+ F8 x
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ L* _6 I( t0 K4 g( A g0 n1 `
n M& v6 q5 ^" A7 d( ~8 v9 U/ F+ C; @" i& v. R
|
|