|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; C+ r# w, |$ W3 t
- [code]EDMA sample test application8 a! ?/ h# p3 b+ U2 Z' }
- /*
& } f. F6 }% O9 v( J. o - * edma_test.c
+ W; Y# z% i$ M4 W; i/ B5 X5 I0 a - *
T0 k' l" ~) t+ I9 l - * brief EDMA3 Test Application
2 _0 Z z6 R- l8 ^. r& ?' Y8 \* H - *
0 L3 _0 D5 Y) K0 A8 J5 b - * This file contains EDMA3 Test code.8 t2 z0 T5 e# g" S. k+ \
- *# E9 v4 [! w& [$ O2 _& t' t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 e& \# T/ m8 b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* V( W- N4 _6 n/ w' v" f, Z( G - * TO CHANGE. y9 F8 }" C+ E; a/ l
- *
4 u8 s' U& n5 \7 |) F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) o3 m b% x# J# c - *
% ]3 O7 s6 `4 u; g! D+ V - * This program is free software; you can redistribute it and/or
' g* V% Y4 D& E7 o$ v" ?, g& j - * modify it under the terms of the GNU General Public License as# a7 `+ `) l, l1 b7 Y( F+ b0 c
- * published by the Free Software Foundation version 2.% C& o9 Y" l5 _* Y
- *
2 O% R1 |) V7 X5 v% E \ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, J: ]& N G8 H: f
- * kind, whether express or implied; without even the implied warranty) s( W" V' V. @' W
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ s) Q8 Z6 s7 [
- * GNU General Public License for more details.& y2 g4 _8 V7 h3 C
- */' S0 t" d4 K1 n; ~- U
- 9 ?; b3 K+ l" G+ T( `+ v& N: w1 Y1 I& `
- #include <linux/module.h>9 X. @) z: c* ]' F7 l
- #include <linux/init.h>" v0 ]/ h* s7 J& w
- #include <linux/errno.h>
8 [; H0 E* P# e) I, F - #include <linux/types.h>
6 w( K3 w" D* N2 L7 K( b7 o - #include <linux/interrupt.h>
% V* R8 V0 p! q4 Q4 Q - #include <asm/io.h>
3 r7 b; i4 A) L! v7 k4 t- D - #include <linux/moduleparam.h>$ N7 A4 D' p& o! C
- #include <linux/sysctl.h>
' B+ R& G! o/ O4 e. k: q3 I. K' f* I - #include <linux/mm.h>
% @4 U' x6 @9 u$ B$ P" a4 m& I* { - #include <linux/dma-mapping.h>
& J: R, p/ v- D/ X X
) G/ G% F, q% b- #include <mach/memory.h>0 x C/ S2 q- k% J2 \; Z
- #include <mach/hardware.h>
1 B& ~9 J% y" @+ W - #include <mach/irqs.h>7 [% x, h& y( |. X) v/ ~, a7 G$ g
- #include <asm/hardware/edma.h>- z* q" R3 P9 N/ ~- G3 R
- / _& n1 [3 W, @) j: p: s+ n+ J
- #undef EDMA3_DEBUG
8 t% `9 _' F: v" A" a* g8 Y: D - /*#define EDMA3_DEBUG*/9 e; T# F( W# M4 L- ~
( x- A/ M" C8 P( k2 `2 s; i. V* X- #ifdef EDMA3_DEBUG( G) d7 |! p6 p0 g& E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* i B4 m# ?- q& ?; s+ [3 g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 E1 v8 l" `, i3 @+ d4 r- w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ s$ {+ d7 S4 M5 w/ s, k
- #else
) N$ @5 w& z* V - #define DMA_PRINTK( x... )
9 D* Z; [3 c. Y7 D) A* ? - #define DMA_FN_IN
* o: W( ?1 _* d3 V - #define DMA_FN_OUT! ?& H4 k% w1 f8 \
- #endif1 `+ e& ^4 [: z% [7 W2 T
- + [% e- }$ s8 U; R: u2 A: A ^
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 `+ F6 K: W. w; w, ~9 R) d; Y
- #define STATIC_SHIFT 36 `) F0 r; H2 ?$ p
- #define TCINTEN_SHIFT 205 n @2 i- w, b: @
- #define ITCINTEN_SHIFT 21
! A# K# U; n5 Z: ~9 Z/ ` - #define TCCHEN_SHIFT 22
5 p9 G2 J: z9 Q& i4 l0 H4 v; [$ s - #define ITCCHEN_SHIFT 23
0 l' V& ?+ |1 m- q/ o
# G! y6 D/ @ A+ V, c/ Q* P7 y- static volatile int irqraised1 = 0;
8 c0 q1 D% Z# p$ [ - static volatile int irqraised2 = 0;+ I" p: h Y1 g
- ' P8 P) C( X) S, n2 U; c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 i) W* G& m9 W; ?' `# w
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ r5 t o3 N* N3 s, L5 t, B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 }4 q, F/ V7 ?! ^3 o
- - _: w0 u3 G1 D, N" ]" K
- dma_addr_t dmaphyssrc1 = 0;
$ L+ X9 B' P t, T9 h" L - dma_addr_t dmaphyssrc2 = 0;- Z, ~$ k- `% u6 `
- dma_addr_t dmaphysdest1 = 0;; k* r. J& w4 c; `' I) G2 y/ v
- dma_addr_t dmaphysdest2 = 0;
4 e0 H' j2 _4 i' m7 x - ; B+ T6 a7 |$ \
- char *dmabufsrc1 = NULL;
% Q2 V; j2 z, _* F4 V, d+ z - char *dmabufsrc2 = NULL;
: Y0 I3 u2 j0 k. q3 R. e& H - char *dmabufdest1 = NULL;
3 x0 L! z9 l: @ y3 y - char *dmabufdest2 = NULL;
2 H3 h3 x8 `/ {3 j4 e
: x- M8 Y! Y& ~' S; ]6 C- static int acnt = 512;
* o% ~7 E- T/ T9 p - static int bcnt = 8;
! Q. Z- p; E: }% D' o* I - static int ccnt = 8;) M3 H) B. w# f/ k8 q0 O
- R& K( y7 q0 v$ z; m/ s1 c/ `
- module_param(acnt, int, S_IRUGO);( Y' [+ q9 }, a( `* Q' @) A
- module_param(bcnt, int, S_IRUGO);# E9 ]3 P/ j# s" E1 I3 n
- module_param(ccnt, int, S_IRUGO);
复制代码
4 G1 H- x! v$ z V! R
; K, \; ^8 t w9 B 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" F" B- O S, e' j1 a3 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# m- j& l& i4 T; e. X+ P6 V# a+ b& c* l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& R; v+ X7 y) T9 ^) T
- b2 K; G7 ^- n
" a/ b$ K& r6 `! [% t8 ^# e. b5 Q |
|