|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 e% b+ O3 j/ k& j. l* h- [code]EDMA sample test application0 ]9 n# T5 l( ^3 W# }+ w
- /*
& r( e( j# ~2 _% C! Y- D6 _$ p) J - * edma_test.c2 T: Y6 b/ x% Y$ o$ o, t# j
- *
4 D O5 ~6 F o - * brief EDMA3 Test Application
+ }) x# w' p3 f q% y' N - *+ t* Z) N- [, R! z% V# ?
- * This file contains EDMA3 Test code.
1 y+ R* e9 w; K9 p+ e2 Y% m - *
. N" t4 t2 ^8 h+ \7 h! @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 C z. `7 j7 l- `& w. Q- ^) Y2 c: G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 W* {4 N/ N4 \" X7 u - * TO CHANGE.
/ u, x* H3 Q8 A7 r; ^9 T - *8 B# |# c- a, j6 u! c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* D2 j* x' c" L( e# l7 B1 F - *; X+ q' `+ a! A# N, D
- * This program is free software; you can redistribute it and/or
: i( d; A( g" M4 X8 b) g) E - * modify it under the terms of the GNU General Public License as
1 I. r9 d9 ^9 r. {2 }2 {( G6 p( A - * published by the Free Software Foundation version 2.; O6 R, d9 C R& J) I3 U
- *, d, k* Y# L, f$ m2 M
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 ~$ K! i7 n' |. M: a - * kind, whether express or implied; without even the implied warranty2 i, z5 f; D* e# Z" |4 b$ e; f
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# \2 |6 D- @' b+ |" S1 m
- * GNU General Public License for more details.
& u5 B% O$ ]$ @ { - */
4 ?0 | G, ^/ Y q" D X, N: w
. z8 N' `* E6 ?" X- #include <linux/module.h>6 F6 v9 [6 d) {. x2 w, Q: J
- #include <linux/init.h>
" ]* R$ R1 B2 S9 o, ?( y - #include <linux/errno.h>, Z, F( ~% F8 R3 ?! B0 F# f# H
- #include <linux/types.h>. B9 h8 M# }, D& ]
- #include <linux/interrupt.h>
7 J* [0 O/ Z4 q; M. h4 V - #include <asm/io.h>
. T- {4 q1 k/ A - #include <linux/moduleparam.h>' S, e* Z; b( C2 z7 @9 y
- #include <linux/sysctl.h>6 c* T- a0 G* n. d$ [: B
- #include <linux/mm.h>/ y7 C8 g+ \$ B
- #include <linux/dma-mapping.h>$ [+ [' l; w5 L+ a- ]
- / s2 t4 `) c- M+ c
- #include <mach/memory.h>
1 G3 c! @6 H$ ~2 z# V& ]5 U- w/ w - #include <mach/hardware.h>
* `0 K" E9 d* V9 i ] - #include <mach/irqs.h>( g1 q: ]; N( Z# m7 Y8 E& }& U
- #include <asm/hardware/edma.h>+ c4 E \: \& _# Z+ p' ]
- ; @4 c: i; M6 A4 R: ]9 r# E
- #undef EDMA3_DEBUG6 g/ h: H8 a" d" X" e# F
- /*#define EDMA3_DEBUG*/& a- s$ D6 l" _ h( O5 |* D2 E! R
8 ?* q' ?% G+ w- #ifdef EDMA3_DEBUG- z0 [+ I( [1 _+ U( o
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ a U# c E/ J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! E6 n6 {& c! d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; U5 K( A, J; t4 _3 @& j - #else
" E/ b) W$ N" l" f% _( W. T0 P6 ^' g - #define DMA_PRINTK( x... )
; t$ v5 C- N3 ^; R" C/ t - #define DMA_FN_IN% a3 g- l/ ], y2 ?( O% j* |* F
- #define DMA_FN_OUT* S% R. s( V7 Z) ~" a: n: h- ?
- #endif9 \: c8 n* e# ~ g, x" |9 c9 x
7 x' u' s) g: ^( J+ v8 o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 y) i8 W; l4 l1 }$ f p- ` - #define STATIC_SHIFT 3
& R0 O5 y8 A5 U4 |( J4 ^ - #define TCINTEN_SHIFT 207 [7 I4 E, X% o/ t
- #define ITCINTEN_SHIFT 21' A R( f, E9 d
- #define TCCHEN_SHIFT 221 M1 u& w# k" L( a
- #define ITCCHEN_SHIFT 235 D1 C5 K; N1 O6 [
- / J# a# ?. _9 F; H
- static volatile int irqraised1 = 0;
& ~- c! N( X$ f0 Y - static volatile int irqraised2 = 0;
O3 r0 p7 C0 b; [ A! a& M, Q4 p - : s! F9 h# I4 _" b9 w
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 X* \8 t7 m) l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 {& ^# J, _5 J5 W; \% A! W3 u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% X) W {9 O c
U3 |- L% ]3 Y2 X% z0 m- dma_addr_t dmaphyssrc1 = 0;
$ ^' W# d( V' [* Y - dma_addr_t dmaphyssrc2 = 0;
3 Q2 z# g0 q( B( u8 T - dma_addr_t dmaphysdest1 = 0;
) W K6 H3 [2 x8 ~ E: f* t: ` - dma_addr_t dmaphysdest2 = 0;, u) i" ]3 O0 X! H( }
+ C( K* R* n1 C' w. j' g- char *dmabufsrc1 = NULL;
/ e' s9 C0 ?5 }2 ]% {5 Z' M- u - char *dmabufsrc2 = NULL;; I, ^( i: K' E! o5 j8 _/ q/ h
- char *dmabufdest1 = NULL;
! D- i( b" x: E* O) p. w - char *dmabufdest2 = NULL;
* K8 g) K- W& h7 c
0 W" G5 Q( t- I6 b o/ `- static int acnt = 512;! X1 Y; B! Y( j) \
- static int bcnt = 8;! z& |$ E( L- ?
- static int ccnt = 8;
9 J& x( Q# |% U: e' d - " g8 }) o9 S2 s" h1 a
- module_param(acnt, int, S_IRUGO);
# }3 y* N9 Y3 O - module_param(bcnt, int, S_IRUGO);3 r }1 x& O1 ?, n% Z4 l
- module_param(ccnt, int, S_IRUGO);
复制代码
, B- b [- ~5 K; V c# @ Z
6 P' q# N% z i" X0 A$ e" l- p& d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' z p2 h) m1 u$ s! L" G5 E- g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 h/ h* I. m8 A( _4 }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. |* [6 ~6 V6 S- e( A* P! N- l6 w( H
3 a* X7 l# e3 i s* Z6 H# H/ v; ~ |
|