|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ ` `( u) |2 r+ x* T$ f( |7 b: F- [code]EDMA sample test application. F+ j+ p( ]8 i0 C H+ i) P( h
- /*; ?8 a- G% y. c4 y5 U! @
- * edma_test.c/ I$ V. j4 D D) c' n
- *9 t* S& @( q. W. I+ y- W' W
- * brief EDMA3 Test Application
% x$ l7 X: T6 x - *, o/ u1 Q: C) R
- * This file contains EDMA3 Test code.3 [# Q- G4 R! _+ F
- *
9 P6 o) S6 {. o" ] - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) s: M9 D8 T) v2 C0 A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 `5 x9 Q) y+ Q0 l& O l! y - * TO CHANGE.; l& i E3 \$ [( c4 l
- *& C2 ^4 L9 a% [" h( b" g5 r/ u
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, z9 o, }- G C# R - *# M0 h9 a( a+ Y
- * This program is free software; you can redistribute it and/or
% ~, N- r0 ~. G2 K2 ` - * modify it under the terms of the GNU General Public License as
. Z. o% ^" ^ G3 U - * published by the Free Software Foundation version 2.1 V7 {+ l; |2 z$ u/ r/ h! j7 A
- *
' H& M7 F, J0 g6 [; {1 R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
n, w0 h* q, s) p) h2 P - * kind, whether express or implied; without even the implied warranty7 o' A# z1 r l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 d" w* T1 G' |0 _0 f
- * GNU General Public License for more details.
, u( L* M- s! m6 c& [; T, P - */
! I" r2 K4 r. a+ x
7 L, Q5 E$ Z) m) A& B- #include <linux/module.h>
" f4 s$ {$ B5 |. _, H - #include <linux/init.h>
# ?6 L, E! ]7 R; h3 P - #include <linux/errno.h>
% X' s4 U- C$ t3 D7 W1 I - #include <linux/types.h>4 e; C. K1 O) X9 Z! i9 v+ ~
- #include <linux/interrupt.h>
. }9 R: Q/ w: K2 [( q& R2 h+ D* H - #include <asm/io.h>3 l* K8 d" A- E3 b& j6 K
- #include <linux/moduleparam.h>2 j: a: g* Z. `+ h) a0 P& a
- #include <linux/sysctl.h>
; s; L4 u" k H# B4 E - #include <linux/mm.h>
n0 _" G7 U1 } c- S E! h4 x - #include <linux/dma-mapping.h>+ y" y5 [ m; K6 A
- 9 G6 P* q* t3 H8 a p
- #include <mach/memory.h>
9 A* h2 k1 a, K, _3 l( c r* z - #include <mach/hardware.h>
! `5 J' _0 A' M0 f+ } - #include <mach/irqs.h>
3 ]- x( P; L4 u* b( P% S - #include <asm/hardware/edma.h>
8 r" b# Z/ l' }) x6 o( n+ k% ~ B6 v
0 f7 i8 X+ g+ w: v9 @; @2 |- #undef EDMA3_DEBUG- e' W/ x& }0 h/ T8 _( Y- F
- /*#define EDMA3_DEBUG*/
@1 ?; N2 p6 s/ o - ) \( F1 g4 d% T
- #ifdef EDMA3_DEBUG
$ A* Z/ Y4 d$ {, O2 [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 e( _0 r. p1 g- ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& R+ b+ E( q/ a - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 v' V. C/ P% [2 h+ P% T
- #else! j$ L3 K& w/ [9 B4 E; L9 n
- #define DMA_PRINTK( x... )
y1 }" a$ Z: @ @0 ? - #define DMA_FN_IN
9 q& ]) x0 G" x: w/ [# Z1 @8 I4 F - #define DMA_FN_OUT
& C5 w# N8 Z( A - #endif
; h0 c# E9 s) _8 Y9 ?( M - , N) n9 R3 i- h5 N
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) S+ s' v! ?2 H
- #define STATIC_SHIFT 3
` q! C* q- C/ w7 Y - #define TCINTEN_SHIFT 20
3 Z4 g/ C. k4 s" v3 f' J8 O( q( S - #define ITCINTEN_SHIFT 21' f: R( Q3 T1 W& p' @
- #define TCCHEN_SHIFT 22
; N9 F8 S9 u' @ - #define ITCCHEN_SHIFT 238 ?( M+ X% h$ L* [( S; O
! y$ j5 h9 r i4 c- static volatile int irqraised1 = 0;
) L3 M( M3 ^# M6 m. G+ H0 @7 D% c - static volatile int irqraised2 = 0;
8 V: {2 V( j! x }' [ - & w9 I0 a2 \# h( `4 z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( U7 F4 \- @. o* ~ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; f$ j/ D" _7 X; M# a; p4 p4 N( D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' I* G' S! I! z! q
. u4 ]2 s" W& Q) _- dma_addr_t dmaphyssrc1 = 0;
4 _7 Z( I; b A0 S+ b - dma_addr_t dmaphyssrc2 = 0;
& O' V0 q" O' g7 g. y - dma_addr_t dmaphysdest1 = 0;
) J1 O* ~4 j# \) l: l - dma_addr_t dmaphysdest2 = 0;
* X8 }5 v& d* e9 _- W
a2 v: y3 y1 z2 O# p9 ?. }' \6 {9 l- char *dmabufsrc1 = NULL;
& _4 ?$ {4 H1 y2 s2 D - char *dmabufsrc2 = NULL;
3 T" f9 L0 A! Y B& G - char *dmabufdest1 = NULL;
8 l% g3 Z% ~7 q' C `* d& i! E - char *dmabufdest2 = NULL;, Q/ X' N; X- m) o
: E& Z1 k% k# `0 n( [& u- static int acnt = 512;! ?$ A$ V# a# q2 t
- static int bcnt = 8;
. o3 \( `& A! J* x) B8 L! z( d1 l - static int ccnt = 8;3 n: m" m- m( Q
- $ M: q+ ]1 W1 r- m3 j% V
- module_param(acnt, int, S_IRUGO);" d2 w2 S4 ]- L' j
- module_param(bcnt, int, S_IRUGO);
) K7 V/ h* ~, A7 ] - module_param(ccnt, int, S_IRUGO);
复制代码 ( i! C; ^; U8 k
. a* D0 o: N" \, h L/ F, z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 r# f; ^0 y( S* K: A) karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ y0 s1 G3 w4 c8 i* B 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- V5 `& t {, A( i0 n% U
`! ~, K# O: u: l- U1 |
, n2 R8 k( S9 G3 n |
|