|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 o( m* X7 ]; R! D \- [code]EDMA sample test application0 B6 b- W! F/ N) }! r
- /*
8 |7 I$ |. f: x, x' F - * edma_test.c1 Q5 _; i5 M" u" x8 K. \/ F* p
- *5 x) c4 v/ x9 G# D( I
- * brief EDMA3 Test Application
$ O: g8 L% w' k - *% e2 i# P3 x+ I
- * This file contains EDMA3 Test code.
8 \. B5 _/ ?) h; x. A - *1 ]! L) `: y( M8 Z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- H/ m, U" H) P0 u- ?% u6 w2 b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 Y5 F: g* j8 g5 j: d: D7 k - * TO CHANGE.
# u2 O, H. s6 C% B3 U$ b - *
2 j! }) s- `$ c, Q: C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ j3 T( ?1 W" ~8 S4 [
- *, e3 ?; O2 F$ x4 H6 Z! a
- * This program is free software; you can redistribute it and/or
& {0 V$ K2 j. r# N) @, B8 B( J - * modify it under the terms of the GNU General Public License as' u- r8 W# _8 ?0 Q' x
- * published by the Free Software Foundation version 2.5 t* K$ \2 A8 D1 \
- *! A: V; i2 ~' i0 W; d, d, \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ {. r2 N M; n9 l8 T4 E `
- * kind, whether express or implied; without even the implied warranty# Y6 b: S' o% D; s' R1 i& s. a0 \, g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 l5 x) b% o$ M6 T: ^' ]0 A
- * GNU General Public License for more details.
- |& ~: f: t) g5 j8 H/ b5 a - */
% E6 K9 K$ Y5 L+ T
/ E6 D" Q: A% E# j v- #include <linux/module.h>/ r/ L, o9 Y: o, C; n
- #include <linux/init.h>
; w' ]! J: P5 y1 C+ F5 r - #include <linux/errno.h>
: o0 G% \- J |: {5 q$ e - #include <linux/types.h>, s! [0 v" ?# Y* R7 X
- #include <linux/interrupt.h>; D6 z9 i) m- h j8 [- O- \# d: V
- #include <asm/io.h>
0 i! t5 o+ r% F" l - #include <linux/moduleparam.h>
, m5 l: p; t, h2 R( e& r - #include <linux/sysctl.h>! P* Z" k8 T F: L; }
- #include <linux/mm.h>/ q; J0 }& h4 K% ~( ?# I' ]
- #include <linux/dma-mapping.h>- |2 J% M+ t" F1 g5 i5 U# c
- ; \) Z3 y3 n: D. d5 H
- #include <mach/memory.h>+ r: x2 w: |: `; m- L
- #include <mach/hardware.h>
+ {3 L; N7 p, m8 @% y" c - #include <mach/irqs.h>0 ^3 ]" B( G5 _4 @4 K
- #include <asm/hardware/edma.h>
# A) Y6 _, p% O
3 I6 r5 n( `6 N6 E4 K; _& |- #undef EDMA3_DEBUG
C+ m9 e+ E0 Y) J2 P - /*#define EDMA3_DEBUG*/
; a; D/ I3 I/ y
) n+ S& H. s8 w; z) p% f Y# w- #ifdef EDMA3_DEBUG
' i8 r- s$ V' v- d( {: o" R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ h& ]5 o* k$ c% ]; ? - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); _( z0 z, Z+ o4 k0 i- y d* [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( v* V" C. w$ W6 S) M
- #else
; i3 q6 J' G8 u$ }! U9 q( p7 Q, _ - #define DMA_PRINTK( x... )
* d6 A) L/ w: l; q' g0 h. K - #define DMA_FN_IN2 n$ e% c6 ]9 V# S0 h
- #define DMA_FN_OUT0 m* t& D# f5 l( k: N7 R
- #endif
0 b" b* W6 f: k i0 S) ~
9 x/ R' m7 }' i2 q- #define MAX_DMA_TRANSFER_IN_BYTES (32768), h+ d. x+ D/ W3 A; h
- #define STATIC_SHIFT 3! e# T/ c% m4 c$ X" ]2 A5 I
- #define TCINTEN_SHIFT 20% n5 F6 Z# l# F; k
- #define ITCINTEN_SHIFT 21
5 i3 b I" c# M - #define TCCHEN_SHIFT 220 Q# V. [& N% o& w
- #define ITCCHEN_SHIFT 23
* ~: e- l' V! ?! h/ g/ _ w3 R/ T - 3 \. |/ \. E7 J+ }' z: O) M8 e
- static volatile int irqraised1 = 0;
' Q( N& n: s$ z$ F/ i - static volatile int irqraised2 = 0;; n. q( r b' w% E
- 9 N" a0 k/ |* N+ A; O0 k
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; [* z$ k: u7 ]+ d' M) S* T* }- g
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& I+ {2 T; X' s, c4 F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. C' C' y3 V7 U/ E
! a( w1 n2 J7 r. n6 e3 I- dma_addr_t dmaphyssrc1 = 0;
5 V; z2 J( w+ M - dma_addr_t dmaphyssrc2 = 0;; s8 \8 y0 P9 u; O
- dma_addr_t dmaphysdest1 = 0;
# |0 h* R7 ?+ L$ \' g" v - dma_addr_t dmaphysdest2 = 0;! s3 f+ Q2 ~9 i d
- / v4 y3 G. ?: W, {6 ~2 ~
- char *dmabufsrc1 = NULL;- j9 {; i3 t( y7 d
- char *dmabufsrc2 = NULL;! T2 K+ B* Y) ~: c1 _
- char *dmabufdest1 = NULL;
. a# D& I" h1 J' H - char *dmabufdest2 = NULL;6 a$ w, \: `1 ?
$ W5 I# |; Y/ x) V- static int acnt = 512;
8 a. x3 C$ B, ?4 n$ @ - static int bcnt = 8;1 X( z+ d M, J+ ^! @$ l
- static int ccnt = 8;
^! ~9 J! F2 Y6 o1 q7 s - 0 r; J6 |: x0 W' b7 K3 Y. Z4 X7 L
- module_param(acnt, int, S_IRUGO);
# |! o( G. O! {/ e; I5 O - module_param(bcnt, int, S_IRUGO);
& w# l- |7 Z$ w# e/ ` - module_param(ccnt, int, S_IRUGO);
复制代码 . _- y# t( k1 E$ m- `, W$ y
4 D& h4 {+ y3 @, e3 H) m/ v# u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" T/ z: y: s% e4 v- U- t9 A: U1 ?' b/ H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ C5 g f8 w$ C- ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 p5 f! T& o* i! G- k
1 D* i8 a) b1 J- ^# x9 t% d: n2 }" U% I9 ?7 B+ ~0 O
|
|