|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 h3 L2 w6 w; p$ L- Y, E- [code]EDMA sample test application# F; t. F5 o% ^. N9 P
- /** Z! k, K3 J/ F) k$ Y
- * edma_test.c
" W* x. q" R3 n6 B" G - *
9 {( K# _1 \1 ?4 c5 k# e2 A - * brief EDMA3 Test Application
' U. @, z6 C4 p! b - *
! E8 o5 y+ ~" r9 z& d/ ` - * This file contains EDMA3 Test code.6 L Z2 |1 J! `2 i: L, E. W9 N1 \- P
- *' O3 x. q! `' Y& B1 @5 M' i$ o- J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 a5 V7 J2 d) Y6 r: N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* k5 _- I1 q4 {; a- M) X6 ?1 x: D8 X - * TO CHANGE.2 }# x0 i5 o' u6 @9 y" a2 x( O
- *
9 J1 A# Q8 y2 T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ J4 z" j* o: u0 N - *
. |' d% y, k; m4 P8 F - * This program is free software; you can redistribute it and/or
6 ?( _/ J; X6 u0 z" a - * modify it under the terms of the GNU General Public License as5 p; a- k, K' a5 g9 H. ~- u
- * published by the Free Software Foundation version 2.
; A D2 B. o% @) q7 |' p - *1 j1 [' s/ P. N& \( N
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. p3 b+ p8 c9 g7 \" K - * kind, whether express or implied; without even the implied warranty
6 T7 K3 z3 V) d9 Y7 P) [* n B) S) v - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ C) b( Y# T8 l5 G* L# d9 U
- * GNU General Public License for more details.6 P# `! y& c0 o2 b$ t9 O, q' H( F. p; e
- */
% `5 ~' |& H% g8 G# l2 ]0 Y, F+ z
1 Y$ e( y% x9 E8 R6 M2 Y- #include <linux/module.h>
+ t& N/ t/ h# f9 @" @# \) Z7 F - #include <linux/init.h>& t# e0 q9 m1 P0 C, ]* h1 U4 c
- #include <linux/errno.h>
% k9 z. X, o) X - #include <linux/types.h>9 J4 H1 o0 J7 w6 k; S+ n4 P+ O. F
- #include <linux/interrupt.h>3 X7 }3 M/ d2 |3 C
- #include <asm/io.h>' L/ I! `# U& r9 i4 w
- #include <linux/moduleparam.h>
) _/ L+ f# b" p' j$ m - #include <linux/sysctl.h>
, h2 x7 H" A2 b+ C& I3 b9 l - #include <linux/mm.h>$ n% Y, ^5 ]* K% j2 S" T7 i. q, [
- #include <linux/dma-mapping.h>
4 G( S" a! U7 I0 B# W - ; x2 @! `. n1 L6 v3 \; w1 G
- #include <mach/memory.h>: J5 {6 |% r6 L( V0 `6 I( y: r
- #include <mach/hardware.h> u- Z4 i3 i& M, |1 ~3 H& |
- #include <mach/irqs.h>4 X: o6 R- t6 h! o0 S0 \) w6 }
- #include <asm/hardware/edma.h>
6 W1 g! v0 U* q0 H( z! f3 O n. S
7 V( p+ z$ J9 T7 H6 Q- #undef EDMA3_DEBUG. K- X% ~' b+ n+ C5 f6 E+ X6 Q
- /*#define EDMA3_DEBUG*/
& P& l1 ^0 n/ N. x5 k4 b( _
. ], Z. ~- _& g" E, K1 e0 p+ Q- #ifdef EDMA3_DEBUG% [7 O# `4 j" @3 X6 E+ \' l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. z, K0 c2 d+ t! \7 ]: E - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' \4 v5 q1 c* N1 n+ k2 u! Y# {
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ z9 D3 _* k6 i G+ ^ - #else0 f: Y* `; S3 Z) {+ N0 X7 @4 Q
- #define DMA_PRINTK( x... ). l2 s. ^) x2 @% v" W
- #define DMA_FN_IN
2 s* H" S9 m' E0 n5 ? - #define DMA_FN_OUT4 [4 A) r* d$ z3 }, F- l0 ~/ \ ~' [
- #endif
|" y, o& o/ Q, y$ D! W - 3 W2 e+ ^, r$ I/ |0 I
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' c4 l b; _! p& o
- #define STATIC_SHIFT 3/ o+ n& ?) e$ D6 u; Q
- #define TCINTEN_SHIFT 20
' U+ \" a/ G5 |' W2 g) h% y* z - #define ITCINTEN_SHIFT 21( ~( g4 E7 B; k5 T5 x6 C
- #define TCCHEN_SHIFT 22
8 W! `1 \3 X q: o% ]+ D - #define ITCCHEN_SHIFT 23+ e4 _3 A4 b# [7 P' ]8 O; a2 [4 n
- 9 r, l, S) B, Z# D5 K& c
- static volatile int irqraised1 = 0;7 N# V3 Y2 i. ]/ ?9 t* @7 l% i
- static volatile int irqraised2 = 0;
; f/ j7 b* [" k9 y7 m1 Y" D
8 P( J* E4 ]; e: R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 [- v1 u6 I4 k8 w% r
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! X* k9 u: S, ]5 C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 h% A5 b* X$ X, N$ o- |+ w
G6 y0 z+ ?% Y9 t( p( W4 ~/ X- dma_addr_t dmaphyssrc1 = 0;4 c8 M3 b8 j e6 j
- dma_addr_t dmaphyssrc2 = 0;
; z& }! D- ~+ Q" T5 Q% Z5 T3 l7 X - dma_addr_t dmaphysdest1 = 0;
3 \( N4 M# x0 K# T0 K - dma_addr_t dmaphysdest2 = 0;. }3 b S+ F8 p q/ ?
- 9 i' h# G/ ]2 v; _3 u! e
- char *dmabufsrc1 = NULL;" H5 B. d- L i9 P: d7 I5 o0 L
- char *dmabufsrc2 = NULL;
( R! T: \0 y' B { - char *dmabufdest1 = NULL;; @& M8 C* g6 E- q2 X
- char *dmabufdest2 = NULL;" K+ N. Y8 t' y4 m6 n. b$ ]
( e' J# F5 C# u- static int acnt = 512;
4 t4 V" y! i# \; k& J4 d9 D6 Q }7 ]' q - static int bcnt = 8;3 o: x# Q& k5 s. x
- static int ccnt = 8;
; A& V4 b' m, \4 V( o
5 n; ^( j& z3 @9 g) a. L: M, R- module_param(acnt, int, S_IRUGO);
' R x C- d- E- Q7 c3 }& n - module_param(bcnt, int, S_IRUGO);+ V6 o( S3 |7 t! l; W& D9 ~" {. U
- module_param(ccnt, int, S_IRUGO);
复制代码 ! }2 X1 Z$ ?, l
* X0 v+ H, P! ]0 B, |% g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% N% Q2 p- |) _% @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ X, c; G4 r/ r: J 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 @6 T; U5 r$ H5 q4 N
2 F- W3 W/ S. {& m5 L( ]% d
0 Z, g% D: u9 H+ @6 v |
|