|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) O8 V" ^- h, x/ t; Y9 T
- [code]EDMA sample test application2 I8 |- O) c$ Z
- /*
! |, C" t" C* L1 t f$ z. y - * edma_test.c
& Z3 H8 F; r( y6 C# d - *$ r, t, i) V6 c
- * brief EDMA3 Test Application
/ B s; |# B. T. ? - *
0 ~8 k; w, T- ?2 Z - * This file contains EDMA3 Test code.
+ o& V8 O2 |/ e/ B } - *
" N" E" s& G% e- S7 V0 d# ^, O3 ]! w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" o/ v8 q# ~+ `/ e! \" P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 u5 t% W* P a. l
- * TO CHANGE.
; |, y: Z# U* ?. d# Y - *
& d0 e0 O( `" f3 z* G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( n# \$ {+ f# V - *
) c- A- y5 L3 d7 ?* `' ~! {' S - * This program is free software; you can redistribute it and/or; i1 K+ b1 S' A4 x6 k# I- r
- * modify it under the terms of the GNU General Public License as
. K. r+ w& j8 l- i - * published by the Free Software Foundation version 2.
$ ^% d7 J; h' j% G+ q - *% w# U& U% d* `0 U1 K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ i$ f4 B; P3 O% W - * kind, whether express or implied; without even the implied warranty
1 q8 B2 V q. T) M- U: I+ w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, t* W' N. Y5 s' B# @ - * GNU General Public License for more details.
& g3 o6 t$ w1 E- h - */
/ n, n' x. M% C" U4 j
9 i C3 w! H. y9 U0 o( f- #include <linux/module.h>' B* }/ F; {1 I. ^/ w0 h
- #include <linux/init.h>
5 R/ C/ f7 I# c# s* q+ ?- K: v" B. @: |7 q - #include <linux/errno.h>! U+ _1 E" u. z0 n( @' \
- #include <linux/types.h>. Y& i0 J6 U0 y" z% ~. n
- #include <linux/interrupt.h>( f" G4 v& R7 |7 s+ j2 o! m
- #include <asm/io.h>% c9 O% S* e$ I- K, u
- #include <linux/moduleparam.h> N* ^, e% b- [4 u& t9 F
- #include <linux/sysctl.h>
! G' @1 g7 R+ a5 O, k- ] g3 Q' L - #include <linux/mm.h>& s2 j8 r$ }' R! w0 x
- #include <linux/dma-mapping.h>1 U. z( ~- @3 x, C4 V
- . W8 ?0 R, K9 p9 Y" E; j' L% G" E
- #include <mach/memory.h>4 m% {+ g# D# |. e# X& D3 c
- #include <mach/hardware.h>
0 E4 _0 m% e C( v$ v$ k - #include <mach/irqs.h>" z! F h6 |" r o/ C
- #include <asm/hardware/edma.h>* |1 f$ h4 ^2 H
- ) Y) ?3 e2 Q; N+ s' M& Z3 M
- #undef EDMA3_DEBUG" I) C; e3 v2 w9 ?
- /*#define EDMA3_DEBUG*/$ ]: [7 [& b/ {" P( s# o& T
: j5 {+ @ s- l9 W( i% }- #ifdef EDMA3_DEBUG, ^4 M' J M0 s# v/ l) H
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 E0 r4 Q) W0 J - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ P! C' E3 i4 N3 x2 P - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): m! Z+ y) s0 w$ L- i: j) v+ H' u
- #else
* t9 b v# @/ [ - #define DMA_PRINTK( x... )$ n( L8 U8 H6 F; {
- #define DMA_FN_IN: M/ T4 Y0 G/ ^. q% X6 a6 l
- #define DMA_FN_OUT3 }3 s% _& U" s
- #endif
+ y$ r! P6 m, t# _, k4 U. K9 E - 1 _( t" y" [: L" C4 ?! X
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), F- b. y! {% |) }
- #define STATIC_SHIFT 34 J3 X6 D7 H/ D) Z+ }
- #define TCINTEN_SHIFT 205 s3 a$ [1 D3 f' k, z- B' b
- #define ITCINTEN_SHIFT 21
+ P3 x8 t! Q( e- J# O - #define TCCHEN_SHIFT 224 X% e; D/ u6 p8 r1 [
- #define ITCCHEN_SHIFT 23( }' W' P" c* R0 X4 S
- 0 }/ P2 D/ Y( z
- static volatile int irqraised1 = 0;( @% g8 j6 K* E7 l+ y
- static volatile int irqraised2 = 0;
! f0 d" i t3 T. T% Y5 ~3 t( R% k
3 V, y" ^0 u5 y( P7 _) Q3 a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" Y# o5 r* K! F# O& l. j/ J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 z* [# ]$ X9 l - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 i c# c9 K8 V$ |
- |0 w1 V, r7 T' p* H5 Z% H- dma_addr_t dmaphyssrc1 = 0;
% Q, e# h5 X0 D& q - dma_addr_t dmaphyssrc2 = 0;, o: K9 i! B8 S- A7 H
- dma_addr_t dmaphysdest1 = 0;
6 i& A9 d0 W7 A8 s0 g5 B - dma_addr_t dmaphysdest2 = 0;. g. w1 w. z- \4 Z# R. O( q C
- ) `0 r& w9 {; t
- char *dmabufsrc1 = NULL;% H4 H2 X7 w8 w7 _2 T% X
- char *dmabufsrc2 = NULL;
& Y0 [$ i0 Y7 B* P f2 i1 R - char *dmabufdest1 = NULL;
& @ i$ r$ k9 v7 T/ Z2 m# b5 b - char *dmabufdest2 = NULL;
- A2 m$ D+ T4 j' n) e6 f
& T9 L0 S) W8 J4 M) {! A9 W8 C; r- static int acnt = 512;
3 q9 r. m# P/ x: N* z6 p - static int bcnt = 8;% j. T0 Y* O2 P1 B' U2 e1 R4 i
- static int ccnt = 8;
8 t8 `/ |+ k& B- n o7 m- n! u - 9 m4 |! b! q$ x2 W& C
- module_param(acnt, int, S_IRUGO);/ A. D1 A9 m0 b: J$ i9 N( `* f
- module_param(bcnt, int, S_IRUGO);; C+ j+ Y4 m6 v( q% L8 \2 M
- module_param(ccnt, int, S_IRUGO);
复制代码 6 E1 h( l4 E Y: s# ?
3 l' k9 u4 T* i) s" F$ Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 x% v* x9 `! `/ ]# i- C4 zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; p$ f" X* Q# t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 y* z2 _" } Y! S) y7 L- L7 a, V& t$ n& ]( c
' @' o* {8 |# z1 u! O1 k }
|
|