|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( g( [: s$ r" U0 [
- [code]EDMA sample test application
9 w% O2 E% w4 d' p9 t6 K @* h8 M! a - /*' W1 H: F7 Y; l9 b9 {) y* I ]
- * edma_test.c% {* c: ]; U" V) I
- *
# ~& \$ u: X, C - * brief EDMA3 Test Application# R4 Z m/ i/ l9 L; V; J! `: E ^
- *& D, L8 Q+ T/ j m% \1 |3 V
- * This file contains EDMA3 Test code.3 h3 R6 L1 I1 S" a, ^7 L
- *
' W4 Q2 K W- k5 H, @+ I/ f# l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. h/ `4 h1 d- I0 {. X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 D6 u) f- v+ E/ B, j4 F+ b
- * TO CHANGE.8 K4 S) f+ H* l% O3 o5 Y
- *: g3 r) O7 b4 d+ Q& k+ \
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' ~, K& Q% F! N( }
- *
/ E* i+ R- h6 S$ h9 Q - * This program is free software; you can redistribute it and/or
$ a" d# f' ]- R- I! Z - * modify it under the terms of the GNU General Public License as
9 K% r' y0 H3 m' E - * published by the Free Software Foundation version 2.
! R0 W/ Y5 m; r$ c1 F' Y0 }+ s; c9 } - *
i9 y. {& t% P: X: A( R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( r1 s5 I! C) q. ~: a& L1 E% `
- * kind, whether express or implied; without even the implied warranty
0 P, x, h; g( p- R% o8 l - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 b5 L& S$ O: O! I( e
- * GNU General Public License for more details.
7 f, F H0 E" s/ V - */
1 @9 ~( @$ \ w- e
/ T+ c. a$ k7 N1 B- #include <linux/module.h># u! u2 L- U( _: L
- #include <linux/init.h>
% W- C" A% t; h( r x8 N/ j - #include <linux/errno.h>5 o! D/ m, M( t# O' J0 t$ ^! r7 K
- #include <linux/types.h>0 q- P ^! }6 D' B; u- Q) U
- #include <linux/interrupt.h>. e- G' S& M1 [4 R( @3 u3 U
- #include <asm/io.h># L$ |0 g5 ~, Q5 w
- #include <linux/moduleparam.h>
8 w, i( C, b6 ?( b - #include <linux/sysctl.h>
. N% G2 u v7 W! s - #include <linux/mm.h>) y7 t3 c( t2 W1 L; w a- w7 L
- #include <linux/dma-mapping.h>0 Y; R, P: Z% p2 s5 A
- ! a1 v, }! K/ `! P- o
- #include <mach/memory.h>( Q# q2 I$ g2 K! N
- #include <mach/hardware.h>
- o L5 `* d1 S: R$ O9 V3 w$ Y' d - #include <mach/irqs.h>) _4 d" Y2 P6 o; c
- #include <asm/hardware/edma.h>
) r$ c8 t/ a: g7 G. ]8 y/ @ - & D: @6 H# [) {+ v( s% |; @. L4 \
- #undef EDMA3_DEBUG& V5 Y. L) o+ w$ J& S! o R
- /*#define EDMA3_DEBUG*/
i2 F. P+ p. p) X
4 y/ H& m+ m" A% z% Q- #ifdef EDMA3_DEBUG
7 K* L7 j1 g1 o1 X! `/ P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& Z1 j, E: p: i9 ]. ^. W0 n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( m$ X! [$ H; C9 J) }+ [/ Q6 Y7 e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! p; ?5 B5 I* k! W" V
- #else
' q; C, Y* ~) j - #define DMA_PRINTK( x... )
# I* d. @! g+ i9 o1 ?, T. Q$ Q - #define DMA_FN_IN" x6 n; o- Q+ x$ w9 \" Y, u
- #define DMA_FN_OUT/ I* S5 u! ~8 l8 m) `' {
- #endif6 F- Q: a& Z" O/ G( S! C6 M
- ) s. `& j ^$ k5 X& c' R2 N
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" \, z$ f5 x+ \3 b. g3 |
- #define STATIC_SHIFT 3! g9 c1 T8 q4 q" w/ I
- #define TCINTEN_SHIFT 20
+ c$ K+ h( I' Q6 L# V; W: o - #define ITCINTEN_SHIFT 213 M0 G: L' s2 T; J- r
- #define TCCHEN_SHIFT 225 A+ [/ J, y6 c
- #define ITCCHEN_SHIFT 23$ z' [- D: n2 f0 z8 V
$ m3 H% }9 ]. A: Z- static volatile int irqraised1 = 0;
( K7 H' f$ t# x# }$ M - static volatile int irqraised2 = 0;4 x5 _; V2 E: A/ g& z+ `
+ d% ~* `; o0 K! w t! X- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& ?) h- L1 \+ `3 m# n" w c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 Q8 z- m& L4 L5 l, a5 H0 { - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- m$ O4 ^: ]; f, w* _9 A& d
# q5 e% v: p/ C2 M- dma_addr_t dmaphyssrc1 = 0;
# k$ T! Q+ p' [# K- m5 W - dma_addr_t dmaphyssrc2 = 0;
; C) Y3 d' m" j) p# T: i - dma_addr_t dmaphysdest1 = 0;* A/ l; U5 u" X. \7 R5 a$ f
- dma_addr_t dmaphysdest2 = 0;! [( Y9 b) C+ W1 ]8 {$ I$ a
5 }2 u& C! `* {2 B- char *dmabufsrc1 = NULL;' ^! o+ Q* d9 V4 S' S
- char *dmabufsrc2 = NULL;" L% f6 z8 ?" ?9 z* b: m% S
- char *dmabufdest1 = NULL;
8 s* s) d6 I5 Z: M& Z" z - char *dmabufdest2 = NULL;
. m$ ~" j& B& p3 ~0 F
3 u8 R* v! V+ C8 [& g3 X/ X o- static int acnt = 512;
" _& T: l& X4 ]0 h5 y. G - static int bcnt = 8;
1 J- s1 Q7 [" D$ g# a - static int ccnt = 8;
4 l" |1 S2 P, C
; O- X* j0 N/ C+ u' K. |- module_param(acnt, int, S_IRUGO);
/ m, t. `; `" l3 O - module_param(bcnt, int, S_IRUGO);
/ D4 @: ^$ z$ B" P/ F - module_param(ccnt, int, S_IRUGO);
复制代码
- K+ t% {8 x1 q' u7 m; W
. R8 U9 h3 k" L; m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. O4 {) w# {$ l0 T4 N0 F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 ~, c6 Y$ ?9 @2 P6 O L) Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 f, t6 U5 C: L. a! h1 A/ N
- A$ v! w4 K6 ?6 `! K" s# j, W+ R m% y" @/ Y: z4 { {5 y5 R
|
|