|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" P% Y7 ^ b0 E3 H, ~3 D- [code]EDMA sample test application/ B# Y; ~# d3 K7 u. u3 {
- /*
- g. u& ?& X; j9 D. Z7 P' I - * edma_test.c
; W3 C6 s2 @- D7 A8 v - *4 W4 \ M$ Q' V+ o
- * brief EDMA3 Test Application
- ~1 \0 |2 v4 H; i+ J4 v7 a - *
" i# M+ Z5 A! O5 z! R2 o1 ? - * This file contains EDMA3 Test code.
# H1 E: C" O* X0 }' O2 c - *! Q- }! V' d- y3 X5 o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 E5 r$ y0 u8 E) ^+ M, s5 j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 ?- ?1 t: l" p# A) n: i - * TO CHANGE.
. m% c8 l$ s. n$ } - *
; x2 E- o0 b5 Y; d - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 h; N9 G6 ~: N6 G# v
- *) k; s; W4 B7 m( f
- * This program is free software; you can redistribute it and/or# i! Y$ k3 C+ ~
- * modify it under the terms of the GNU General Public License as
8 g9 Q, Y4 G7 M; i - * published by the Free Software Foundation version 2.
% M p0 t1 d: q! T - *
$ f, M6 b& o1 ?7 o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! V9 C$ K9 J2 o' P$ Q. i" F - * kind, whether express or implied; without even the implied warranty/ l. S J3 q' F% P$ U( G7 X/ F/ `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 M; o2 f j/ m! `4 i$ x
- * GNU General Public License for more details.) n5 h/ z. S# W' \! f
- */7 @ v! ?& L) K& W6 e# r6 w5 d
- 5 Y( d$ D( t& J$ d
- #include <linux/module.h>
4 r. U+ t4 S. B- z; x - #include <linux/init.h>
. o" G* e5 V# O9 h - #include <linux/errno.h>* o% V, E7 p6 l' a$ |
- #include <linux/types.h>: g" P! J0 `& p: n' X }( Z
- #include <linux/interrupt.h>( J. o1 W: ]% L" J+ j
- #include <asm/io.h>! U8 Y7 A' ?, T
- #include <linux/moduleparam.h>
3 x# W; h0 V/ c% G: z9 g9 j3 I+ U- w - #include <linux/sysctl.h>
( l; I; y b x* p7 D% R - #include <linux/mm.h>
" t8 F/ M( z4 V" E/ v - #include <linux/dma-mapping.h>& _4 R- z" ~1 l: D! V x [2 D
( t( \& k3 g1 u& f- #include <mach/memory.h>
) K" }: V$ d& ~9 W @ - #include <mach/hardware.h>
& R3 A$ l9 H& `2 w - #include <mach/irqs.h>7 r& a: ^$ m) o. B
- #include <asm/hardware/edma.h>
1 P5 b- N; W' G0 l) @( d5 a8 P
% r u% T$ ?# {# r ]5 u3 S- #undef EDMA3_DEBUG+ F2 R0 v, O/ V3 x$ n
- /*#define EDMA3_DEBUG*/
" R( @( ]7 s- K L; Q
5 Y" e" f- b4 }+ }/ k- #ifdef EDMA3_DEBUG
! E" x m" l; P) X9 x. \ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' Y# a: k* n2 |! v4 ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( o& T, Y: A' N! U+ N4 R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 O) E$ f, y) ^/ G4 F9 Z+ Z - #else
+ W( e. A8 K% _1 s+ d - #define DMA_PRINTK( x... )4 E. C) D7 \/ d9 L
- #define DMA_FN_IN
# j4 c3 L' ~# P6 _! i. N, r - #define DMA_FN_OUT+ b3 C/ J% m, v
- #endif& A3 Y6 B6 s1 ~( Z, W; v b
- / j/ w/ _! U3 E! Y i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ t+ O6 K7 v: Q2 v2 l* o - #define STATIC_SHIFT 3
c& R7 d6 _; ?1 w$ q - #define TCINTEN_SHIFT 20
/ p; j+ y9 g$ C, T8 x& [ - #define ITCINTEN_SHIFT 21
2 n- s% Y! N+ [4 u - #define TCCHEN_SHIFT 22$ y0 ~ z' k% W$ Q
- #define ITCCHEN_SHIFT 23
, v; U+ D' }- \1 T7 e6 l# W - ! b$ b+ r6 K5 E1 j# O& C3 _
- static volatile int irqraised1 = 0;
) Q! d! c3 C6 z - static volatile int irqraised2 = 0;
4 M7 i# t; V. D6 D
* o" t# r. Y% t8 C1 Y; J7 ~% S% g- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, x* o9 W" ~/ S9 _5 B2 L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) a6 e. W+ M% D. [! C" B
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 |, \+ \1 B% s3 _8 y - - e) O! U4 ?& P( R8 @' F% F
- dma_addr_t dmaphyssrc1 = 0;. J( ~( _2 G6 _; E
- dma_addr_t dmaphyssrc2 = 0;
0 l$ i2 i8 f4 @ - dma_addr_t dmaphysdest1 = 0;3 h2 D) [3 p7 k, w2 [" [
- dma_addr_t dmaphysdest2 = 0;% G) a- M, W: B0 F2 m: o
- : D7 ?/ j6 e9 b o$ i# P [- f( X
- char *dmabufsrc1 = NULL;8 J4 b: T( U9 v1 I
- char *dmabufsrc2 = NULL;( i. n& f, u* [5 L
- char *dmabufdest1 = NULL;: T3 V) r T6 Z
- char *dmabufdest2 = NULL;
1 U/ p$ ^+ O h; Q+ ^ - n/ @& S; x5 ^. o; m, O7 ^
- static int acnt = 512;3 I2 I/ g) j ^* d) n2 S
- static int bcnt = 8;
& s" n. }& e6 L+ R8 L1 i7 b - static int ccnt = 8;& g6 J; P: D. `7 O7 b# w- B
7 K! M' O7 Q9 M* k7 ^# w, N- module_param(acnt, int, S_IRUGO);
3 n+ P& v% p+ E5 p* n - module_param(bcnt, int, S_IRUGO);. K: i" u& p% c$ R3 O/ D8 _
- module_param(ccnt, int, S_IRUGO);
复制代码 ; E+ `" U; r& e
& }0 O4 p' o' [# z: [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' S$ Z; T, B# }+ b% g3 k/ F3 q! z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 [& _+ g" K7 W
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" B# ~' L3 v9 b. J5 R4 j
( z. L* u. h, n
% W4 S: M- l) [0 b( t* F& u* u$ L$ }# S
|
|