|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - k7 M2 l7 z/ q! ~
- [code]EDMA sample test application* y; S9 m, k) {, W e
- /*) j8 K& F& G2 Y
- * edma_test.c) V* j' T0 V( ~: F0 _" a- {
- *
6 H6 V& R6 L% x% ^ - * brief EDMA3 Test Application
' Z& I) [5 r' O3 V% u8 w - *
$ }& ^. p8 A' l! @3 @ - * This file contains EDMA3 Test code.( d4 K% {; a @5 c( ?4 Q7 S9 ]
- *8 R$ \; @( \: ?/ i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. X& G! _; ?4 C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 s7 a G/ z, X% [
- * TO CHANGE.* W/ b8 U D( H) e8 g4 D# y
- ** m0 z8 W2 }/ A' a/ r. S2 \
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" {, e- W7 U4 {! I6 f N& S - *
4 q& y% ~1 ?! \$ G - * This program is free software; you can redistribute it and/or/ Q$ c. Z M" U
- * modify it under the terms of the GNU General Public License as: `6 f4 q& ]& X: J
- * published by the Free Software Foundation version 2./ |( u- p* M# r. k
- *7 z5 L" ~* m" E: V d; J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 c: Q; n9 [# Y: `. P# |: ]/ p
- * kind, whether express or implied; without even the implied warranty
4 E* H8 s, T$ u7 U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 d6 b. Q& ]: I/ b3 o5 i) |
- * GNU General Public License for more details. X& `, j8 X0 l5 g+ x2 [; _6 i
- */' t: k( ~- V- V" p6 g2 S$ z- r! Q2 P
: W* ^# o" u8 g- #include <linux/module.h>5 w) M& U3 e( |- G" S
- #include <linux/init.h>5 @ A1 \ L% m* ^* f2 r+ f
- #include <linux/errno.h>1 w- e8 P; H6 }9 P, X
- #include <linux/types.h>
5 n# k: j' E' Z% r+ ?+ U2 x - #include <linux/interrupt.h>; W* `1 G$ r* P- P2 ~- w. Y( f
- #include <asm/io.h>* H5 r: _7 O7 Y& `9 j! z
- #include <linux/moduleparam.h>& b6 i5 }+ f1 C
- #include <linux/sysctl.h>
1 _& V- n' c% Q+ I5 \3 q9 u - #include <linux/mm.h>0 c& ^0 l7 w$ c
- #include <linux/dma-mapping.h>2 N9 h, k7 T1 {( q4 c
; x4 f" w4 F" P& c. e/ ` p9 k5 l3 \' ^- #include <mach/memory.h>8 B( W" v: G: w* f6 _
- #include <mach/hardware.h>* n, @' B; ~3 n: q1 L7 _8 O8 j5 G
- #include <mach/irqs.h>
! e8 G2 U9 c0 B; L: b - #include <asm/hardware/edma.h>* A6 K' I: N @. Y
- ; m3 I# g/ E* b z x3 ~
- #undef EDMA3_DEBUG
& N6 w$ R( C8 P# I4 Q - /*#define EDMA3_DEBUG*/& N$ _) w1 f1 C1 J
# G1 Q# ?. R9 ~' @% h- #ifdef EDMA3_DEBUG& ~8 d& k0 {. g: I6 i+ r0 m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). q; e. F6 M1 i4 j1 F& f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ Z) {2 T$ X/ J& @7 b; O - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
x1 r9 v& [4 ]: q" p" ^ - #else
8 s& y3 U2 U$ V0 B7 _7 g7 ] - #define DMA_PRINTK( x... )
" S% j4 y; K% M* Y - #define DMA_FN_IN; `3 B: |1 E P7 b- b* M9 J8 Q
- #define DMA_FN_OUT- }2 j0 t& [. a9 n2 w4 K: r" B
- #endif
7 a+ x3 z) E5 t) J; I3 _ - " X3 T3 ] B* T0 Y2 |9 F
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 d' R8 q9 f; i4 t5 ~6 z - #define STATIC_SHIFT 3' {, `. L% l% S: V# F( S: G
- #define TCINTEN_SHIFT 20( |# N; @8 [; ^) x. U
- #define ITCINTEN_SHIFT 21
6 Y( l# K I, u7 t3 D7 ?7 w- i8 @ I5 ?/ [ - #define TCCHEN_SHIFT 22
; ?& @* g' ?1 G, f( p - #define ITCCHEN_SHIFT 23. T* T1 \" L* {( x# a1 w
- ( ?( r8 g( l% F0 @8 n
- static volatile int irqraised1 = 0;2 m4 W8 O; U1 o% y
- static volatile int irqraised2 = 0;" Q# D4 x- }& x+ i! g
- 8 P& Q) F! Q$ Y! L+ Z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! V3 M! j/ J n3 q$ ?3 R9 a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 Z9 H7 b/ V% w% N! C6 N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 `; E& q" h0 G. z& }5 A% X! R
+ B; o! Q, m$ _$ A% ~; Z+ `0 L" _4 F- dma_addr_t dmaphyssrc1 = 0;0 W! [- L: e7 H g" y# h
- dma_addr_t dmaphyssrc2 = 0;" Y0 j1 @7 Z, S& |
- dma_addr_t dmaphysdest1 = 0;% x7 A) Q$ @! |1 l% r7 f% o+ I
- dma_addr_t dmaphysdest2 = 0;+ b/ Y1 D* W6 ~
- 8 |; d G9 r3 l
- char *dmabufsrc1 = NULL;
9 U! F0 v3 [7 ? e5 M' L - char *dmabufsrc2 = NULL;* Z; Z' B0 \/ [! _2 f2 j- Z
- char *dmabufdest1 = NULL;
6 `1 k) q7 \$ `0 a/ c - char *dmabufdest2 = NULL;" s! C" j; P2 {
6 S# U/ q- H& f- static int acnt = 512; e# W$ E9 Z5 L; z
- static int bcnt = 8;
( b; r/ z- o: s: U# H! u8 ^% T8 _ - static int ccnt = 8;4 m9 n0 }% R6 i) Z
+ \8 ?, F6 Z5 b- module_param(acnt, int, S_IRUGO);
# w& F {6 O% F1 ]# G* [6 ?) R - module_param(bcnt, int, S_IRUGO);
% J. L. W: o' d - module_param(ccnt, int, S_IRUGO);
复制代码 : t8 b! U% F$ J+ \
9 U) x1 D8 H5 F$ ~$ p9 w+ e
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 Q- ^% E5 |7 u9 h1 r- oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# Z ~- H( c! \. w! ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 i% j' z6 Q; O% x. t' T0 Y$ z/ i _0 j6 j6 r
$ I. h3 y. Z4 q. M |
|