|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # c! ]9 |& _) Q7 B+ o
- [code]EDMA sample test application
. V; [7 a' y$ ^( Z - /*
4 [2 D/ x% y) C0 o& F2 S6 e2 X - * edma_test.c- m# q( z1 a! `7 l& b9 ~. a4 V
- *
2 k( f. Q. O# ]1 r5 Z - * brief EDMA3 Test Application
/ q& c+ f( E3 f* P - *
! h1 S; V& K7 I- M# t9 R - * This file contains EDMA3 Test code.9 \9 ~) `. f. y; g6 L9 B# ]' }
- *, w Z# e6 \8 d& }/ _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! m$ w( u1 r: H7 `) r# z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% i( |0 v& f4 @" F1 p
- * TO CHANGE.0 m ]1 ^& ]: G+ i) V c+ h
- *, r( G% [7 e8 I) ~/ @# S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 f& E0 a$ z# ]% q
- *9 `+ X' m3 ] A0 l# T0 g* F
- * This program is free software; you can redistribute it and/or3 Y3 D( A) @. V; A
- * modify it under the terms of the GNU General Public License as+ v5 i0 L' o Q7 E: K& y3 C
- * published by the Free Software Foundation version 2.( q5 \* n/ Z; g1 H7 Y- X
- *$ C4 G% O' {7 `& M0 s
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ L' s6 |8 \' _ - * kind, whether express or implied; without even the implied warranty
. l A& j# i9 d. R - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 [2 P! I3 N( U V" Z# Y8 R
- * GNU General Public License for more details.! @6 w* g% K$ W
- */
' ^* r; r6 S- R8 w/ t0 N5 i x
4 E0 V p2 N9 J5 D/ g, M8 F- #include <linux/module.h>
) L. q$ [4 D# h - #include <linux/init.h>
* u% L& _+ {5 ^' @ - #include <linux/errno.h>! x- a J$ P1 k* W' U
- #include <linux/types.h>8 T9 x, o; ^# ]! q3 Y( e
- #include <linux/interrupt.h>- I& ?9 m6 c5 }" k( U" g4 w
- #include <asm/io.h>
" x) Y. T/ Z0 D; d, p - #include <linux/moduleparam.h>
: Z9 [! X! @- y+ \2 @5 I - #include <linux/sysctl.h>
* I/ h/ U9 M6 J7 y3 P - #include <linux/mm.h>
! |* L4 e0 u8 @# l3 b. H. L - #include <linux/dma-mapping.h>7 S; h; f' |- U- Q
- " N. A/ Z0 M8 v8 a
- #include <mach/memory.h>
) ]2 D: L7 X8 p$ j - #include <mach/hardware.h>
4 a/ d9 N( X6 J$ s$ S- |, @: E - #include <mach/irqs.h>
" x3 ?6 U$ w; I9 u8 d# n3 { - #include <asm/hardware/edma.h>
( ?. s! L+ Y l1 X$ W$ S; R
; ]# @3 U1 \0 l8 E4 \* O9 E& w" l: a- #undef EDMA3_DEBUG
9 _5 I: i" N) W& F' f! q - /*#define EDMA3_DEBUG*/
, m7 {% ]7 n5 ~+ j O - ! {( j* w& r$ e! w# A( f. k! o
- #ifdef EDMA3_DEBUG F3 c1 k2 T1 \2 z! z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). h7 C" b( s, t" O O! l: {) k
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 P4 y1 l5 G* Y2 I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 c# `# c3 o) l - #else; Z( e' T0 y7 Z5 r2 m% w
- #define DMA_PRINTK( x... )
5 I% c- a3 w; E( D- O ~# w - #define DMA_FN_IN5 _' { j7 j* G5 z, t# L" o
- #define DMA_FN_OUT
9 B$ c# W. h4 C" |: _' f# x. x - #endif/ @+ R0 O& W7 L
- ( F- k7 W! O# o9 R, a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) c& x, R! G* s; ^( n ` - #define STATIC_SHIFT 3 a0 w$ K7 z' e0 C$ D% n
- #define TCINTEN_SHIFT 206 g8 B9 m/ A' h
- #define ITCINTEN_SHIFT 219 R7 L* p* j9 |, r) w4 b) {. a1 z7 T
- #define TCCHEN_SHIFT 22$ b3 y* |, h3 D4 W, P& {' M8 R7 i
- #define ITCCHEN_SHIFT 23
1 H- m4 ?. V9 A$ t/ F- w
6 h9 c! j$ O8 ~, j' @- static volatile int irqraised1 = 0;8 t1 y( N6 V, \5 x2 `/ \, _: ^8 F
- static volatile int irqraised2 = 0;
/ ~% v0 I2 {; }4 }5 e - 8 e) `, r2 H6 o* M, C* [5 H
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) U" ?3 X9 b3 @4 _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' Z: z' x( L$ t1 m& p$ p
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 b1 p5 d& M& Z0 J- } - + U- Z% \5 c9 y' L6 E
- dma_addr_t dmaphyssrc1 = 0;9 A6 M/ c" S+ d# Q% O- s- G
- dma_addr_t dmaphyssrc2 = 0;
o! @. C2 d' S7 ^5 n3 g; Z! r - dma_addr_t dmaphysdest1 = 0;# w$ z- ~, W# ?3 _
- dma_addr_t dmaphysdest2 = 0;2 g( ^- Y7 |4 O
- & m$ E3 h+ J s7 P/ z8 c
- char *dmabufsrc1 = NULL;' A+ A" g2 h4 q D7 g5 M" O
- char *dmabufsrc2 = NULL; S! Y/ W% S% v7 d! F
- char *dmabufdest1 = NULL;) Q( @) `+ f# w/ M
- char *dmabufdest2 = NULL;7 I" d1 R. b# c6 m* c& v
- ~1 ~( V7 @/ u6 F( ~- static int acnt = 512;
2 C' f/ |: ]/ k; p* i - static int bcnt = 8;7 f5 A4 d, C, K) c
- static int ccnt = 8;
! z4 ~1 |! j2 U3 b( u
! P0 X5 T5 x" r- f# R4 B- module_param(acnt, int, S_IRUGO);
# Z) E! P9 Z2 B1 a, F3 C - module_param(bcnt, int, S_IRUGO);
1 e0 N! h1 N# p X" A - module_param(ccnt, int, S_IRUGO);
复制代码 + D0 Q6 z& r* |5 K
" W$ N) |) `. F) w/ M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 o, w" S. O6 y# H! }& U: v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- s& n7 s3 ~* `! K. I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 S+ B2 r9 r2 x" ?( [4 p% Y6 C3 s
( l, |2 d a& O
) U3 }# T, N& J0 ^) l' P |
|