|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# K/ h$ \5 b: R/ I, N- [code]EDMA sample test application
, M0 N9 Q4 j0 l1 Z. z6 [. e& x; g - /*
3 Q5 y. K" v/ r7 Y6 ~9 ~ - * edma_test.c" U, A# |2 R3 ]% }
- *7 v# U9 o$ D" I, R. T/ j
- * brief EDMA3 Test Application; b1 }' X+ i: J
- *
) e/ ^4 b9 W) m' x6 C, ~9 T* ]9 A - * This file contains EDMA3 Test code.
! ]" S, {2 a" z$ ? - *& L; |3 O7 _' Y& \& o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
_! G2 u+ W" u# o - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: ?. G5 I/ N9 l! h) G& J! h$ ] - * TO CHANGE.
' n f& R+ I% w) T - *
. \* q. k- K; q/ l; R- E; i% H3 l3 y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 B. m0 n! I4 L P( u
- *
7 l4 Q! S* ~$ h6 s - * This program is free software; you can redistribute it and/or3 [! {* @7 q: ^ U2 L
- * modify it under the terms of the GNU General Public License as0 }9 S# L8 j- }& q# O. \- `9 ?
- * published by the Free Software Foundation version 2., o m) ~/ t# V- u* y2 X7 S! A+ p- c+ \
- *
0 Y$ e0 N0 u9 ~$ v& L2 C" @" `9 W% o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& o _9 w3 m* b; F A; u$ e0 L - * kind, whether express or implied; without even the implied warranty/ X9 m/ w5 V6 L4 {# b) s" {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" H/ ?( F+ M9 N% o* j, j. W
- * GNU General Public License for more details.
/ p0 L0 p" N3 a/ D$ m* k0 z7 q - */
$ v: C" `6 H2 s: O
) z3 k4 H& ^* [+ f2 [, A$ l# e- #include <linux/module.h>. X( i$ W6 C$ D$ S2 A+ d! G9 k; l0 Z( F
- #include <linux/init.h>5 L$ v1 i2 t2 y7 P) |
- #include <linux/errno.h>
* \' @( {& K& {' |+ \. u& y W$ { - #include <linux/types.h>: N* N5 O0 ]/ w' T
- #include <linux/interrupt.h>
5 c1 P$ ]9 Z$ e* ]: H: u Y - #include <asm/io.h>. |& z3 V. t2 e% h6 }
- #include <linux/moduleparam.h>% |8 F3 ^. `0 k6 H1 {& v
- #include <linux/sysctl.h>
$ R/ c9 a# i0 H( G/ v - #include <linux/mm.h>$ Y& r* n1 Q* m$ L. x4 L
- #include <linux/dma-mapping.h>
* l x3 S6 ~1 Z. [) |. h* J
: s+ B( d7 W9 n8 U; }! e9 k$ d- #include <mach/memory.h>5 m, S$ B; D2 C& u. Y; q
- #include <mach/hardware.h>
6 v _) ]# ? g - #include <mach/irqs.h>
4 t( @6 [) x- Z& }) L" x - #include <asm/hardware/edma.h>( {* |7 x5 Z3 x6 A
- : x3 Z! r+ r3 [+ h
- #undef EDMA3_DEBUG" G1 ]6 H a* P Y
- /*#define EDMA3_DEBUG*/8 T! }3 \$ B9 L& W( [' ~
, o( I) a' c# X @& i# y- #ifdef EDMA3_DEBUG
5 j0 J( a" w6 P$ a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) o, _2 W% j4 P; v6 w# O' r6 u9 P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 E6 t+ q! p& Z2 v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ J! a# T: c, D9 ^) B - #else9 f i6 S2 m1 h) a6 @
- #define DMA_PRINTK( x... ); _8 [( P' G3 u, \" |
- #define DMA_FN_IN# v( g+ R1 [ U2 L3 I. i" z8 J
- #define DMA_FN_OUT5 s- ?6 U, w/ F' @
- #endif
$ F5 _4 W0 y: r2 s - + W- d; x- l& D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
B6 b" q4 C$ X7 h! `) o( L - #define STATIC_SHIFT 3
/ X5 H3 _4 _' r. J! s - #define TCINTEN_SHIFT 20
: b2 }9 a- d9 s' L0 d - #define ITCINTEN_SHIFT 21/ w' {3 O: i4 a4 i5 a2 ?) {' t, J
- #define TCCHEN_SHIFT 22
$ l* s7 ?7 D) v, g3 y - #define ITCCHEN_SHIFT 23
6 N' m# A9 z4 E$ |" S! P4 f, e: Y - 1 M# e& Q, d5 R, r) K9 _
- static volatile int irqraised1 = 0;9 t5 y0 L3 O) y" b& n1 [2 }
- static volatile int irqraised2 = 0;
F& z5 u: `; v) F# i2 L+ g
6 r5 Q7 i$ l. |- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* C( A5 [/ r( d- f6 _& l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 j7 H1 Q+ X! b4 ~* c7 a# n
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# Q. }4 X' W# x5 |, D4 l
- 5 ?$ y0 L# |' m* G, u$ H2 x/ b; x
- dma_addr_t dmaphyssrc1 = 0;
+ [: _: }2 r9 G# \: d - dma_addr_t dmaphyssrc2 = 0;
- s% w1 _9 N' ]* j. v - dma_addr_t dmaphysdest1 = 0;
! h' ~* J% j; S* A& e1 t - dma_addr_t dmaphysdest2 = 0;# ~# p F" D; K2 b. O( ^' E4 p
- " }! t' J8 d3 `% r0 |
- char *dmabufsrc1 = NULL;
2 P" r+ R3 z. s7 ?* {, S8 f - char *dmabufsrc2 = NULL;4 ~9 z( K- I0 g& H X
- char *dmabufdest1 = NULL;) \3 z H+ y8 l% J
- char *dmabufdest2 = NULL;
9 [ ?' x* ^9 L
( P7 H) m y D9 I2 F8 N+ E- static int acnt = 512;
; w4 q& Z. E% G& ^8 B - static int bcnt = 8;0 @1 V& I5 M. s1 U: ?1 H% ~
- static int ccnt = 8;
! {8 l1 C+ \" a4 j7 W
- s) {: p) }! I- T" Z" A- module_param(acnt, int, S_IRUGO);
* I' D: @) W/ f# n( T+ T. T - module_param(bcnt, int, S_IRUGO);" H, u( K; c ], d7 t( B5 x
- module_param(ccnt, int, S_IRUGO);
复制代码
# {6 t( J7 B$ U. H% k' t1 n3 M I" q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- W5 d% W- z5 `5 G6 _7 F% Narm-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, @' ]5 {# v6 r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' _3 M! T( R& W, E* G
3 @1 ]/ H, Z) Y
& e5 T5 F0 K. H7 ]! r( H |
|