|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 J+ c0 R" x2 S- [code]EDMA sample test application) a: A' r5 k- h. G, ~& \# F) D
- /*4 k1 b3 E$ p1 W( ]0 Q2 F
- * edma_test.c
! K, g9 ^3 _" T, E' L - *
3 r; L6 D5 b5 D- {4 }5 N - * brief EDMA3 Test Application' A" C ^0 ` @* H7 X5 k4 r9 F
- *
) D; b$ q9 Z! R9 A4 b - * This file contains EDMA3 Test code.6 a1 B. r( x4 x. d) T4 ?& _
- *
- v0 `9 V6 }: w1 b n0 L - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& B9 z& u9 f. ]+ T$ K4 N w - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 [ ]" K- D, n, F7 C7 [8 K# S
- * TO CHANGE.: P) Y2 P X1 G% E- u) m+ r/ w
- *
* K7 N5 J5 P7 ]* m5 G4 V' X8 v - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& F1 g2 v( K+ w9 r; T0 x7 B0 u4 a - *, T w! P' q8 J( Q& c' d
- * This program is free software; you can redistribute it and/or
1 Z: J' `+ ?) `8 y; |) _ - * modify it under the terms of the GNU General Public License as3 K# ]# R& v' l; k" S6 Q7 s* q
- * published by the Free Software Foundation version 2.9 i, j `/ F- m4 t" J! k
- *% k, H0 n7 l- l* T; G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any j* {. ^' I/ @5 C! ^" q( n
- * kind, whether express or implied; without even the implied warranty+ \7 N* v7 K- |' Y* o7 U& c. z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. W5 I' O8 ^+ L! Q: F Y - * GNU General Public License for more details.2 v. p+ b3 l' e! K3 Z: P. t* S% s9 U
- */& m S$ g: [, G
c1 x, |; ^1 o& g( g1 h: d, I- #include <linux/module.h>
) S1 m4 q# |* E0 p0 C - #include <linux/init.h>
$ e; r/ _9 `% z: x - #include <linux/errno.h>( d, W: [# W- M- K* V
- #include <linux/types.h>* M3 b: q! K1 ~" N0 q4 A( |
- #include <linux/interrupt.h>7 w' P' m' r+ l% C8 n
- #include <asm/io.h>
" Q- S% z q/ h7 q; n2 E) V - #include <linux/moduleparam.h>
/ u5 v# O8 @( _8 A - #include <linux/sysctl.h>
8 L* O9 s$ O3 ^: v - #include <linux/mm.h>- s$ _. z) ]3 l' ]. `9 |
- #include <linux/dma-mapping.h>7 x* v+ u `: N% I2 H
- \+ b( p& }( f$ q5 g8 V- #include <mach/memory.h>
! O6 ]" q7 L+ S5 I: G. G# s - #include <mach/hardware.h>
1 |$ e8 K7 Z: m9 _) f2 L! j4 _ - #include <mach/irqs.h>4 |# a! ^# _9 t j* I
- #include <asm/hardware/edma.h>
: q* E" I- k' Y) s4 w# O( ~' ?0 v - : l4 L- m/ C% Z3 R% k4 ^- S# U T
- #undef EDMA3_DEBUG* G( `# q) P& |( ?/ t0 G
- /*#define EDMA3_DEBUG*/ z# I. G& p* K' ?
: W+ C- w; ~5 f r* E; Q- #ifdef EDMA3_DEBUG
- d6 F! a9 p9 e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ G' B9 `; C( N( F8 i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* G! V/ a$ q- N
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! g9 E; Y0 M8 P* o" E
- #else: y* o/ O/ m" b( o0 W7 q
- #define DMA_PRINTK( x... )
8 y1 l8 ]7 L4 Z( m$ j - #define DMA_FN_IN
( Q. Q5 w8 |$ ^9 _' T. I - #define DMA_FN_OUT o3 l# \0 R& K2 b
- #endif- A! {% z% U9 H' L5 `
% P, }% J k4 n4 S, ~. { q. R3 ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& y8 {+ {8 O9 m' M% `% t6 W - #define STATIC_SHIFT 3/ p, o& G+ r& f# G8 Y& k: p
- #define TCINTEN_SHIFT 202 x* x7 u2 S2 A8 w. k# }
- #define ITCINTEN_SHIFT 217 R U5 a& x$ m% G4 I
- #define TCCHEN_SHIFT 22' ~$ I! Z5 Q, z. L/ Q9 |9 w1 F
- #define ITCCHEN_SHIFT 235 y5 [1 K- y! r8 @1 d: h6 A
- y1 m$ O _0 E- static volatile int irqraised1 = 0;
/ v" i- @# h7 M' r, |" q8 A& O2 o m - static volatile int irqraised2 = 0;
1 B( U' G* N: c' [- V! w, T2 _5 O - & u& d, v4 ~6 j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 P: K- l0 e+ M. C8 a9 _: _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' G6 J& H- s( y0 _/ ] - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& @& y2 z* f. X2 {. L. P - % U5 C7 G+ _; K& U
- dma_addr_t dmaphyssrc1 = 0;1 w! i5 i$ |7 `( R" S
- dma_addr_t dmaphyssrc2 = 0;
9 K$ d) g: e7 ^0 l6 v# z - dma_addr_t dmaphysdest1 = 0;
! o4 |' g3 q4 K& f( e1 n+ D4 T* m - dma_addr_t dmaphysdest2 = 0; p! {9 v% H. c
. P) X/ W' L* W- char *dmabufsrc1 = NULL;, J; t* Q: }# U0 I" J4 M
- char *dmabufsrc2 = NULL;
' B8 C* g$ T2 O& _' ~) K* h - char *dmabufdest1 = NULL;
: Z7 a6 A) T5 v1 J) u$ V - char *dmabufdest2 = NULL;# F0 l5 d/ M' b+ y6 U8 \
- 8 u9 ]& O% u) r% G% R
- static int acnt = 512;
* m3 F- K u! q0 _5 { - static int bcnt = 8;- R+ N- F8 r0 q- N: B
- static int ccnt = 8;
' U3 q3 m* r6 ^' g+ L4 C; { - . @/ v& T; N/ y
- module_param(acnt, int, S_IRUGO);: o- d& q* R/ g# {# M. a- f* U8 \
- module_param(bcnt, int, S_IRUGO);( L" ?) W+ W& R( r) \' p* g
- module_param(ccnt, int, S_IRUGO);
复制代码 . Z/ N l) h D9 _: x. J
3 p6 t, y9 C0 N$ O3 P5 x4 s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& R2 k- x! O$ X: V3 c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 k5 w. l( S/ g4 ^+ f
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 t, y/ }: p9 a3 ?0 X' z; x1 |* @
4 p" R3 c9 ?, e+ p+ R3 m9 a
. s$ E. \) |) Q1 E) ? |
|