|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' c/ Q/ Q) f5 t& S" v- [code]EDMA sample test application4 z) R* s) w. ^. h& D4 y$ |: {& Y
- /*
5 g8 _$ [5 D& S - * edma_test.c
* e7 I* Z! r) S3 n5 e$ f - *
/ v( }5 S3 d/ N8 M* C5 f& {2 R& u - * brief EDMA3 Test Application
8 b( Z5 q$ u% ^" ? x' b - *, l' p9 P B8 V) W Q E
- * This file contains EDMA3 Test code.
% m& t; o X) j# { - *
7 a4 y/ o( U4 b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ X* |- N: \5 V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 R- ?. T [4 n* s, \( F
- * TO CHANGE.5 C' u& d/ Q0 A* e8 O
- *3 S8 T2 S" b9 X0 V: h; V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 \" n, p g1 S7 F3 j$ v: i" v* i - *4 N) Q) Y& b/ n% w2 O' u' G
- * This program is free software; you can redistribute it and/or4 D. S/ E1 M. s, z
- * modify it under the terms of the GNU General Public License as
& L. y0 S! ]& `/ u' V+ F - * published by the Free Software Foundation version 2.8 S+ Q1 q" y2 L) g+ B
- *
* i* H# @( \+ x' } - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# x$ O! h. U- o) H& i
- * kind, whether express or implied; without even the implied warranty' Y6 Z3 H, K5 l& [# e6 e! t1 b
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 `( J' j [- K# `* b. G6 f - * GNU General Public License for more details.
; m' e& B3 J. A! C- x - */
8 c0 }. n9 E& E+ q/ K' b& Q5 u# ` - " v+ @9 B) |5 l- i
- #include <linux/module.h>
, T9 h9 A8 Q% I/ U" J7 u8 a - #include <linux/init.h>0 T9 C' ~; y+ V7 \: J
- #include <linux/errno.h>
4 k/ d# l/ Y0 w( w! y O% D9 z$ z - #include <linux/types.h>/ B, u$ T: X+ ?4 }3 U$ r0 K5 S
- #include <linux/interrupt.h>
2 g% \; K! B% I: A" A0 }/ H1 }0 U - #include <asm/io.h>
; l' I0 a1 e! g8 h, T' x - #include <linux/moduleparam.h>
# k$ J" q8 f: I: |; e# C8 Z - #include <linux/sysctl.h>6 l# U' |+ V5 S! m* e1 T
- #include <linux/mm.h>0 K( M* Y) a2 O& q ^# W
- #include <linux/dma-mapping.h>3 h7 ]" }& }6 g1 e
6 Q$ y' L1 y% F' b0 C5 ~* s- #include <mach/memory.h>
& ^1 M$ u- x' H8 s - #include <mach/hardware.h>
1 k/ d/ D' X9 V; J2 c. m9 a( I - #include <mach/irqs.h>
7 O+ F! J' S- ^ Y" |( b - #include <asm/hardware/edma.h>+ r/ ?9 m/ b6 k0 C
- % K; m' P* H! ?! B4 g5 o' ~
- #undef EDMA3_DEBUG+ [7 g, Z4 O8 h' F! n$ x* e! U
- /*#define EDMA3_DEBUG*/
/ b; q! I6 T, S4 k5 A - 6 g& | I" s d) q! R
- #ifdef EDMA3_DEBUG- y% I/ H, s |5 g
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), i$ F9 f! x$ S$ W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 l5 m% z; N! e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( A6 w# C* _8 d7 S5 s - #else; q m- D) `) A' p. V( |6 w! N
- #define DMA_PRINTK( x... )( F9 t2 n5 I; P, k
- #define DMA_FN_IN" o4 G' \+ p' {( Z" Y3 L( X' V
- #define DMA_FN_OUT( r6 _6 a( u& v- l7 L9 @) A
- #endif
' A9 C( m% f- [3 s3 O, d/ B1 k
* p' o; h, ?. B# M8 b( ^* o5 v- #define MAX_DMA_TRANSFER_IN_BYTES (32768). I; t4 B( j( [$ R: \
- #define STATIC_SHIFT 3
% |, b ~" k: z8 R6 O - #define TCINTEN_SHIFT 20% X: d1 k0 m# ]6 f2 ^" p
- #define ITCINTEN_SHIFT 21
9 \3 e+ g* [, N/ v a+ q% O - #define TCCHEN_SHIFT 22/ I1 [. i' ?1 Q9 a4 z
- #define ITCCHEN_SHIFT 23
% Z3 Q( _ O0 O. `+ X/ {
7 k/ B4 |) } ?! a% d2 k- static volatile int irqraised1 = 0;4 F; i9 }" S2 r; L9 a/ R
- static volatile int irqraised2 = 0;( S( x% S1 C- s6 p- Y8 H- m
0 h" f% S7 \# _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! c3 z" _, o3 ^& o0 G- Z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* X" {/ o e: Z2 I2 q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ c) i1 V( V' H. O _- Q0 u
! [) T+ W i1 @+ L4 ^- dma_addr_t dmaphyssrc1 = 0;# R. e* C/ V+ w3 e4 X0 E5 v
- dma_addr_t dmaphyssrc2 = 0;" c5 V( ]& y: b T
- dma_addr_t dmaphysdest1 = 0;
6 r/ X2 V/ b$ d; k9 C - dma_addr_t dmaphysdest2 = 0;. h5 `7 ]. N+ h) p1 R
- + ^* q( a. ~$ n; d' @
- char *dmabufsrc1 = NULL;
( `9 P, `2 \7 J; f. @/ }8 V6 u - char *dmabufsrc2 = NULL;
4 z; S; z! N& D" |2 i# h - char *dmabufdest1 = NULL;
3 }6 |3 }6 A" x$ p - char *dmabufdest2 = NULL;" Q3 t! d' l( R# C8 E$ c& s1 z7 z
1 A2 @/ ^: p1 F. g& E: q- static int acnt = 512;
$ N# w: o; W) i - static int bcnt = 8;0 d+ W1 U$ f: C+ i5 ^- G
- static int ccnt = 8;
@$ n6 l+ ^" g j0 b; B
' j2 m' y+ k: C, S- module_param(acnt, int, S_IRUGO);- ]( }5 t/ j4 u" Q5 r
- module_param(bcnt, int, S_IRUGO);
, A% }% U& O5 h - module_param(ccnt, int, S_IRUGO);
复制代码
4 E6 M" U2 a Q& m* U* l1 R" R/ a1 K( T& E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 L2 a, I- Y3 l. p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 B6 F* p- N! U4 x( Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' i) `, l( C7 R
& T8 @, N3 P( J* v
9 Q( M1 D# }# ] `- f, C |
|