|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" s4 l0 I+ V7 Z5 j* a4 I) B- [code]EDMA sample test application
7 Y; p, t! R. l( c. c - /*" E$ |1 R2 ?/ `2 ?; J+ N2 x
- * edma_test.c
% B& C1 G% O/ Y; L" u - *
; n6 L/ @ q% ~/ W7 Z1 s' |$ Z - * brief EDMA3 Test Application
; n/ C& C% r# u& V3 q - *( R8 M- U9 w7 w1 t: o
- * This file contains EDMA3 Test code.+ e% r( @; q6 i3 g
- *
8 y0 \9 `1 u; M& x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 f; a& s4 ~! j* ]
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ @+ w6 }$ \) z( Z: Y
- * TO CHANGE.$ t5 ]) J! ?0 A$ e3 N3 j. v
- *
- a X- K$ f, [4 G( V" t* U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// o# x6 K. Z, a+ P
- *
0 l+ q' C6 N0 P* z4 F B - * This program is free software; you can redistribute it and/or$ V h- e$ K2 x' \
- * modify it under the terms of the GNU General Public License as
1 b. [& s6 c+ J - * published by the Free Software Foundation version 2.
; D$ V' z1 W% w - *$ c r3 A/ z: A! v( b2 ?8 J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 {" B9 U' p4 M# i - * kind, whether express or implied; without even the implied warranty
8 H3 {+ K/ b* F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 q" ]# t! e- O i7 B* A4 Q - * GNU General Public License for more details." X9 \0 O. ^* H% i, U# b
- */
a: e- h5 F* n) @4 t+ m - e( `' y& \! \. L' B9 T0 D/ u
- #include <linux/module.h>
( [, G3 ?" r& S6 e l - #include <linux/init.h>: R% L) }+ Q- S7 r; h
- #include <linux/errno.h>$ A& S" k, v( J9 i' Z$ e7 b/ u
- #include <linux/types.h>
( P7 b& X9 f2 b' j* \ - #include <linux/interrupt.h>3 j, }( N% G) ~9 n) t& y/ @4 ]8 ]
- #include <asm/io.h>
. T% v- |: H8 E" `$ B3 z% B+ _ - #include <linux/moduleparam.h>9 T) _+ b8 \# S' I2 K% C. J
- #include <linux/sysctl.h>
- L8 Y8 }2 V" i6 i$ k9 A, j- S - #include <linux/mm.h>
' u3 W5 D6 U- \2 |7 K. N% h9 j - #include <linux/dma-mapping.h>; o6 `2 B v7 O3 B+ |* S5 I
@: q8 E' H0 j! @7 U+ Y+ g- #include <mach/memory.h>* U4 T* J- a8 C3 Q6 _7 [, L
- #include <mach/hardware.h>2 J3 j5 ]0 N) T* C9 H
- #include <mach/irqs.h>
}7 y, B8 d$ \ - #include <asm/hardware/edma.h>/ C4 U6 R/ G. b% _$ B8 _
+ ]9 v6 Y+ n3 v& ~2 J; p" J7 u x- #undef EDMA3_DEBUG& E, |! S, ?+ o% j: _9 p
- /*#define EDMA3_DEBUG*/
; _8 r; ~/ a6 Y# J0 S - 2 n% X& m7 _) t* h& q0 x0 l) H
- #ifdef EDMA3_DEBUG' h' w9 }- q: m9 Z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) I2 x! p3 [, p0 ^2 f$ a _) f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# W% u9 H' M: ~6 { - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ f+ K7 ~3 i) [7 V( q - #else8 e T; E. s6 ?! M6 O9 f3 Q, k* {
- #define DMA_PRINTK( x... )+ w: C! z3 d: \
- #define DMA_FN_IN4 i! I" ^8 W$ z) R6 o6 W1 Z% o
- #define DMA_FN_OUT# F M5 d7 d7 e9 e
- #endif+ b$ r3 ?9 i. g8 z5 b
- # O' d& [3 U2 n# p+ D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, X Y5 y. ]& n9 J1 B - #define STATIC_SHIFT 3
& {2 J' J% q* j( Z - #define TCINTEN_SHIFT 20# j* @/ ~5 @2 i
- #define ITCINTEN_SHIFT 21
* T$ A0 A# x; @. x- o% g( D% { - #define TCCHEN_SHIFT 22
$ w, M3 x- v z - #define ITCCHEN_SHIFT 23
! H/ L4 a- v+ ` - . e, z6 X S: a9 M8 J
- static volatile int irqraised1 = 0;
2 F/ [4 A& U: X; R+ H7 E - static volatile int irqraised2 = 0;
: `$ w" }6 m2 |9 m2 \+ `" z
, G% w+ n, p1 N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 X- P1 a9 _, D; [) _; s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 w% ?. d! Q. f3 R - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ S% U/ e( W6 ?
' }$ K9 O; L% g- dma_addr_t dmaphyssrc1 = 0;! x4 V f, F1 v9 ?- @1 m% x2 f
- dma_addr_t dmaphyssrc2 = 0;! D6 I) j, r4 x# U
- dma_addr_t dmaphysdest1 = 0;5 Y" K7 B% w6 _7 c" H' U
- dma_addr_t dmaphysdest2 = 0;2 a. E( D# s7 V
- * H" }0 ^$ m( G$ P4 o) z+ O
- char *dmabufsrc1 = NULL;" E! c5 { j3 P9 _& ?- ^. A
- char *dmabufsrc2 = NULL;
" u. \* p& f. n7 Q# R7 J2 w' i - char *dmabufdest1 = NULL;# F& ~( e( G# t/ l
- char *dmabufdest2 = NULL;# `5 Q+ F/ A3 U* h3 m( M/ K! }
/ p3 _ M: N% B5 j- static int acnt = 512;- M: y% U1 L2 y; d. {
- static int bcnt = 8;8 _% a% \3 E* `9 S
- static int ccnt = 8;
; J$ p' B) B' h5 M - # a, b9 u. j* [
- module_param(acnt, int, S_IRUGO);
/ k8 t" E1 U+ N+ |2 ^# o - module_param(bcnt, int, S_IRUGO);4 O# \8 Q5 A9 n* h, O
- module_param(ccnt, int, S_IRUGO);
复制代码 + Y; C. A* u( K; W& p; O- ^
, k8 z- ^3 u7 D6 R! h) o7 r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 G1 R, a; `% X9 O+ q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# R' A9 [0 u, k% u) p- d% i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 ^) {4 z/ L5 |1 N3 `' j% k* c' @3 Y1 e% o; T& l: p& z
' f; N3 _" ]8 |5 G
|
|