|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 {6 U7 O8 g {& |3 _6 @- [code]EDMA sample test application' Q: j" V3 [) G5 |
- /*
1 p! f0 K, L0 U. b - * edma_test.c
: r; O* u3 O+ v! L* g5 ^ - *9 o; M& F s1 M
- * brief EDMA3 Test Application2 @3 @8 k$ Q6 w
- *
1 ]+ n) i3 v. v8 w: a. C - * This file contains EDMA3 Test code.
' g# c- w* i) _$ t( v9 M0 C6 Q - *6 I; @* c, }# R2 f4 l
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, ~3 `8 M$ r( s2 }- R/ x9 N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# D& T. d) S m) ^+ G" `
- * TO CHANGE.2 C" V: ?9 [5 J, v
- *
6 a2 q7 b( B( p9 Y# D( Q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( G, \: ^) c6 P1 \# `( E4 R; ?
- *8 [+ f& i* k* N* A7 f
- * This program is free software; you can redistribute it and/or
* U# D, k" Z) p/ L - * modify it under the terms of the GNU General Public License as
' c) Z9 _ }3 ]+ @ - * published by the Free Software Foundation version 2./ d5 Q' E' C* Y' G2 p! b4 {* W+ x
- *
. x L+ Y, w1 f g9 e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& j+ {; |% t2 P) K3 `+ T - * kind, whether express or implied; without even the implied warranty) J; A8 G z, H C" d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. X8 P# v8 Z6 N - * GNU General Public License for more details.0 q& u; ]9 B' ?7 k8 D( B
- */6 @7 y' y* j" Z' y9 G
- 2 N+ G6 }" x& c
- #include <linux/module.h>
' M% P6 v$ y9 D9 t - #include <linux/init.h>4 f" ^/ u* @6 R" w b- N: R
- #include <linux/errno.h>. i m$ `0 Y8 E& F4 I, P. b. J; ^
- #include <linux/types.h>
! ~$ ?" s2 _6 d& R5 L! a - #include <linux/interrupt.h>
( Z1 O. ~* E7 S - #include <asm/io.h>
6 X1 F; r) ?! Y2 Y - #include <linux/moduleparam.h>
1 f; Q8 _" i6 w: u5 }' w5 I2 V - #include <linux/sysctl.h>, F8 Q7 I7 E- d
- #include <linux/mm.h>
" g; t4 k$ B# Y* G2 z0 ? - #include <linux/dma-mapping.h>
3 l. | [6 R" N/ A
: p" u4 Q! k# q: o# ^" ^- #include <mach/memory.h>
6 Q$ V i; K" b9 U! C. _, k - #include <mach/hardware.h>
, X, |/ J7 ~8 r- Y% H8 [ - #include <mach/irqs.h>
* H) y7 q9 W; Z' I2 v+ E! u p/ v- H - #include <asm/hardware/edma.h>! Y& J# @ u; W' M. k# u( T
+ e. N+ ~( a3 K. d( |- #undef EDMA3_DEBUG
5 _9 W1 K3 `' R$ f, W5 V/ M( O - /*#define EDMA3_DEBUG*/
0 R8 V8 w1 k. X" z8 `' m% ` - / t1 G9 [6 I5 M4 P
- #ifdef EDMA3_DEBUG0 w5 m1 y- ~/ [* ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 c# v( ]' o. b - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) C8 Z' p& o, e; R1 P9 p6 L$ ? - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 ]1 |6 j& S. e' r N - #else
# i7 T' b/ j7 W+ t( Z+ b. J$ e - #define DMA_PRINTK( x... )
6 j/ C8 d) J- q - #define DMA_FN_IN
2 e' x4 {& w* d D0 i" i" H \ - #define DMA_FN_OUT
0 T0 X4 m9 W& F6 T& F - #endif
. i: A0 N# j4 D0 k0 C' J - . y. j1 w# m3 B, P* T+ x4 f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 q9 H9 C8 N6 c+ s! q, _
- #define STATIC_SHIFT 36 S/ N8 l4 s, i" n) W: ~. U
- #define TCINTEN_SHIFT 20
4 O$ Z. `) g4 Y9 [+ E) \ - #define ITCINTEN_SHIFT 21
0 _% X! ]% } ^% ?5 O, J - #define TCCHEN_SHIFT 229 b$ k- i6 E# a
- #define ITCCHEN_SHIFT 23; _) m2 d! F1 H; ^8 V
- / ^9 a# ~2 H) H6 v
- static volatile int irqraised1 = 0;
8 ]6 d! o1 j7 S - static volatile int irqraised2 = 0;; Y8 O1 W# \5 j9 Z; O* g: i
# T% s% g' N$ Z" \" d- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 P0 B2 _+ ?9 y& g, | ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 q( O4 t6 F, v
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% Y5 \- ?- W. D$ p- c/ |4 Y: y @
- 7 Q2 p3 w, y4 q, _5 e$ f" m8 {
- dma_addr_t dmaphyssrc1 = 0;
8 L& m/ H( w/ j# V# H( p - dma_addr_t dmaphyssrc2 = 0;) B: i! N [& @8 V; A
- dma_addr_t dmaphysdest1 = 0;- I# d" A. n5 g% {+ N
- dma_addr_t dmaphysdest2 = 0;8 i1 h) O6 k% G0 _! ~
- " d; B- E' c9 w
- char *dmabufsrc1 = NULL;: \) `7 ]- W- F o
- char *dmabufsrc2 = NULL;1 V4 k9 u* k! l; E# D
- char *dmabufdest1 = NULL;' b( d* O+ g1 F9 k" x7 v3 }. \' G
- char *dmabufdest2 = NULL;
0 v8 H B/ E* _7 }8 h0 n% j - , H7 z+ o0 z0 x
- static int acnt = 512;- E1 M1 @8 }7 K( y# ?
- static int bcnt = 8;
0 R4 }, {! Y- s: V, B% b& S3 r - static int ccnt = 8;
% Q+ b3 u: _* A2 [8 X+ T
, f/ f% p; l" h1 ~! V: D- h" @- module_param(acnt, int, S_IRUGO);
* O n5 h2 U9 A# V% D& J - module_param(bcnt, int, S_IRUGO);# o7 e* g# I/ n( s$ G+ Z+ E W) M
- module_param(ccnt, int, S_IRUGO);
复制代码
/ S5 `3 R' G- V6 R4 V
A4 f2 x s7 O1 ?; L6 R) t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 p3 p/ c4 a& a1 a6 J+ l- K2 L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 ^: u& g6 P. G6 x; I/ h" |: a 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 R& u- Z$ R% d% y
; J! n1 r8 u- W
- r' u2 b% n2 W5 S
|
|