|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' f( T% B- v! w
- [code]EDMA sample test application
A3 a. |) Q& E$ Q2 R - /*' s4 _: M4 d( a1 U! b5 S: v
- * edma_test.c, a) ~$ q* N/ w' E
- *
. L7 i' d) o' M, A - * brief EDMA3 Test Application; Q# j5 ~& ]5 \, a; X v9 {
- *
! ~: { h% g" ?1 L/ G1 p - * This file contains EDMA3 Test code.
+ }. z% }! ?& F. N6 e: J - *
: v& P4 P# i) f, \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- g, i" X+ j" P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, Y& J' v2 U5 e# E8 V. J6 v5 H& \
- * TO CHANGE., Y+ x- j$ b$ L6 p D; s
- *; k: f$ G! z- Q6 T0 Q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# l) W0 j" b+ N! \/ a
- *
, f1 v& P5 s+ V% }( t3 c+ ^5 X - * This program is free software; you can redistribute it and/or$ E8 u, H8 ~. S" b) x
- * modify it under the terms of the GNU General Public License as8 s) K$ M2 g( `# Z8 c6 T8 F9 _
- * published by the Free Software Foundation version 2.
; B* o- Y* i4 m& M) c& R7 M - *
2 E7 ]% X% f3 b0 {$ l, _5 J - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* k$ n) {& Q5 @ - * kind, whether express or implied; without even the implied warranty
% S( f+ |' O! T0 t& O - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. w( L2 n3 R. C4 O0 L - * GNU General Public License for more details./ I1 T0 ~7 ]3 `
- */
2 F5 T% S' v# o* A3 U) i - % m) W# O( u, |; T
- #include <linux/module.h>; \# Z( `3 H1 a6 H8 H
- #include <linux/init.h>
" |9 N; x4 O7 U - #include <linux/errno.h>, V3 N6 [( a9 n' ~
- #include <linux/types.h>7 H: Z0 [+ O$ X! Y
- #include <linux/interrupt.h>
) O, |9 x' ~! k) E/ M7 f% f0 ]# b: H - #include <asm/io.h>
* l0 z& `# \/ F9 Y# I( `) S8 R - #include <linux/moduleparam.h>
6 ?4 X3 w, C# J& l - #include <linux/sysctl.h>6 [( C8 A. V, j! N4 Z& M
- #include <linux/mm.h>
$ @/ p* ]* Y5 P2 c - #include <linux/dma-mapping.h>
& q# d( _: J9 J. e7 A5 | - 2 l' y. ^' p, f" Y4 a) @
- #include <mach/memory.h>
0 Z2 X& N# j; ? - #include <mach/hardware.h>
. Q# I3 d1 U9 T( Q9 @: T - #include <mach/irqs.h>3 s! X( A8 H- \3 s, B$ P
- #include <asm/hardware/edma.h>
) y- S/ @3 K0 b( | S# S
. P) p* K/ C( M- #undef EDMA3_DEBUG+ v- `8 n: x+ Z( s2 t v) E! @
- /*#define EDMA3_DEBUG*/
$ P& D# E% n7 l, W
, F6 i8 N8 J9 a' ]- #ifdef EDMA3_DEBUG+ ?" R/ H' b# M7 x
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! n6 j# R4 c1 L0 r2 Z) l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 U% _, I+ q! D9 L) l- Z6 |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 q0 Y. k' e0 ^ - #else* ^. |2 `: a1 |: c! ] m; x
- #define DMA_PRINTK( x... )
e8 n/ \8 x4 P - #define DMA_FN_IN3 |/ b0 D$ x& H- B/ j! B
- #define DMA_FN_OUT7 x9 f6 p* k' p d2 j9 u
- #endif
/ b$ q7 t$ h( M. s4 o
/ b, V8 d' V- }* N. ?' T. L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& m4 I m: D- ?( L: C5 P' b& t
- #define STATIC_SHIFT 3
% i$ Z+ W: L# r, D - #define TCINTEN_SHIFT 20
2 g3 B8 O4 }0 {5 J - #define ITCINTEN_SHIFT 21
9 f% L1 d/ f; L - #define TCCHEN_SHIFT 22
$ }) W4 {( H5 {: O$ M/ G! p. m - #define ITCCHEN_SHIFT 231 Z3 E+ i" {. f
z$ H5 Y4 X$ z' I0 H0 E( A9 y: ^, D- static volatile int irqraised1 = 0;
- f. ?/ d% V/ d- M3 |# J& i+ n, a - static volatile int irqraised2 = 0;
# q) S8 _3 v! D7 o1 [" a" P$ Y
: m' i+ }8 l) J4 J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. g# k/ `& _7 \. A$ H
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) n) Z2 s& V3 k7 L2 t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% ^- p! }" _; F' c
' v5 ]* y0 }; F% a& T$ Z- dma_addr_t dmaphyssrc1 = 0;& e+ S& B" ^4 R, b% H
- dma_addr_t dmaphyssrc2 = 0;/ R0 P& A3 v7 O$ I e& p
- dma_addr_t dmaphysdest1 = 0;8 L* O I6 u T* n* f: o9 e
- dma_addr_t dmaphysdest2 = 0;, ?" Z: O% f' t; ^: A
- % K/ O& J2 R+ e/ r
- char *dmabufsrc1 = NULL;% v9 x! N( p7 T
- char *dmabufsrc2 = NULL;( d% ?/ U* |" @% }
- char *dmabufdest1 = NULL;: v# k2 I/ @5 ?* _# b1 C5 g
- char *dmabufdest2 = NULL;
/ Q* G j. @, f1 u( G+ O; h/ s
" @& p9 L1 q7 B: N- static int acnt = 512;) ?# n5 r4 p+ k- ?8 z' Z/ c
- static int bcnt = 8;
2 }" E' h% x# i0 k. l7 G# I1 L3 | - static int ccnt = 8;
/ o, T1 q8 A q" \/ @( q# z3 F - . c2 c" e, G% H6 m; N
- module_param(acnt, int, S_IRUGO);* s, v# }( [" y# x8 ~* H x- m
- module_param(bcnt, int, S_IRUGO);
2 [0 Q" U: X" q( c/ s - module_param(ccnt, int, S_IRUGO);
复制代码
, e. b, h' z3 O# K" v
6 b' f* [: B0 f; c0 [0 s! F3 G) \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ l a9 c' S% [# }8 [/ l9 narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 k6 T/ C+ R+ e' \* M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ A2 _* p) v4 ^8 |) I& r( x4 L6 O/ y- q/ }; J) N
' N% K' L$ c* O* I |
|