|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
f8 b1 `+ ?) K! x# ?' z; F- [code]EDMA sample test application
9 C2 w( J! g5 J" v - /** }+ I6 K u8 i5 n
- * edma_test.c
a+ t! W3 B" e: r - *' m3 `0 @5 y3 s
- * brief EDMA3 Test Application
k6 O4 ^2 K N5 i+ J# @ - *
! d2 V5 t" Y- T: T { - * This file contains EDMA3 Test code.7 R" i3 b3 O \, D
- *
* t) T' A" ]( ~2 T# r- F- I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ T. e+ [6 G+ ~" |( G+ m0 H) c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 k' i9 j; G2 h$ f: }2 [ - * TO CHANGE.$ G) K" }3 z& n. G5 R6 b4 Y3 `
- *+ j. U: u5 J0 t3 i( [; {: y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% H; V" x0 I' { - *
1 J" T) E& X! u/ x% w - * This program is free software; you can redistribute it and/or+ H$ n0 i& {6 q: [: R3 \
- * modify it under the terms of the GNU General Public License as
/ y0 b3 x: q0 {" a" A( C - * published by the Free Software Foundation version 2.+ p+ b1 E9 d1 L) l
- *# @7 j7 T7 e9 N9 h1 f. j- A
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! D! l' P# B! }
- * kind, whether express or implied; without even the implied warranty
/ c; v1 e; s1 r( ]" [- `- [ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) \7 V: `' E) \9 g, S0 U" [: @5 X
- * GNU General Public License for more details.
" f) O$ r) r/ Q& f8 b9 ^& j, s - */
8 Q- A7 ~4 e" C4 Q @8 ~ - $ k6 x& q/ T- k+ A
- #include <linux/module.h>7 w' Z' M: h; w# G( z
- #include <linux/init.h>
0 ^! r& {; P) F$ @8 u - #include <linux/errno.h>
7 J2 t/ G0 {) E0 a2 S k8 O/ g - #include <linux/types.h>
6 _9 m6 J: X# d0 @' _0 x s. J9 u - #include <linux/interrupt.h>$ V: e" L' J/ J2 ~
- #include <asm/io.h>
3 _0 x+ H& p. a6 M+ F - #include <linux/moduleparam.h>
0 c6 f! }- M0 q. ? - #include <linux/sysctl.h>% q; c. o @0 W
- #include <linux/mm.h>0 U$ v$ C% }4 c7 d3 g: w
- #include <linux/dma-mapping.h>
$ s7 g' Z' b) L - 7 F2 }% P$ g. C6 N2 A
- #include <mach/memory.h>
% ]& O [9 g0 i0 ] a1 h - #include <mach/hardware.h>
! v: q7 E- h. l% n4 B# ?! v - #include <mach/irqs.h>7 h( N4 P. U" X0 q5 \" f
- #include <asm/hardware/edma.h>
2 L/ D8 S( U+ H0 s$ V - - @/ \% _ Y; ]- v% Y/ W I, I1 C
- #undef EDMA3_DEBUG
" N* {: o- ]' u' X" C - /*#define EDMA3_DEBUG*/6 ?6 q% C9 p3 T$ @$ @
; u' T) [5 u8 ^' {9 E8 x1 d- #ifdef EDMA3_DEBUG
% Q0 H' Z, _' i( |/ H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! p( k" N3 c- S6 E) @" x# H+ f7 n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% ^2 x; ?' q# X0 K% k; y( r$ @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 F9 {1 u3 q- i- y- n) n - #else
) Q+ b" A& I3 y/ z1 V - #define DMA_PRINTK( x... )
2 [8 M9 D- q$ R! _ - #define DMA_FN_IN& a0 B+ b9 n L, t8 b
- #define DMA_FN_OUT, x/ ~+ E3 F0 S4 e. C" m7 z
- #endif' G* D* e# U. w: E! A/ y6 s! ~
, M6 a1 @+ {1 D4 {) o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 m; P( U6 |# Z; r, g9 e2 n - #define STATIC_SHIFT 3" O* x$ p2 E$ N. H0 l1 l1 U3 `
- #define TCINTEN_SHIFT 20
4 Q4 R4 s7 M9 g _2 h' N - #define ITCINTEN_SHIFT 21
: Y; x, J, J( H, k, L - #define TCCHEN_SHIFT 22
) {, L/ o3 Y; {0 V, p4 T$ c; S% E - #define ITCCHEN_SHIFT 23
* O& ]9 U3 ~8 ]3 ? ~1 c" d
* D3 {( w1 Y8 Q# V |( D- static volatile int irqraised1 = 0;
' |& z' z8 c6 U/ p4 y4 M( A) K - static volatile int irqraised2 = 0;
: r% \9 I O0 F' m4 ~
, k1 x+ j' d, J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ p1 I* F2 A% I+ _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 F1 k9 }0 l E. w1 n) \* r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ N8 V; u- m$ X
9 a6 V/ r* Y" E; J- dma_addr_t dmaphyssrc1 = 0;* x! D% W2 E: w3 @; V! L& X, T7 N" k
- dma_addr_t dmaphyssrc2 = 0;
1 ^2 p) E( @: P0 _ y& n1 \ - dma_addr_t dmaphysdest1 = 0;9 ] c( F$ d4 M# T
- dma_addr_t dmaphysdest2 = 0;
2 V: J/ o; \8 U% e: j0 \ - 6 }9 m2 q- q: q. n
- char *dmabufsrc1 = NULL;
- c _! z! l9 ]# i - char *dmabufsrc2 = NULL;0 y) T* I2 a5 K. |# \9 \% F
- char *dmabufdest1 = NULL;/ U/ h- X& Z N4 K
- char *dmabufdest2 = NULL;
' ?! G# h' r/ I$ D$ `8 R# `' y
/ H& }) j3 ?* o" b, K' |- static int acnt = 512; l/ K) x! Y m; v% W
- static int bcnt = 8;& I$ d) ^! O# g9 `9 x, v& {
- static int ccnt = 8;1 \5 T* |1 o4 Q9 L1 l) b
" [; f! `( t, ]- module_param(acnt, int, S_IRUGO);0 p% n9 \& o: j' c& F9 X, @
- module_param(bcnt, int, S_IRUGO);1 b$ {& | r( I/ \, W! X* z$ t
- module_param(ccnt, int, S_IRUGO);
复制代码
0 d, E$ Q, n0 |+ i/ z+ g3 J
7 ]# u' J" `( f* | 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 X+ y) L0 {& p# @+ O A1 karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# l' v8 L4 v5 N- u. R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 {# Q. U- n* Y N
# ~0 J: o6 |% e
( n! e0 Z4 e4 c. U8 I4 g' z$ j8 Z
|
|