|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: [8 v) ^# Q- ^, v# N. T; y3 E- [code]EDMA sample test application
5 }$ k; ~$ U h+ l% c; s - /*
/ X/ H8 z( v3 @4 o& c; Q* M/ |- ] - * edma_test.c2 S# o5 W Y& b, |
- *
, w0 l K" O& o5 y5 s- b4 I - * brief EDMA3 Test Application
+ y8 ^6 a G" I( B/ e$ U9 s7 [% v - *% f; l1 `( T. H0 c/ l
- * This file contains EDMA3 Test code.1 s$ x% o4 N1 M) S) f
- *
0 E, f0 R, j' i) { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( V8 Q1 f7 @ W1 j: E6 X) ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 h7 B: r+ n$ p; J8 n
- * TO CHANGE.: o) ~ @3 d2 X# Q* Q; b
- *
8 g$ |7 ^ c/ e8 O m# ]3 ^/ N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 C) C* `+ b' K% o) D# Q7 K- K- N
- *
+ y. F( X* I& C: Z! ` - * This program is free software; you can redistribute it and/or1 T! Y7 a3 v& f
- * modify it under the terms of the GNU General Public License as# k% C5 B+ F( w# Y
- * published by the Free Software Foundation version 2.
" X1 d8 Y4 p# b+ D' [ - *0 e6 v \4 u# g% K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. E4 i% U0 u; j7 L/ P - * kind, whether express or implied; without even the implied warranty4 k6 ]: g1 d3 Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( ]4 D! X' y# S0 h0 [; e6 t
- * GNU General Public License for more details.
7 j1 T: s, X& t% T - */% J/ h3 V( @. e1 _3 W% t( ~
/ ^9 q, |' v- s( ^" \ Y- #include <linux/module.h>
; u% W, n3 |& w# Q5 R, i, |2 y - #include <linux/init.h>
) w- h1 A3 C1 V - #include <linux/errno.h>
% i1 ?; v7 V: \7 t0 O7 [9 N - #include <linux/types.h>* V! z; R, X) t1 P
- #include <linux/interrupt.h>3 ]8 R8 P0 G. {% n' p+ J) u- a
- #include <asm/io.h>- k9 C+ j4 F6 Q" i% V3 w; d% t" q
- #include <linux/moduleparam.h>4 }3 p3 ~" J% m5 ?4 Q& ~
- #include <linux/sysctl.h> \$ V7 B$ }% g* J" {+ C: ^
- #include <linux/mm.h>- Z5 I+ M3 J2 `
- #include <linux/dma-mapping.h>0 w Q) B; A7 _3 m- K4 I
- ( X, [. z/ s+ ? w% m! o: `
- #include <mach/memory.h>
$ e' ~: m6 B4 w& J6 [2 @3 O9 a9 O - #include <mach/hardware.h>
3 P: _9 J7 j- i9 l2 P& T8 i- A - #include <mach/irqs.h>
: }2 {8 N7 h9 R/ s+ c - #include <asm/hardware/edma.h>
; k) a0 v8 m, F7 Q" } - " k9 o+ L9 U3 e
- #undef EDMA3_DEBUG
* M% g: x% t" a8 [4 m6 N - /*#define EDMA3_DEBUG*/, t5 l, E6 s4 r, u
5 \& g, g. S& i K) t) X( [+ q- #ifdef EDMA3_DEBUG/ ?$ f3 I2 q2 e; Y6 {% J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" l T( _9 }: o9 k( l2 l9 v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) [! w$ j8 R5 [ ~3 Q" V* t$ \# v. E
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 D! c7 l x; L - #else1 N% ]1 a9 U7 P2 X C
- #define DMA_PRINTK( x... )5 x( h* L! ]1 h+ U s
- #define DMA_FN_IN
/ B" ~. ?# n. D9 D9 z: ` O - #define DMA_FN_OUT, g2 N7 w# f: m) ?7 }
- #endif: C9 Q$ ]; C$ W" n$ t ?
- ' h/ E4 ]2 o8 W$ U) p4 N
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ r [3 u& X$ I# u0 [ - #define STATIC_SHIFT 3
* r+ y& }7 g5 s6 s - #define TCINTEN_SHIFT 20
- _! G. d( ]/ U% X - #define ITCINTEN_SHIFT 215 F, e6 V0 s4 q1 b4 M" F- R. M& y) C
- #define TCCHEN_SHIFT 22" T5 D$ ?# w- _5 N. V! V) X9 \
- #define ITCCHEN_SHIFT 23
; s, i% C( n k! z ~" ~7 y
, g3 [* V V9 p* d- static volatile int irqraised1 = 0;9 X5 V. X* Q, @" [& x
- static volatile int irqraised2 = 0;
8 P P' O. J7 r3 T/ q' d9 N
# C$ s5 ]* i* X- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ `! p+ E1 o7 P3 v. ?: e. s' V- ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 {3 P) Z; E' V: c7 l7 Y' l# t - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" v. p' g7 G( U& z
- 0 e+ r s9 J; @$ u" c
- dma_addr_t dmaphyssrc1 = 0;) V1 j8 W0 W n$ U. D6 J; [2 y
- dma_addr_t dmaphyssrc2 = 0;
7 s! u S9 l, i& r1 L1 I - dma_addr_t dmaphysdest1 = 0;* R, Q$ H2 x8 e7 Q- g
- dma_addr_t dmaphysdest2 = 0;
6 \; ~; V! \- @( M2 N" C# q9 F: z - ; j+ b" R" F |4 D) B4 l
- char *dmabufsrc1 = NULL;, p- f A% S& j
- char *dmabufsrc2 = NULL;
$ X3 @" C) |# q0 V3 x8 V - char *dmabufdest1 = NULL;
5 \! A2 ]3 n& e) ` - char *dmabufdest2 = NULL;% F: B9 O( `' f; o( |$ {
- + E+ X+ t# J) E$ m% v/ A. d
- static int acnt = 512;% |% w9 `6 s4 V+ n% C2 H
- static int bcnt = 8;
) t# N2 S6 m+ B - static int ccnt = 8;" O9 {$ A/ q3 [
- ( D6 d+ V; ]% w+ {8 X
- module_param(acnt, int, S_IRUGO);, A4 G1 c. p. a/ @9 V
- module_param(bcnt, int, S_IRUGO);! o. g" v9 o0 T2 Y1 }- k P
- module_param(ccnt, int, S_IRUGO);
复制代码
2 s! R$ t8 ]9 M3 v s- n5 z) L, z5 j# ?$ H% Z( T7 @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' l4 Y* l3 Z9 K; u: g4 D6 Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 n$ U1 }: e% ~& A0 w6 C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! b3 m9 O* G# z! R
" l5 [! S* e6 p3 \. {
2 T% T+ m2 _# W4 U& d |
|