|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & m4 H. ?8 U9 U7 Z4 G
- [code]EDMA sample test application0 G( V4 R9 U# C6 G4 F
- /*, ~' X5 l- o+ A, X
- * edma_test.c) @% ?4 F3 q q- b/ h
- *: P/ E$ t( m/ S6 q
- * brief EDMA3 Test Application* G! X9 R ]: `8 g; p0 U3 w
- *" e5 E5 {7 B( ~! D, o9 M$ E
- * This file contains EDMA3 Test code.
4 ` G/ e3 e9 y- {' @- c - *7 o/ a3 F! S( u" \, U9 K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" O$ Q/ a7 M% i, @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# T/ L4 V; L' h7 l d( h. M; T! } ~
- * TO CHANGE., U7 V: V( t8 {" v- {, R/ [( |
- */ T7 b3 F7 |6 `9 j" ?
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 l) y9 c/ Z% ^) X$ S - *
, v. J+ g; u7 g m/ Z - * This program is free software; you can redistribute it and/or5 h& @+ B# q& A0 c$ m5 Y; p( v. |
- * modify it under the terms of the GNU General Public License as3 p' L/ V) C- l0 T! P
- * published by the Free Software Foundation version 2.
, z8 H% w( u, F+ x - *
6 m5 Q% k" v4 C1 ?5 a: s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 P% G# n) `, q8 n9 W
- * kind, whether express or implied; without even the implied warranty
1 ~/ N6 W4 u2 p% `7 ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 N; t3 J, i5 g9 g6 Z5 p
- * GNU General Public License for more details.+ P. b l: L# N+ d; S
- */! ~8 A. Y$ Q) x* c- b5 _
- 2 A. y \" R( Y) Y) j
- #include <linux/module.h>
( A/ [; P" p! e& h# K# `* L - #include <linux/init.h>$ b$ B) h6 x% \& T$ G$ k# t
- #include <linux/errno.h>+ }& I& Q, L! f2 l1 j) Y7 b3 U
- #include <linux/types.h>: ]4 M6 [ Z9 i8 X" k& _6 N
- #include <linux/interrupt.h>( V0 G) \8 r/ K* s
- #include <asm/io.h>7 d3 ` q( n# z% @9 F* ]
- #include <linux/moduleparam.h>- M5 e3 y/ y2 l9 r4 c
- #include <linux/sysctl.h>
9 {/ g8 Q5 T' b, j - #include <linux/mm.h>
. ?' I# }, P3 O; v- P0 X! m" l - #include <linux/dma-mapping.h>" k7 x: V. H; J! A6 p7 \8 {( u3 e
- ( r& j$ I" B$ b2 ~/ y; X. W" V
- #include <mach/memory.h>
7 O5 l% q7 B3 f/ Q - #include <mach/hardware.h>
7 M5 |9 c; U9 B: u/ @ - #include <mach/irqs.h>
. O- B T: {3 E - #include <asm/hardware/edma.h>
$ o0 q, U% d7 p# r - b& o0 I+ Y+ B1 E; L
- #undef EDMA3_DEBUG" w9 t- d1 |' n9 U Y
- /*#define EDMA3_DEBUG*/
* i+ u" _1 @' {3 m4 t
# T1 U; q( x! e$ H" c- #ifdef EDMA3_DEBUG
+ v2 h" R; X: T - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 A5 n( A9 n/ s& K, A1 H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 v+ Z8 v# J! G- r( X' s" m9 S
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# y% C" O# c3 u. g2 r
- #else2 T. V8 z, a4 o
- #define DMA_PRINTK( x... )
4 i. x( D9 z" ^( ?: V - #define DMA_FN_IN
6 Q& y- p4 |* K - #define DMA_FN_OUT
8 ?# \5 Y: c& q5 u; J0 \; W% F - #endif
* n8 a: w N5 D0 x) N0 L% Y/ K - 9 ^0 Y: E1 {% m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- k' D d0 X4 Z Z# C& H3 z
- #define STATIC_SHIFT 3
1 K( s! _5 C* u - #define TCINTEN_SHIFT 20/ x# @+ w$ _0 I" U+ M/ d8 P
- #define ITCINTEN_SHIFT 21$ g7 C% X9 D. ^6 ^) M/ i6 r3 n& b
- #define TCCHEN_SHIFT 22
7 P" \$ E8 e% \) l - #define ITCCHEN_SHIFT 23$ i! v2 y: _7 U* I) ] M7 I
1 m5 u0 D' h) ^) x# S. S- static volatile int irqraised1 = 0;
0 V) b$ S2 ~3 B - static volatile int irqraised2 = 0;* n9 b; I `) B) D1 h" I
- 2 F3 ~2 o b/ b8 Y! t k/ N
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 S8 i C* V) `) s' n1 J$ u6 w5 }' x& ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ Q3 h4 T% i" _) J' e1 _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); v( O2 C" F! R9 J! T: F' [3 W
- / e* @* ^( H8 j/ |: z
- dma_addr_t dmaphyssrc1 = 0;7 L8 W: H: m$ t# x) t# \3 t
- dma_addr_t dmaphyssrc2 = 0;+ Z8 i6 O% {/ o; f
- dma_addr_t dmaphysdest1 = 0;# _) E$ x. l! S8 q5 L+ Y
- dma_addr_t dmaphysdest2 = 0;
8 o: `0 _, p% E" h: s) Z" _$ p - 6 ^& ]2 _/ \* a* R* s0 O, z* l
- char *dmabufsrc1 = NULL;/ t# B! p& _ s
- char *dmabufsrc2 = NULL;
5 J6 T+ V! G+ m, p3 A; k( ~ - char *dmabufdest1 = NULL;
2 h3 e! d6 o- ^4 l% @ - char *dmabufdest2 = NULL;
2 x% w2 s& V5 F1 b2 r1 R+ t
+ n5 p7 g T, _9 o: Z- R- \- static int acnt = 512;
5 @- `! H# F6 c3 f# [ - static int bcnt = 8;/ e' K* x6 O+ B& J
- static int ccnt = 8;& B2 d! ]4 b. `( O
! y+ M! r# H c3 r6 q; `3 t% {- module_param(acnt, int, S_IRUGO);
4 Z% E' |+ q v! W) Z+ [. M - module_param(bcnt, int, S_IRUGO);
/ u( {& |( `$ {1 V) @ - module_param(ccnt, int, S_IRUGO);
复制代码
+ A5 [$ o* A+ P2 ~" w
* X0 b8 T% ]: s4 ^) u8 k/ K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" Q% t$ K+ a$ k' |; Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- q$ l* N% l9 Y( m% i/ Y+ } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 ?7 g9 n9 R: z3 n
0 r. g Y0 J0 ^1 v9 {! Y1 {7 ~
& O3 M: W; ?, v! p |
|