|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. v; ?. D+ N5 ` Y- [code]EDMA sample test application, h% s9 U% H9 @5 B! f& C3 I( Z
- /*2 x) Z+ W3 k- H( _) V
- * edma_test.c. f. _0 X: s! E* b1 }# u
- *
4 _- s. l! h) Q/ e4 I- J, S- I - * brief EDMA3 Test Application
4 y5 i D* x5 }; k- R4 C, g - *
, u) }2 ?0 U3 V- M( p S - * This file contains EDMA3 Test code.
& c1 H- [9 G9 L1 S/ J - *# t3 g! S8 B& ?3 B. @
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- l. J& U) L9 l8 l U/ n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. Q3 m( ?) ` Z2 v4 u/ j9 J8 k - * TO CHANGE.
7 T) A' \1 M! ` - *5 J' G a7 N% p+ J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& H1 m+ w/ F+ S7 Y% D - *! j7 G6 R' U) G) _* ]
- * This program is free software; you can redistribute it and/or$ v Z: D7 K1 ~) Q
- * modify it under the terms of the GNU General Public License as
9 Z2 H; |. g( e5 H - * published by the Free Software Foundation version 2.
6 e) v* C$ U7 l# s% d - *
4 X9 A6 o7 ^! V- j - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 y( [( |1 S, S' d. q1 z; z0 n
- * kind, whether express or implied; without even the implied warranty6 E& ]* Y2 ~8 R- k
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 s; @# h# x! ~$ }* G - * GNU General Public License for more details.
6 t+ ]7 J5 k$ _, \ - */
3 K$ |% ^- @6 o7 K - ; }2 ?$ j% i) o0 m1 U* I
- #include <linux/module.h>9 E; v9 h x& n3 V |" Q' F& o
- #include <linux/init.h>
0 E0 z0 R P. u( u" d7 Y - #include <linux/errno.h>
# c E) T( ]5 l7 @3 E8 s - #include <linux/types.h>
) m m# M2 G1 Z1 n - #include <linux/interrupt.h>7 F: c/ w. E& j2 z
- #include <asm/io.h>
# \/ y$ f8 W0 l0 I, ?0 ?$ Z - #include <linux/moduleparam.h>
7 t! O1 \# b# L3 X. @ - #include <linux/sysctl.h>
7 t' J2 K i( B* x7 f - #include <linux/mm.h>
( d1 N+ X# Z& E3 u& D. ?. [ - #include <linux/dma-mapping.h>- d! g$ J7 w3 F9 t& H6 g0 c M
- ' ]1 Z. w S$ {2 x
- #include <mach/memory.h>+ L7 U. M% F/ b# A, k( }4 q
- #include <mach/hardware.h>
9 _: j1 B3 i7 ?& T9 Z/ U - #include <mach/irqs.h># }6 F5 [- U% i, I! f# F7 \
- #include <asm/hardware/edma.h>6 @7 Z2 b2 w/ s2 h2 D$ Q5 q
- , d7 U. R: D C- r# x
- #undef EDMA3_DEBUG
9 K7 B$ K9 O2 B2 `: H - /*#define EDMA3_DEBUG*/9 i+ R3 K8 ^8 u( X9 |; h
- 6 m( z; a5 x4 Y$ k
- #ifdef EDMA3_DEBUG$ B1 ?/ n w! T# l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 N; [" j" V7 i0 E0 U - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) ?. P$ T0 u" |) c& U* [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): l% Q' _0 C8 k/ P$ G0 H
- #else
- e* w' l4 n) M - #define DMA_PRINTK( x... )3 @: k( D" V8 A/ U
- #define DMA_FN_IN
) w! E( p+ ~% \) Y: l% D: k - #define DMA_FN_OUT3 G1 v+ j' W7 `& ^
- #endif
+ ]0 O; ^7 a, _( e9 v: P$ i
+ J9 b @7 s7 R- F- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% A2 d8 A' L* J' S6 w# q* x( v# p
- #define STATIC_SHIFT 3
5 U1 w, B5 o5 j - #define TCINTEN_SHIFT 20! E! K, h5 b9 B% z& U
- #define ITCINTEN_SHIFT 21
) L% w+ H0 Z) m2 e - #define TCCHEN_SHIFT 22" z4 t/ [: m* V K
- #define ITCCHEN_SHIFT 23
; m) E5 u( s* h. _- z
' _; x4 n1 {+ d6 V6 {) Z7 x- static volatile int irqraised1 = 0;5 H1 Z) k \" m! N
- static volatile int irqraised2 = 0;$ e" I9 v/ p/ X6 X- \7 R
/ B2 l% @; F: v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 F' a) p; Y' ^! U- S+ H - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 E5 V3 q/ a5 r5 [ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 D4 g* `! s3 I; X1 w
5 p8 C [$ Z; ]4 V- dma_addr_t dmaphyssrc1 = 0;# `9 g, e& t6 F% g/ P. j8 u
- dma_addr_t dmaphyssrc2 = 0;
7 Z v) i$ c/ D - dma_addr_t dmaphysdest1 = 0;9 S, f0 o2 M3 ~5 v* b
- dma_addr_t dmaphysdest2 = 0;
$ ~: o: B" b$ N - d$ f$ N. t, H3 B6 K6 L% _* o9 ^
- char *dmabufsrc1 = NULL;
" |8 G* i& N% ~+ I3 [: j% } - char *dmabufsrc2 = NULL;9 c4 W" ]) j& _2 ] f; F
- char *dmabufdest1 = NULL;& D" _$ z4 R) _" S7 t/ F) H) l
- char *dmabufdest2 = NULL;
7 P- f+ g, ` b) [4 r" P* s - 5 ~: u; x9 p. D$ h# C) I) l" K
- static int acnt = 512;
: Z+ d5 L3 ]0 T* J) p, `: h - static int bcnt = 8;2 g. X9 U; N0 G$ M4 O( Y, W
- static int ccnt = 8;
5 j) T* U" Y7 X - * G5 b3 e3 {: I9 g' z. r* z
- module_param(acnt, int, S_IRUGO);" L9 l0 `) [% _2 ^+ u; w
- module_param(bcnt, int, S_IRUGO);
" P# Q: H7 I0 [4 ?9 O! l& U - module_param(ccnt, int, S_IRUGO);
复制代码 ( J! Z. \/ u* H$ {/ e4 y
/ G$ o; |1 A9 f( @0 g4 r- g$ z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# Q5 X. ~ c( `( m6 s5 \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& I5 o: U& w0 `0 A8 ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. c& T& m7 i) ^. }
3 E l9 ~) f9 r9 K6 o- U
) T/ J7 U6 {( x7 _: D$ B) F
|
|