|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% D5 ~" k, d9 o% ~- [code]EDMA sample test application6 b) H0 ]3 Z% e' g9 x; c+ y1 {
- /*7 e% p4 t9 d. M- X$ {! `" p
- * edma_test.c$ p( K1 L9 u7 }" c* S# o& K
- *
$ G% j8 ~2 P& C) h - * brief EDMA3 Test Application
; @2 V* H0 u) i, b& R7 X - *- m$ p. d, b3 x
- * This file contains EDMA3 Test code.! Z* {' j& n( i
- *3 R. }3 \$ o& o7 H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* d4 W& p' F- ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 R" p4 h5 V. X( P! z, H: v$ f v9 D - * TO CHANGE.
: N4 Q9 k5 t# O4 E: X! Z) G - *
3 P6 X& K/ f9 @3 N8 N1 Z8 k - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 {, H( t8 X) v: `) x9 d - *
3 U5 D3 }& j! [9 D j5 u2 L - * This program is free software; you can redistribute it and/or
; v& O5 Q) k$ _! m( x$ ~' j - * modify it under the terms of the GNU General Public License as
+ F, m, ?' n9 T4 B% j - * published by the Free Software Foundation version 2.
6 d" y. c2 }3 E- R - *
* f9 N& G% l9 u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ {; q3 }- L/ b$ s- C2 { \
- * kind, whether express or implied; without even the implied warranty
( O& v7 n7 ?' |2 z: n - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) Q. x3 C- v& a5 | - * GNU General Public License for more details.3 y! \0 _/ H7 e" F0 A8 Z7 W" ~
- */
: |6 {3 \' J# l" q6 \! J3 L( \& Z3 ?
, l! p* m' l7 C# [# u- #include <linux/module.h>5 l0 ^ _: l( v
- #include <linux/init.h>' a1 J+ ]6 L* _& n$ h2 J) P$ V
- #include <linux/errno.h>5 g* O* V5 I/ M! l @- `+ N( u+ H
- #include <linux/types.h>
: e2 d8 z0 W* t6 L. ?8 a6 @2 N- v' x9 C - #include <linux/interrupt.h>
/ d$ ^6 q* g9 \- f/ Z. G7 { - #include <asm/io.h>1 P# ~* T: j9 m4 t: M; N- q5 W
- #include <linux/moduleparam.h>( D% X3 H% {, H+ \5 W0 P5 S% u) u6 v
- #include <linux/sysctl.h>$ Q( l0 J5 y5 S) g1 n3 ]
- #include <linux/mm.h>
! x. u1 }0 J: b - #include <linux/dma-mapping.h>
1 @: |6 G3 K5 D
1 j7 |$ n/ \5 ^2 s V4 }- #include <mach/memory.h># h; K3 t6 d2 c) N- K$ q
- #include <mach/hardware.h>
) S+ i+ m" ~% a1 P) K# F7 |" { - #include <mach/irqs.h>. h' h$ B0 o* I( l, X3 F
- #include <asm/hardware/edma.h>
7 ?% P% Y4 ~2 [# U - 2 c2 z- ?4 C% H+ A
- #undef EDMA3_DEBUG
, A; i1 [- q! h - /*#define EDMA3_DEBUG*/7 Q; p/ A; y# T9 w& D1 K0 b, k
) t* A5 `1 P7 D/ B. [! V- #ifdef EDMA3_DEBUG* d0 k8 D% ]1 A" y* g
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& U" O. H6 V) q. {
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) p5 t' `' c' Z. `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ d4 U) j0 d- a$ J) @
- #else' g v, O- z( ?7 Z- ^$ T5 |' J
- #define DMA_PRINTK( x... )
+ j4 H# c; c5 i - #define DMA_FN_IN
' A" b8 V3 f0 k) P$ Y8 Z0 G+ a# K( L. u - #define DMA_FN_OUT
% u* c3 U/ C) v4 n' F% \' k* E- h - #endif
: d& x% J F" v9 m
6 Z, o/ i( @: }0 _( I+ ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768) k8 y% j7 Z& B
- #define STATIC_SHIFT 3: c1 V6 V3 U3 y4 h6 k
- #define TCINTEN_SHIFT 20
1 t" h1 s" y+ T" Z. ?, w - #define ITCINTEN_SHIFT 21
/ M% }, ]& @" u' s7 v n - #define TCCHEN_SHIFT 22
9 T8 k* {% r; e' a8 C/ H - #define ITCCHEN_SHIFT 23
& a) j- h; i8 I) S+ \& @" I4 L
9 K( j, l- ^3 P; X- static volatile int irqraised1 = 0;
& s! L; t! M5 o" Y [8 O - static volatile int irqraised2 = 0;
1 g9 W. V6 \& ?* ?" i+ O+ a! l
! ~7 ~" J1 }* _! T7 j: W- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" A- h2 \; D3 D! o" j8 n - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 [8 r) V9 i$ x8 F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. b7 |. I- J6 {; ^
. A" I. Y) f9 H9 P! I5 A- dma_addr_t dmaphyssrc1 = 0;. G! G5 K P8 k- Y1 u; F
- dma_addr_t dmaphyssrc2 = 0;1 P. S" d; w6 r
- dma_addr_t dmaphysdest1 = 0;
3 v' N5 q- D4 D/ b' A" E - dma_addr_t dmaphysdest2 = 0; i5 b% o& J4 l% V- F0 y! Q
- d' y+ |* v/ G4 P2 K8 b6 ^
- char *dmabufsrc1 = NULL;
' @7 x0 @9 y$ F4 s+ k' o - char *dmabufsrc2 = NULL;
" Y1 F' _# B8 x) q3 k3 d - char *dmabufdest1 = NULL;
8 H' o) I1 M( R: r1 T) v& H - char *dmabufdest2 = NULL;( j" a( c! R* r* g
- 6 @; k: j3 E/ t8 J1 y8 Y6 Z
- static int acnt = 512;' E' W8 q5 c) \
- static int bcnt = 8;
4 } \" y: A; V" v& b% v- F- a/ o4 A - static int ccnt = 8;
+ L7 P; j8 Q3 `! i
9 j1 c- ]) \' h" e& } u- module_param(acnt, int, S_IRUGO);* ^% }5 w" T2 e* ]- _" P( P
- module_param(bcnt, int, S_IRUGO);4 g0 w! v; g+ Z$ U7 O% p" T
- module_param(ccnt, int, S_IRUGO);
复制代码
- [' M" ]- Q7 H6 {; ]2 v# S
! R+ A8 s/ k+ ?5 ] 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# B3 O; Z* G Q7 m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( Y u2 }+ G. [. B8 v( V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) c7 c1 @5 K9 c( _
8 p* G+ R2 a0 g0 P
* N( O+ X+ ?- i2 ]/ T% K6 {' R; w |
|