|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! x4 C+ ?; H0 g
- [code]EDMA sample test application
7 @" C$ C" A, O6 ` ]9 d. ^ - /* o5 q- \" A: Q" T8 V9 l4 ~6 X
- * edma_test.c6 j2 A. k }; y) G' B6 \
- *5 ~2 b) B2 O4 B3 h
- * brief EDMA3 Test Application5 S# A7 F: K$ A' Q' S/ \
- *; [7 V; M6 b8 z0 l8 Y: i: v
- * This file contains EDMA3 Test code.
5 u. X! J6 A6 J7 L - * O; F: E5 ?* T# m
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 ~- Z3 b* y m: ~. h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! `5 l' n- I$ M$ H7 h; k+ X
- * TO CHANGE.
4 _ `/ L& C0 m/ ^/ N6 f6 V - *9 c3 u. d" u; X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 e' J v( H" J, }% {! | - *
% x1 O6 G0 G8 C - * This program is free software; you can redistribute it and/or1 `1 F2 W. V9 b4 Z
- * modify it under the terms of the GNU General Public License as7 E4 @- H) e; I+ N! i, \ q
- * published by the Free Software Foundation version 2.% G! H. G. j4 ^7 H4 \3 i7 R
- *5 `! z: R" D2 e( z- y% Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: `" |. o" }% {. _& s3 p
- * kind, whether express or implied; without even the implied warranty* I; o0 _4 \, W
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 z9 e0 i/ f5 i) T+ O# f
- * GNU General Public License for more details.
q' X2 Q0 u) N/ C - */
5 F; }. }8 H8 E
3 E; _6 t1 P a, s- h+ w- #include <linux/module.h>' ?4 Z0 `/ R) N5 ~; u- ^; G
- #include <linux/init.h>
% B# `9 w, a# t! l( U: b4 n4 E4 T6 y0 v - #include <linux/errno.h>
$ D9 s9 K2 U/ x' D - #include <linux/types.h>8 I- p* e @; ?! l; M" z- y
- #include <linux/interrupt.h>
# l/ a. A. t @. ^$ E - #include <asm/io.h>
$ w O) V' U7 I9 L2 `2 v& b7 f5 Y" { - #include <linux/moduleparam.h>
; P3 O/ m% l9 a) X& h+ v - #include <linux/sysctl.h>- p: V j7 {' T" @! J
- #include <linux/mm.h>
6 R. [( U# E4 C+ I+ z - #include <linux/dma-mapping.h>
$ [6 P8 x4 a) A) {& }6 t
3 u* X5 `" `& H- #include <mach/memory.h>
1 y v, A) Z0 }) H. I( O- _/ U! F& L - #include <mach/hardware.h>
( q( Q/ ^# I {4 G' a0 E- b2 s - #include <mach/irqs.h>
& d6 _+ \- I, _/ J0 Y - #include <asm/hardware/edma.h>
- l# |: J g X. \6 Q. n! D - : t; u0 O( {7 j9 |0 _: S. q4 [
- #undef EDMA3_DEBUG
4 v2 h" u! U, k- r. L. h7 B% S - /*#define EDMA3_DEBUG*/- x: U' F1 ?0 v; I4 @. I
- X$ ~0 H8 G( t) ]- #ifdef EDMA3_DEBUG# K( B& [: P+ F8 V' `1 ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& q4 r3 C0 |) k, Q$ n9 w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ l' Z3 g/ A; Y' w" L- v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! i* m) N( x& H% k! q
- #else
( z3 K# U; Y+ } |$ |, z - #define DMA_PRINTK( x... )/ b5 n: Q& K4 j, z
- #define DMA_FN_IN
: B% R, q. J3 X9 `) S; o. E - #define DMA_FN_OUT, e" X. ~6 q0 ?& ~* w5 A4 w/ G+ {. L
- #endif. p; l! S( x( H4 M1 z/ \
- ; \ T( e2 E+ e3 y% h! s: a& f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): g& |8 Y! q+ m$ s
- #define STATIC_SHIFT 3) A/ i, ?/ _( p# Y
- #define TCINTEN_SHIFT 20
/ u. t0 F. ]! s7 s - #define ITCINTEN_SHIFT 21
: ^: A+ k$ |" o3 {4 e1 D - #define TCCHEN_SHIFT 22/ \$ U% k8 s) O' i- t3 L0 z
- #define ITCCHEN_SHIFT 23: K% a& s& e6 \( h; k% |
- ( c- A& _ ]" I6 W7 b
- static volatile int irqraised1 = 0;
+ i8 V2 N; z$ o8 S; H( [7 E$ y - static volatile int irqraised2 = 0;
* p+ ^; V4 i6 q/ \2 A5 \2 y* _6 a! X
( \5 Q" L# e6 N9 h X- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* T2 P9 x$ |6 K! L6 _5 c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 d( o3 Q4 q7 k* H6 W( O: M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; _, b2 R/ }4 j9 i% u' ` - ! w) |- j+ u5 M" V
- dma_addr_t dmaphyssrc1 = 0;+ j* Q1 |3 h: I3 j
- dma_addr_t dmaphyssrc2 = 0;5 Y+ c" f3 D* J2 E* \8 _
- dma_addr_t dmaphysdest1 = 0;
! z& j$ K* O' x0 q - dma_addr_t dmaphysdest2 = 0;( O$ Q- _' T+ w# J! H' b i
- 1 `: B9 a: n2 e% g& m4 m2 f! {
- char *dmabufsrc1 = NULL;
. b! x2 | O- H8 ~: l/ ` - char *dmabufsrc2 = NULL;
( o9 T+ P' u# f( [! @7 @ - char *dmabufdest1 = NULL;
, G+ U _0 Q3 n( M - char *dmabufdest2 = NULL;4 ]9 |# f; G' d: @9 h# Y% O
- ) Y+ O% D K' V: {3 B$ h
- static int acnt = 512;
" x8 b) x0 P( {5 | - static int bcnt = 8;
" L7 {" S$ p$ [3 ~! U' ^ - static int ccnt = 8;
( r) ~, p3 @! G, ?( c7 T - 5 k3 t# s. c: N! y0 C2 S
- module_param(acnt, int, S_IRUGO);
$ l' U# B3 ^$ J/ X+ H# K - module_param(bcnt, int, S_IRUGO);. j' J+ n! \) c2 [3 f- |# ]! M5 K
- module_param(ccnt, int, S_IRUGO);
复制代码
" d; m6 [( F- F5 w! X* y* e0 g' k" U9 ~+ D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 U/ N. D. F: l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 I7 R1 h1 ^+ _3 g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 _8 Y b+ c: V
: Z" W5 O+ v8 n. \/ O% {5 z [; X+ i' L9 o# F6 P
|
|