|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % F& E) Z) S# e3 {5 M# L+ C! F: B# O
- [code]EDMA sample test application
8 }8 B8 f- }6 t4 A- D6 ?: ?+ y - /*
% X3 A7 k9 p9 {. v - * edma_test.c
6 { q; u3 ?( h - *
4 y3 E* |! q( T& N) v - * brief EDMA3 Test Application. |* @& ]' c5 H: [# r
- *
" R3 g/ E/ _# I5 |& q7 ] - * This file contains EDMA3 Test code.! z! z) H, ?2 Q. I+ ]
- *
6 j ^2 n/ U" `! ` y( `) v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- { m! D& u I f( v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* c5 G7 t6 ^2 ^8 Y# @ - * TO CHANGE.
' |1 @8 Y: ~' U- h* x6 u! z - ** s' g* y+ A P7 r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; L8 R5 O7 [8 e - *
0 @7 J. B# W' i' R$ M% a - * This program is free software; you can redistribute it and/or$ Y% o: s7 L+ g0 h0 ?4 \! o4 j
- * modify it under the terms of the GNU General Public License as1 a* q- U" F9 m! R
- * published by the Free Software Foundation version 2.
; Y- z: ]2 @+ w S$ \/ N - *7 D1 u% q' { w" ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ t! l1 ^) E. u! b, ]5 s; G: k
- * kind, whether express or implied; without even the implied warranty
5 [9 |7 r" r4 M" X$ V2 r. [ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) K9 m0 r* F& t+ P' V
- * GNU General Public License for more details.
# l5 z, Z' _8 \, U8 o# H# c - */% S/ L3 g& h. O9 u, r3 @7 y* Y
! Q5 h4 ~5 Z0 B- #include <linux/module.h>
* [1 _: K7 S2 R+ I6 N - #include <linux/init.h>
1 _) ?6 E6 f! A# }$ u7 d - #include <linux/errno.h>- m0 l# g% o, W# m
- #include <linux/types.h>3 p4 Y2 @6 ?3 i: g
- #include <linux/interrupt.h>: F: U; d4 ]/ p0 y& U' \
- #include <asm/io.h>
' N! T. F+ p) l: C+ @- R! F& w - #include <linux/moduleparam.h>$ J, X4 B% w. k- B1 N8 z4 O. ?! d
- #include <linux/sysctl.h>
, W3 S, ` |) S7 f - #include <linux/mm.h>
/ |3 i- l y' T! f7 p/ N - #include <linux/dma-mapping.h>- P- C8 F! j8 q5 q% c- }1 c
4 H/ D, t' k/ B: _8 i- #include <mach/memory.h>9 U/ ^5 A) Q0 f) V( M% a
- #include <mach/hardware.h>
8 R. ]( C. O% e) t* D# Z/ E: l" e - #include <mach/irqs.h>/ O# N/ I( d5 h; C" Y2 {! e
- #include <asm/hardware/edma.h>5 _4 r2 @( Y% n1 h) E
- ' [& B6 z4 F; P5 V+ f! o$ F
- #undef EDMA3_DEBUG
4 h! F2 `) i# t: p7 } - /*#define EDMA3_DEBUG*/
4 ?4 K E B3 g8 E2 e5 B& x - % `2 Z8 a- s9 }4 }
- #ifdef EDMA3_DEBUG
1 r+ V6 _! I4 [5 G0 y8 Z+ q5 A - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 s, H' n6 S# h& G9 J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ i/ b+ E4 s$ S( q1 _3 D
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ Q7 U0 ^; y s! M3 G- p% h# J
- #else2 D! m x3 g( X% ]$ u. U3 J
- #define DMA_PRINTK( x... )
1 w5 ?: M8 H) V- Q) b# _ - #define DMA_FN_IN8 E* I0 p( c, }/ z
- #define DMA_FN_OUT! [7 i* i% g9 j/ P3 K. M& r
- #endif& t9 W% C! ~" A% u
7 }) Z: R% B' T9 \# d1 ]: ~- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 i5 G3 X1 O" |7 ?# ?, b - #define STATIC_SHIFT 3
5 m; D# r- R& y Z - #define TCINTEN_SHIFT 203 Y( T1 g. a- _( X! p$ }
- #define ITCINTEN_SHIFT 216 `4 ^6 G% S6 _* l; E6 N; y$ f
- #define TCCHEN_SHIFT 223 c3 v/ Y! p! J3 ^) U, W% l6 ~
- #define ITCCHEN_SHIFT 23
) ^" z! i& N6 W( ? - 3 w& M& P" x6 L9 z+ ~
- static volatile int irqraised1 = 0;: ]' d# Z# S8 e S1 V4 R" m
- static volatile int irqraised2 = 0;/ e3 T5 M5 _. k; c6 h" d/ w
- R3 L9 ~* V7 e ~' F8 F/ i9 R" M: w
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* X Y6 L9 K) { - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 H- i( b) [' N2 Z- z. v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 b5 W4 k* N9 s. R' E X% ?! W
* N. V7 ]) |& i' z6 t) G, t/ `6 I- dma_addr_t dmaphyssrc1 = 0;& p; Z% M& Y' z- [8 u- u: U
- dma_addr_t dmaphyssrc2 = 0;
+ p: y/ x5 Z0 O9 u' n - dma_addr_t dmaphysdest1 = 0;1 ^( e7 e: ]# s( A- [
- dma_addr_t dmaphysdest2 = 0;
2 v }! R3 m1 _) _1 J2 M9 e" k
- [" s% m2 q M/ A/ a7 A( X' Q- char *dmabufsrc1 = NULL;7 l: g: W4 u( [. u" F: Z. ^6 ]
- char *dmabufsrc2 = NULL;
L( m/ J( f! R7 d1 @ - char *dmabufdest1 = NULL;
0 G2 f" r' h; e) ^$ z# _. Y0 u) z" O - char *dmabufdest2 = NULL;6 Q1 E8 B0 K* n# b4 R t+ I- J0 e
2 h' p+ R. \/ N6 f' M- static int acnt = 512;
# ^) V `+ W# d/ ` - static int bcnt = 8;
/ X$ _9 N X! t" [ M1 t - static int ccnt = 8;/ e! r) l; Z, \* n: }4 N
$ w! @6 z" L' M5 H- module_param(acnt, int, S_IRUGO);: x) `% [$ {; D( I8 t0 o+ D$ ]
- module_param(bcnt, int, S_IRUGO);& _/ i- Q$ G+ _6 \" M: t4 O6 [5 k
- module_param(ccnt, int, S_IRUGO);
复制代码 . a1 w3 x( G0 h1 R9 s* x( T: x) M
% m% I' v2 W2 K: p; |7 w. @: G: _
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 @1 p) P3 f4 K" K+ harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, w$ a9 t! f4 O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 i# \9 v) }/ Y% W! F" R
$ Y: ]+ p! O- I2 s3 \' {9 _# }+ n6 m5 O$ y+ J
|
|