|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 i+ e0 c/ k# b% N3 P2 e; @) X- [code]EDMA sample test application! {7 ]2 J6 A! g9 `1 e! ~
- /*
1 s" Q/ L' J7 _; T, ^+ w3 T4 H( z- j - * edma_test.c" O; l- B) o, _0 G4 X# a5 `! d" o( R: d
- *
1 Q, N/ ]) G; C( m" J - * brief EDMA3 Test Application/ |! z1 m3 k% `6 Q1 y% I
- *9 t9 X5 i. B# |' ?' ^- i$ o
- * This file contains EDMA3 Test code.
# K' B$ s$ [# U2 Z* i) _% [" @ - *! H3 \% L# |" o/ l9 A O( T8 q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; T, r$ K8 q# A8 B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( o/ f4 w8 `# W0 ^3 R
- * TO CHANGE.& g7 i3 ?/ x$ l
- *
+ @, _0 e/ }9 M$ b& ~ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 U# t6 `( d! U% D6 T3 i
- *) I6 D1 z% |% _) u: i
- * This program is free software; you can redistribute it and/or
: O/ ]% N- ~! w- M" h( i: O - * modify it under the terms of the GNU General Public License as: l( n, X+ J0 x' p) `2 h
- * published by the Free Software Foundation version 2.9 d; m& E( ^2 M* D
- *' W8 P+ N- E O2 M. q1 z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) [1 U2 K* `2 H0 h# G- `# A - * kind, whether express or implied; without even the implied warranty
2 F2 D# O- Y/ U1 Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# Z# H$ N! _4 A \6 a$ H - * GNU General Public License for more details.
" ~1 k2 G$ ?, b3 O! P - */
/ F( ~' o, e5 |4 F) K0 J" O - 3 [/ J0 U* |+ `& k i4 z" b
- #include <linux/module.h>/ M) [0 {. R' G3 M
- #include <linux/init.h>9 m* ^! q3 M8 Q
- #include <linux/errno.h>
8 w8 g) V* j& x% ?; M* U3 } - #include <linux/types.h>8 P. v: X* H, |9 O
- #include <linux/interrupt.h>
6 ^" f2 x' i# ` I5 I - #include <asm/io.h>6 j1 _% q7 y, B
- #include <linux/moduleparam.h>! y2 Y. M r# V; E: @4 @0 a( v2 d
- #include <linux/sysctl.h>
, J4 Q$ Z, b4 _& ] - #include <linux/mm.h>
0 ?9 U* h( e$ ?9 ^! r" `/ R5 h3 v - #include <linux/dma-mapping.h>! }7 t# E# y7 K: \ `2 |
) n: I0 Z. T0 h% C- ?- #include <mach/memory.h>
3 F# w# ^2 |2 j - #include <mach/hardware.h>. y1 a4 J9 e) @6 ]$ B5 S
- #include <mach/irqs.h>0 v8 }8 j( T+ d- F d* a
- #include <asm/hardware/edma.h>
3 F+ [6 R$ Q7 M - / J# m% ^4 u2 _4 h0 S$ ]
- #undef EDMA3_DEBUG9 R' e" n' L$ m E. B# I
- /*#define EDMA3_DEBUG*/
1 l! |7 D$ d" F3 j( ~ y
3 _6 b2 i7 w( P# u9 L* G- #ifdef EDMA3_DEBUG
* f/ ~! _% z9 V, `% e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ A8 V& j6 A6 M8 K8 X1 I7 O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ H8 O% ?3 R+ {
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; [* L H8 a9 q! l - #else+ g, \3 m3 D9 d. E$ e: d" D
- #define DMA_PRINTK( x... )# V. [# b( a1 H1 I4 m. G4 I+ ]+ ?
- #define DMA_FN_IN9 r, K% r2 q" F8 ~: b) u( |
- #define DMA_FN_OUT
- K$ u4 ~* x3 I1 O$ e - #endif
8 m& k& a) t' t, _
9 h* W. F, n; Z% }- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ s7 |9 p+ O# y/ s - #define STATIC_SHIFT 38 Q9 j" H( m* C" ~, W" k3 _- R
- #define TCINTEN_SHIFT 203 l' T! Q3 Q9 K2 B! d) _
- #define ITCINTEN_SHIFT 21
0 |2 Y: O2 b! r2 U3 J9 W/ x; D% a - #define TCCHEN_SHIFT 22( F* Y+ J! K1 f* z0 _
- #define ITCCHEN_SHIFT 23
# s, [- B7 _( ]2 z1 p" O - , `" K: D3 w: [9 \6 K# A" E# W
- static volatile int irqraised1 = 0;
" N' X2 ]! [( Q& Q - static volatile int irqraised2 = 0;, x+ d2 x* Z2 }0 N* R3 q
) z8 E. q6 @) O3 A4 ~1 i' m T6 n- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ N g$ a" Q- B* A3 F3 O) B1 ^( Z u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 K' X; r1 G" C2 B \6 Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ z- E, v( j4 \! l9 D3 F2 C
- 1 z3 S4 S8 B% [! k# o* S) h1 v
- dma_addr_t dmaphyssrc1 = 0;
) N9 J9 @/ l, ^/ Q3 u+ } - dma_addr_t dmaphyssrc2 = 0;5 h+ M0 C6 M' ]" i
- dma_addr_t dmaphysdest1 = 0;
9 u V! Y* V: x0 B8 n/ R - dma_addr_t dmaphysdest2 = 0;
; D9 j- U6 ^% S6 ~8 ~ ` - , t: U% _# @3 J7 K( e& X
- char *dmabufsrc1 = NULL;7 y/ n& Z8 J& f+ u: S [! K
- char *dmabufsrc2 = NULL;
# r) h/ D3 v" U( R4 b. i2 M z - char *dmabufdest1 = NULL;$ ~ }/ ^* ~8 V, A0 O+ a; Q6 J
- char *dmabufdest2 = NULL;
/ `9 q, D ^/ u - 7 f' y, f4 D' u- o: K' d# Z1 W
- static int acnt = 512;) H) E$ Z- a% k' U! }
- static int bcnt = 8;# D! I6 ^4 z$ S- {1 }
- static int ccnt = 8;4 _- A0 o) y V
- $ p; Z8 r0 z7 W
- module_param(acnt, int, S_IRUGO);
- i" b8 ]% s- p* ^ - module_param(bcnt, int, S_IRUGO);- b. f# k5 W6 m0 v9 N+ i; H! }
- module_param(ccnt, int, S_IRUGO);
复制代码
4 k! s7 \6 v! ], o: k+ n
" G; n3 q+ f# d# }* u7 [ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 O- L7 x1 o6 C# [: \% a4 c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 C3 b: h$ E E- `! M
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) V; |7 h5 L7 r9 N& M& y1 |; F' u7 }9 [1 J4 L- P7 D4 H. N% D x6 T' [
- ~, n- Y+ b0 _ |
|