|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 K4 t; Z$ v6 n8 G* y3 W5 d- [code]EDMA sample test application
. l, _% a3 F0 v8 m' b7 g6 b - /*# T9 a4 f" `7 [8 J+ p3 c
- * edma_test.c. g4 E% W0 j8 O
- *2 D7 Q( R6 D- N w# q
- * brief EDMA3 Test Application" T( Y, F; V- U4 u
- ** c3 g, H5 O- |% E5 [
- * This file contains EDMA3 Test code.
/ c' s# M7 B. ~4 Z8 W0 N - *8 L9 j% E% ?$ m( X, ?% ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* Z% A* @8 g4 u# [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" P9 L1 s, [: a$ G7 T& @% L
- * TO CHANGE.
; x* f- D1 h, E5 q- B, \ d9 o - *
9 H; ?6 X1 U/ d2 F& O8 i ~" X - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, ^$ _* e; t; @2 P0 J" q/ m; b `
- ** a. }0 Z7 H# ]
- * This program is free software; you can redistribute it and/or
. o' P, H5 J% z" V - * modify it under the terms of the GNU General Public License as
- {+ c# W3 i, Q" t1 \ - * published by the Free Software Foundation version 2.
! M5 t6 t: @$ L% G- F - *
% a2 T1 C/ l! `* ]0 R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# q9 L+ Z. F9 G - * kind, whether express or implied; without even the implied warranty3 @9 x9 f; \+ O: R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ W/ K. @% K4 | z i! @1 N - * GNU General Public License for more details.
% d3 A: r, L/ y6 i7 \; r - */7 K" u& _' r, p) c
# E2 e& J# _; w+ ]6 D) Q- #include <linux/module.h>
5 k4 v' ]' i% ^; u" k, s* W - #include <linux/init.h>
$ n$ i1 E0 K& f9 V. A% i0 R - #include <linux/errno.h>- V4 \: z( z" [4 N# L
- #include <linux/types.h>
7 x2 k5 N/ _1 P7 n& N7 p - #include <linux/interrupt.h>
7 b8 ]$ O+ I. A# R9 a* N - #include <asm/io.h>* t0 {* p9 y3 t# @# g' S8 L+ Z
- #include <linux/moduleparam.h># x0 l' z3 W' ]/ `- [* k! n9 C
- #include <linux/sysctl.h># ]/ v$ J# K3 w' M; C# r& B
- #include <linux/mm.h>
# i) I$ w# i, ^: G - #include <linux/dma-mapping.h>
9 C- S1 L& e! q( a9 {" A
* Y+ J* I0 O4 M! m" ?4 R- #include <mach/memory.h>
9 }5 @! c# N8 [, f - #include <mach/hardware.h>
& `( `, x$ n; {0 K; ^6 p - #include <mach/irqs.h>: I9 ?6 g0 v4 q6 i- V3 f
- #include <asm/hardware/edma.h>
. |# p$ K; ~/ d* M7 j: V9 Z
; z6 V: R0 ?. G) ~6 q- #undef EDMA3_DEBUG
4 s! m0 v7 \& O# h - /*#define EDMA3_DEBUG*/" x/ M: d7 I' ]+ u
$ o- ^7 t: F9 @1 m& P- #ifdef EDMA3_DEBUG
; v7 f; D* {9 F; g* R- b5 R5 @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% B3 k8 E% z! Y# u' V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), e# Q& x0 k: T$ H2 {: \
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 _5 R/ z: _& [ z - #else* u# K! l+ d U6 l8 a
- #define DMA_PRINTK( x... )
8 _; F' E% Q( j2 R - #define DMA_FN_IN
* u+ W* F9 _% X' E5 J - #define DMA_FN_OUT
+ f+ F( d1 c5 G) _" [1 m - #endif2 m' Z; O) F; |% }9 x# Z
- 3 k. T2 e8 j6 e; R
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' ]8 Q H2 K$ @ w - #define STATIC_SHIFT 3
1 p$ \7 r: l6 {0 z3 e - #define TCINTEN_SHIFT 20
- g8 \: G9 g5 i# ?. b - #define ITCINTEN_SHIFT 21; u2 O. F2 n" o" e$ v) e0 x
- #define TCCHEN_SHIFT 22
1 m1 z1 Z1 j) o - #define ITCCHEN_SHIFT 235 `# v7 n) G$ O4 v( r
- , R* J! r3 A9 P5 O2 |/ a/ J
- static volatile int irqraised1 = 0;1 p2 N4 J T* k, D( q1 G
- static volatile int irqraised2 = 0;
* S8 x G: P ?
; v5 M8 J, Y* b- q1 r- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
C& T; Q1 }- f. e% r3 h# E7 Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ~( X8 e. t# Y" c1 T- y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 O. ]) y( i. k* u: t% U8 l6 A
4 ^0 U' }5 d$ o) H5 a' |* k' J$ q- dma_addr_t dmaphyssrc1 = 0;" A% b* c6 F, {7 [- i: M% R
- dma_addr_t dmaphyssrc2 = 0;* } ?% K: h' t7 C- n9 y( \. @
- dma_addr_t dmaphysdest1 = 0;
5 p" t" q" e2 k$ S: @* ^ - dma_addr_t dmaphysdest2 = 0;
) b1 @, n! C7 a0 e. E# v0 ^4 C7 H& ~ - - Q+ B. o$ `9 I6 d a9 D# {: s
- char *dmabufsrc1 = NULL;0 T0 q9 r8 L n8 [' u2 Y
- char *dmabufsrc2 = NULL;0 }- @% O4 u4 s6 g
- char *dmabufdest1 = NULL;
( y1 C9 N; [8 T% f' _, _2 o3 Y8 C) ~ - char *dmabufdest2 = NULL;) h. x1 @8 [1 f9 W9 C7 y
- - G' S( t+ u; z
- static int acnt = 512;8 D* \% t1 q: V& L: q/ i. ^/ Z
- static int bcnt = 8;4 H; i. K. ?& G6 H: D9 X
- static int ccnt = 8;- e( ?" N5 Q7 J% Z/ C* W
- # u& [ w; L$ W
- module_param(acnt, int, S_IRUGO);8 F, |8 G) ~6 J3 X/ X
- module_param(bcnt, int, S_IRUGO); _8 S$ E! t; Y
- module_param(ccnt, int, S_IRUGO);
复制代码 6 @' [/ R! }/ k" G, Q) Z
, f0 O3 ~6 J2 o \& z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% n" h a% n7 Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' l$ f$ |: e* R- \8 Z- x( p! F
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! B- ~, @. x+ }1 D! f6 G- `1 K
- l( Y* J! \! l( Z- F2 C
, w' X" p7 k; j- }, W
|
|