|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: N. V0 ]4 o0 r. H ?4 |) l- [code]EDMA sample test application0 z0 r( E$ ~) r( C) t; G* `0 s* U
- /*
& ]7 F; @0 W# s - * edma_test.c
/ j/ U9 \/ d. Z2 B' z4 V) Q - *5 f' F4 @5 z5 }3 q A& Y
- * brief EDMA3 Test Application
- Q/ Q! `% M3 D0 l* ]8 p- w' n3 { - *
^, \2 I# m; ~' L - * This file contains EDMA3 Test code.
; o, e1 E/ p j# K: ? - *
3 u1 ]# f7 z' R7 K+ Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% y7 \& D' ^6 K/ G: ` - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' o l/ _: D6 | - * TO CHANGE.
- h1 @+ Q J! x) e& d+ J' e - *8 p1 v% [, j& h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* l0 `8 @! W+ y+ u& |4 \" K
- *0 ` ?1 @) Y d: e
- * This program is free software; you can redistribute it and/or$ W: U, {8 w/ t& h/ P: G" s
- * modify it under the terms of the GNU General Public License as1 ?* I- j( P6 v# A
- * published by the Free Software Foundation version 2." x# M# I% P+ c
- *0 G& E5 b/ O; O7 j
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 S* w0 M# q' \: L" {3 n - * kind, whether express or implied; without even the implied warranty
' O8 s0 D3 V5 x% |& C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* ?) {# j4 E0 d' ]* ?
- * GNU General Public License for more details., B7 C6 v7 v* }. g, \. m' T
- */# v. g& ?2 |$ U
- 2 n. J) } l" a# v7 S
- #include <linux/module.h>
8 E6 o) r0 q2 Z \; M - #include <linux/init.h>* A" }. h- p, r2 W0 g" H
- #include <linux/errno.h>
' H# m# x; {/ Q - #include <linux/types.h>3 v9 U4 m5 Z/ l) ^' E) a
- #include <linux/interrupt.h>
8 {7 g" L& J: c/ C. ^+ H' r; y - #include <asm/io.h>% g0 {: @6 X7 B0 ^. M3 L& B- M
- #include <linux/moduleparam.h>7 \% r1 E. e9 @- \. b; j
- #include <linux/sysctl.h>
: o. C6 k6 Q0 H2 u K - #include <linux/mm.h>
7 \' k2 n/ [+ }$ s - #include <linux/dma-mapping.h>* h5 r8 @5 [; T7 f6 ?
- . k7 {/ p! V3 M! {( b
- #include <mach/memory.h>9 E3 Y. `% f+ D8 _( @: K& }, I
- #include <mach/hardware.h>5 Q, ^* w7 X3 P/ V5 R( c' S
- #include <mach/irqs.h>) w3 k3 x4 f: x/ \1 n* k
- #include <asm/hardware/edma.h>
$ B$ N2 u- p5 @: z' x2 n/ w - 9 v* c3 `1 |+ G2 e6 @0 V
- #undef EDMA3_DEBUG
0 p4 i4 w2 J5 ? - /*#define EDMA3_DEBUG*/
9 F0 N! n2 {) O& h7 f# w - 4 c9 D$ E4 {: ?8 y! }; H% G
- #ifdef EDMA3_DEBUG( i9 o, {1 |% B. U: g$ _0 a0 w# A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 @/ T/ b2 G8 e, o5 M9 M$ r9 M' y* \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" r/ k/ D$ i, `0 i$ z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 R7 i# H- B4 x" z9 y8 V# s6 F5 A
- #else
& K/ Z3 H6 Z" w' U* N7 f5 W - #define DMA_PRINTK( x... )) u& b' Y" z- y6 E
- #define DMA_FN_IN& K7 l3 P+ \$ V
- #define DMA_FN_OUT
; k$ V! h" [8 g9 L9 L% n - #endif* ]4 X5 \4 |$ o1 S
- ' k0 F! ?3 D. u8 C! L3 I
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! `/ ]. \- b8 O3 ]: p
- #define STATIC_SHIFT 3
7 a M0 n' a' z& L. i( M$ P6 o - #define TCINTEN_SHIFT 20
9 k+ t7 f1 W3 c4 X - #define ITCINTEN_SHIFT 210 F' Q# Q, }3 V2 D2 I# z8 Q
- #define TCCHEN_SHIFT 22" ?# U ?* e2 N2 I
- #define ITCCHEN_SHIFT 23" a* a# q9 N+ E t/ i0 f+ b3 T
: O% t. J+ t( t: x' b! v- static volatile int irqraised1 = 0;$ e$ I2 s; c& B$ v9 }- }) B( Q0 Q
- static volatile int irqraised2 = 0;
) m& \+ o* J( i, t* t - ' i6 p) [/ q; d3 U* m1 T: a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ w' f3 b+ ~0 G* f; l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ P+ ?( T. o9 z, f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 l, o* f5 X2 I8 y5 N7 _7 g- J- a
* ^0 P* `& M# c' \6 i6 ?- dma_addr_t dmaphyssrc1 = 0;
- {6 v& g* ~( U% p0 | - dma_addr_t dmaphyssrc2 = 0;/ s+ Y7 ~0 V, F) P' U9 o! r
- dma_addr_t dmaphysdest1 = 0;
0 i! I9 Y7 T4 d# r2 P - dma_addr_t dmaphysdest2 = 0;) e" ~( ?" l: X" O
- 2 M1 @1 i4 X4 q9 j7 U1 ]- Y/ C5 j4 N% N
- char *dmabufsrc1 = NULL; j0 p: a$ @& i/ y2 B
- char *dmabufsrc2 = NULL;
% c% T: k: z' f7 ^# u( k# z - char *dmabufdest1 = NULL;
( M. o1 u$ v9 T( i2 _ - char *dmabufdest2 = NULL;3 x- o; E" J" `" r0 `
- F$ D- p, i5 \6 D/ h- L* Q# Y
- static int acnt = 512;
5 V/ X: Z0 y$ i' ?6 ~5 q - static int bcnt = 8;: {! L1 m+ w1 a+ G
- static int ccnt = 8;) P6 ]) `0 }1 m9 G) ?9 l
, s/ g6 d* X, p H4 B5 S- module_param(acnt, int, S_IRUGO);& M0 t2 b G' H" ?
- module_param(bcnt, int, S_IRUGO);5 g( K, J- W0 E, F
- module_param(ccnt, int, S_IRUGO);
复制代码 5 N) L" v2 c7 d- K) e$ D% ]3 L
/ G1 W, ^* \) m' J+ h. r3 m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 {2 X v" i, ~3 d3 a% k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 d% w- Q' s# _3 O8 }/ K) s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ p7 |( d# Z8 S. n& \. R
0 X+ c2 }0 \+ L7 W4 m* S; \5 j" Y6 m' h8 G3 U' C
|
|