|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 Z; `; e1 _- a2 l* F% j- [code]EDMA sample test application: V/ g U& R! m6 f3 [9 X8 t
- /*
. c" }/ U" t4 k6 D. c& @ - * edma_test.c
7 K3 V4 m: g9 V, e7 I - *( R- r h0 I- V, D
- * brief EDMA3 Test Application
5 Q; _4 k8 G2 u, J - *
# E7 q" B# s6 N - * This file contains EDMA3 Test code.
( j8 b* Z% }$ ?* Q9 I4 {/ Q - *: |/ j. k! g, d V* [/ p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) ^ S' N9 P2 `1 w - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& p: ?! C3 P2 k$ Y
- * TO CHANGE.! k/ b* e- _4 `% m% e% Q
- *3 P3 ~5 y6 ]1 h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
F s( f8 S8 j. i G - *
: i; N8 \9 q1 k5 ] - * This program is free software; you can redistribute it and/or
D1 m4 `1 @: Y: o - * modify it under the terms of the GNU General Public License as' _0 e/ E d9 e4 q+ G6 L- B
- * published by the Free Software Foundation version 2.# l) r3 V% W5 e" M8 z& _% n4 |) s
- *
8 Z; Y! _9 c( i. X' h3 ^6 l2 | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; C! T- B! r) t, X% { - * kind, whether express or implied; without even the implied warranty
, s$ D9 n- L; w0 M$ r7 t! [ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- a3 @, S1 L2 s6 @. T) f6 L
- * GNU General Public License for more details.
3 h8 i' g9 h7 ^' v3 @$ e$ K - */8 J* V5 d; B* \3 v
- 7 ^, v L+ O& B* d; _" ?
- #include <linux/module.h>' [( ~8 t5 k4 H0 t& v' p; z
- #include <linux/init.h>' b7 H8 u. a, p
- #include <linux/errno.h>
- t9 T! ^$ D0 {$ s: e, ~ - #include <linux/types.h>8 \4 h G) e: m) g5 \
- #include <linux/interrupt.h>. J5 k( E" Y3 f
- #include <asm/io.h>
- r. A( y$ M! a' N7 ~+ x& f8 G3 x - #include <linux/moduleparam.h>9 S' u5 Z" L* T; {, [/ x; G
- #include <linux/sysctl.h>
; b% [6 k: u6 x5 n t6 z - #include <linux/mm.h> B, [' a+ `0 Q0 y/ E
- #include <linux/dma-mapping.h>6 _" T' l- X, ]
7 O- ^" P% x6 ~+ V5 m$ q( E- #include <mach/memory.h>
+ ?1 m) v- D3 X - #include <mach/hardware.h>
+ @5 l/ s3 {6 i' F - #include <mach/irqs.h> d! M+ `9 f: m5 S! D j/ @+ i% e
- #include <asm/hardware/edma.h>
* Q0 p' x- q2 N" X
1 r: c4 D, r' [5 }- #undef EDMA3_DEBUG- y* x# \% ~4 N2 V
- /*#define EDMA3_DEBUG*/, g1 N% B+ z, k( M( i& A0 o
0 G7 K4 c+ e$ m- #ifdef EDMA3_DEBUG
+ h5 H% |' @* _9 k+ S( W) t4 f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 z' W8 `( E4 i& Z3 @6 O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): p8 R8 ?' P f& z/ _
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' m! j& o; n! I6 k1 P; R( y - #else
; t" f( k* A {0 ?. i S - #define DMA_PRINTK( x... ) c* u0 _; D g. ]' f' v
- #define DMA_FN_IN
9 Z6 e6 j. k$ d! r$ W$ S0 x" L2 S - #define DMA_FN_OUT
# j% {) H( A+ e+ O7 { - #endif1 j9 s/ @ g" o8 Q
# h4 m3 j T' z( p$ [: K u. h+ C- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 {8 |% y* K2 ~# Q- f2 h
- #define STATIC_SHIFT 3, Q1 Z- v3 }. C5 Q6 m7 W
- #define TCINTEN_SHIFT 20
3 \6 S& d7 h. d& O, O - #define ITCINTEN_SHIFT 215 S! v+ V, h% ~" J% `# X. R
- #define TCCHEN_SHIFT 229 J" E2 q& }. U
- #define ITCCHEN_SHIFT 23
2 ]# ?' h8 Z9 o - ' ?+ ~) g' x, p5 O2 L( i0 c
- static volatile int irqraised1 = 0;
% u1 D) Q2 c3 W6 V; s+ D) l - static volatile int irqraised2 = 0;9 o1 h+ h& s1 q! D8 P1 r4 h
- 7 A& D& U9 Z0 e7 y/ ]8 m4 d9 }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- z G" N" F' |& _9 X - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. ^( \' ~! d2 m1 C% Q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 l/ h* c y; q4 {7 P8 _7 g1 _
1 } z7 m& q& A0 Z- dma_addr_t dmaphyssrc1 = 0;
( _2 ~. j( D8 n& V - dma_addr_t dmaphyssrc2 = 0;& C( h: Z3 j5 g4 M2 N2 W+ I
- dma_addr_t dmaphysdest1 = 0;1 }, O k5 ~2 ]( w; e/ |
- dma_addr_t dmaphysdest2 = 0;6 a4 X3 H: `* q5 l9 I5 t
6 A, o5 x. Z- j( U- ~- char *dmabufsrc1 = NULL;, N9 _. K0 z1 A. l" f+ z
- char *dmabufsrc2 = NULL;
1 B. B/ r9 B0 ?1 P- N# d; d# A - char *dmabufdest1 = NULL;
* Z; m5 `$ `5 \4 F - char *dmabufdest2 = NULL;
# U$ O+ ?/ f3 k& Y, i$ ~
/ N2 q* B. b: `+ j" n+ e% a Z- static int acnt = 512;" c8 A0 ?8 \4 P
- static int bcnt = 8;! G/ O2 D) l5 V! F3 O T+ W
- static int ccnt = 8;7 p4 ]. ^& l( r% m4 ~/ m
. D4 w0 x8 E, B- module_param(acnt, int, S_IRUGO);
+ P) [2 F2 [( c" t - module_param(bcnt, int, S_IRUGO);5 `3 K+ t; t' |" n; X
- module_param(ccnt, int, S_IRUGO);
复制代码 3 M! M( S$ |( _; C/ f
8 |* [ ^1 R4 l. U& A! S 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) [4 i% y1 u0 O8 J) T7 d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ q, M3 A& ?7 ?6 i, C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 l3 Y4 }% ~ g' P+ z2 d3 ~8 X, }) w8 L9 m" M3 d% K
- J( l3 p1 S. }, D5 T' u |
|