|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 S) t% f7 I% e4 ~' N- [code]EDMA sample test application: m( ~* @- _7 F- i! V
- /*
# l$ }, ?/ [5 z X/ b7 D - * edma_test.c$ z5 W# D4 k! h* N+ Z
- *) D, u9 n. j$ A! ~' o) V
- * brief EDMA3 Test Application. l! y6 i+ x; J* {' J
- *
" Y% V% }/ `% `" P( u - * This file contains EDMA3 Test code.
$ ]! O& T. g, M - *
+ z2 u2 `2 h5 \9 [+ H - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- e& [+ F$ @1 L* s) R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ c" c5 ^! U( V0 q: T! m - * TO CHANGE.; q6 j/ r9 Z/ D6 g4 E
- *
+ }0 c) G/ w6 G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 \( R) b$ D) L" z& j0 {; J - *
& d. v6 p9 G0 T( H3 F7 G0 k - * This program is free software; you can redistribute it and/or
! q( C, p8 Y- @2 r% Y! K - * modify it under the terms of the GNU General Public License as" c7 g; g! N) s% @5 Y
- * published by the Free Software Foundation version 2.
7 a9 E/ h4 h/ E) s. g - *
8 S. s: p/ H1 J! h# P l; e2 l - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- G0 Q0 `$ I% g9 ]
- * kind, whether express or implied; without even the implied warranty2 T$ }' \# W0 ]; T4 R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 q9 f2 Y+ `4 N9 }1 p2 f: Y7 ` - * GNU General Public License for more details.
6 F" v; y) [+ D1 O! A - */4 d' E( K. Z# c/ c- ?9 y- O1 P
) z( }4 x9 d1 h3 x2 r- #include <linux/module.h>
( m6 y% E% D+ w" @& D, H4 ~( Y - #include <linux/init.h>. _& ?4 w& G' K2 e! A
- #include <linux/errno.h>
/ B0 E, r+ V2 f9 E - #include <linux/types.h>
$ P: m% j3 A4 b d% f - #include <linux/interrupt.h>3 u" c8 ]4 e# T: D
- #include <asm/io.h>
6 g2 ]' |# z R - #include <linux/moduleparam.h>% U. `0 |. R, E
- #include <linux/sysctl.h>
! V: V5 w0 t9 {6 M% X - #include <linux/mm.h>
( E& O) Z, }; H' C) T: E* b! ] - #include <linux/dma-mapping.h>0 f" y: u% p: }9 I7 g
- # o, M: f3 u. w$ O0 R( P. T ?
- #include <mach/memory.h>
3 U% d }, b, p: E$ A - #include <mach/hardware.h>
" O. N1 c2 V. T, ` - #include <mach/irqs.h>& V" F, ? w% Q3 s& j. @2 c0 a
- #include <asm/hardware/edma.h>
/ f7 d/ f4 |. p( n5 G
( Z7 f `' T9 x, y J7 J9 M7 b- #undef EDMA3_DEBUG: J$ v- s4 |8 ~" C: Z
- /*#define EDMA3_DEBUG*/3 @$ ?" i, [- r: Q* a3 n
( D2 Q$ j! U8 }8 C- #ifdef EDMA3_DEBUG+ {& U" S& k6 S o# n5 z0 ]1 K
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 `" V9 g0 b: J: c( }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( Z+ N) m& S* k( P# R4 t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 \- h: a% b) ]* {# Q3 m( S C
- #else; C; \5 b! _0 w) x# R
- #define DMA_PRINTK( x... ). V8 I4 A o9 F. N m/ d- t
- #define DMA_FN_IN1 p, Q5 w' o2 [7 `' E
- #define DMA_FN_OUT4 n6 a) B2 H: S+ b& v2 O
- #endif* |/ \* ]3 P4 u2 F9 e( N! S
9 z0 b2 K* d2 B/ G" Y# j- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 ~+ m2 x* N" ?# u, P# Y
- #define STATIC_SHIFT 3
! N R& i" }3 }; E& M, Q1 n - #define TCINTEN_SHIFT 20) C$ f9 l$ K" g# `# G* n
- #define ITCINTEN_SHIFT 21
) p! k3 q& J( j) m - #define TCCHEN_SHIFT 22
6 Z3 z# K) l/ n7 |4 t; t/ T - #define ITCCHEN_SHIFT 23+ _# x! d* q: e0 V, z
6 V: Y& t# }- m- static volatile int irqraised1 = 0;, d# O2 w' C& [/ u+ C1 }
- static volatile int irqraised2 = 0;- \# o" G( u- V/ g; }* ]- `: V
2 N- U7 R% M u9 z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ E+ X/ b; U/ @! G$ K" j& u9 W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 G+ w0 P1 P/ f6 U! ^ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& E: X, o% u l
' _% G& Z8 s: h- dma_addr_t dmaphyssrc1 = 0;! F! E( K# m- L5 u! i, V1 [
- dma_addr_t dmaphyssrc2 = 0;
4 Q$ e. l: J3 T* z7 f# F) } - dma_addr_t dmaphysdest1 = 0;
: k; a$ E0 I; w4 b3 t2 ] - dma_addr_t dmaphysdest2 = 0;& b( [& R8 w" ] a8 I; p+ H3 E
1 V. Q+ Q% Y! d- char *dmabufsrc1 = NULL;! n/ c5 c- a1 `9 j; d6 T/ j/ K
- char *dmabufsrc2 = NULL;
. b7 N7 a- ^! `( x2 p9 S - char *dmabufdest1 = NULL;- q( W, \* B e J
- char *dmabufdest2 = NULL;
" \! o1 c$ w: [5 x# F$ g& C - . g, u% P" @- ]- ^4 A+ [
- static int acnt = 512;
# f A" i4 x- w' s - static int bcnt = 8;
8 S4 y1 L, c' `% _$ f - static int ccnt = 8;. J2 x$ x7 r4 d) w! C( f% g6 D
9 J4 O% |0 Q: D" ~8 I- module_param(acnt, int, S_IRUGO);
. a4 N0 |& Q' H. ~" O - module_param(bcnt, int, S_IRUGO);
9 \6 ^* P$ D/ S - module_param(ccnt, int, S_IRUGO);
复制代码 + D7 P" @; D0 t0 C9 E( t
: H' x9 c* V& h' W$ ?% ^ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 ], _3 |( n, g( D- B# 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 X. F7 }" e$ \7 `; V; g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 X) q- e) y2 G, V- ~$ _; m3 i3 L: v) y) x( m: R0 q( O3 g
- N+ I8 m0 w% B. \) U1 p9 i
|
|