|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 G- R3 j+ g4 J5 @* }4 h
- [code]EDMA sample test application
$ t# X5 n, D6 P( Z/ q; F - /*; g5 `3 [2 k) @# z. l4 V
- * edma_test.c1 c0 l- p; [1 A$ T" V7 C9 ]4 V. V
- *
s0 [5 r3 f/ I, Y - * brief EDMA3 Test Application
! a$ Q9 h: e( {# w4 w6 I$ q - *' i1 h( a0 ?$ C
- * This file contains EDMA3 Test code.
4 a2 x# ~/ z7 Q+ \+ y6 ~- ^ - *0 n: S7 m0 ]. F6 e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 k1 U& d- w6 X1 C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 J) E% t. e8 @ U1 D7 r, s: a! x& b - * TO CHANGE.
9 M% g/ v8 `* z$ a; x) `" x. b - *3 X& n' b5 k3 ~
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; E) {' n* `7 J9 l/ {4 \# K
- *4 L8 @! [. \1 _) O& s! u
- * This program is free software; you can redistribute it and/or5 Q$ p) U# C1 ~1 M: q8 B
- * modify it under the terms of the GNU General Public License as, Y g$ b/ h6 d4 G# N+ M
- * published by the Free Software Foundation version 2.
/ V. ? o; X5 L" E: i0 y - *2 d9 a! v% v) E, i3 k- [+ [
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ R6 |- R1 `' H, J+ Y - * kind, whether express or implied; without even the implied warranty% N- W+ u1 I1 X: k% h) N- {0 ?
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% e7 o2 \; D0 h- z- }1 A. B! E; v U
- * GNU General Public License for more details.
! u: r! M, K0 ^" g. x - */
4 g& E) P$ ]: j& X) F6 Q; o - 7 q- d& _$ i0 i( V# r- }
- #include <linux/module.h>; n9 _% ^ Q2 r8 w7 }
- #include <linux/init.h>0 i, M& Y( s X: \$ U# @0 Z
- #include <linux/errno.h>6 y- M4 j& u W$ j
- #include <linux/types.h>* g( u9 E2 d: S4 b
- #include <linux/interrupt.h>
5 `. t, ?( n4 `7 P - #include <asm/io.h>
, H5 Z( u! z1 ~% V$ @8 j. [ - #include <linux/moduleparam.h>( X, d3 y" T [) N$ D
- #include <linux/sysctl.h>- F, y w( J9 C
- #include <linux/mm.h>
1 [4 k# J4 N; ]1 _ - #include <linux/dma-mapping.h>+ k0 s5 x7 L' V. U
# n- t# g/ l' g! [6 G* j6 X, c3 L- #include <mach/memory.h>
8 y g8 z+ b# H* k0 M - #include <mach/hardware.h>
" `1 x' b. {& u7 R j# N - #include <mach/irqs.h>
, y2 F5 V2 b- ?. o - #include <asm/hardware/edma.h>
# @/ r( {# Z1 L$ H7 |, h - 1 i a; T2 v8 o6 w8 B
- #undef EDMA3_DEBUG3 U, {& k# X1 M1 |8 Z0 s5 g. W
- /*#define EDMA3_DEBUG*/# F: l7 L3 x |
7 _3 y/ C; q% }) d6 K% @/ \& }& U- #ifdef EDMA3_DEBUG
- T# A/ j! m) I; x/ G3 b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 \5 q6 S; ]% C; d
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* |8 M" S) g% q$ `% h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& L& v' C; _0 M: u! T/ y% p( o# L
- #else
/ M4 i) X- P. m( b - #define DMA_PRINTK( x... ). V' P& r5 O% y3 h$ t6 ?: v4 ?6 w
- #define DMA_FN_IN! w' c0 o' ]4 v3 Y3 ?
- #define DMA_FN_OUT
$ {; s. b, [6 U# h0 f - #endif6 j0 J! x9 N/ {8 B, ]
% c# c5 U0 V% a' K/ I# ?; m- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ Z& n; ^1 V* f7 T( o s. z - #define STATIC_SHIFT 3! b& g. S9 N) I# Y1 @+ P
- #define TCINTEN_SHIFT 20
: F0 J# G9 ~( H2 R3 d+ g - #define ITCINTEN_SHIFT 21
' g$ H3 z: `/ c3 X - #define TCCHEN_SHIFT 22: z: ~0 U3 i3 B3 \ e' b
- #define ITCCHEN_SHIFT 23! e# U1 {, R, a" H* F' F# G
- 9 Y! h' Y8 j, I
- static volatile int irqraised1 = 0;1 @" U* G2 e R; W. L) } M
- static volatile int irqraised2 = 0;4 ^* K# E; g7 P% N2 x3 y
1 ~ L5 p2 O2 U5 a9 u$ h0 P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# Y, g9 v! N i3 ~: x - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- X1 ?) I7 s6 V8 n& o" W+ ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: n" I1 ?7 A1 r* }
- 5 r& m, y" h8 I0 a7 f
- dma_addr_t dmaphyssrc1 = 0;
8 r4 E @$ K( A; U' D - dma_addr_t dmaphyssrc2 = 0;
) T5 d% Y8 e+ H ?9 O7 y - dma_addr_t dmaphysdest1 = 0;: h7 ~4 @2 @; D; G" K% M
- dma_addr_t dmaphysdest2 = 0;; T, {3 C3 h( w; }
- + c/ _; J6 J8 H: D- Q- q
- char *dmabufsrc1 = NULL;, w: e+ Q7 R! g9 C. t9 E) @5 |* `
- char *dmabufsrc2 = NULL;
( Q G- v. W7 \4 \7 I - char *dmabufdest1 = NULL;- \7 d# |5 d4 ~5 a" b
- char *dmabufdest2 = NULL;
+ `( D6 `5 U4 u4 B) n/ K1 L! I
* F- M8 E$ q9 Q- static int acnt = 512;
) j& h0 j, i; T' R. ~ - static int bcnt = 8;
/ z+ {. C) m5 h; {8 ? - static int ccnt = 8;- a/ x& k1 h* X# Z
* L7 L4 E" ~ G- module_param(acnt, int, S_IRUGO);+ r' _4 V3 b6 M
- module_param(bcnt, int, S_IRUGO);3 J9 L# A6 X/ W" Q# t! ~+ ?
- module_param(ccnt, int, S_IRUGO);
复制代码 $ ^4 X" S$ D9 s: p. o" `& e- a+ e2 k
5 ^. E: _+ U% P% ?8 H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 v9 z/ g) Z4 Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. k/ \# b- y( w& A, I
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 C" l( I3 I, M# ^6 P/ r/ K3 g- V; a. Q
0 {, y) w+ M/ j) h6 O' K |
|