|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 g+ a; \! N% e0 b3 S/ ?- [code]EDMA sample test application
1 \& u' Z. ~4 W7 W5 M% z) G$ N - /*
3 [4 i" ~# g! I& B( G+ T! P - * edma_test.c' `/ O6 ^* H. m, Y1 r. t& d
- *: V v' D/ W. H! p# Q% }& k. D. Z( `
- * brief EDMA3 Test Application
( r' T% M: j8 r* O: h3 W7 M - *
% f: _! x( k1 E! ] - * This file contains EDMA3 Test code.1 ~$ u s: |' a( L' V& g
- *: x% w" s) g# J+ j2 q* a9 f# x% R: y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" ^! h0 b$ L3 c& R" P- s! b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, e7 E9 s: u b' S( t l- a6 ]" [ - * TO CHANGE.7 ?1 p# b4 {+ s0 R- i' V, q J
- *8 N; Q- x$ i; w! \1 a
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 X$ v; t3 X% J) ` - *4 v0 f6 x" J; J5 w% F, t
- * This program is free software; you can redistribute it and/or
- j3 d* P! y8 C9 o' t - * modify it under the terms of the GNU General Public License as2 d* h7 i+ m; {" P
- * published by the Free Software Foundation version 2.3 i& Y* x, }. K) n/ }9 E2 Q! ~
- *0 O8 H7 q/ |0 R( ^' p: @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ n' P) a K# ~
- * kind, whether express or implied; without even the implied warranty
, J* V ~! _! I% x9 j - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
V% ~9 @: W) D( a - * GNU General Public License for more details.% n! h, }+ F! R% R, V
- */ g+ ]& u" K% n- I9 J
- 6 W, R& [2 E- n
- #include <linux/module.h>' a4 ^4 W: K' J7 `* E( p
- #include <linux/init.h>% U4 ~# p9 {9 e! W! X
- #include <linux/errno.h>
$ K- F6 k3 J' g5 M0 } - #include <linux/types.h>8 R. S2 t) T( ?0 I7 \
- #include <linux/interrupt.h>
/ z0 L4 n$ _7 e - #include <asm/io.h>
& Z# j# X3 e4 Q1 \- B7 y9 O - #include <linux/moduleparam.h>/ F2 D- p! D; L4 ?. X# h+ f/ {
- #include <linux/sysctl.h>2 a& H; b- h2 H) J. ?* Q, u
- #include <linux/mm.h>, W* F6 C. s! j1 \* V; n
- #include <linux/dma-mapping.h>( F. a! P! T8 D q/ R0 X; m8 K
9 v6 o; _) F9 P* L- #include <mach/memory.h>$ Z& e( V3 i$ j( ]( L9 j+ J
- #include <mach/hardware.h>' v: i& L; V$ J; v& p
- #include <mach/irqs.h>
9 ^* A5 e0 w; k! n0 L k, ?+ r1 ` - #include <asm/hardware/edma.h>
( v* ~8 M0 y' g8 S+ |& ]9 E - : w( \, `' O8 q: G* b, P! i% o
- #undef EDMA3_DEBUG, P6 v+ S" \; c0 I0 {
- /*#define EDMA3_DEBUG*/3 L+ o: ~, Z3 }
- % v1 N0 {; v3 r( N3 a
- #ifdef EDMA3_DEBUG1 K' G8 p, q' B. n" `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! I+ H4 a6 E) w2 \: \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: g2 p" M8 X# O% p6 m1 }# C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 }9 w+ G) r* W e; n
- #else
) { T! \6 B/ `! x3 K7 h - #define DMA_PRINTK( x... )4 }4 l5 W; C7 f2 ~: [
- #define DMA_FN_IN
2 O- G R. L) y# ]2 ^, M - #define DMA_FN_OUT
3 `1 f% d. c- ?- L. Q - #endif
3 i/ H% X7 `8 F - + i5 I. r5 t% y4 ~# D9 Q; R
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& L9 o$ X: A" d3 }9 X: C
- #define STATIC_SHIFT 35 E" t1 r) i. a& X `
- #define TCINTEN_SHIFT 20
" V4 j# V6 o/ v. ~; v: }+ u) C - #define ITCINTEN_SHIFT 21/ D# w. ~" G3 T" L
- #define TCCHEN_SHIFT 22- F/ q) X/ Y; ]: X: q) T
- #define ITCCHEN_SHIFT 23
! e; I' O) M3 e- q! v" ?* |2 l - 3 J8 J9 m; E- n0 T1 L4 _
- static volatile int irqraised1 = 0;1 R' v- i/ @# F4 I
- static volatile int irqraised2 = 0;
, _5 W' b ~" F' q# Q - ! I G( T/ f& h; |1 {5 l" }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: d- o. L+ G/ A6 Y2 a( L/ e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" f6 l# ~& G# }2 G4 ~3 C+ V - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 P4 z0 y, u+ v
# _, T# C; F8 B* Q% U! g- dma_addr_t dmaphyssrc1 = 0;
' k6 E& G- \$ A1 q) \ - dma_addr_t dmaphyssrc2 = 0;% I. y# O3 N' a
- dma_addr_t dmaphysdest1 = 0;0 {$ Y" D7 L! S e: w c) f4 U9 ^" h
- dma_addr_t dmaphysdest2 = 0;8 P% P& l, c- u( C% q4 h, t
. J7 @2 I9 U% U( s1 P/ ^& ?- char *dmabufsrc1 = NULL;
# g, H, r& Z* |; c5 f - char *dmabufsrc2 = NULL;
2 S% B3 f: [8 t- J: ^- i9 V - char *dmabufdest1 = NULL;& P* m9 o% N8 r
- char *dmabufdest2 = NULL;2 Q9 a! E3 K* P- w5 Y$ R
- * e p9 [5 S( z
- static int acnt = 512;
i$ l4 |& T/ W& [, S4 A9 ~ - static int bcnt = 8;
9 Q. a' d) `7 W4 {/ k4 X, E' L - static int ccnt = 8;3 [- p% d/ Y8 q3 i5 y8 t& e
% p2 H1 K' h, s v2 X- module_param(acnt, int, S_IRUGO);1 D+ E; m+ x7 F. P" ]# T
- module_param(bcnt, int, S_IRUGO);* S9 q7 ~5 l9 K. P R
- module_param(ccnt, int, S_IRUGO);
复制代码 . x3 A( i9 q/ y: x& k
: i" [% }" `+ W
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ z+ E9 Y. k0 z. u" l0 i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, H3 U& o$ B o Q* V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) N9 |! O2 V z8 ?
$ J% g. T9 C2 J3 ^# C1 I* M; O. a1 ~7 U1 I& x
|
|