|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 i" t; \, D- n" Q; F3 M% D- [code]EDMA sample test application
* M; p4 {. k3 ] - /*4 F0 A0 I9 P- l5 r& u
- * edma_test.c4 @$ ^$ U. `/ T& ^
- *: g6 n2 \: S$ W8 T: c8 F4 }; ?: J
- * brief EDMA3 Test Application3 N; w" h6 K \+ |
- *& B3 S% D% a) ~ T
- * This file contains EDMA3 Test code.( f, t3 M5 O M% Y' k
- *- l+ j, W5 v' m" l: j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 k" f# Y' n# Z- ~ ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT R {) q( P- j2 w* h
- * TO CHANGE.
. {& i4 e h$ h5 \# C - *4 Z0 M7 `* R8 F$ K B7 V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* b- g% P3 \: _* K- M
- *
4 m1 E( e2 q0 |' L2 q9 W+ \: M - * This program is free software; you can redistribute it and/or
) u+ K j5 d' Q1 k - * modify it under the terms of the GNU General Public License as1 f" i" I) ^2 P' v, x3 ]5 x
- * published by the Free Software Foundation version 2.* K5 ^( l4 R* D! V4 `
- *
1 R! r/ y5 V- u( V, t9 o& d0 W( C - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( e& f7 D. R) v# J
- * kind, whether express or implied; without even the implied warranty3 M6 v9 W& o& ]
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 z% k( k$ x. X" d; K, ~" X$ k
- * GNU General Public License for more details.2 [1 M0 L" p6 @8 |% O1 a+ a, ^
- */2 b& _2 B! a% f1 O
- ! H' p) i0 ^: x# E) J6 h( t
- #include <linux/module.h>
7 V9 `/ c/ Y4 N - #include <linux/init.h>- e' R: m( f7 c8 O' k! I
- #include <linux/errno.h>
2 i/ D5 t& \% t% K - #include <linux/types.h>7 l" g7 g3 E- i: `# D! Q
- #include <linux/interrupt.h>& \8 Q2 _% C0 g, A. B; K# k! T
- #include <asm/io.h>
7 V3 I( q9 t- Y9 J; F) U0 V6 d" y - #include <linux/moduleparam.h>
! o+ h& Q) [5 Q: m2 o" z - #include <linux/sysctl.h>, @! v- C) [- {2 }6 E6 E' J
- #include <linux/mm.h> z9 G6 [3 `1 \6 o
- #include <linux/dma-mapping.h>
9 J7 {5 I; b- H V7 M. T9 ` - - C) I' R6 B& q. J
- #include <mach/memory.h>* G: ~3 G, E. S6 F2 J0 o
- #include <mach/hardware.h>
1 C6 Q' v( K$ C% e9 N4 u - #include <mach/irqs.h>
: ~: k- h: q! s& C - #include <asm/hardware/edma.h>
. O& H9 c1 ~7 b8 K" |8 w - 4 ]! Z8 d) f' t* N2 @$ f- A$ W. V9 e
- #undef EDMA3_DEBUG0 B, h4 B( v f" i6 R1 u
- /*#define EDMA3_DEBUG*/
5 V- ~3 C* a: N5 V8 }3 `% J: Q
8 Q1 e F( j/ K' L. r: f- #ifdef EDMA3_DEBUG
+ t3 I, ?% x: [. [1 Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ n* {( Y& q( V1 s& q c4 o; d' K - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) w# A7 {- `" d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 T: H8 _* S s0 j
- #else! [8 k; u- l0 j
- #define DMA_PRINTK( x... )
4 c: A& X% q9 r, U- L - #define DMA_FN_IN, x/ y% Y8 L" C, v9 m5 c3 ]% A
- #define DMA_FN_OUT- d5 D6 j* w8 Z) ]; I4 |1 `3 ?6 n5 V
- #endif
- M! i, }# b2 A# x4 o0 Z; v
, Y1 A: I; ?: D9 a- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- F9 E4 r4 l2 |( k8 ]: b - #define STATIC_SHIFT 3. F8 k2 _. Z, N$ W! [: \$ K5 P
- #define TCINTEN_SHIFT 20% Y; r/ N; l0 E
- #define ITCINTEN_SHIFT 21
# C. U7 w( c1 v+ p+ t - #define TCCHEN_SHIFT 224 b& _+ |2 \ b; u, v' Y
- #define ITCCHEN_SHIFT 23
" j& r# a& j% g& y( k; x
" W; w( l9 ^; o0 @- static volatile int irqraised1 = 0;+ M' s9 `6 E% x) p* b
- static volatile int irqraised2 = 0;; x2 e1 b/ D# U. P" q- E' q$ a& L g
- - ~( r5 c) [! M. a4 y% h4 I9 c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ S" p! c6 o+ ^( Q& j
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 p( i, L* l$ h k# m: c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" Z) M! r. c$ V5 @! @: s8 ?9 B - & z* d9 P5 R' Y! T+ Z. R
- dma_addr_t dmaphyssrc1 = 0;
9 w) t9 h! f# t. X - dma_addr_t dmaphyssrc2 = 0;" b# o; l. s* t8 K( J g7 J7 R+ s
- dma_addr_t dmaphysdest1 = 0;
. ]" q. P% ?, r Z3 g0 L, q* U - dma_addr_t dmaphysdest2 = 0;5 S* R5 |- i/ D2 a1 h# c, |
8 L6 S# }8 P* D* \8 h- char *dmabufsrc1 = NULL;+ i$ V/ I+ K' \
- char *dmabufsrc2 = NULL;
- {$ ~' I8 _* K+ _, @$ H4 ~: h' J - char *dmabufdest1 = NULL;" c1 f6 S g: U% \- F7 w
- char *dmabufdest2 = NULL;/ W% t4 D! }7 f9 e
3 Y. J( I5 @/ ^ i- static int acnt = 512;
) k& t' L) [+ W) q5 T6 u - static int bcnt = 8;, t) ~- }% B6 T6 O" O+ {
- static int ccnt = 8; E) Q4 @% \' b% M/ X% M
4 H) M! k: G. i! x- module_param(acnt, int, S_IRUGO);
2 N d& ?$ K+ I' X* t" ?& Y, _+ l - module_param(bcnt, int, S_IRUGO);: P5 u3 H4 e; ~2 k% X5 J, _
- module_param(ccnt, int, S_IRUGO);
复制代码
w( y: h! ~2 F& k4 W/ j1 q% a. F% S g8 h
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% n+ R1 l0 E2 p7 b6 E1 S, m! h6 J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) `) z7 H/ U5 I4 {: @5 ^$ v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ Y+ \& }$ c( K, |& c( @
7 C6 @" e; S* _0 p2 R' P/ Q% G# F+ {( `$ K& [
|
|