|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: S6 W; Z1 C2 e# N+ Y% o3 a4 x- [code]EDMA sample test application
( Z' H ]0 r8 J; y0 {" i9 u - /*4 R3 q3 S# N' Q5 D
- * edma_test.c
2 Y# H3 T N& N/ L4 S - *
7 ]* i( p) }$ } - * brief EDMA3 Test Application
! u) `+ i8 U" x' X1 ?; ? - *% ]/ J9 x# y* \# @/ N/ M
- * This file contains EDMA3 Test code.
9 R9 Y7 c- }# d2 @5 Q - *
& e u1 u- G7 m# {! E& l- I" L9 G/ b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ p& N* @0 Q- V% C& L* D6 c* t
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 A! F- h) t. l. b. [
- * TO CHANGE.$ {( I0 ~- r( ^7 G0 i) _' b
- *
3 S9 k& B+ X% Y1 \1 S' ~, k7 w2 G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 k1 L% J4 x1 I8 h. o, w; J - *
5 \0 c" P- M$ L$ s _/ ] - * This program is free software; you can redistribute it and/or
8 J% V C% `$ e7 Y - * modify it under the terms of the GNU General Public License as" E8 x& l8 t# M
- * published by the Free Software Foundation version 2.* l) {- ^+ b, o
- *8 Y9 l; @* j& G# \8 K7 ~/ f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, V2 g! _' m$ z7 [/ |, h* } - * kind, whether express or implied; without even the implied warranty0 L8 E+ s0 `2 e# R) s0 n2 P* L2 b
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ D8 a a2 i& d/ y/ s' L( h# Z. r - * GNU General Public License for more details.
* x# M+ @& n5 @ - */
) D; f/ U( l# }9 r0 G' d/ s7 x
) y# J4 O$ w4 W, ?( @+ J- #include <linux/module.h>
8 h( c' y' V, l1 b# k! l; j/ b+ Y5 V - #include <linux/init.h>
+ i) b; z" g. P* \: [1 m - #include <linux/errno.h>, ~+ I" H1 e7 E) @, j2 s
- #include <linux/types.h>! u; w3 T5 W: b0 o# N
- #include <linux/interrupt.h>
# i }% r2 T }% R8 `. K6 g/ w% A2 T" j - #include <asm/io.h>- s3 X8 Y/ q% O7 z
- #include <linux/moduleparam.h>
4 L. F1 O! G2 K" w/ T+ M6 w - #include <linux/sysctl.h>/ h4 p% \( e: Y& P* T) w
- #include <linux/mm.h>7 ]! Z% \. D, C
- #include <linux/dma-mapping.h>- m1 y: q, v" W; K' r, n4 m
- 9 K+ t/ Z9 ~, G1 S; G* x
- #include <mach/memory.h>! D, {0 U- V$ d- ~ R2 V
- #include <mach/hardware.h>! J3 B( d- o: C4 S, Q
- #include <mach/irqs.h>
2 G3 o1 X) J7 ?4 J0 T - #include <asm/hardware/edma.h>, P( R" w3 Q$ }6 l, j
. E7 `- P: h4 Q! k4 ?- #undef EDMA3_DEBUG) g- S4 }& N" R
- /*#define EDMA3_DEBUG*/
/ C* G# w, J) @) \6 e7 }9 p' O- K- q
% x" J }5 [6 O7 m8 ?7 h9 ~; f- #ifdef EDMA3_DEBUG# ]( N* H' n+ b, V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 R, h0 I. t- f D! V+ f3 F6 u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). L. E- v5 [) I P
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 `, q& e0 P6 {4 \0 S
- #else
) i& R3 ] g: s- C6 v1 E - #define DMA_PRINTK( x... )
& S1 a3 Z2 r8 v2 B. Z6 V& y5 y0 j, ? - #define DMA_FN_IN& x7 O7 U8 D5 L, o3 D
- #define DMA_FN_OUT( P" G4 T! {& Y& `! A) C8 ?# l% ~
- #endif |0 G' z) C+ b' Z# R
) ~ O; E, L! ^1 n8 s/ R% C2 n- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# ^" E5 G7 N) F$ f5 p4 R* t8 } - #define STATIC_SHIFT 3
; v) j5 o }! i' v - #define TCINTEN_SHIFT 20+ |$ ^8 n3 U& Q( y1 m0 Q- `, i
- #define ITCINTEN_SHIFT 21 S# O& x, y; a
- #define TCCHEN_SHIFT 22
/ w, F! D- G# o" t/ \+ M( H+ F - #define ITCCHEN_SHIFT 23
$ V+ m3 } g# g - 7 e) @4 c {2 @! v
- static volatile int irqraised1 = 0;6 w9 Q }7 [9 V* N! q4 J- L4 w- u0 K
- static volatile int irqraised2 = 0;+ T0 Y! T- p y
- ! Y( K o; X2 _+ O7 A& l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- r$ i6 V; E, `+ |; u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ^6 [3 S/ \8 @) [" p
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" S& ]$ T3 V% @! T( Q7 h8 u1 e
+ I( k2 I; v" Q1 L$ R3 o- dma_addr_t dmaphyssrc1 = 0;
- y( m( J8 ]% j8 n) d# f - dma_addr_t dmaphyssrc2 = 0;
; S G6 P, l" K8 m* _# {& x - dma_addr_t dmaphysdest1 = 0;
4 V& \+ L1 h7 o) A - dma_addr_t dmaphysdest2 = 0;7 s( t* ^* @3 u; j7 [, E
- 7 n* c, f) V/ p, A$ x6 J( t
- char *dmabufsrc1 = NULL;
2 o. B) P. m6 m4 ~! @0 _, @ - char *dmabufsrc2 = NULL;( l, X+ T5 X0 S! b4 m" X0 Y
- char *dmabufdest1 = NULL;
" P+ y( N( b6 q5 V0 ]9 _ - char *dmabufdest2 = NULL;: V; M8 S2 z4 i; I5 Z2 V
/ J& x) _8 y* G, m9 |- U- static int acnt = 512;6 G: z0 P' O$ j3 A
- static int bcnt = 8;' C& U' C+ ~& D" E8 W9 e" P. Z: y
- static int ccnt = 8;- s: z; x7 D0 W4 Z ~6 W
- # B5 H( u- f9 U7 B6 D; Y$ O
- module_param(acnt, int, S_IRUGO);
* r4 _7 P! s/ I2 c - module_param(bcnt, int, S_IRUGO);2 v8 t; W0 F6 d' @" M0 O0 @! r2 g
- module_param(ccnt, int, S_IRUGO);
复制代码 * H% ]0 [- l* E6 M
4 v* Z4 W, Y" s& l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 s' @4 X$ M9 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* D! u' u0 W' R' ^2 ]7 O4 t' L" j6 X 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 }& H' `) B T h: p3 w5 D k
. |# C$ m/ J5 n7 B% a3 s6 o; w
) `( w/ `0 H$ \0 N1 S7 K9 x |
|