|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 B* I3 Z* ]( f3 w0 Y- [code]EDMA sample test application
4 V. N x2 }/ |5 ? - /*# b( z x1 ~ f) Q; R) R
- * edma_test.c
8 d6 G7 p' L T7 {& F( I, M - *
3 D' L) y! ^/ ^ - * brief EDMA3 Test Application
6 g' j0 L ~+ V2 g" x - *) Z# Z. F9 J# A9 m0 z l$ R
- * This file contains EDMA3 Test code.
! |6 r4 D! A8 I( l5 }% O - *
- R* p( p6 e+ a8 [$ T - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# e% Q D9 t1 |7 S - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ }9 Q j# w# ?& V( G
- * TO CHANGE.
' b1 M/ {4 Q" m - *( d/ ?" `$ s1 b9 G
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ _# q) {( w; D. Y3 o - *; `+ g" `& Q$ z" Z
- * This program is free software; you can redistribute it and/or
2 D, X0 K8 ?6 u# J0 a& I. T - * modify it under the terms of the GNU General Public License as
- T4 t! Z4 |: W/ N1 g6 K* x; R0 N4 w - * published by the Free Software Foundation version 2.
, ~" G+ Q7 V r& M& W# P4 u - *1 u( w4 q6 ]: x: W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 A3 E$ Z3 k k0 \/ [6 B
- * kind, whether express or implied; without even the implied warranty
' |0 o/ u- ~; R - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; T2 Y) C) n' r3 D
- * GNU General Public License for more details.
. R4 h5 s# @, R! K b# V - */" @1 K3 e( `6 O7 f- g; X% |
& T; P) c5 j, B: N% D& U- p3 ?, y- #include <linux/module.h>1 g, U9 \; ^; ?2 \: t" s
- #include <linux/init.h> N% e/ h; Y ]9 ]
- #include <linux/errno.h>
* V( e2 k/ i' e: w, T" _ x" T. }5 a - #include <linux/types.h>/ E% W5 @) [% s
- #include <linux/interrupt.h>
0 Q5 j3 N2 F+ p! q% M - #include <asm/io.h>
, f9 x4 w/ }; y* q# C! m0 h5 O: H - #include <linux/moduleparam.h>! a& f1 O. S' f* E& @" _" [
- #include <linux/sysctl.h>% W" |3 u2 M( ?
- #include <linux/mm.h>& K0 l- _* ^3 U
- #include <linux/dma-mapping.h>
$ s+ R' p( g, J% G6 j+ Z6 ^
% g: i' Y, n+ J L2 D- #include <mach/memory.h>
6 ~: M( s5 O2 K- ^7 w( C7 r8 H - #include <mach/hardware.h>* c( K6 y! L+ I( o7 @8 Z6 e+ }
- #include <mach/irqs.h>& |2 P9 e7 k- F
- #include <asm/hardware/edma.h>
% S! v) D1 z' M
1 _) s6 b* Y; x: N0 P' {- #undef EDMA3_DEBUG
1 \* k$ E& m3 `7 `/ u - /*#define EDMA3_DEBUG*/6 s# a; f9 l- o
- $ D/ G! l6 ^, }- {
- #ifdef EDMA3_DEBUG1 J1 B; J+ u- P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 [& _5 o" s, {, U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). P$ `+ ^; ~2 K5 X% L
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" a8 L+ C) @4 |/ v- l& f! {
- #else7 @5 l+ d/ \ M6 u E j7 ?5 h
- #define DMA_PRINTK( x... )
6 s$ f* q: c7 P" k; @5 e' f# q - #define DMA_FN_IN4 N7 h/ R7 U' p) ]/ L- \
- #define DMA_FN_OUT2 L6 w0 K9 C9 a# T/ Z# ]- }
- #endif0 W6 {3 b; z6 T) R, ]9 y. s
- 8 i7 c3 W/ X1 r$ T& {" Y8 p
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 W K( s, C7 ]7 h5 N' w1 J) X* W
- #define STATIC_SHIFT 37 {2 V5 I! Y. W X
- #define TCINTEN_SHIFT 20' \9 ?! _% u2 s. p1 b$ i: u$ K
- #define ITCINTEN_SHIFT 21/ v( \% s: p8 X/ F. W8 ?# X. M
- #define TCCHEN_SHIFT 22, B5 I! X0 f/ `, J( C4 y8 o
- #define ITCCHEN_SHIFT 237 U! i3 I: G7 k( l5 U
9 l$ S U" c9 N4 Q) z/ L) O$ o- static volatile int irqraised1 = 0;
6 p# z6 j1 a( t% h7 f, z2 H5 m+ h - static volatile int irqraised2 = 0;
/ p; w, \% }% J! t! `1 W: c
1 \, g; u+ O1 j; C! ~( D- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) |5 X' j: G# q( s* _% m2 p5 F - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 o& z) V% ?1 H! p( ~7 H) ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( u# M9 _' W+ _& A# [9 F* s
( n; p' e2 }5 e6 L G- dma_addr_t dmaphyssrc1 = 0;
& E* a+ V% k8 T7 ?. h- [6 B9 N - dma_addr_t dmaphyssrc2 = 0;
5 b/ [9 A& ~) t; ~ - dma_addr_t dmaphysdest1 = 0;# Q/ b$ [: x3 H. T4 W
- dma_addr_t dmaphysdest2 = 0;" Q' Y# ~8 s% k* m! f3 {
- ; x# i% m% `5 h2 ^6 I/ T1 E* R
- char *dmabufsrc1 = NULL;8 K s/ `* W/ e' O! P8 }
- char *dmabufsrc2 = NULL;& a" g2 E0 t3 O! e
- char *dmabufdest1 = NULL;) E: p: v, D4 Q. B% ?& y: f
- char *dmabufdest2 = NULL;* H, I$ ?1 F9 a4 J8 @8 s# v
6 g! j$ j! e1 c' {- static int acnt = 512;# L4 ~& F$ `/ \$ G
- static int bcnt = 8;
, F5 f9 J3 U8 ^/ D" R V: x. Q - static int ccnt = 8;
; O) B; m0 D: P, I- b: S
7 b% [' o- n( H8 Y- r- module_param(acnt, int, S_IRUGO);4 f- S- s+ q+ g( t/ H- g
- module_param(bcnt, int, S_IRUGO);4 N0 U( o5 a! C8 M+ W# p
- module_param(ccnt, int, S_IRUGO);
复制代码
1 q, f8 T' s, m! E1 f* M+ `4 C
1 y* v# D# w; O: M ]* e' D& W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 ]8 |3 ]( C9 T- n. Q! D6 Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 e5 }2 R% ]! R% I$ Y6 Q. u) z8 N
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- X: c- Y; G* h! s' H! q U
7 p: W% S# X$ M: U% F; G I* ~, a0 F( y
|
|