|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " P& _1 Z; e. T2 f1 W
- [code]EDMA sample test application
0 v- P7 a. ^+ v - /*
( U/ A! z9 |: t' A) }" F - * edma_test.c
2 }) _) y0 }, t2 E - *
* S" D! a) X! X. ]0 Q/ l - * brief EDMA3 Test Application
* e$ A0 b. V& q - *) ]4 o1 S; ?& X6 D2 ]/ j( T4 E
- * This file contains EDMA3 Test code.
4 ^3 a+ n% Q) c# T( Z: i, t+ p" ^ - *3 M5 I. T, i! o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ g2 [4 _& u) Q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" W5 Z8 C$ a5 m" P - * TO CHANGE., m( g6 b8 `( C) J. U+ Y
- *
4 e' Z; \: u/ g# ~! } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 s" q# A! ~3 j- P, ^8 w - *5 D* y9 N: ^. ^4 f' ]/ N! f9 L
- * This program is free software; you can redistribute it and/or
: }$ C, E" Q2 q f9 s' K - * modify it under the terms of the GNU General Public License as! z6 Y3 L4 K6 ?6 {" F
- * published by the Free Software Foundation version 2.
2 }) H/ v- U- p, [7 W - *3 f8 O0 |( t" p4 @3 [1 L8 r9 N
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 Z, n" {! B! c% [
- * kind, whether express or implied; without even the implied warranty
7 v+ p. F r$ l* B) {6 Z* \, r - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 D/ r$ F7 k8 X# g9 \
- * GNU General Public License for more details.
& a# X! n0 M( k* a/ J - */
' F9 x" h( a1 {5 B - $ g) N4 \9 p2 k& P3 W0 n
- #include <linux/module.h>
' X. V3 U6 ?- x# v - #include <linux/init.h>! l" h% @4 u7 N, r
- #include <linux/errno.h># i+ W& W* }) n8 N6 Q1 _- m
- #include <linux/types.h>$ l! H' M; ]! P `, x0 c
- #include <linux/interrupt.h>; m9 G# J6 t5 J& x# O! S- a% H5 ]
- #include <asm/io.h>
. q% p2 L$ ?& c6 T# q - #include <linux/moduleparam.h>$ C9 v/ s) s1 O) Y' |
- #include <linux/sysctl.h>
6 @* b$ Q+ m7 Q" C( k. Y - #include <linux/mm.h>
; @1 j- t* o# w* A7 C" D9 d8 o# B - #include <linux/dma-mapping.h>) f( H9 M8 y( z! L1 L: u7 {
3 X0 r A, s( V. b) R2 `( _- #include <mach/memory.h>
3 P1 t0 E, I( {! P& F' u$ [$ \ - #include <mach/hardware.h>
+ T+ V [" I8 m' h# g - #include <mach/irqs.h> n' K( R6 U, [
- #include <asm/hardware/edma.h> k. @2 ^) z7 y6 ?' \: {: o$ f
- / {; H- T3 R" h
- #undef EDMA3_DEBUG
9 v9 p: u) C: E5 r9 T" O) z. ^ - /*#define EDMA3_DEBUG*/4 o) J) k# i7 N r% Z
- 2 l% l. Z! q6 F" O# Z- L
- #ifdef EDMA3_DEBUG
: k' K! R0 }6 V+ s# k' {1 t - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' N. i' P- A9 J1 d' S/ E$ P - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ _$ w6 A, n' @; i
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. y2 F6 G% ^ `; C - #else3 f. M2 U! C4 [7 ~) G+ @" B5 @3 J9 w
- #define DMA_PRINTK( x... )2 e2 ^3 R6 x( \+ J$ Z" |8 C/ O
- #define DMA_FN_IN* w( i: s. f' V
- #define DMA_FN_OUT
6 x) x6 c6 V6 c! B0 L% [+ Z/ r) o - #endif
1 `! ?0 O5 O/ { - & G& E4 l& q- n' H0 {- _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% y7 t! J; C% _3 S - #define STATIC_SHIFT 3
0 r8 G. f" I v. ]3 v$ Z - #define TCINTEN_SHIFT 204 k2 ^( u/ G4 n7 d& h. {' v8 Y# W) ~. L
- #define ITCINTEN_SHIFT 213 x& X* e/ j6 B" c) q0 y7 V1 ~
- #define TCCHEN_SHIFT 22% w. F" L4 j }5 ^1 Z1 {% w
- #define ITCCHEN_SHIFT 23
# Q7 G! C# X( b* o- ~9 A( D" k0 } - ; m( A- ?# }8 k# N; I y% _
- static volatile int irqraised1 = 0;+ w' a+ B4 s4 G8 R
- static volatile int irqraised2 = 0;' N, e* b; M; j: r* F
) n0 b7 N: B0 u y+ f! ^4 _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 b [6 d9 Z9 Z) t& `- w9 U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( }# u' ?5 S7 L5 ^* C ]$ X
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 h! y+ ]6 a# m8 ^; O3 p - 5 F; f$ y9 }9 z$ h
- dma_addr_t dmaphyssrc1 = 0;6 D5 _, F9 ?) j* a0 F7 E: e
- dma_addr_t dmaphyssrc2 = 0;, }% ~: Z% F1 h2 v+ B
- dma_addr_t dmaphysdest1 = 0;
: R; V9 t/ \) s* C, O - dma_addr_t dmaphysdest2 = 0;8 T6 u/ Q7 ^4 S( |& i$ Q# F' d4 E
- 6 }6 F9 g& i3 R+ p k1 M
- char *dmabufsrc1 = NULL;
4 I1 G8 i& z" n9 c C0 a( V, I - char *dmabufsrc2 = NULL;
& \# ?! a( x9 R w - char *dmabufdest1 = NULL;
/ {" t. s" Q# b1 n7 ?4 ^ - char *dmabufdest2 = NULL;
& ^/ [( l- M0 ]/ S1 J
8 y% p! ] w# B/ Y5 c- static int acnt = 512;
. n! I' p" e _7 U2 Z6 r - static int bcnt = 8;% h/ Z$ V7 w; p1 I8 z& |
- static int ccnt = 8;
, I. c! i8 R. ^9 b% b/ Y4 z
3 P' |$ G% P5 |4 N- b- module_param(acnt, int, S_IRUGO);
# k/ Y. N4 V! N6 [, s - module_param(bcnt, int, S_IRUGO);
9 k$ g3 I( g$ Q# ^ - module_param(ccnt, int, S_IRUGO);
复制代码
, v# r3 }* W$ R: H8 h, e# e+ r+ J; I: v0 Y0 d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 m' D1 N6 N; T/ f" |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 j8 r# O* R$ K3 D! x9 s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- d z3 Z, g& {1 y9 H9 i
_* V" k' L) p$ [+ y4 e5 o
" a* h8 B! A& P/ l2 U5 H |
|