|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ R6 q( n4 B- ^- [code]EDMA sample test application: ]9 ~" [0 c% O7 T5 Z+ m7 d
- /*! D; r/ U& t' b% e5 n, T" w
- * edma_test.c
9 ^% m: f }9 R' j - * s7 s- g& J9 a% b6 b6 I2 ?7 g% T1 \! T
- * brief EDMA3 Test Application. Z, u! ?/ E S1 g' i/ g
- *
% S& s; W- `* H" U+ ?# d - * This file contains EDMA3 Test code.. x7 {* q% t8 F# j \- V+ @
- *
4 P4 R: P4 m& {# E% K S; T - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) Z' ^5 S. d! k- g/ ]3 U7 U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) z( f+ O6 J A; }3 f" I0 N5 I2 V
- * TO CHANGE.
; N. A" S; h( E# W- a+ p - *5 o9 N3 } o R+ @7 V v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 P2 T) [) W$ q8 q6 T" R
- ** g/ }3 H# L4 k/ _
- * This program is free software; you can redistribute it and/or5 W7 j! W$ ?! U
- * modify it under the terms of the GNU General Public License as
, ^/ t+ _& ~# z- P( a7 G - * published by the Free Software Foundation version 2.! ?3 D5 W6 O2 E z
- *' ~; U6 L* x0 ]; i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! p5 K5 b: P* @0 d& z) j
- * kind, whether express or implied; without even the implied warranty
$ v$ A8 s1 Q4 V( G. b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# x4 _, S9 [) W2 S
- * GNU General Public License for more details.
! h0 M+ c% p* c8 x! a' E - */
/ b( X: u' c% L- ` - & h e$ E; I! S& z
- #include <linux/module.h>
3 \* s. y) a1 R& H - #include <linux/init.h>
9 W/ V4 Z% i% A, Q3 s D - #include <linux/errno.h>
9 k, Q" p9 y8 r% r5 d5 U - #include <linux/types.h>9 {& I' v% H$ Q" x. H2 Q
- #include <linux/interrupt.h># V* {& w# X$ {' y9 o( {
- #include <asm/io.h>
# f( q" H) c: b" F# r4 f' ` - #include <linux/moduleparam.h>* T% N" b. R( x8 G4 A0 v
- #include <linux/sysctl.h>
; I3 k" J/ U- ?& h2 U - #include <linux/mm.h>
2 u+ m- O6 {7 R" A - #include <linux/dma-mapping.h>
8 w. Z( E1 E9 j, E; G- g; U$ z, Q
2 w& \2 W8 @+ d2 E6 B, C- #include <mach/memory.h>
- W9 R/ N) i5 E. Y - #include <mach/hardware.h>
8 k: P9 Y( `0 s5 w- ~& k5 _# x - #include <mach/irqs.h>
! ~! O$ k8 L: p" M - #include <asm/hardware/edma.h>8 N5 b$ Q6 K" p; w' K7 g' Q- ?
- 2 v6 ~# o7 t7 h( Z+ J
- #undef EDMA3_DEBUG( m! L5 G0 Z$ c+ I* r# Z9 M2 `
- /*#define EDMA3_DEBUG*/
$ c/ o. Y& ~: r1 F8 P
, L6 u* F4 G4 T# j3 Q- #ifdef EDMA3_DEBUG# v6 _: J9 I0 J: V R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ [+ \' ^" u* s2 |. I3 U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% Z4 J9 a8 i7 d- E1 s& D7 @$ E# Z) h - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 u! ], ^# O: w8 ` - #else j5 `# D3 l/ m; H
- #define DMA_PRINTK( x... )
5 t) v( f( O7 w e7 v1 f' y - #define DMA_FN_IN# p( f( ^+ ?3 }6 Z4 c `8 e- I
- #define DMA_FN_OUT" j$ X- D/ I. I5 H3 c
- #endif
6 ]2 _, M3 ~4 b. j' a/ ~3 S - . ~+ G# I5 n. Y) z! B$ c6 Y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, z4 J9 p- _* c0 E) C - #define STATIC_SHIFT 3
# A( t8 R+ E+ _3 O - #define TCINTEN_SHIFT 20
0 _+ p, K" x8 L2 G! W' ?1 @ - #define ITCINTEN_SHIFT 21) ^" L, X& j, x. W8 y3 L) o: [
- #define TCCHEN_SHIFT 221 J# h! h! P/ T, x8 N! t; x
- #define ITCCHEN_SHIFT 23
( q H: E) Y, k! c5 W h
. y( k, G9 E: T; K# {- static volatile int irqraised1 = 0;( V' [% P( H n6 b; B
- static volatile int irqraised2 = 0;
4 {; ^! k, e8 p% R5 E+ u$ o
! v; v; g6 h# W8 P, \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! _+ a* ]; U9 p4 G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. V! h5 {% Y# s2 S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( y* i- W6 I9 P3 v( {% S) B - + p/ p2 p2 g/ Q, S2 @
- dma_addr_t dmaphyssrc1 = 0;
1 Q$ v5 q, F5 p q - dma_addr_t dmaphyssrc2 = 0;- B( e. B2 m- c2 b9 a" K0 R9 D3 p
- dma_addr_t dmaphysdest1 = 0;0 {4 S! C, c; [$ E
- dma_addr_t dmaphysdest2 = 0;7 _) p0 S# p9 j& L& l
) O% b; s, o& G0 o: S9 {9 V0 S5 s- char *dmabufsrc1 = NULL;
2 _: J! j6 r3 s) b - char *dmabufsrc2 = NULL;
: a# G$ F# A. q& M - char *dmabufdest1 = NULL;& Z6 U0 R7 i4 W" u
- char *dmabufdest2 = NULL;# e" g% O2 m5 G
' L1 \* H) j ]/ G4 A$ F- n- static int acnt = 512;, g, B9 S5 L5 Y8 S+ T
- static int bcnt = 8; K3 P( S+ r- t
- static int ccnt = 8;
% O# z% x+ k" j - % `0 L% E$ `5 E4 W4 g1 a
- module_param(acnt, int, S_IRUGO);- g7 c& B( u& r/ f6 _ t
- module_param(bcnt, int, S_IRUGO);
2 Y5 p1 ?! w2 r1 Y, R - module_param(ccnt, int, S_IRUGO);
复制代码
% L' f) E. E. m) Q- K! |& |" s( f6 F4 R
' \% F( X C, I: z0 ?" c 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) k& p1 ]8 L5 f0 ]+ H; e3 ~4 N- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& F3 k( V E; g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 g7 e9 j* J0 N$ j: X7 o& b
; r2 j; O% G3 c4 z4 I' y% l: o! A0 w2 o/ Y! a; J; g5 K4 Z
|
|