|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% `1 I( l6 P) i$ j$ A- [code]EDMA sample test application
. Q3 D6 a% m8 r/ d - /*; u/ I/ S6 X8 s5 x
- * edma_test.c
9 u% n! z: L9 ~: P4 i! f( `) N - *
2 F8 @ w4 a. ?; ]& e* H$ }& _ G - * brief EDMA3 Test Application5 A# [. I) c2 T* R# i' X% r
- *
; m: b. ?& k! G% R: i - * This file contains EDMA3 Test code.
9 J! r$ N ?* X. A! i - *7 g! i8 _, `) A" \1 y* A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 V+ B; L- M0 \8 K: C. k2 s" n# m
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 Y5 S( ^) {: a
- * TO CHANGE.
' @. G4 |3 j+ T. R" m/ X - *
# @) b1 W8 R# @& s3 |% ?& Z7 P, N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 L+ I; G9 L9 d; U! `
- *8 g/ G+ c. S' v* F
- * This program is free software; you can redistribute it and/or7 e1 b9 l1 f) K2 z3 f, d
- * modify it under the terms of the GNU General Public License as) z. J9 k" D7 h% E
- * published by the Free Software Foundation version 2.
0 h# V4 l3 } P3 ]0 r# f& ^ - *
# {* f# o* o# q6 g; E# e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ z! w A& D: y3 J8 H: x - * kind, whether express or implied; without even the implied warranty
7 ^% ~+ T1 z2 G+ H- h1 @6 I* f5 R - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. U! O9 M% U' X2 C" N
- * GNU General Public License for more details.- X5 Z# i$ ?9 d- [9 Q! j; b8 h. f
- */: g' Q/ b B% ], Z3 s
3 w; o. P( X: w: P7 F- #include <linux/module.h>- g5 s! t+ J8 \# w" J
- #include <linux/init.h>
* L0 t0 `% Z8 C' D7 _0 b, R - #include <linux/errno.h>, c- U( T+ q$ m* ~
- #include <linux/types.h>
. d) R! {! r5 n3 Q - #include <linux/interrupt.h>, g. D: O. W0 ~4 B- ^ Z6 |
- #include <asm/io.h>8 y0 l: E6 t: r5 [% B- U
- #include <linux/moduleparam.h>+ g+ f2 d6 F+ l8 Z8 G
- #include <linux/sysctl.h>2 J; [# k8 h/ S; h. z9 |) G. m
- #include <linux/mm.h>; y: u4 S0 t% i2 K! _
- #include <linux/dma-mapping.h>8 ] Q; x) ` \7 ~+ v( w' ^/ n" w( o
3 |2 H( a5 i: H+ B: Y; e5 U" L- #include <mach/memory.h>
' z9 K! K' Q: q0 P2 ~7 s$ } - #include <mach/hardware.h>
% G5 Q! U6 r" z$ v( @; W c5 b - #include <mach/irqs.h>
3 r- r6 S2 {2 p( T3 R8 j - #include <asm/hardware/edma.h>5 R) S7 T; k) f' j' ]
- * x# m0 F, M) e1 V( B1 r# _
- #undef EDMA3_DEBUG
- S. H0 R& d6 F ]: f+ ] O7 R - /*#define EDMA3_DEBUG*/
4 ?# ~9 y! E, C; E$ A - 7 i/ M( r) o J G
- #ifdef EDMA3_DEBUG
# c' F* O/ m' K1 h9 z- R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 F, f) e+ n( W3 A5 U7 \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 G8 |" Y* ]4 W/ d3 Z, k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& e/ j& i! D+ V6 R7 l
- #else: d$ R' ^& {5 n4 k0 m5 J
- #define DMA_PRINTK( x... ). x$ o8 v- ~) `" u) ~
- #define DMA_FN_IN) U% j, y' X9 e: I. t' |6 s! e
- #define DMA_FN_OUT6 x" s% y0 n5 S# M1 T" I7 i E
- #endif
/ }- Y Y: t/ P2 M" W/ W
+ _; p" C* {+ h7 W' }- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 p' O, m& t0 G
- #define STATIC_SHIFT 3! ~, Y* S6 \- F
- #define TCINTEN_SHIFT 20! a# ]6 _' d( R; r! c
- #define ITCINTEN_SHIFT 21
) O* E( j* b! Q - #define TCCHEN_SHIFT 22# ]+ D& R, D$ c4 U% n' e5 e; P5 o
- #define ITCCHEN_SHIFT 230 p9 y7 Z0 Q& K- E' o& ]
" @. q+ K# P8 I7 m) {7 `. l' ]- static volatile int irqraised1 = 0;5 X, n5 Q4 p; h' L4 w9 G$ c0 W3 [
- static volatile int irqraised2 = 0;
9 }7 O& m: S: J7 }6 X
+ C+ H8 S: V- x! u8 d4 A# @8 w7 \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 c; @3 Y7 f b8 _3 D- b1 ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ m1 X3 g# v! m - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, ]" c' p& }. f8 ]5 ~7 }0 B
# W4 O/ F. N0 V r- dma_addr_t dmaphyssrc1 = 0;9 M. O& @7 P: a% d9 w
- dma_addr_t dmaphyssrc2 = 0;8 B) Z8 b8 k2 C% H& g. v& ]' {
- dma_addr_t dmaphysdest1 = 0;
' X2 v6 B- U" F4 l8 M# B - dma_addr_t dmaphysdest2 = 0;
9 s/ M+ u/ }4 X* m" X' I3 Z - % u7 H: l( S+ o8 ~1 @6 B2 A
- char *dmabufsrc1 = NULL;
$ x2 z- D) `7 G$ F& E1 l - char *dmabufsrc2 = NULL;: l+ T5 N1 x ]! n3 W
- char *dmabufdest1 = NULL;1 Z/ h) N6 O5 J" g1 a
- char *dmabufdest2 = NULL;, Q" i! ]: K! j$ v; t
- 0 W; C/ G: w# x( ~( c
- static int acnt = 512;
s9 D! H4 u* ~1 _2 C# g i' d/ } - static int bcnt = 8;
! V6 t6 v, w2 z& y1 X - static int ccnt = 8;
! A2 Y% p2 D7 ~: I
2 j" T( v6 ~8 H- module_param(acnt, int, S_IRUGO);
2 `; H( g1 _+ x! c7 H( M - module_param(bcnt, int, S_IRUGO);
: x2 `- O, b- m6 C- N$ e9 |+ a - module_param(ccnt, int, S_IRUGO);
复制代码 . W( A% i6 A6 I# R) S; j
0 @8 {" W8 \$ ~9 @( }5 L9 u/ R! |4 W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 s) G" Y4 @# 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( H* D* \/ N6 h3 d 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% @% E7 U$ \# ^/ ~' a$ {9 e- v4 x+ {
* X" _/ A: w+ {( ]+ ~
|
|