|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. |+ Y" G5 y: m6 e- [code]EDMA sample test application+ Z5 Q( ~8 h! z. X
- /*' F1 y, P+ U3 L$ ?" ?# E
- * edma_test.c. L: f6 n! L( L$ P, u- d' \
- *- ]0 W6 B, j. ~+ Y/ M
- * brief EDMA3 Test Application | z+ r; o' a2 I+ R
- *
0 x" w ^, ~8 o% U - * This file contains EDMA3 Test code., }/ X4 q5 F1 V2 ]. s& |
- *) `, _" I/ h1 \2 f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' E2 ~! H; s* _- L7 {! ^8 e6 ] - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& p% Q& I9 g: C- {, c/ | - * TO CHANGE.6 ]1 F' }/ J; u4 P& U* U- B4 R
- *6 M6 M: U0 R# I, \! [7 W2 B3 [
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" Y3 L. f6 S0 V- n: P3 @& t2 W5 K0 i: N( \ - *% k* H w: D- L- q+ P
- * This program is free software; you can redistribute it and/or
+ Y# t0 @5 H5 h2 b8 `( T, ^ - * modify it under the terms of the GNU General Public License as$ O9 j- l$ u# ?- a8 k
- * published by the Free Software Foundation version 2.
/ ~. `' J4 ^5 L G6 R - *
4 h1 d6 d; t; d% U* o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: f2 D4 ?* y: r& R4 F* t - * kind, whether express or implied; without even the implied warranty9 D4 `/ V# Z0 Z7 b! @# M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ [# S3 V$ j' }; l! a+ e - * GNU General Public License for more details.* ^- c; h; {+ t0 ^) ^& \* Q
- */
' S3 ^0 `( P4 |% H+ d
0 S, b. m X! q- #include <linux/module.h>. j v$ x( m' s) g/ }5 F
- #include <linux/init.h>
H% g* X) g2 E7 @/ N- t6 `6 X - #include <linux/errno.h>/ v7 m6 |+ g' E& M2 [
- #include <linux/types.h>! \, a! a9 s5 ~' ?( W
- #include <linux/interrupt.h>7 A4 w% I; _3 @( X0 F0 l \
- #include <asm/io.h>
" B6 X! s9 h% ~5 I9 E - #include <linux/moduleparam.h>+ b# e4 J$ Q6 i0 c' ^. v& ]
- #include <linux/sysctl.h>0 q3 O$ R; M/ y5 |5 L4 h7 }' e, ]
- #include <linux/mm.h>
! @7 S: R4 r( p5 s5 P/ v" u$ h - #include <linux/dma-mapping.h>
; B* T b' j: K$ k - " p- }& s3 F" Q i) N
- #include <mach/memory.h>5 N0 K& h3 \# \0 k
- #include <mach/hardware.h>0 H/ i2 R8 i1 Q4 s1 q
- #include <mach/irqs.h>( l i1 p2 G2 F6 p9 C" v" W2 M' }
- #include <asm/hardware/edma.h>
0 @% k* ?' P; s" L' |
2 l8 P1 y$ Z( f# Q i- #undef EDMA3_DEBUG
4 U; v+ k# ?" N' n2 @5 Z4 V; @1 x - /*#define EDMA3_DEBUG*/
5 h5 A9 ~' q" r! J9 P$ K4 E
5 x& h0 }, v+ k7 V: g( K- #ifdef EDMA3_DEBUG6 f9 E5 p: C- s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), e, k& s6 a/ u8 U# Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 u- S) b' I" p - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" W) h$ M1 r0 Y - #else) g. K% C2 c" l# ?2 ^
- #define DMA_PRINTK( x... ): m3 x7 N% E2 Q) M7 `; Z
- #define DMA_FN_IN
/ ^5 }. v. a" O- n - #define DMA_FN_OUT, _ I! Q& m& l' |9 Y( Y
- #endif
( B6 H+ ~4 ^ Q9 e8 T
9 [% B6 Q& ~' r |5 y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& c- q, r! r% G0 i! V - #define STATIC_SHIFT 3& v# t+ n' y, e2 b
- #define TCINTEN_SHIFT 20
- `+ A4 c3 K0 d& O7 a( c( K# N6 C1 P - #define ITCINTEN_SHIFT 215 ^8 G$ u+ r$ I! ?1 R5 o5 Q1 [
- #define TCCHEN_SHIFT 22. a3 ~, r |' I' ~- X3 y: a
- #define ITCCHEN_SHIFT 23
: m" s( Q* v8 N+ M0 u e$ w/ w - 7 r" U$ U- R6 U T: d& |
- static volatile int irqraised1 = 0;0 q* A8 P% d% U7 ]& w, C
- static volatile int irqraised2 = 0;$ v& q( Y, u, c2 }- J! M
- ' t: P6 a P$ M
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) R& j' O8 m$ u+ U) i2 i+ n% M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' P1 ]+ z: W, J) V
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# ^. R7 c. z6 c* D; q - . b# @. h$ J: A( a' e' M
- dma_addr_t dmaphyssrc1 = 0;
4 {1 Q* k3 P, H5 S) g Y' P: J; G - dma_addr_t dmaphyssrc2 = 0;3 k% r9 z7 }1 c* i
- dma_addr_t dmaphysdest1 = 0;0 f0 E. `6 O4 v7 j3 X
- dma_addr_t dmaphysdest2 = 0;
4 R* H& W3 ^6 o* n8 q/ O
+ c5 m% g5 A/ O! H8 j( ]2 A( W- char *dmabufsrc1 = NULL;
: V! r& N: K( {- x! w' m. L; d - char *dmabufsrc2 = NULL;" L3 t( i1 W& H: S& B# B5 \+ w
- char *dmabufdest1 = NULL;! ?* ]6 G g0 l1 h t# D
- char *dmabufdest2 = NULL;
5 ?# A! N* W5 k - 2 T$ ?& _8 p+ Y. B* |- v
- static int acnt = 512;
) y% W2 X& `) M( I$ a1 \8 F' X2 a( [. m( \ - static int bcnt = 8;& I/ k/ b2 M, Y0 P2 a" [
- static int ccnt = 8;
3 @4 h d9 q6 u
. _! h' _0 L: X! O! z! l6 [6 u- module_param(acnt, int, S_IRUGO);
# o4 p# l+ w+ G5 A - module_param(bcnt, int, S_IRUGO);
8 p% F. o9 k- r9 |9 I/ G d/ n+ r - module_param(ccnt, int, S_IRUGO);
复制代码
) S& p c6 K: W
( t: {' u) o( x& G' k2 b0 s) V 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 F$ P5 t0 ~1 a7 ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 R0 P' p, S! u) a; q9 S0 _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- e$ C% }! M5 z4 @# b
- K$ |" q- a3 j8 v2 O7 ]
- q8 a, R) |* { |
|