|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 t1 m g( M% e) J, E5 F, v- [code]EDMA sample test application
! r9 R; }: U3 V$ d5 m" o) j - /*
0 k$ p* G6 k; A4 P - * edma_test.c
1 a+ c+ o1 r+ ] - *. J+ Q" x. ?6 b9 O
- * brief EDMA3 Test Application5 Z! V! y+ u* B! x
- *
1 D/ D2 N& w3 g/ g+ B/ G - * This file contains EDMA3 Test code.
* N0 w; ?( |% j/ R& H9 f; A - *
- c0 w s- X# ~! n, r& Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE Z. ~5 {0 H! P1 O. M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 \# o; q$ J3 R
- * TO CHANGE. [& ^5 J" L- A8 z3 j' _
- *
8 K, z/ e+ q2 L# `$ h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 |$ h: E7 C. Y+ P! V( O0 \
- *
0 [: x( S6 @- d1 A0 q3 G - * This program is free software; you can redistribute it and/or
- q( ~; W- ]; J - * modify it under the terms of the GNU General Public License as
- a4 }; o. E) r& o0 r( } - * published by the Free Software Foundation version 2.
, s# m4 ?9 o: y1 X. V - *
4 k. b, k; o* `4 j+ b' b& U - * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 g, U$ n8 i3 R/ e, Y9 c
- * kind, whether express or implied; without even the implied warranty0 L, ?* O! z- }9 g' _
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) b& \- { d4 B6 b& G+ @0 a - * GNU General Public License for more details.1 M% R5 D' m' G1 u+ |# @; b
- */
e- @2 I0 ]1 Q% B( g4 y* { - & H- D( ?5 E- {, t
- #include <linux/module.h>8 q: n) V3 {/ W6 ~3 i* \
- #include <linux/init.h>. K7 a1 Y& \4 ^6 A. H( d1 u5 K
- #include <linux/errno.h>
* k3 c: y& _) G C! h7 { - #include <linux/types.h>
8 S/ p- i9 H. X - #include <linux/interrupt.h>7 ^, u% J: H; Y" |
- #include <asm/io.h>
# `2 v2 ] C3 `, O6 P. A - #include <linux/moduleparam.h>. n3 p/ C+ t) h; r, s2 W
- #include <linux/sysctl.h>
* }3 e6 k$ h6 C - #include <linux/mm.h>
5 V- V" o. e6 I& x! h4 i' d, P - #include <linux/dma-mapping.h>- V" H+ b* u' v( h. d
) H- V( U2 @' s1 ~; q: B- #include <mach/memory.h>
# F' Q' D' s) ` - #include <mach/hardware.h>
4 q0 Z* h4 Z4 R: l r3 T - #include <mach/irqs.h>
0 c$ o9 G/ p& e7 M# Z# y! q - #include <asm/hardware/edma.h>9 M! l8 y, M0 e2 x V9 b2 L6 W
4 H9 a7 ~- u v. _$ ?: ^2 g" I8 W- #undef EDMA3_DEBUG
+ t4 X! T' h6 a. h& D - /*#define EDMA3_DEBUG*/
& f+ R5 z( a+ ^7 Z5 ?+ F - * M% E/ B4 L+ N% @5 S
- #ifdef EDMA3_DEBUG# \9 B% g5 ~! o. P2 ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& S1 Q# Z7 V$ }7 n3 A. b - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): `3 }! A9 \" L8 \8 f$ g$ `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. M& }. s) W& r0 h2 o - #else3 ^% h# z5 l2 z: }, [
- #define DMA_PRINTK( x... )
9 \6 Q2 u5 a" u9 e& j$ W, E7 @ - #define DMA_FN_IN
5 M% C& }/ F- i7 o - #define DMA_FN_OUT/ T7 K% H& m) H7 f9 Q6 i
- #endif
- {0 C, d# N- ~) N+ W2 j7 g - ' o+ j5 J/ \" g3 Y5 {0 g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" x0 ~+ n5 K" y8 [: K* z: C - #define STATIC_SHIFT 36 h6 H& d0 W) w; _
- #define TCINTEN_SHIFT 208 N. T5 P/ I# k
- #define ITCINTEN_SHIFT 215 H. |' I6 {, H# L1 e. r6 d
- #define TCCHEN_SHIFT 22/ s! L" a% o9 W* i4 E ^! j
- #define ITCCHEN_SHIFT 23: G, H$ O4 N& e k& i) A" w
5 T3 u, g% ]0 K2 H9 ^/ R+ m- static volatile int irqraised1 = 0;
0 I7 O1 h+ D( `5 P - static volatile int irqraised2 = 0;9 C! r" A e+ ]7 f
1 t9 k+ c7 e! B/ m* A% H0 r( z5 T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 L9 w7 C$ h- Z/ g/ m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ H! t/ V' J5 B( T+ T0 e - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" D# ^; O( N* [5 q2 l( J7 i - . \0 F' @- ?* S4 d) o4 O) f8 s$ c
- dma_addr_t dmaphyssrc1 = 0;
2 E4 \- [7 j! J- H - dma_addr_t dmaphyssrc2 = 0;
9 k/ y6 I3 p1 v h# ?% i- Y - dma_addr_t dmaphysdest1 = 0;$ S i. h$ q5 N I6 ^2 j7 E
- dma_addr_t dmaphysdest2 = 0;4 S4 ^" L. E+ e8 R7 S
: f5 Z9 U8 {$ _1 S! h/ I- p0 \- K- char *dmabufsrc1 = NULL;
3 |) z; v- P) J- a* ^4 V - char *dmabufsrc2 = NULL;
0 ? |' E2 Y$ k3 h E3 O+ @: m - char *dmabufdest1 = NULL;1 t5 P1 ]3 J% f1 ?3 `' a2 q% Z* E
- char *dmabufdest2 = NULL;
- e) Z0 k, e( |/ p- L# o; Z" S
3 j# z, {0 P# O h( W' ~- static int acnt = 512;5 I$ E* g+ Q1 j! E9 ?
- static int bcnt = 8;
$ Q; i; d- ~% K( c( \' y - static int ccnt = 8;
! c6 d( ^7 x9 D: i% X - & Z8 j7 A8 A9 u* g8 ^$ `
- module_param(acnt, int, S_IRUGO);$ b. O# ?6 ~1 r, d5 ^/ r: e
- module_param(bcnt, int, S_IRUGO);
# G- y3 A* s6 p' T - module_param(ccnt, int, S_IRUGO);
复制代码
# O2 P/ e, z! x3 ]0 Z* A5 M
& u& v/ j8 |4 Y' K" v& ] O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ A# K5 R- R6 q! {) t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# {! h" g" M) q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 ~; x: B R, d2 v: R h9 s0 ~
5 t/ H2 J+ _& H% R8 l$ Y
3 k, d3 m: U, ^% M. @
|
|