|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' Y+ A$ K4 g5 r1 t
- [code]EDMA sample test application
. o- T: T% I5 x% f8 [5 [' ?. a7 z - /*( V# ?" ^# e$ m! K$ Y& D
- * edma_test.c
" F& k' H0 _- M" T1 v - *+ ~6 P7 J' J" t1 r! [5 w) g
- * brief EDMA3 Test Application
4 F8 W+ t$ q+ {3 o4 D - *) }: N$ `+ n/ f3 N8 v
- * This file contains EDMA3 Test code.( Y) ^" R! {4 \3 r5 |/ S
- *
2 V- x6 B* v( w- M4 o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 z0 _8 E1 ?( H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 ~+ n4 t- {# P( ~
- * TO CHANGE.1 d0 D+ [7 B- {, {/ _
- *
- j0 } O- e' Q, e$ m* T- t% u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 t8 p6 h" D2 K9 H" V
- *
* }7 Z: L/ _4 ?$ [% q, S9 \ - * This program is free software; you can redistribute it and/or
- L0 u7 A J" d) t2 K( }8 D, ` - * modify it under the terms of the GNU General Public License as
* r; A$ b& J1 P& n# ^ - * published by the Free Software Foundation version 2.( P- y3 D+ H- y- _- q' h
- *
! r& E) [# u8 f+ R& R- g' a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 z& @+ v. z( g" X3 e - * kind, whether express or implied; without even the implied warranty% r$ e+ ~# t; @- \
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 Y" F9 J% O/ h& c1 \9 x" h - * GNU General Public License for more details.
! M: M4 s: R( s" @$ S% b - */# C) q, s; \; T: S+ S8 P' A( ^* N4 l) j
8 h" Z8 l, M/ J0 o5 e- #include <linux/module.h>
; a/ W+ j4 E: _9 O& d/ t+ s - #include <linux/init.h>
9 A2 b- ~1 u- E- b - #include <linux/errno.h>
8 q: ?3 t4 T! M - #include <linux/types.h>
+ a3 R5 ?% `9 g( y& l4 e/ j( e - #include <linux/interrupt.h>2 P/ H. C8 r: E5 @6 Y
- #include <asm/io.h>
$ L/ M6 g& Z- |+ g - #include <linux/moduleparam.h>
& A; y+ u! t" R1 f% l - #include <linux/sysctl.h>1 ?. M+ e# d, ^$ W9 N- E! \$ `
- #include <linux/mm.h>2 S7 u5 _& Z+ h% e/ `
- #include <linux/dma-mapping.h>
e2 R8 a2 E, @( p" | - 9 O( r/ f; u+ [7 n' i: ?% ?
- #include <mach/memory.h>6 Z2 j. g! F) z9 J6 a$ ]* b
- #include <mach/hardware.h>
# ?- t1 |5 S+ k9 Y. p X W, } - #include <mach/irqs.h>
3 K; E3 V! ~) n) S- t. T - #include <asm/hardware/edma.h>2 P* J) S" m# p" D2 `
6 t: P9 O2 L1 L8 B" X- #undef EDMA3_DEBUG4 `$ L/ x0 S2 L! k5 H* n
- /*#define EDMA3_DEBUG*/
( Y+ y2 ^5 i9 V+ n; X _' k - 3 r2 ^; ?4 E% I; g9 n$ Q
- #ifdef EDMA3_DEBUG
9 \$ C% i3 M# @1 R0 h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): y9 L% x) h$ Z- L4 p/ W1 u& W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! k) U2 _0 K% a6 w" [; \- N/ w, w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# z% t. Y* u& U; M: W2 Q - #else0 D& F, P) L: L" X* Z
- #define DMA_PRINTK( x... ) I# ~! i/ f1 e- \* P; I
- #define DMA_FN_IN, l0 G% r# i$ U9 R
- #define DMA_FN_OUT3 A$ |$ y$ t) o: u Z- C7 j
- #endif2 q& Q( i0 O5 z8 }
" C" r* ^* l4 x7 H+ Y4 Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ k I2 E# S) G - #define STATIC_SHIFT 3
3 }$ T" I3 ^/ j$ u, U: S5 I& Q - #define TCINTEN_SHIFT 200 d. ?/ e. j/ N L6 k5 v" }. c( a
- #define ITCINTEN_SHIFT 215 ?- u9 P% z& o* D2 v
- #define TCCHEN_SHIFT 22, L; \$ c% s& ?! ~% e
- #define ITCCHEN_SHIFT 23
/ O( c- A9 M8 e( ] - 0 d4 A1 _% X! V: W. k3 m
- static volatile int irqraised1 = 0;
8 s) ~- s+ I) k1 r/ d( j - static volatile int irqraised2 = 0;
4 f' j2 t ^3 r$ l; O/ s; D7 n - + \9 o. a$ x1 P. ]' O
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 y: E& V. {* g: K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 q" b+ P7 p) C% ]' |1 r& y( v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ p8 Y3 m5 V- I - : k6 V2 z$ G7 ?% w/ r; M
- dma_addr_t dmaphyssrc1 = 0;
2 }. q5 r' P5 m! O: i: b% R - dma_addr_t dmaphyssrc2 = 0;
3 w y9 ?0 C) l; w - dma_addr_t dmaphysdest1 = 0;
* |% g5 M' H& F* m K - dma_addr_t dmaphysdest2 = 0;& r0 v/ D: `' G Q5 K
7 U2 G v- ]- u6 N- char *dmabufsrc1 = NULL;
# K+ }) a: L1 k+ W6 s - char *dmabufsrc2 = NULL;
6 ^0 L2 t8 G& d: o5 P - char *dmabufdest1 = NULL;
" g8 ]5 t8 t7 i - char *dmabufdest2 = NULL;: ]5 I3 m1 U6 [# X5 J% w( A5 Z. C
9 V- K9 g+ I1 ^& W" q1 }- static int acnt = 512;
9 v9 @& y$ ~7 m/ |( k* k - static int bcnt = 8;+ i1 m: u/ K2 I6 D% \* W
- static int ccnt = 8;4 X2 J$ v8 V% z5 R" k
- ! @! q0 m/ ^# q2 ~- g- b" D
- module_param(acnt, int, S_IRUGO);
6 x7 |+ l: O; j9 @" T* p - module_param(bcnt, int, S_IRUGO);
% A3 r1 l$ L" G* w$ v: ` - module_param(ccnt, int, S_IRUGO);
复制代码 f) |" T, B0 ?' e% r, m5 y& Q f
% n( P9 j/ i- N/ g$ e' j7 q, V: d7 Z7 v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 e: v# ]4 R6 v$ e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* x$ o* [1 ~$ a& \" M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" K$ D) _% Z$ I' m9 u( G c+ c( I% I& I* `
! S: F2 U N" X7 Y6 q6 v! d. ^ |
|