|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 l# Y$ P0 P) M2 D
- [code]EDMA sample test application
4 W2 V! R" b* z+ x7 Q9 P8 L - /*
* k" G+ X( i' V8 W - * edma_test.c' \- c A6 l1 i
- *' [5 b& j7 v5 q* w7 `3 r& C
- * brief EDMA3 Test Application
9 ~+ T% |5 p6 z' I. D5 y D - *1 k& \. A. E& S0 D" H" b
- * This file contains EDMA3 Test code.% }! y( N& j, s7 Z( g) s/ `$ I
- *6 M5 S& q; R+ C- f, _/ j& x% ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: [4 a) Z# E0 K! _! p, n/ U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& T0 p4 F3 J! X2 ~8 F - * TO CHANGE. o6 Q0 Y$ k6 e$ t" g! e7 m9 b
- *
* N5 k; f) ^9 U+ i! _% u# ^- i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: T' i5 y5 x9 P5 \6 k* g' d - *
9 X4 L1 i: @$ I+ Z+ s7 `$ Q6 D - * This program is free software; you can redistribute it and/or% ?) }+ z4 `1 B$ o: j, I1 |5 t
- * modify it under the terms of the GNU General Public License as
2 z. e+ C$ l$ P0 z8 I* C - * published by the Free Software Foundation version 2.
5 R1 ~/ A3 Y# w. D - *
+ Z% F8 k* l: V5 y6 C" m0 O5 C+ h - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 f+ N2 ^2 @; \! w - * kind, whether express or implied; without even the implied warranty
5 {, a# E9 r8 p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 E, |( q% x& d9 K8 i/ `
- * GNU General Public License for more details.
3 M' C9 c$ F' u4 d2 J - */
# L3 y' p& y9 r, }: e, e6 q - ! M1 W, S2 y6 @0 }4 T4 u
- #include <linux/module.h>; J4 ~/ h( z4 V9 q8 a' R
- #include <linux/init.h>
% @" @ W/ l4 q( s - #include <linux/errno.h>
F( e) \9 e5 ]& R9 M' t: \ - #include <linux/types.h>
" V% a4 i6 O. |& h1 o% |/ E+ g - #include <linux/interrupt.h>
5 D- n1 M* S% L: b" H0 h6 w - #include <asm/io.h>
, @9 T- e9 e( b* R! @ - #include <linux/moduleparam.h>9 e4 U0 e" o. d" E4 K. E3 {7 C
- #include <linux/sysctl.h>
. e, k# t8 e: d: G. g0 `# Q - #include <linux/mm.h>
3 Z( G- z- c8 T7 P0 n# ^ - #include <linux/dma-mapping.h>9 _) \/ }4 |( ]1 J
- % @5 }5 |- W Z i4 {5 \' t: k
- #include <mach/memory.h>
/ w( d, @/ x# d* f0 F( N - #include <mach/hardware.h>4 r) y/ D3 P" [1 K: a
- #include <mach/irqs.h> \: Q% y' X6 [6 A) d& B+ A. T
- #include <asm/hardware/edma.h>
1 B+ m$ [9 D$ P" m2 e - 6 C. N" C5 [# ]* H
- #undef EDMA3_DEBUG
5 {2 Z. K4 J- K/ Q; [+ u - /*#define EDMA3_DEBUG*/& {4 `0 ?9 E# V; f" b
- 8 l/ W/ i) C/ _% Y) `: \
- #ifdef EDMA3_DEBUG/ C w- G0 P6 i/ x2 c$ u: Y0 y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 g, l% I; w9 n - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 e( s! O! s" q/ \/ ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- k" ^, y% U( }3 S `3 Y. Q
- #else7 E: E: c" D5 L3 W! d
- #define DMA_PRINTK( x... )
0 A1 @* w1 |6 ^' V# } _* l - #define DMA_FN_IN
% [! M6 G0 z' R" P - #define DMA_FN_OUT
- m4 j! P& k) r! u - #endif1 ?5 j7 e7 u9 S/ e& J% y$ D
- " S# |0 d$ b# X) E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! K1 _* I8 }; l5 Z3 u
- #define STATIC_SHIFT 36 h' b: x2 `$ ^: \3 o! p4 k
- #define TCINTEN_SHIFT 20
0 V2 Z! p, e, b) {6 t+ @. H! b - #define ITCINTEN_SHIFT 21
/ a* D9 R6 L' M9 W& H: Y) Z3 M - #define TCCHEN_SHIFT 22& z& Z8 t6 t2 p1 Y
- #define ITCCHEN_SHIFT 23 X: x: s6 H( E" ?2 _# S. u
- ) _7 a/ P# L, [% g! {
- static volatile int irqraised1 = 0;
5 k A: r) T( ]; [ - static volatile int irqraised2 = 0;
) N9 R m) y% W/ I. c3 l - & M6 @+ X: Y8 l. k( w- ?" c% K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# J0 I l/ y7 c X8 K# a - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ |. E( L/ A( s; s6 p. P O - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ c" Z/ `3 `# f) X! a. ?
+ a- u# M+ I" B$ y/ w9 o( ?- dma_addr_t dmaphyssrc1 = 0;! d( U. C2 g' i) P$ E' G
- dma_addr_t dmaphyssrc2 = 0;
6 v4 J% ^1 i* x# ` - dma_addr_t dmaphysdest1 = 0;
! z \( @" e. u. [- |! |2 G - dma_addr_t dmaphysdest2 = 0;
# Q, L4 H& m, v' @9 |. y - 9 v/ G: v% I2 P
- char *dmabufsrc1 = NULL;
( L+ d1 q3 d6 N - char *dmabufsrc2 = NULL;
' i6 o2 E3 r; p5 H! Y - char *dmabufdest1 = NULL;
: G% O; N6 m2 y% N: F; i - char *dmabufdest2 = NULL;! f, g9 M0 R3 V
+ H! |( S6 o* T- static int acnt = 512;# ]+ U0 C( g! I) ^; H
- static int bcnt = 8;
6 c/ O6 a3 _7 b. r. F - static int ccnt = 8;
1 P: ~/ j1 N9 ]$ K
" E; w; c) ]' p9 c6 d+ H/ H- module_param(acnt, int, S_IRUGO);6 }- g# q9 g5 |( m) g
- module_param(bcnt, int, S_IRUGO); s( j1 y6 w G4 e) O8 d
- module_param(ccnt, int, S_IRUGO);
复制代码
7 z9 q, s* Y% J* B H1 U3 \+ \5 E/ A
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% V0 S# A, F! _6 t* Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 O- R. U5 @" m# g- _7 q6 C9 D' C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
K5 q! G3 h+ i8 R3 x# r$ S* g7 z0 B- q6 c
# j8 y+ Z) T- v9 g3 } |
|