|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! H( i5 r/ T! W
- [code]EDMA sample test application
. B# W. w, H7 @, k6 _ - /*! E' {% N1 b* Z
- * edma_test.c
5 c& ^0 ]% M- h+ N( Z7 u7 ] - *+ V$ Y1 t g6 J# w. [
- * brief EDMA3 Test Application
2 P6 r- b0 @- Z" R( ~2 V0 t - *
# N8 b: }0 ~- O' o# a: r! S- w - * This file contains EDMA3 Test code.
* ?2 _4 X# ?* f& i - *! u$ O* w3 k) V% \+ Y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 y1 w( }* K1 J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ ?' n( O2 |2 R# I) |$ u - * TO CHANGE.% ` V% w5 c1 R3 T# x7 V, X' a
- *- _* A4 o, h: s' @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) o8 o! d$ Q4 w: a2 Q) D! S - *
8 z ^ Q7 D1 y; x; j - * This program is free software; you can redistribute it and/or
. m5 W. H$ _# C J: T2 k+ K - * modify it under the terms of the GNU General Public License as
: L& U a4 ^" ~: i5 a - * published by the Free Software Foundation version 2.
- w s, I, ]; G& y# F. g - *
7 J* e& s% E8 Q/ X( j - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( W, n0 _4 w% V9 Y
- * kind, whether express or implied; without even the implied warranty
{) ]; ?6 u u6 c9 H: C" ]; h - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ F: K3 J- s# `; }
- * GNU General Public License for more details.
J! |6 o1 Z( Q6 f1 S C2 \. d - */5 @9 _' R8 m( R% t5 I& [
8 X( k" X0 w' v" \8 h; [- #include <linux/module.h>
2 o7 }1 c! d A/ l0 r - #include <linux/init.h>3 K$ E3 D* `, F0 r
- #include <linux/errno.h> ]% f: {# e- N6 F
- #include <linux/types.h>$ r" u: k- n. G' S# U. G% K8 b) A! K# O
- #include <linux/interrupt.h>
/ S8 j9 K4 u" H2 q0 T - #include <asm/io.h>5 e6 d# w4 u! G6 T3 |
- #include <linux/moduleparam.h>
6 V; u% v0 g: x - #include <linux/sysctl.h>
* ~, T: H: f1 n - #include <linux/mm.h> A8 k: k2 ?+ w' N$ _
- #include <linux/dma-mapping.h>9 }: ?! y; Z# n+ B( d$ k6 e6 T
' B' _/ _3 {3 Y6 Y3 I: B- #include <mach/memory.h>
$ o( D( y) f6 x3 D% z* R; h - #include <mach/hardware.h>! g S! L) `3 O
- #include <mach/irqs.h>, h' E! b9 I1 @' N
- #include <asm/hardware/edma.h>
7 `: d) I8 v6 g4 Y N h% L - # P3 K: M2 y1 c' x; o6 g9 T
- #undef EDMA3_DEBUG' Q5 b0 g5 X6 D- H
- /*#define EDMA3_DEBUG*/- n- d0 q5 ]7 K' k, R* k! ^
- + g1 V; D5 m; D. [. O- S
- #ifdef EDMA3_DEBUG- o; o% H i! V" E: v' R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 q7 ]% W- T! s( T - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 j1 |7 s6 i) S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 C# z3 P6 n7 c+ N, C - #else
/ u# A* u. X1 B3 X - #define DMA_PRINTK( x... )
0 v2 z: @, ~* ]: w; _5 e - #define DMA_FN_IN0 e" r3 i; j3 p+ j0 |7 d3 ^
- #define DMA_FN_OUT Q" s3 }, S ]( n6 B8 Z. S
- #endif* X( F' V! Z# l# D: ?+ N
1 e; ]! L' R1 G$ V- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( H" @7 f2 M) J. J3 i+ |
- #define STATIC_SHIFT 38 f: J/ Z Z: T
- #define TCINTEN_SHIFT 20* P( r& I: e d7 A' T
- #define ITCINTEN_SHIFT 21
# B2 e- h5 F- } - #define TCCHEN_SHIFT 228 X, k" N( J( p8 Q% H9 [3 B" `3 u. i2 D
- #define ITCCHEN_SHIFT 23, _- G9 p/ \2 e M/ {
- + C) I2 s' [0 H& u; d' j
- static volatile int irqraised1 = 0;9 `) @: i( c* E
- static volatile int irqraised2 = 0;! l3 z; d/ X+ L- w& J
+ ?# j% T! x2 f( j0 O$ X6 S- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); Q+ c8 i' b/ M1 Y3 D- k
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; }3 z* U; g& i; x; b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' U& l& m6 |& {2 c2 ?7 a
# D+ `. n2 d' \5 f- dma_addr_t dmaphyssrc1 = 0;! y9 Y j1 P% w. N1 }9 v$ m/ v5 \
- dma_addr_t dmaphyssrc2 = 0;
1 v5 z1 v1 L; k. c5 M - dma_addr_t dmaphysdest1 = 0;1 w2 i4 F" [3 K/ b7 [2 {
- dma_addr_t dmaphysdest2 = 0;
. _' U9 O0 J$ w& O% S
( Y- @/ B* W6 H2 M/ h( h' \- char *dmabufsrc1 = NULL;5 V% d+ b1 H& j
- char *dmabufsrc2 = NULL;
, ^, g* J$ a4 S0 {$ | - char *dmabufdest1 = NULL;
) l' y& _( b2 p - char *dmabufdest2 = NULL;( S2 g+ n& v: ?% F$ M
- * g9 a$ a( i4 L0 v
- static int acnt = 512;
& n6 D$ M+ m/ r/ U5 Y) P q - static int bcnt = 8;
: w% l; O- U# ?' R Q& u - static int ccnt = 8;* y; e* y4 x4 f' ^7 k
- , _. c. u. G/ U# `$ A2 H) P
- module_param(acnt, int, S_IRUGO);
9 p4 y# c% H8 Y1 i* D - module_param(bcnt, int, S_IRUGO);0 H( F* l. @2 J7 A- x
- module_param(ccnt, int, S_IRUGO);
复制代码
8 {( k) |3 ?% ^' M+ B
7 k7 b1 E% y5 @ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! W1 R2 k5 v l; n0 G( b1 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; ^: e0 i9 G. |* W; F" p/ ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ f$ |4 S4 N1 { A3 N j L: G) k1 g7 R+ L' }9 }9 F) y. d
& L) Y: M7 x7 G3 n9 T |
|