|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # G% ~' ~/ M1 |& X* Z3 n
- [code]EDMA sample test application, U5 a" H! B% Q' F+ g
- /*, b2 X, \2 c8 `
- * edma_test.c8 i% S% d3 `& }
- *: s- t# c* C t; O! H# t
- * brief EDMA3 Test Application
+ l4 ?* Y; V: X$ l - *9 s, _; b; E. {& m& t$ o( d
- * This file contains EDMA3 Test code.
$ X0 [" p, ^+ Z - *
0 [8 W# n; _' b2 i+ `: g( ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE i+ P5 E& x) L; O- s$ P1 Y4 i
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- n' v" C( B# ]
- * TO CHANGE.
- w; K- J8 g7 S" C3 O - *
# N6 y$ N3 |: I& k* M% d& F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( W) h X) j/ w( p" `/ z9 |! } - *5 W: A5 j1 e A2 p5 c( U" Q
- * This program is free software; you can redistribute it and/or# j% C7 s! a0 g) R5 B3 Q6 F
- * modify it under the terms of the GNU General Public License as
3 O7 L( m& t! ]1 g7 R( r- `* K - * published by the Free Software Foundation version 2.
; D8 c! ]5 b# B w u - *
; H* L2 D% Q1 n! q) ^, k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 [9 h+ `3 x( h2 S' A - * kind, whether express or implied; without even the implied warranty) T8 y: ^) h0 i6 C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 ]" p; L. M' y e' i3 i
- * GNU General Public License for more details.4 E* g7 ^! h9 h4 e% O2 q+ ^
- */
& L- x+ y E5 r- q
& d( @9 e6 E. |- #include <linux/module.h>% E: @4 A, D* \
- #include <linux/init.h>
- B u. P5 ]- B; c6 N, a; H ^ - #include <linux/errno.h>
9 a% C ]; i5 f7 o, c- ?' A - #include <linux/types.h>
$ |# P* J3 }/ I3 x5 A1 A M1 x - #include <linux/interrupt.h>
0 C# g5 T i9 M/ g2 r$ Y# a - #include <asm/io.h>! d, _& n1 v9 C- u3 A5 L
- #include <linux/moduleparam.h>( C. Q2 @) }) }# K# L' x
- #include <linux/sysctl.h>
) u: Z' G0 U- O - #include <linux/mm.h>8 {8 v: E* C/ W+ v
- #include <linux/dma-mapping.h>: F/ T1 G! q0 r
- 0 j- U$ e+ e8 p1 R
- #include <mach/memory.h>
. W, N2 q+ @. C - #include <mach/hardware.h>
3 a. Y: e. R3 k2 v - #include <mach/irqs.h>
1 n& _* ]6 p5 Z) c% p! V! h - #include <asm/hardware/edma.h>. D; O( @- ?9 Q) V. }. @- ]% T
: r% H3 H$ w& G( l& [- #undef EDMA3_DEBUG& L9 E* O3 D5 Y
- /*#define EDMA3_DEBUG*/: \) l9 S. |6 u5 N& ]3 N8 R2 e
- * U5 |8 p, ~4 I% z
- #ifdef EDMA3_DEBUG
# q9 e& Q' h7 J- [: G* a0 |4 L - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 m( r2 H- l4 k - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) \( I9 m0 B+ m7 y7 o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
N+ n) n$ E! Z N V- E8 P$ j - #else3 C7 l5 p# P% h4 z/ J
- #define DMA_PRINTK( x... ), K( f; Y' |5 ^# f; Y" H3 K( a6 T/ H
- #define DMA_FN_IN7 i7 u& x: S" n7 i6 E( W4 X
- #define DMA_FN_OUT
' z6 c4 Y1 A: t3 V8 }! f. T - #endif! N" _' V7 v2 B! r9 q6 L. j5 C
- * v7 o. w! P0 ^1 k/ l6 K& p0 ~
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# P! L1 ~0 D E
- #define STATIC_SHIFT 3) _9 o# ~2 a& [' T0 X- i( H: A Z! D
- #define TCINTEN_SHIFT 20. e$ c/ h6 u, o% X5 I! I$ G% w% R$ D
- #define ITCINTEN_SHIFT 21
4 d' G; ^8 X8 o2 _, | - #define TCCHEN_SHIFT 22' a: c* X( { b. g
- #define ITCCHEN_SHIFT 23
- g Z# F' r, }8 v/ u
2 V4 ?1 S! G- M: K1 ~! V, b) u- static volatile int irqraised1 = 0;5 }6 R9 N; I' d1 T8 G
- static volatile int irqraised2 = 0;
* g. U+ F/ x5 L, B
6 ]" v4 Y4 x" E a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 Q4 W5 Z n2 i9 ~) F( q0 G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- e( D/ z% b7 {7 ]" [ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 n# F2 l0 r. b9 q; @. \: x2 n - - p' B: Q( L6 r# }8 M
- dma_addr_t dmaphyssrc1 = 0;0 O2 J) N/ R1 v. a+ q5 l
- dma_addr_t dmaphyssrc2 = 0;
# c6 x5 a' ~ `* e; m( L- _, @ j7 z - dma_addr_t dmaphysdest1 = 0;
/ r# A8 ]8 ~- _! w1 r. M. @4 \ - dma_addr_t dmaphysdest2 = 0;/ K' _0 F0 J* t9 M, X
! v5 [( ]! f. V% C5 V3 d: _1 \- char *dmabufsrc1 = NULL;6 b7 Z9 p8 Y! C, {+ n: l
- char *dmabufsrc2 = NULL;
5 L9 `: K; x) a. T* w - char *dmabufdest1 = NULL;
7 A: G. [; ?" x- s, j$ x* {1 k - char *dmabufdest2 = NULL;
' x# T5 y9 t V1 z8 V+ |( _ - * x m c& w, y3 x) i
- static int acnt = 512;
( M8 n6 \/ z9 c - static int bcnt = 8;
9 Q7 _% M/ f' u0 [/ G! Y" P; q5 F - static int ccnt = 8;' K( C# B- X) C! @. ?8 j6 p) G
* ^ h' r5 I* b2 o1 x- module_param(acnt, int, S_IRUGO);
3 |( I2 }( \8 r: I" F - module_param(bcnt, int, S_IRUGO);
2 W- j5 m' _: p& ` - module_param(ccnt, int, S_IRUGO);
复制代码
2 P8 [7 V9 B+ H' e7 P$ ^( d9 z7 P+ j3 B& F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 D# j: @8 P0 I3 \+ l6 ~! {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 O' Q# U( d @$ p6 E+ O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! z6 H7 ]1 D1 ~+ \' r1 P6 P. j1 e# j. Z
* t' y4 S9 }& q' `9 @ |
|