|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* q9 F J" P/ l6 B$ K: [- [code]EDMA sample test application
; x/ n( t0 o5 S0 v3 k - /*0 y7 M% {, {9 t! o9 i" F' e* H. D
- * edma_test.c9 v9 _0 {, a- K& J
- *
& t: ]% R! t( n4 t8 [ - * brief EDMA3 Test Application+ ] g( n+ _+ P \
- *, V' {6 j0 c4 W# r
- * This file contains EDMA3 Test code.
, e, _- i% i+ z* Y7 v) J! _ - *# ~* z% ^- ^* ~4 o+ f7 S8 G1 E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) _. W6 s5 E# Y1 R, W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ g# I4 y0 U) R8 p c, |' [ - * TO CHANGE.
2 ^- y* }5 {/ |/ g$ |$ Q4 I8 O0 }- g - *4 }2 K F) ` g3 Z: X* w0 C/ F& r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ N6 l9 ^* H; S
- *
$ A3 b7 p7 u9 j. ?- u) \ - * This program is free software; you can redistribute it and/or# G2 s$ l0 Z5 f3 g& }# H
- * modify it under the terms of the GNU General Public License as$ }8 x% T& r) k$ Q; d5 t% Q& w
- * published by the Free Software Foundation version 2.
7 @8 R( H# ]- d. i z+ Y# ` - *
8 B! Z& g: b# Q3 o& R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- B. n6 d. f# t* O7 C$ M
- * kind, whether express or implied; without even the implied warranty
* O N- O+ O7 \) F8 P! t# s, w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ @* M/ t1 U% G - * GNU General Public License for more details.
2 _9 M$ H1 Q/ m - */7 f. b7 w5 V' V+ f" r! R
' L( E& V- r9 |% A- #include <linux/module.h>0 R/ p) k0 b% y! q8 n Z
- #include <linux/init.h>1 Q3 V5 M0 B" f
- #include <linux/errno.h>3 j2 R2 N/ c/ P
- #include <linux/types.h>' M( g3 u' C( ?
- #include <linux/interrupt.h>% ~' n9 Q* Z, w+ L! V K
- #include <asm/io.h>
; h5 m2 M) J7 Z, |. j" J$ H - #include <linux/moduleparam.h>
" g* D8 f% K8 ^" m - #include <linux/sysctl.h>
# A& c5 }, Y. O5 I: O+ p( ^# @ - #include <linux/mm.h>6 ?& r8 N u. Q& J% s
- #include <linux/dma-mapping.h>
4 X! C0 Z0 j: a* e, E# G# z5 r - - ]- r) N9 ?4 m6 C9 C6 P
- #include <mach/memory.h>
: J" }9 J, t# _ - #include <mach/hardware.h>: c1 |3 ?+ \! }0 ?0 j) ?: _7 _6 ?
- #include <mach/irqs.h>
# F% {. q7 T0 \4 e7 f - #include <asm/hardware/edma.h>$ D1 B7 l2 p* D( N% h/ W7 a
- ( r: d9 x6 f7 ]* a5 L& ^* _1 X0 t
- #undef EDMA3_DEBUG
2 g) V6 z9 x$ a, g! Q - /*#define EDMA3_DEBUG*/4 W/ ?( M" Y1 o, r( _
5 y6 b1 ]: n0 Q1 U& a+ F/ E- #ifdef EDMA3_DEBUG8 h( b- ~/ L: l. K3 D& |4 [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- N$ G( d% E1 p; A# o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) e" b8 n" q: Z; r8 t4 A; C T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 s3 v- M4 `& W/ ~5 M) } |4 p - #else9 T0 U# O0 q; t% T
- #define DMA_PRINTK( x... )
2 y6 I6 u/ }/ K/ \ - #define DMA_FN_IN
7 p1 U E" C: R( B7 Y! } - #define DMA_FN_OUT1 Y/ S0 T% S$ {& @& \. N
- #endif6 p) I% J, D. E: H
- ~1 r& M, h4 ]" F" X2 J) A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ E+ D& R3 @6 [# b: c6 w: H" J - #define STATIC_SHIFT 3) S2 S: L; o( r1 K1 |( K* z
- #define TCINTEN_SHIFT 20
; ?8 y+ o# v5 V7 A f6 i3 t" H; e - #define ITCINTEN_SHIFT 214 k8 P6 i- P7 P' N5 a, x( H3 i
- #define TCCHEN_SHIFT 228 E9 p$ K( L0 v8 z; t Y
- #define ITCCHEN_SHIFT 23
' _& y4 a0 b7 _" M I4 T. [ - ! F: Z u0 K) o7 C% l2 `
- static volatile int irqraised1 = 0;
. n0 H& n) m+ c- A S, I) [5 w1 { - static volatile int irqraised2 = 0;
5 B( B3 t1 V6 y% a0 @3 r* ~
6 R: P' a T: s, P( p1 V8 V- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ X: T0 e2 m9 ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: D" g9 U+ `. s$ n: t- y0 D) ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& O( }6 u- i6 v6 Q
) ^' E3 r2 F6 P; P3 H* |) Y- dma_addr_t dmaphyssrc1 = 0;
3 F, H8 d) G/ P) G- u - dma_addr_t dmaphyssrc2 = 0;$ J8 \/ F {4 l0 h3 s9 ?* `4 e
- dma_addr_t dmaphysdest1 = 0;; X z0 w# O1 z( t% x5 v$ U
- dma_addr_t dmaphysdest2 = 0;9 c: k( T2 F, T/ J" g. ]$ y- U5 ^
- $ q. ]6 }7 \5 A: Y1 i9 O* R3 B/ Y/ i
- char *dmabufsrc1 = NULL;7 [3 s+ r8 m- _4 g: t
- char *dmabufsrc2 = NULL;8 [# g4 M/ V0 R4 n! y: F9 [; g( ]
- char *dmabufdest1 = NULL;/ k* s0 j+ K6 L6 s: j6 F
- char *dmabufdest2 = NULL;6 d6 C( B' x- N6 ]3 P' B- M
: ]7 T$ V) j% G/ l- static int acnt = 512;* m5 Z8 j/ O& d6 f) y2 @
- static int bcnt = 8;0 I4 A: w) g- B4 ~/ u
- static int ccnt = 8;! ?" P1 Y! o0 v% n
" ^. E `, {: Q- module_param(acnt, int, S_IRUGO);3 e: d- F4 |$ [7 _: H+ d0 }4 k
- module_param(bcnt, int, S_IRUGO);
, T! ?8 o" q0 I, G$ p) T; Z; s - module_param(ccnt, int, S_IRUGO);
复制代码 3 l8 j( p& P% E I; a
9 A0 z3 m# |! F& l4 T9 X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; u; d& D, O; H2 C1 D5 [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 i9 W- |9 J( T; _# D
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" }/ C8 k/ V# ~; n
" y! @+ d7 G f& j+ k; j+ `
1 t3 h2 ? t) O, y |
|