|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 P9 a5 y4 T& F8 k- W3 N4 s- [code]EDMA sample test application9 v# Z* \0 M7 o; r8 s
- /*
) O# Y8 s/ R; |% m* m1 I - * edma_test.c3 O3 B8 G% S! ?4 g6 h9 K' t: N4 D
- *1 i$ Z4 { U. ]
- * brief EDMA3 Test Application
* a! g% h! }5 I - *
8 G2 v; h/ d# S; K4 C - * This file contains EDMA3 Test code.
; m5 w, i0 ~( x8 F: b: f/ | - *4 y! A* \" G/ J n$ g
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- r4 A4 ~% }' j& }+ g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 t0 j9 ]. Z9 T - * TO CHANGE.
6 r8 z/ s8 r" R5 Y0 b" l! U" j& w - *' Z3 b I$ ], F3 y, U( Z: n: v; C% i
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 Q: K/ A$ s# @: I) v" i: d
- *5 O9 f1 l* c# `! _' Q! }
- * This program is free software; you can redistribute it and/or$ B4 w8 {6 ?) ^9 x5 K5 D i
- * modify it under the terms of the GNU General Public License as' s# G/ R5 m1 v4 k( R
- * published by the Free Software Foundation version 2. p' v" L% X' m
- *0 H' [' v3 D* n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; i/ F" t% V! f
- * kind, whether express or implied; without even the implied warranty
4 Q, J; E- Y4 s& m7 ]) r - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) E, r8 ^) { [2 b W/ h
- * GNU General Public License for more details.. Z$ m$ P7 q; n% [0 x
- */
6 ~. Z3 I/ E$ B+ N4 q
, F& J; {9 o* l% x- #include <linux/module.h>2 z# D6 c$ b) x. F+ x3 S, X- E
- #include <linux/init.h>
* Y* q. F' R0 U2 S; d0 q - #include <linux/errno.h>
2 p9 i9 ]5 G$ T' G7 ^) K& g$ y' c+ j - #include <linux/types.h>) D( }( x9 B6 B$ E
- #include <linux/interrupt.h>
' i/ S& S% | | - #include <asm/io.h>7 F, r4 V1 }& L+ P4 ~
- #include <linux/moduleparam.h>
1 p& W- C4 x" S# h- a$ v, x - #include <linux/sysctl.h>" d4 J) t8 \* [0 g! i& x. V
- #include <linux/mm.h>
@1 r5 R1 M" X4 x" S i2 s - #include <linux/dma-mapping.h>
) R [% H: t* r: j4 V- S# D
2 w5 \& J/ X+ |# U- #include <mach/memory.h>5 V( e/ T! q2 X4 W0 U
- #include <mach/hardware.h>1 F; D; v: M# V/ `! O4 G& P& H
- #include <mach/irqs.h>3 D; z- A8 ]( L% a" K
- #include <asm/hardware/edma.h>; m* w; h5 @; W- W
|7 o+ ]+ n6 }! ?) n, U- #undef EDMA3_DEBUG
, {( K+ J. T' X# t; z, _ - /*#define EDMA3_DEBUG*/0 [' I$ [) w1 A( T
- 1 z0 O3 ?. [' ]. [* J3 k$ U) i- u
- #ifdef EDMA3_DEBUG( \& C( ?* F2 _" t0 R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 g2 X8 S/ l" I9 O$ O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ m" |1 j" q6 m$ J- O ]
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- ~* I" N6 }( a. Q+ W/ t3 p - #else$ e; R' \% J2 k" q1 d3 [
- #define DMA_PRINTK( x... ), Q, h1 M0 N. l: R8 c* a8 U
- #define DMA_FN_IN
: M+ N* B6 y: H3 N8 O; I* t% K D - #define DMA_FN_OUT
4 p: {/ E* Y- c. w - #endif, S9 Y5 d" J! Q8 k6 m# u
3 ^, r9 R9 s7 r6 E) |2 m9 F0 f- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ q$ x3 g7 ^/ P1 ~% w0 Q7 }; @ - #define STATIC_SHIFT 3
) {9 p) \& w5 M+ q" h - #define TCINTEN_SHIFT 20
8 ~; D+ F3 e0 J- u - #define ITCINTEN_SHIFT 21
+ r0 x e* b0 A5 b - #define TCCHEN_SHIFT 22
0 w1 W8 a! M' Y9 V6 k" X - #define ITCCHEN_SHIFT 235 d5 R5 _% N. C9 F) ?% ^/ C, c, v* x
, O3 `4 \4 H* N0 k; Q, P- static volatile int irqraised1 = 0;9 J6 g6 a3 D) [7 C
- static volatile int irqraised2 = 0;, t2 j% ^/ X. \: o5 x8 Z
3 p/ j, a1 z, D- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: f- B7 y* n* i, n9 \5 S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* B- F* U' M$ Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 G5 |+ K" T. K+ d% d5 j - 0 p, n' [6 U8 m7 V0 }
- dma_addr_t dmaphyssrc1 = 0;
7 p. e, `. R- z* ` - dma_addr_t dmaphyssrc2 = 0;" }8 w* |$ |7 c4 q6 a" t
- dma_addr_t dmaphysdest1 = 0;
7 c: P h9 ^( \- l1 @ - dma_addr_t dmaphysdest2 = 0;6 y. u: W) D0 ~. h9 g4 z$ W
& N5 @5 \5 k" S; O7 s! }( t- char *dmabufsrc1 = NULL;0 p3 ^- a& W$ n( L
- char *dmabufsrc2 = NULL;/ H# C+ @7 J' D" B E
- char *dmabufdest1 = NULL;9 S. ]1 b2 j5 x V. F! k9 m
- char *dmabufdest2 = NULL;! L1 \1 u" W3 C% a
- $ M; w( o4 \+ R. v+ l" R9 y# M
- static int acnt = 512;6 S/ y. P) L X) I" }# W
- static int bcnt = 8;3 z8 _# B5 M# _! [* i4 Q
- static int ccnt = 8;$ [% n6 C# V: F$ V" h
- 7 p0 `& Y# s. d. [! o) I, a S' ]9 H
- module_param(acnt, int, S_IRUGO);- t0 D) w% u6 z+ o
- module_param(bcnt, int, S_IRUGO);
/ k. X/ f# z9 n4 S- x - module_param(ccnt, int, S_IRUGO);
复制代码
. y/ Z( q! b+ n. g' Z
7 t0 d2 L) \' ~; Y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- H7 N4 @( W+ v& k$ _' J- ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 s9 [$ w1 ^% K$ B! P1 m: o/ Z$ Q& m/ E
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- g1 `/ q; @3 c# Q5 Z( w' S c0 T
U+ h( d, U& [# J! v" J
9 c' O& n' f; J2 F. _- H |
|