|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % a; O4 I$ h. p2 W' n) L7 V
- [code]EDMA sample test application! s: R1 r/ C- U, j$ e0 F$ E( _
- /*
7 m/ `3 y) |$ [ - * edma_test.c) ]' Y0 d' L, K, T5 p Z
- * k! i2 N+ x9 B. F' J1 S
- * brief EDMA3 Test Application/ u R+ [; K7 [' h0 w q9 \" H
- *
7 S l% I q9 y% J1 `% O2 t - * This file contains EDMA3 Test code.8 F$ o! n, s j B0 _3 T
- *
# `/ `9 E8 u/ {6 i; x8 K - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 m- a5 n9 q8 A! Q: B- x; j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; W+ p& U8 d2 ?8 y# G1 R3 j& P
- * TO CHANGE.; I \2 T( @- Q r$ s$ e
- *
. z6 S6 _; N, _# O% ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 a* l ~4 j7 w
- *
; V4 U# {6 d5 i+ m+ X - * This program is free software; you can redistribute it and/or
5 ?" S7 L$ @! P. ~+ @* } - * modify it under the terms of the GNU General Public License as
9 u' J2 z+ I5 V! t1 ^: I8 _9 N - * published by the Free Software Foundation version 2.
* e" B+ T& b8 i% B4 z - *- h0 U2 K" T) E; R z8 X! K! a3 J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! v- }, L1 S' X4 s8 V - * kind, whether express or implied; without even the implied warranty$ D7 U% N* f( Y# Y4 E# V. \8 G
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& @# X; S" s/ P: Y% s5 Q! R% k9 J - * GNU General Public License for more details.2 Q8 o' B8 m2 X* y0 O
- */4 |- o) W7 n0 g
+ F9 f: W6 z7 V. y$ i& m- #include <linux/module.h>) _; @* i6 d5 [/ A
- #include <linux/init.h>
1 q: T4 w; P g ?% ^. f7 _( ~" w5 K - #include <linux/errno.h>
; e5 L# | N7 P# ?) s. s - #include <linux/types.h>
. ~+ o8 T' X* C* K) e1 [ - #include <linux/interrupt.h>. s4 |! q3 m0 o$ x8 K
- #include <asm/io.h>/ d4 ~* F' |# J! f" H# l
- #include <linux/moduleparam.h>' v* c x9 P# y) y; W5 e) P+ i% ~
- #include <linux/sysctl.h>
9 i. ~* Z4 e, o - #include <linux/mm.h>
% }2 Y7 z* l' ?: | - #include <linux/dma-mapping.h>
4 ^: i) ]* B! F$ s - $ K& ^5 u6 L7 D) E% d1 w$ A% ~: x
- #include <mach/memory.h>
2 [' G( M& C3 u) H% O7 Y5 b - #include <mach/hardware.h>( j* l0 ^$ J' Z: @" Q% v o! x4 m
- #include <mach/irqs.h>
@7 \7 w: t O1 n; I4 a0 Q& ~/ u/ M - #include <asm/hardware/edma.h>3 p* {3 h& D6 D) d4 x2 |
8 O$ {1 _# d/ ~% m: S8 I" ~- #undef EDMA3_DEBUG, N1 Z9 H& R8 G* u+ E) o
- /*#define EDMA3_DEBUG*/5 j' m! L3 m! ?7 Z- [
# {, _& i$ |; D* z% F8 c& v4 O- #ifdef EDMA3_DEBUG
$ q- z& ?( x) L; Y1 ]$ q2 q5 \ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 x4 `+ A+ Y+ {8 l6 ]2 z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' o6 l4 z6 m+ k/ h# @' e' t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% N2 M: @; D9 P7 |
- #else7 T- M: Z1 O l0 f
- #define DMA_PRINTK( x... )
O* Z( P1 Z. ~$ x' w" H0 v - #define DMA_FN_IN
- [3 _% i7 ]' w7 R2 `) p# x - #define DMA_FN_OUT/ Q8 b( } \0 P B1 j* u0 l
- #endif8 E( Y* q1 J$ ^. k+ N) \
' P" f% Y0 H+ K+ Y9 u* ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% Q% _8 {$ O* n0 J6 B - #define STATIC_SHIFT 3
: G# F) N* |9 W8 L: R2 J% J - #define TCINTEN_SHIFT 20
_% x( k4 o9 l: S) p - #define ITCINTEN_SHIFT 21
7 J4 U4 P2 k% k - #define TCCHEN_SHIFT 22
- q0 i8 W7 K5 ?* t- K. X/ S - #define ITCCHEN_SHIFT 232 n! u( o3 } `, ~* }% `
" x/ {0 P5 [4 w- x- static volatile int irqraised1 = 0;
' D' C$ Q& v! G9 g9 P1 E3 F - static volatile int irqraised2 = 0;
% h, g6 r; @# h$ q; A* b. Y
# I0 {8 p* o4 s8 l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 J' K! b* ]+ d# m( H, |$ v. N% A - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 q2 w! X6 j9 m2 ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# R+ J- p Z- m, v7 d* }3 T) e
: X+ e3 e9 {: ^; m$ y9 Z6 b# g- dma_addr_t dmaphyssrc1 = 0;0 d& C0 _& G9 F" y; Q( U7 V! f3 Y# m
- dma_addr_t dmaphyssrc2 = 0;% e8 U; t+ `& B) E) j
- dma_addr_t dmaphysdest1 = 0;
; G" u: G+ g. I. i& K - dma_addr_t dmaphysdest2 = 0;3 o' Y0 t8 g) _" e, G
' x1 d% _$ o- e$ R; f. l/ s- char *dmabufsrc1 = NULL;
& d# y: n4 f& o( P6 M - char *dmabufsrc2 = NULL;
5 P5 E1 S0 V& E L5 ~# r: ? - char *dmabufdest1 = NULL; D. x* d, C9 [( m: L
- char *dmabufdest2 = NULL; r3 d1 Q5 b) V; P6 `: h; u$ Q5 M2 \2 H
. r$ r6 U1 m& e. \- static int acnt = 512;8 A7 f& |6 @6 z: W+ Q4 T& a, p/ j8 t: [
- static int bcnt = 8;' L8 P4 t+ o: t2 e
- static int ccnt = 8;
% |& t/ z2 Q# ~1 K0 R: V
; C& t& \3 ^$ Y0 z3 g! o7 v- module_param(acnt, int, S_IRUGO);
' J7 Q- F5 C: c X& f$ G6 r - module_param(bcnt, int, S_IRUGO);; v! q4 n0 j5 H; h% f
- module_param(ccnt, int, S_IRUGO);
复制代码
' H( `5 V M% |4 _; E) ]5 O, H6 h; X" n0 w$ k, u0 R0 V0 j. L( P
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ m" s7 \" D ~: \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, A+ [4 g% e% p0 D7 w! E* H% F 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: A+ b8 m5 e4 V* H
6 F3 a5 f& g8 |) n y5 X' t1 L
8 n b7 x7 H1 G8 U
|
|