|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; G/ o# Z3 D" r# \6 ]: r s
- [code]EDMA sample test application
, r Q/ y6 m5 V4 l - /*
( d1 M' q ^9 T. v) p( q( J - * edma_test.c2 c1 v* L: M+ g, s# C
- *: _4 g/ f# M' A) ?# z( d
- * brief EDMA3 Test Application- A$ s* }- V" a u m0 |
- *
6 L3 D5 F3 Q! y, x) R - * This file contains EDMA3 Test code.
5 q. }0 u' j- i [, y - *
- x' I, D- r& z" O x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 _, A9 a5 N/ U& m" h, s4 @+ E! ^7 P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 s8 J" |2 ]! Z* O) p/ }
- * TO CHANGE.
2 M4 v- x2 H+ x' c Q - *. u0 j: r9 `+ B x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: _& H- [! v0 c, _ S - *
3 @- a# b; l$ \- `3 | - * This program is free software; you can redistribute it and/or( x1 W0 \2 Y& g% j
- * modify it under the terms of the GNU General Public License as0 W/ o# y9 W- c6 h! z8 q( B
- * published by the Free Software Foundation version 2.
$ U, H( i& e. D% |9 h - * O( w* S* t, E) `7 [
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; b3 o3 V8 v _1 E% a2 n
- * kind, whether express or implied; without even the implied warranty) b- \# J6 x/ w. w! ~3 i& r0 B/ L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# U, H8 L6 y8 Y" Z" ? - * GNU General Public License for more details.9 [! f/ [# _* T5 d4 O. a+ e
- */
! ?- ]1 z: ]& v2 I
9 j) ?. q, D! K' P% |( G) B- #include <linux/module.h>
, P5 U( L. I; h& k1 S - #include <linux/init.h>
# b: ?! Y0 B% r - #include <linux/errno.h>
6 I) M) H! O: r2 a% F2 x7 p - #include <linux/types.h>! C$ F6 C. h0 r, \: w
- #include <linux/interrupt.h>
4 n6 T/ O7 h$ b( @$ D - #include <asm/io.h>' x9 C x1 n% f( a+ [! n
- #include <linux/moduleparam.h>
6 w/ G, h$ c8 v- q, C - #include <linux/sysctl.h>
3 h5 _6 Z' c4 d2 u. A - #include <linux/mm.h>: W" m, Z F/ [! ^# @
- #include <linux/dma-mapping.h>9 R. m$ a9 I! L
- R$ H9 G1 v: `2 t3 n$ y: A+ q- #include <mach/memory.h>
1 ~9 v" @6 B% ~+ @" w - #include <mach/hardware.h>
r) D. |; R8 v% q) H/ X* Z) j/ b - #include <mach/irqs.h>& P' C* G% r! c" d! m
- #include <asm/hardware/edma.h>" ?" O( m! @9 ~, \
8 j% h1 [& [# T+ L" i+ @9 z- #undef EDMA3_DEBUG+ [7 K' |8 B, U
- /*#define EDMA3_DEBUG*/
9 a$ p4 H: X! G4 g Q* \# k: y
6 S8 e, a9 C& w; U5 s* X- #ifdef EDMA3_DEBUG: @% w' B" U) ?6 m/ U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& ]. X! g1 W8 T0 U5 f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; k7 `8 h5 Q7 v - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 ]5 k w. B' l5 Q+ A3 e
- #else8 y x. ~- j0 q1 m1 L
- #define DMA_PRINTK( x... )
$ O$ U) ]) N2 Z! Y2 j8 } - #define DMA_FN_IN6 g* o( u8 `1 m/ f' {& w3 f
- #define DMA_FN_OUT
" H# O! q5 z. y- K& N - #endif$ m3 g( f5 \4 T9 ]. |: B6 Q0 T
- - {& Y: I- {9 v `
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 V8 a8 E* X- c5 {( p0 d
- #define STATIC_SHIFT 3
! w& u8 g& L6 B% \4 F - #define TCINTEN_SHIFT 20
, @1 m7 X2 i: H - #define ITCINTEN_SHIFT 21- B) }' `, A1 z% C0 v" L/ f
- #define TCCHEN_SHIFT 228 y. T& w' C& G @4 M7 ^
- #define ITCCHEN_SHIFT 23& ^ F7 j0 R1 O5 i9 e# O; A9 E
# P/ {+ Q" M( d# H W" A- static volatile int irqraised1 = 0;
1 o; x" D! v- c0 `3 S- s, ` - static volatile int irqraised2 = 0;/ a8 k( s* G# t8 U4 G# _
. w+ l1 t X) Z n) ?1 i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* r) X/ q& K; h* P t4 ? - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: V% b/ U' d+ w) L - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 e3 R6 d' {, k7 c; n8 c5 f
3 M, q! l$ V' ?8 g- [% k% Q- dma_addr_t dmaphyssrc1 = 0;
7 ~( T; I9 u2 k! {" R - dma_addr_t dmaphyssrc2 = 0;
8 l7 |0 V0 }* a1 Y& Z - dma_addr_t dmaphysdest1 = 0;& A2 O6 M5 O2 k4 p7 P
- dma_addr_t dmaphysdest2 = 0;
: w( n0 A8 Z7 A( E: E1 L3 j7 x - 2 N; u5 X' j, X- u2 O9 p
- char *dmabufsrc1 = NULL;
3 f5 p( f1 i) Y8 M. ] - char *dmabufsrc2 = NULL;
4 C8 d5 L5 J; l4 a' U4 p8 n7 o - char *dmabufdest1 = NULL;% N# ~, @+ b% ?& r/ s) E% x5 w6 s$ K( u
- char *dmabufdest2 = NULL;
0 L+ }3 M3 c& `
\5 z: m7 k0 m3 U- static int acnt = 512;
" r8 H* X# }# v- j! S9 L% S0 i% @1 K - static int bcnt = 8;
0 ]1 I$ I0 }3 Z) L! f - static int ccnt = 8;
; G" P( `5 N! h+ |) L
) H9 w' ^0 s* r" y, B' K) w4 U7 _- module_param(acnt, int, S_IRUGO);
& ^8 X" w) @0 ^' ^9 M4 _ - module_param(bcnt, int, S_IRUGO);) }9 Q/ C0 ?$ q4 }& y2 F1 Y9 V
- module_param(ccnt, int, S_IRUGO);
复制代码
1 @) `( I/ |" X8 E2 R
* K' e: ~2 Z/ d3 \- j& h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ }) a2 P4 @' g0 ~1 _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* L- [& w; M3 O' D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 T" k: W3 \) o
/ s& I" v, `: y+ x v5 x
$ k! _" }9 }" |0 o, | |
|