|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - ^% g8 n" Y/ X3 o/ F* X3 d
- [code]EDMA sample test application) x2 s+ c- G# J
- /*
. K/ ]: D: F; c0 i: h* @' G - * edma_test.c
. M8 Z! H3 b+ C. m: [( T7 t( L/ L - ** A6 |; q: J1 S. z3 f0 z' L2 g
- * brief EDMA3 Test Application/ v' u0 T8 P% b. D7 ~( y) u
- *
. v. V% X4 c( k, {8 D - * This file contains EDMA3 Test code.: ]! a% F, _% w( m# N
- *- h* f8 C6 C3 a1 Q7 p5 \ j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ u- Q8 ]' X2 P: @% h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 x8 q2 A# ]& ]8 i' k! y, x
- * TO CHANGE. e; t' g7 a8 P9 H) g
- *
% C/ V# P3 f9 G, K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 I" M$ r6 e4 Z- E9 l
- */ Y ^9 L2 @9 q
- * This program is free software; you can redistribute it and/or
1 M# f2 ~ r0 p" V; T( {, [ - * modify it under the terms of the GNU General Public License as( h- o9 S5 u/ h% y! B$ g
- * published by the Free Software Foundation version 2.
$ b. l% B$ m0 ?, q% p# c# h - *+ z, \7 X- w# q- Y5 M$ _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 ]1 q' M1 {+ E% D
- * kind, whether express or implied; without even the implied warranty' Y7 \. { h! y, |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 n% a* P- @, O$ O
- * GNU General Public License for more details.1 Z$ c: a# N: }# o3 Q- J
- */
f$ E5 I9 Y% K3 N' i+ ^ - ! ~5 N C& M$ b
- #include <linux/module.h>1 ?& v0 J/ x( {1 b
- #include <linux/init.h>1 a1 }3 Z6 [/ A: _% z/ V& A/ k
- #include <linux/errno.h>0 r& m9 R; Z6 B9 t. g* f1 @
- #include <linux/types.h>% H) l8 y( _8 b1 r! p
- #include <linux/interrupt.h>
4 F# P% w! a% ^4 I0 T - #include <asm/io.h>2 G; U& R; y* Y2 {
- #include <linux/moduleparam.h>3 ~: H7 q& ~0 r* s+ Z- i% D
- #include <linux/sysctl.h>. Y$ g9 S2 N% t
- #include <linux/mm.h>
; ?) v# p0 p" [; n# u3 a, n - #include <linux/dma-mapping.h># V4 H# \! W. H/ G( q1 m
' H9 p/ \/ G N" J8 X+ K7 M. a% z1 e- #include <mach/memory.h>
3 N6 b3 L: } J- R5 c - #include <mach/hardware.h>
1 R2 S7 y$ ^3 g" r" I1 H - #include <mach/irqs.h>
$ W+ _7 J/ f0 J5 x - #include <asm/hardware/edma.h>
, Y, ?. Z2 S7 s& h - 5 X8 I* @) n& x# z9 E: ?( y
- #undef EDMA3_DEBUG1 R, H% ?) ~, ?+ K! X8 B
- /*#define EDMA3_DEBUG*/1 ^* i; j2 d( i( c; X* t; L& z
3 m2 s7 T/ r% S/ _5 H- #ifdef EDMA3_DEBUG
% L2 O5 B6 i6 R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, K7 `1 w6 A# U; M: B* [. [1 [ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 T) |' S% U% }' b' U9 W% S% q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- _3 o; u5 W. [% w - #else
. k: F& Q8 _) t; ]% n! S - #define DMA_PRINTK( x... )
9 a7 z8 I* x: H% h - #define DMA_FN_IN& Z* b, V1 j+ r! ]0 T6 @
- #define DMA_FN_OUT
. _! X! Q5 y& x+ y - #endif9 n/ ?+ K1 f! Q+ [: d5 s5 F
: o8 K9 u: B+ K6 p0 ]) d) _* O- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 |8 W9 l) u" A+ t6 o- ]
- #define STATIC_SHIFT 3
6 `1 L, A* q" P& m* ?: N+ K5 J9 Z - #define TCINTEN_SHIFT 20: Z o9 D5 U9 u. m* `
- #define ITCINTEN_SHIFT 21' c* a) f) j c& K6 b. i# j9 T
- #define TCCHEN_SHIFT 22
& J$ C5 ^9 I) e! H. [( k - #define ITCCHEN_SHIFT 23
( n! q6 [% x5 L6 e7 |
1 l- s6 \4 V; v8 j* f5 Y- static volatile int irqraised1 = 0;
* e+ ~+ r/ J, a) o0 k4 J; d - static volatile int irqraised2 = 0;
* d$ Y* I: p+ q; {& X7 s9 }
. F( [0 B! L6 |- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 r% O0 l4 |5 _0 I
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 u4 I; d) g2 V" N6 n. ~" J6 w) L9 ~ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% G. w( a& W }" Z: c
- 0 `; v3 H8 T( P3 L/ C( Z
- dma_addr_t dmaphyssrc1 = 0;4 Q2 W; A' ]6 |1 d- ~
- dma_addr_t dmaphyssrc2 = 0;% c% s4 q5 R9 m& D9 P8 H, u
- dma_addr_t dmaphysdest1 = 0;6 q: l7 q V; A$ x$ S) l" a* y
- dma_addr_t dmaphysdest2 = 0;' W6 @+ y0 W& \7 T
- 4 T4 Q- t& |2 A$ t5 f3 J8 U" r% |
- char *dmabufsrc1 = NULL;4 C2 l3 E/ f+ U, A
- char *dmabufsrc2 = NULL;, }7 F H: ^4 Z
- char *dmabufdest1 = NULL;
5 L4 _0 t. `; D$ `7 r, M1 |9 D - char *dmabufdest2 = NULL;
& e3 T+ c0 s" ]- F, C+ \ B
$ @3 a3 m( m) @8 b& o# ^- static int acnt = 512;# g7 Z5 w6 N; H k; G+ s
- static int bcnt = 8; i& P* C; @0 J. f5 q, y
- static int ccnt = 8;1 |* X- V; E. }8 ^2 v% i4 S" M
7 J9 C4 @5 m* S( `# L) ?- module_param(acnt, int, S_IRUGO);9 t4 ]5 z: d0 h( s4 R) C
- module_param(bcnt, int, S_IRUGO);
* ^: x7 m% [, i; o' A) k# r - module_param(ccnt, int, S_IRUGO);
复制代码
5 n' T& U1 I/ G& i! W9 S$ s, W6 T2 A
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 U/ \3 M4 a7 K! b! m; i! D$ z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ `- v9 J2 n7 T
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# _! |3 l# J4 P/ V5 X4 {" E- W1 ?$ D; b# ]- F
- M4 y+ X+ b* f0 C) h |
|