|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( v; `$ E3 f! }" x9 h7 Y, ~2 Z- [code]EDMA sample test application1 R- Z( U; H, k
- /** X3 R3 e. a6 g2 D
- * edma_test.c. V% U! o$ ]) t9 v$ E! @
- *
' T4 u' t# M. g. {% R2 p" Q& j - * brief EDMA3 Test Application; j# T5 I4 p4 m, C! w6 y! p6 G0 h" w
- *
: |7 U# \$ j% }& R. q - * This file contains EDMA3 Test code.
+ V O* K% ^+ E; g4 B! @ - *
+ e+ L5 E& c4 l' L, E7 L2 k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" A" u/ c. [# G) J. j1 ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ Q) T3 f4 K! {( j - * TO CHANGE.
' z4 K5 e" d3 @5 h - *
& P9 }/ K1 r, s. F6 b! |" L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" E6 y% q% C5 H
- *+ Y% @" t3 u; A7 `$ q
- * This program is free software; you can redistribute it and/or
$ d; z, u! }# w - * modify it under the terms of the GNU General Public License as& f$ t( V, s, u7 z, s# }
- * published by the Free Software Foundation version 2.
' ]' r& O. I3 D: G; Y1 W; Z - *
+ K8 t4 s0 w8 c9 x! j# [ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 B7 C* e0 |0 N: g, e - * kind, whether express or implied; without even the implied warranty2 M/ o$ h. y( t- G
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, q i8 N& Y+ b; p5 n$ K3 g( z - * GNU General Public License for more details.3 u, x* r8 Y6 J
- */
: s5 y* A- _+ z7 f8 Z7 m - . w) L( U# O4 i
- #include <linux/module.h>1 o$ y$ J% I, S9 g
- #include <linux/init.h>3 g0 K6 L3 W& ]1 y7 U K
- #include <linux/errno.h>
0 X& E5 p; s: t" M - #include <linux/types.h>
% e8 W# u" D' R - #include <linux/interrupt.h>
' s8 i% l) F9 ~ Z1 n - #include <asm/io.h>
& `4 a( R- T7 _. A7 ]3 p - #include <linux/moduleparam.h>
2 T; g( E* o V o/ O2 T* I - #include <linux/sysctl.h>7 q2 G& q, f I9 _( s* M* b
- #include <linux/mm.h>
0 N* l& R/ I6 L7 u - #include <linux/dma-mapping.h>
- z3 r6 g5 g2 Y- Y; F
2 D& I4 l# |5 Q* x8 Y- #include <mach/memory.h>
3 i* Z a* [) T' p/ s- K3 |6 M0 g - #include <mach/hardware.h>
7 Q1 N8 Y$ Z/ V" V - #include <mach/irqs.h>
+ }) Q! x& G1 {% E p4 Q - #include <asm/hardware/edma.h>. N- ?* O) r' K) W: L
- $ e3 n9 D2 T) ~6 L8 \6 m8 x& V
- #undef EDMA3_DEBUG
; @: ^, H! J2 j - /*#define EDMA3_DEBUG*/
( R7 C5 Z+ J- B9 G8 I - 7 o0 q1 s; s+ K E
- #ifdef EDMA3_DEBUG
. w# B8 c& ?* f) S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 \$ k0 K" X/ e6 u8 y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); L, C$ r8 P, X( Z5 d: H1 X4 ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" o$ r$ k& i% V: L) b
- #else
: O( _9 m' [* | - #define DMA_PRINTK( x... )
6 O0 N% S2 R2 ^0 @5 `( ]1 G& Y - #define DMA_FN_IN
5 Y( K2 j0 q- ^+ |7 E# I - #define DMA_FN_OUT) f6 o u4 x1 O3 Q+ e5 C, |
- #endif
5 c1 E4 {% r L+ p0 e1 H/ ]5 }
8 b3 Q8 D$ I1 Y1 g& P- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; S6 e$ D4 o9 j3 { - #define STATIC_SHIFT 3* y0 f: ~" \/ j. y% o& k' T
- #define TCINTEN_SHIFT 20
% Y* a* {- D9 ?# m3 x1 X - #define ITCINTEN_SHIFT 218 R% @3 _ m" @" b% u( f
- #define TCCHEN_SHIFT 22
) U' f. Z' ~5 g t4 F1 T) t - #define ITCCHEN_SHIFT 23
: \/ [# t% Y! i) ^: I1 [ - ' j! l) {' L I7 V
- static volatile int irqraised1 = 0;/ e1 y) h$ w+ y. m/ y
- static volatile int irqraised2 = 0;
' J# u2 P' E, i/ [ - 8 s$ b- \+ r1 W+ P& f( U+ c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* F( b1 Y# M" W& w: V
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ z. c' w2 d% W( h - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& ^+ Y3 `) K+ n6 p
( g; o9 x. s0 g8 P3 l* W0 ~- dma_addr_t dmaphyssrc1 = 0;$ n' M. M* U) E, V$ f9 G2 {
- dma_addr_t dmaphyssrc2 = 0;8 O4 d# V+ l: r' M% n
- dma_addr_t dmaphysdest1 = 0;
3 s9 F! v' y/ c% U - dma_addr_t dmaphysdest2 = 0;) j% G2 s0 D) \, M, d
- 4 ~: L- M! n$ |3 K6 p" v
- char *dmabufsrc1 = NULL;5 f7 R. S: M! C4 _+ C
- char *dmabufsrc2 = NULL;8 G1 D- I8 W* Q( ~. _
- char *dmabufdest1 = NULL;
, o- m" [- F0 V; q9 ?6 g: s7 I, L - char *dmabufdest2 = NULL;) Z% g4 B4 ~6 A: |" X, @
- ' a5 |1 R3 _8 |/ K
- static int acnt = 512;
" f4 Z( P) H+ V$ l; m - static int bcnt = 8;
- l" p& @7 c9 x& I/ G3 |! A5 b4 l* ] - static int ccnt = 8;
( s5 D+ ?0 ?* U
7 ^! Y! n! S) N( P8 W- module_param(acnt, int, S_IRUGO);
! n* ]4 x- }. j& c4 | - module_param(bcnt, int, S_IRUGO);
, ]% C; I- f$ r6 O6 y. W9 Y - module_param(ccnt, int, S_IRUGO);
复制代码
9 z) O, f \- V9 w
9 ~: p; f% k% d2 z/ p- _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- U$ O; v( w" Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 C/ F* S1 c0 ?6 b4 R* m
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( F' v" f# u0 C8 j3 |9 {/ o
5 d8 v$ h- \& l) G
: k. E' V3 D0 w3 A |
|