|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 B: h8 d5 I$ M. L
- [code]EDMA sample test application
5 w9 c7 _4 h2 B, Z# t/ i4 @ - /** z4 s, p- l0 x* @
- * edma_test.c
$ {8 y+ C; C- w# i% l& b4 u - *
3 Z) [5 Z! e9 R* T0 {2 ~( \. K+ n - * brief EDMA3 Test Application
) ]5 p: q& k# e+ D' f - *# u, |/ P" e1 h
- * This file contains EDMA3 Test code.
/ |& O0 M* S4 u, T6 [. U$ g - *! ?0 q1 f6 o+ z5 `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' U# z; f' E. K4 r4 m& Z! B3 \+ F - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# u# Q3 U' {6 A3 n; M - * TO CHANGE.0 [- A; j3 s- n! y+ _
- *2 I6 ~* U9 h J# m& w* f+ r- g
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: r, `/ [4 M: |* q% t1 l, v5 V - *
2 G& X" j; n7 I8 a- w - * This program is free software; you can redistribute it and/or
$ T7 F6 C) W2 d8 h; b - * modify it under the terms of the GNU General Public License as; R% z0 Q. N" u/ q2 S& n# L: n
- * published by the Free Software Foundation version 2.1 L% I0 |9 I) w; J6 b2 B% E
- *
# I& S9 t; b( }8 T; l/ N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% ~8 Q; L. N) L/ h* H: [/ t9 u
- * kind, whether express or implied; without even the implied warranty
6 j; Q6 w' ?: u7 ?! ^8 e" u8 ^ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ Q1 l1 L( I8 p, p! I
- * GNU General Public License for more details.
. \7 x7 m9 q8 G# |8 y b9 ` - */
$ V9 J. v) b) }& \
) B$ |# q; E. S$ a8 i- #include <linux/module.h>
. W' K+ q7 V C) K1 h$ {# p! y - #include <linux/init.h>0 t e; h; t; q. `3 @3 }8 N4 Q
- #include <linux/errno.h>
, S0 O" D \( s- k$ F - #include <linux/types.h>( `3 G) \1 F- x, L' w% F( a5 k+ X
- #include <linux/interrupt.h>* Z% V4 t) I9 S6 r% Z' ?) U6 |3 B
- #include <asm/io.h>
9 G$ c5 y3 `, F$ w8 u5 c l - #include <linux/moduleparam.h>
* @8 B/ j+ W, k" ?5 T - #include <linux/sysctl.h>$ X$ }9 ?, `/ d0 t5 F8 L. F
- #include <linux/mm.h>
# j8 j6 R1 f+ a4 ^, g - #include <linux/dma-mapping.h>" a8 ~8 o- j. @. z- E4 a
- % g. m) N4 J/ g, i, S
- #include <mach/memory.h>; k; ^/ h" O8 N5 D- ]1 ~
- #include <mach/hardware.h>
, ^. {" I5 H# |- v& m5 U0 ` - #include <mach/irqs.h>6 ~ k0 `; L- O+ F* a& a0 H9 ?9 o+ G
- #include <asm/hardware/edma.h>
% I6 ~/ M" S+ d& i9 p; N - # s0 L$ T8 _3 x! g- s' h7 |
- #undef EDMA3_DEBUG2 _- g' r' e+ ?: S5 x6 r9 I
- /*#define EDMA3_DEBUG*/0 q) A& r1 m) d2 H! e3 n
- ) f6 w5 | y- O" R
- #ifdef EDMA3_DEBUG5 d5 n3 b; D* V( A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& i- N& k4 G7 h H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# I8 [8 Z3 h4 E9 J% `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% U3 Y0 D) e' w - #else
8 X x8 X5 [9 V2 Z3 A& z/ w |* ] - #define DMA_PRINTK( x... )
3 r5 q2 g* `6 [5 t) d - #define DMA_FN_IN
! F* b7 r; c- M - #define DMA_FN_OUT8 u) c5 b/ S- x8 n& a
- #endif
+ c, B: }: `, o
$ T3 u! C5 c1 H9 ]; E: H& Z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; H. P! Z+ z8 n @ - #define STATIC_SHIFT 35 F, ^# z# `% ]# v6 i- p) C9 c
- #define TCINTEN_SHIFT 20/ ^: s) T. T/ p$ _
- #define ITCINTEN_SHIFT 21 u( S8 I* f0 r4 m2 V8 I
- #define TCCHEN_SHIFT 22- C9 G7 q% ?4 V) C
- #define ITCCHEN_SHIFT 23+ Y* e4 s& s6 W- `! c
- & H1 N& L3 b# Q A
- static volatile int irqraised1 = 0;* F2 z# T/ K" q% {
- static volatile int irqraised2 = 0;
: C2 _! z* w3 n" K
* V8 F' H" V; f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 y9 P3 @6 `7 n* I, C) x, \2 q( L - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ w. s, O; }6 T! g E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, y) y. |/ Y3 R$ T' u
- ; P# P5 }) B# j! D5 q7 X! r
- dma_addr_t dmaphyssrc1 = 0;$ u& u( Y/ W. d/ P. ~
- dma_addr_t dmaphyssrc2 = 0;
, @: j' B, ]% W - dma_addr_t dmaphysdest1 = 0;( `( `, h7 @2 F% f. m- m" D& [
- dma_addr_t dmaphysdest2 = 0;3 _& H% J' T# X7 n# u+ [) M4 M+ v/ x
$ Q. W. m6 b; F, m& c6 S, P- char *dmabufsrc1 = NULL;
! R7 \3 w; c' t9 B - char *dmabufsrc2 = NULL;$ V8 u) d9 ^$ X
- char *dmabufdest1 = NULL;: a4 }; a1 q T8 @* Q
- char *dmabufdest2 = NULL;
9 j, C, d: D0 D" i
; {7 d1 z1 w5 c. @3 @0 O9 h7 i- static int acnt = 512;
: c" Q# j) x$ t; ^; T5 I! Y - static int bcnt = 8;
1 Q. \" Q6 k6 n1 f: `3 G$ {" g! z - static int ccnt = 8;
+ B' Z/ [: y z- U& }# G1 e - - \/ ^. P! V1 b1 ~" x
- module_param(acnt, int, S_IRUGO);- M9 T) O8 E+ m E, h5 V1 o$ | X0 h
- module_param(bcnt, int, S_IRUGO);
8 D& b' S8 e7 P* a. @1 { - module_param(ccnt, int, S_IRUGO);
复制代码 / V1 O0 Q3 p7 u; |3 `3 E3 X
9 t& K/ u$ }* @3 }+ q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* U, o9 s9 f5 J" I$ \4 \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; a' v9 |# d6 M. B1 p
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 F. @) d/ {' b) F( j+ b, p' u. Y: [1 l
( o* _9 j( B5 R1 N2 J9 E
|
|