|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
Q2 M5 n6 j% B0 X8 p- [code]EDMA sample test application( l% Q8 i9 P, B* c, U5 W7 e) v5 i
- /*, ~2 S" G( [0 X, w
- * edma_test.c3 A- [( o9 {! e' Y/ L0 H# ?9 y
- *4 i7 m, o7 ~* ~+ Q3 L7 w0 F
- * brief EDMA3 Test Application7 @, P1 n0 f6 Z" r) U
- *1 v% t: f4 T7 u1 l+ V5 U8 v" d
- * This file contains EDMA3 Test code.
' |7 m; y$ ^" d) t" v - *
: `5 Q3 t$ q- U - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 B- H" E" ^7 w: i$ u" q6 F - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" @8 A& r- V4 ? - * TO CHANGE.3 N) j9 P7 `8 @! h; Q& N3 c
- *, C$ R+ o. f9 i3 s8 I8 D0 {' N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" ~( ~7 U/ v) o2 x d1 z' c
- *1 g4 [4 m6 m8 D9 l" J3 X
- * This program is free software; you can redistribute it and/or" _& u* L, a0 W% U6 L
- * modify it under the terms of the GNU General Public License as
$ _0 W }& x6 V) n# \- ]; v - * published by the Free Software Foundation version 2.
9 E' j; W( c* q3 W: k - *
9 ]4 J) r0 n+ d6 O3 J% [2 s' G5 e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; R- u/ \! Y& n: y
- * kind, whether express or implied; without even the implied warranty
4 j0 J/ @* Q. l: X - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! W& d" f q4 L; o. r' q; ]
- * GNU General Public License for more details., R, x# I x) L3 K! N' H3 |
- */
# F0 Q8 R: }. m, R* _! H7 W
! H& i* H- K W: a+ F# l3 z- #include <linux/module.h>4 r" a; t8 Y! b# M
- #include <linux/init.h>: ~* y+ C& ^) b% _/ V: C
- #include <linux/errno.h>/ N+ s7 ~1 D$ `/ T2 E
- #include <linux/types.h>6 E1 g3 h5 [( a7 ?2 z( ~
- #include <linux/interrupt.h>
+ }4 }* g1 \, y3 z - #include <asm/io.h>
. x: Q' b, }0 {: T! Q# _( x - #include <linux/moduleparam.h>; C) z- `" `" f' x4 B
- #include <linux/sysctl.h>
* r2 q9 |$ h( S- ^' Q$ h - #include <linux/mm.h>8 K: M/ V: _6 h+ y& ]0 l( f5 ~# x
- #include <linux/dma-mapping.h>. K# q- r/ \4 S; n8 r$ r
- , G E0 k$ ]0 }+ Z3 j! u
- #include <mach/memory.h>
X! p0 k) l& o: K. \( ? - #include <mach/hardware.h>0 w6 L. {6 I0 e% K/ I, \
- #include <mach/irqs.h>
% [1 D, [) W; \( g2 T - #include <asm/hardware/edma.h>
- [0 z# W* K6 p; G, z% j$ ` - $ a5 G' J# _" g! W1 I1 O; s1 _
- #undef EDMA3_DEBUG
, e, c( K, Q3 h6 s. A; F( i - /*#define EDMA3_DEBUG*/ k8 H; R0 J/ p- i
- 8 v( [/ v/ V. y
- #ifdef EDMA3_DEBUG
% n4 Q& D( v; q4 ], G w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: d M6 O& }$ s- I - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). r* J9 B, i9 k, P6 o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, t# M9 y! [' N% R& P: b2 r) ` - #else
. j- n. T% @: T! j8 y - #define DMA_PRINTK( x... ) z/ J2 y+ n. E) X* q
- #define DMA_FN_IN0 y$ C* {4 P j3 x0 m0 t4 U# r4 M
- #define DMA_FN_OUT
, `; M! ?8 W& b- p' ^! P - #endif; n9 H& M0 M) d& R; K
5 r' d) p$ c# w$ ?7 l- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* u" T: E1 |; J7 @& Q$ r$ N
- #define STATIC_SHIFT 3
4 q9 W" Q. k/ Q# s3 Q5 a& J% y - #define TCINTEN_SHIFT 20
7 H0 [* X/ y% c! k, L* { - #define ITCINTEN_SHIFT 21+ H% J+ E( W1 V3 b z! l" s' `
- #define TCCHEN_SHIFT 22! n2 e7 H: y6 M6 y3 b
- #define ITCCHEN_SHIFT 23
" U( _9 a8 N( [: F3 d3 K2 q - / ]" G$ m3 ]: ?% ]+ i# h
- static volatile int irqraised1 = 0;- h5 H/ C/ g2 `- Q7 h
- static volatile int irqraised2 = 0;
) w7 t+ o' ^" T$ y - $ T5 g7 b7 a$ L/ @
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 X( y5 M3 l: x1 Q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" y: C8 |, t+ ~# F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. b( @) A4 v7 a7 g2 v; u! M }- ^! J - ' j6 s2 B' o" L
- dma_addr_t dmaphyssrc1 = 0;
2 `6 j9 r+ T$ f1 ]: g% l - dma_addr_t dmaphyssrc2 = 0;) ^! S6 B4 X) O5 p0 `) v
- dma_addr_t dmaphysdest1 = 0; d7 R# }4 }) \- t
- dma_addr_t dmaphysdest2 = 0;
# Y% p4 s# r8 ^# I) j# k& Y7 J
% `) c( q6 M m- char *dmabufsrc1 = NULL;
. g5 \5 o1 X/ o3 E. B `4 J - char *dmabufsrc2 = NULL;
O, ]: G5 p& D# Q+ v6 K; s - char *dmabufdest1 = NULL;
2 |, R* H, ]& U+ B - char *dmabufdest2 = NULL;! Q: |# e T: U' @) _ P3 t7 T1 B
8 a3 c8 u# b" N8 k: F8 c1 ]1 T* ~- static int acnt = 512;# A, t4 G( T+ o' L' @+ o
- static int bcnt = 8;. ?2 P' \. f, o8 I
- static int ccnt = 8;
& ~3 {7 R9 A$ T - ( P4 x4 o& l- V* q/ {: I
- module_param(acnt, int, S_IRUGO);
, J2 `# v. ^! ? - module_param(bcnt, int, S_IRUGO);
" }! N) a h9 e- w$ u. |2 Q' I - module_param(ccnt, int, S_IRUGO);
复制代码
5 `' v; J% E$ o# Q5 H) X/ Z" Y/ D3 { @0 M4 _8 V2 O; y" e
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ h$ s9 F- L+ [* }0 L& {- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! Q5 I& J3 y/ H) i! l, U. W
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 i$ `9 C- D& r1 e% S" L) m* [$ g
% H+ y$ e0 w6 }2 S+ M( ]1 ]3 Z, y# [, b T" m+ h$ k" U6 N
|
|