|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 K* I y& h% `5 f/ N- [code]EDMA sample test application2 c' \- A$ y8 h1 p4 M, `. `# R5 t% G4 U: {
- /*
' C [6 \% j& T0 V - * edma_test.c
- d1 `4 U2 {; M - *
W" a- c: H, |# E/ z: J0 C - * brief EDMA3 Test Application3 r7 @# |- p9 B* D2 e
- *
8 ` t0 c2 H/ o, F& x; } - * This file contains EDMA3 Test code.9 ]4 f f: A9 w+ X. W& ?
- *
. E2 N0 H9 U U - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: t! N# z9 U! @9 p7 z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 a+ P3 c! v5 M& T* }( V( S
- * TO CHANGE.1 y* A ]) b0 w: A8 P* _7 }6 f. [
- *; i8 p) j6 o- I3 N/ @( K# |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& E1 c/ ]+ P; F. Y: W5 Y& J# x
- *
: v% x3 m/ `7 O( d+ X$ F - * This program is free software; you can redistribute it and/or
0 Q, i+ [% m. j7 h - * modify it under the terms of the GNU General Public License as
% m/ r6 P! a" p% R' `0 H/ E - * published by the Free Software Foundation version 2.: |* X# z+ C J) }& v: t3 E
- *
! C7 @0 Y# c5 @0 U4 H! F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 l! q# H( S1 J8 d/ w0 A' G - * kind, whether express or implied; without even the implied warranty" ?& G$ X3 F2 m5 t) v: ^+ x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 A9 H' ` J& a3 G9 ?
- * GNU General Public License for more details.! h4 z- b' |7 p# F; Z
- */6 Q K; ?& t" `8 K8 l& J3 q
( j6 N- {8 r( n& k( s+ ?- #include <linux/module.h>; ]6 l+ d9 }3 q% Q& N7 o% k3 b
- #include <linux/init.h>- u( K: ^# h2 d' R A7 j
- #include <linux/errno.h>9 _) I+ R/ O6 L0 ]0 R
- #include <linux/types.h>, q" Q) Y9 t3 u4 L+ M
- #include <linux/interrupt.h>$ f% r0 z/ J$ z3 |' I4 l: l
- #include <asm/io.h>
1 l) f! N1 S5 u# [' K3 } - #include <linux/moduleparam.h>/ f, Z/ f; n4 P0 f7 O
- #include <linux/sysctl.h>
" f5 l5 [! B6 V - #include <linux/mm.h>* S7 g* E5 |" |, ?1 e
- #include <linux/dma-mapping.h>
W. S+ H7 h8 r$ K2 ]8 [2 R
, M& P; o2 t8 Q- #include <mach/memory.h>) d/ @7 `$ U& c6 l: v; W7 x; ^
- #include <mach/hardware.h>$ k3 i" u2 J, x, P; t a
- #include <mach/irqs.h>
3 O6 D% ]. U, ] - #include <asm/hardware/edma.h>
& F) Z. A' B( c
, d/ J% }; N! Q5 V5 e8 [- #undef EDMA3_DEBUG1 |4 \4 L! I' Q4 b; {( m6 ~
- /*#define EDMA3_DEBUG*/
9 E# w. u' m# c
- B6 j4 H; k! F, Z6 M2 ?: a$ `# W- #ifdef EDMA3_DEBUG+ J8 P5 v5 [- B- m: g9 F9 ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 Z! r' R7 P8 Z! j2 l9 W - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: }8 Q2 Z* n( ` W" f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# s- m( X" b2 R6 t ]
- #else F# C7 X- Y: v% x) Y- [0 S& E
- #define DMA_PRINTK( x... )
1 ]/ e- Y; v+ b9 q8 U# ^0 Q$ Z$ T' y( d - #define DMA_FN_IN. M$ D8 G( i7 {, h& i# t
- #define DMA_FN_OUT
4 q7 r' d" z) ~7 \2 K- Q' L6 B" m+ | - #endif( \* @% ^" c+ x& A, z) y
; I& @# H4 \, [) G- #define MAX_DMA_TRANSFER_IN_BYTES (32768); s' g' {2 ]( U. C
- #define STATIC_SHIFT 3
7 u J X g8 Z0 n - #define TCINTEN_SHIFT 205 k/ H3 A2 M+ d& Q: A0 p
- #define ITCINTEN_SHIFT 21
7 l& N) f1 H+ ^4 w5 a* { - #define TCCHEN_SHIFT 22" _4 o. V, m4 ^0 `% d h/ z
- #define ITCCHEN_SHIFT 23! t! L" |; e: a
- , D6 J, I! L: ~
- static volatile int irqraised1 = 0;) p& ]: `, C& d% Y( r' n" \8 J5 X
- static volatile int irqraised2 = 0;) o a& q# _& K* e
C# M& y+ Z$ _! [+ p. R* K: C2 w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 y& h2 I6 P& ? - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, a) I( p8 H6 x% J4 b - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* d# W+ w8 Q- D) I: J7 j: k
- g, H5 ^- _6 l6 Y) E5 x* U0 b
- dma_addr_t dmaphyssrc1 = 0;
- b- E4 q9 A) u$ _6 z2 |0 t) k& t - dma_addr_t dmaphyssrc2 = 0;
: p, p' |& \; P, i8 s - dma_addr_t dmaphysdest1 = 0;+ N( ?! u/ q; M+ T, Y q
- dma_addr_t dmaphysdest2 = 0;0 y) H1 G) ~; H9 j( L
- # b6 { `+ G4 _- g! G
- char *dmabufsrc1 = NULL;
4 g3 f9 s) ~" E7 O3 L- K8 y+ X - char *dmabufsrc2 = NULL;
5 C$ t Q: k( g - char *dmabufdest1 = NULL;' {/ H' J/ N' \. d6 U3 ]
- char *dmabufdest2 = NULL;
8 n1 a, c9 U: r4 I* b, t1 E( Y0 X
: N' s6 `" I- L7 v- X- static int acnt = 512; r ~. B- A( y1 q
- static int bcnt = 8;9 ~6 z0 {/ i, P$ _
- static int ccnt = 8;. o% Q' x# d9 u% L, L# [' U
2 c8 S( J5 ~( V0 ~7 t- module_param(acnt, int, S_IRUGO);: d2 Q4 t/ Q+ n$ e- r m
- module_param(bcnt, int, S_IRUGO);
" j+ Y* `0 A- j& ] - module_param(ccnt, int, S_IRUGO);
复制代码 # a( t# R5 b7 v5 ?) ?( F T
/ Q% S% o/ D1 T- ^$ v! {- B# d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- {9 h4 J7 @: \7 K& P: W/ g/ c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 _7 F& O L& \3 e' r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- g* }, r' ?7 V/ O0 r5 M
% I6 H3 ?% a' v8 P; n; E9 @' ?6 A6 S, T2 x% P3 j
|
|