|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 k6 i* Z f5 H1 O! @
- [code]EDMA sample test application6 |* O& }' k2 U; J; @9 E0 `& v- G
- /*; e# q: _1 n) R0 D; u
- * edma_test.c
, P7 ]# R+ k1 I+ _* x! } - *! I: C ?. P$ s! z, m# y G
- * brief EDMA3 Test Application0 R/ i8 S. v2 x u
- *
/ N6 u8 ]9 e3 j( I' H1 { - * This file contains EDMA3 Test code.( I3 k* a; u8 N: s+ _
- *
) {* J- O& A3 T. h& D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) F7 u+ M9 {2 u n9 |/ u
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# v) x H8 } U! \ X
- * TO CHANGE.
- H3 I" o2 j% F8 [# L H' M, [ - *! M# M+ Y. p! y" i6 v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 i7 S0 j2 m0 G9 O! Y& y# A) `
- *
1 I. _- ?- C) g$ d* o - * This program is free software; you can redistribute it and/or
$ z4 n# W" P) F3 C0 s - * modify it under the terms of the GNU General Public License as: O4 X3 `7 }; o+ a: @
- * published by the Free Software Foundation version 2.
+ R4 Y3 i9 Y7 z! S$ ], x* A5 U7 A - *+ b q% ]1 u: _1 J% |# E) j N
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 a' c1 Z) O6 d8 m2 k! J
- * kind, whether express or implied; without even the implied warranty1 w* _- h* _+ I
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 z( ~7 ~8 z) [3 K, { Z - * GNU General Public License for more details.
0 f2 d. Q, J7 B. o - */! D( D0 u- \% ^3 K
- 0 m j* m5 j. c1 H
- #include <linux/module.h>7 q, p9 A5 | ]& J0 ? |1 u2 I, N; y
- #include <linux/init.h>- s+ {. n/ O6 n* y. G/ C
- #include <linux/errno.h>
- N( A! ~1 d% d2 C - #include <linux/types.h># x* l8 p( d# Z* G& Q+ T3 e
- #include <linux/interrupt.h>
" f& P K U- c3 A - #include <asm/io.h>
1 v) D8 l/ |& f# X0 x - #include <linux/moduleparam.h>. ]% W, f) T! T {8 U+ G
- #include <linux/sysctl.h>
m2 d, L! c7 K1 i: G+ t2 ` - #include <linux/mm.h>
7 R0 E1 n6 S5 Y: J3 b8 o - #include <linux/dma-mapping.h>8 A8 Y' T7 C7 P' \8 ~
- ( [6 W; Q0 G& f, E
- #include <mach/memory.h>( `& {- i& T+ M4 S' P' N8 }2 g4 w3 d
- #include <mach/hardware.h>
( v7 g% R) T2 H9 A+ N, d3 a4 I - #include <mach/irqs.h>
- C. k2 U" R8 H$ a, { - #include <asm/hardware/edma.h>2 ?5 k" S2 ^: j( R, \+ Z
2 Y9 \' M' l/ H1 {- #undef EDMA3_DEBUG
. ]5 H- Z% J A) S - /*#define EDMA3_DEBUG*/' ]9 F0 P9 [- U' K) V+ z6 Z \
- " P9 w+ j1 H% o6 S" o( A0 P+ K
- #ifdef EDMA3_DEBUG( L. m9 }) K0 @1 a5 z+ F
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 D; H4 u) A7 S6 Z0 d
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 a* V' x& F7 Z3 [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 a1 {/ Y, A& K# ^8 X/ i0 D/ h
- #else
' N/ `" k" P0 R2 X( w - #define DMA_PRINTK( x... )
3 a+ Q& Y- M5 ~" z% g - #define DMA_FN_IN
* R/ Z" ?0 y' x/ j4 y1 O+ ? - #define DMA_FN_OUT* T% h& i8 n7 h8 U8 J" ~8 A, a
- #endif2 A% B7 B, b$ x/ H( E& B) \
- 4 @& ~$ l0 Z X B. A
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 ~/ Y$ N' d+ F1 K% V) L
- #define STATIC_SHIFT 3
/ E+ B7 h: \3 Q7 @( t0 a - #define TCINTEN_SHIFT 20$ Q5 n: Q& }8 f& |' q+ W$ y4 K
- #define ITCINTEN_SHIFT 21- |" ?/ w% R0 h( I
- #define TCCHEN_SHIFT 22
) ~- z* Y" C: i; _1 E( i - #define ITCCHEN_SHIFT 23
$ }9 X. T5 M" H' ~
6 S- y) d6 p6 K& W1 j9 n- static volatile int irqraised1 = 0;
( R, l' w: O: ]6 g5 I3 _ - static volatile int irqraised2 = 0;
% h0 I6 t: k7 ^0 _ Y A - * b' z1 `5 J& Z! T; T+ J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 x# W7 h# M( ~
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ j ~, o: _6 u& H, L; H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 }6 d+ g& y4 J: D# x( e. f5 G( w - ) X6 `8 w$ i3 V# ]
- dma_addr_t dmaphyssrc1 = 0;
3 b4 i# K! S6 U - dma_addr_t dmaphyssrc2 = 0;
1 z2 Y( K+ y T5 r" ^9 W# l - dma_addr_t dmaphysdest1 = 0;% X+ G( N, L# V8 r% f% ]# }
- dma_addr_t dmaphysdest2 = 0;
0 |- i7 |; n0 b0 X
- }6 m! h9 Q' N5 z& j* k) l- char *dmabufsrc1 = NULL;' x1 _, @1 z/ Z4 Q) p
- char *dmabufsrc2 = NULL;
4 |8 g) X4 ~% Z" X& y9 C - char *dmabufdest1 = NULL;8 x* |) C! Z( C, r
- char *dmabufdest2 = NULL;
$ l9 y+ z& ^5 b: f( g& \0 U - , c# Q: ?5 Q. W8 y! z
- static int acnt = 512;
- ]3 d3 u$ Q' m0 K* J# b6 s2 K - static int bcnt = 8;
7 s" C1 \9 l, N2 O - static int ccnt = 8;
2 I4 `+ P/ X- h v# Z9 s
6 ?. M: ~ V. q9 F+ k- module_param(acnt, int, S_IRUGO);; `) I2 W4 c0 ~( i+ V
- module_param(bcnt, int, S_IRUGO);
6 Z1 ~6 h/ w- K; s w, D" K0 D - module_param(ccnt, int, S_IRUGO);
复制代码
2 `* d# {. y, p% _: U5 n% w" H, q+ z6 f+ {/ Q4 [( b
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, S. H; M9 ~7 _2 e% m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! i) X+ ?& c( C/ j( d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" B- P% F: J9 R! H; f
. e4 R# r1 ^: x) ~. [
2 j* I$ G: Z+ e; ^ |
|