|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , L& f7 V V+ W3 ^" ^$ K$ h
- [code]EDMA sample test application
$ r! t0 W5 k: l - /*
& [$ i2 Y! L: {+ i- x; l - * edma_test.c
' w7 `* a( K. L( O' c - *
/ [+ A1 q2 {! U/ x! Y2 N) w - * brief EDMA3 Test Application8 y9 \. P/ G& o
- */ d' }6 S7 u, }6 Y3 U# |7 p. I& I
- * This file contains EDMA3 Test code.3 W( H- Q: a% d7 \5 T2 l# V
- *
8 {: _' W" U# o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ f7 i X; B8 i, U X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 L. e3 |/ N* v$ P" q5 L - * TO CHANGE.& M& Q" ~$ G% ]/ i% r& Y
- *
; ~ {9 G) E9 k8 l1 B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% d6 C# K4 Z9 U: g2 q - *
' B2 e/ Z/ G+ P/ \% }- _# y* c - * This program is free software; you can redistribute it and/or% W7 G; V4 k+ b
- * modify it under the terms of the GNU General Public License as) `( v+ H9 G' Y( c6 K) H
- * published by the Free Software Foundation version 2., q, d% M( b& `; Z, a5 R+ A
- *
0 ~3 W: E4 g2 a. E3 ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) B X, e2 x s: R! i
- * kind, whether express or implied; without even the implied warranty
0 W0 @2 d' B$ m: m - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 Z+ i) }2 i2 ]6 f
- * GNU General Public License for more details.
/ o& p+ h$ \# f6 h$ x9 v - */
" q1 ~3 }6 A; w$ _% ? h8 T. a
( ^, Z! Z, Y/ J7 D9 h( w- #include <linux/module.h>
* j0 r2 {* h& i! E; I. @ - #include <linux/init.h>; M; t: @1 u0 ^. e, ~7 r1 R, n5 O
- #include <linux/errno.h>
% h# y! Q8 {4 b. }! p5 Q - #include <linux/types.h>
M/ [7 J& D) [/ L - #include <linux/interrupt.h>$ g' T0 f* |" q. m/ e1 p8 X
- #include <asm/io.h>
$ V: q$ u! l% D$ E5 L - #include <linux/moduleparam.h>, [! I5 Y2 Y8 T1 d2 N9 w( p
- #include <linux/sysctl.h>0 j$ A2 e3 l. p ]
- #include <linux/mm.h>! d. o4 W2 i* m) A i# I' z
- #include <linux/dma-mapping.h>: g @& n; x% |1 N7 t
5 s2 D8 h1 [+ I% b5 n- #include <mach/memory.h>
! q& B: u' h2 x( s& ^7 j - #include <mach/hardware.h>
. T8 Z4 r$ t1 C7 T - #include <mach/irqs.h>
- _1 T3 x k2 e* W( x - #include <asm/hardware/edma.h>
6 r5 g: X! n8 h* W( p. ] - f2 q- q( e; K9 b# `; E; F
- #undef EDMA3_DEBUG7 L+ X, [6 Z1 m7 x# S2 a: i
- /*#define EDMA3_DEBUG*/
0 Z+ ]' y' m- s( a z: M. f; S
% ~. q' Y; |- p; W$ I, H- #ifdef EDMA3_DEBUG; w: q" d8 _: e, l2 V7 h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- i8 C2 `+ d7 c* x) H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' d2 I5 x3 g Y$ k
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 t! K* T) j6 h - #else
; [4 x& L* r i - #define DMA_PRINTK( x... )
) j# n, u! \5 q - #define DMA_FN_IN
, j1 C" |3 T( x7 W - #define DMA_FN_OUT9 w3 I$ u% Y5 ?' O5 Z, R( j' Y2 n
- #endif
1 ~% c2 |3 X$ {+ { @6 }! V3 z - 6 _; p" Q2 X1 f3 @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( x% O2 y+ V9 v4 k' F6 V E6 x, ?/ C
- #define STATIC_SHIFT 3# ~" z' s2 l9 f8 M( i
- #define TCINTEN_SHIFT 20* g5 F- k- y* V$ {1 D. h( v
- #define ITCINTEN_SHIFT 21
; u! R2 x) ~3 Q' F - #define TCCHEN_SHIFT 220 {9 q# K0 Q$ a( K( F
- #define ITCCHEN_SHIFT 23
0 Y5 l& w+ f/ f
; t( K& B1 y3 B0 w: m8 _# ?5 K- static volatile int irqraised1 = 0;
: {& i5 a9 R$ p9 E: P2 e) D9 v6 S - static volatile int irqraised2 = 0;
B/ o6 T' X; C/ C$ c
' I1 u9 a' u4 ~6 i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 ^/ D- E/ `% L1 ?( b' Q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 o1 i$ i2 z" z7 S+ _0 O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* d& A `: K- Y* d& |4 v3 v
% Q7 u$ \' n! _' T& ]- dma_addr_t dmaphyssrc1 = 0;( S" D; a# A( C
- dma_addr_t dmaphyssrc2 = 0;( T& n1 Q2 F& e- W1 H7 ?
- dma_addr_t dmaphysdest1 = 0;" D( O1 S( S0 P: J4 {
- dma_addr_t dmaphysdest2 = 0;
. Y; d1 E7 D& ]" h! `. [ - ' r) {3 x' Q4 u# M
- char *dmabufsrc1 = NULL;; k0 p5 u8 |9 x
- char *dmabufsrc2 = NULL;. S. H8 w7 }1 F) \1 D: ^& Q) K
- char *dmabufdest1 = NULL;* L+ d# G$ n" D0 l0 s" E; v [8 h
- char *dmabufdest2 = NULL;
7 I9 y+ V4 n. c! e: {
1 X! x8 }- D2 Y: W5 N- static int acnt = 512;, A7 n$ E( N" I+ G; R# L
- static int bcnt = 8;
1 n% O* _& P1 s" {5 k - static int ccnt = 8;
* h6 |3 a# \& Y - + y- {' c8 b6 e2 [! V
- module_param(acnt, int, S_IRUGO);/ j o u# V$ `9 C$ r
- module_param(bcnt, int, S_IRUGO);
6 m" j9 m' E+ {, }, j3 o - module_param(ccnt, int, S_IRUGO);
复制代码
# @. l3 U: }, G* }! n
+ f6 I& K. p/ u2 q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, I/ O% q! w+ B, _" q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: M5 X; n/ k0 [2 l; W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. {3 Z0 |! X/ _0 x1 z1 }8 C) O$ g: _0 j2 w
! ~5 Z6 `/ ^) }# C# G# p) X! Z8 F
|
|