|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, V. H0 W3 u" n& Y- [code]EDMA sample test application5 Q- q% @" o; b M+ K$ A: d
- /*$ n' o% D) L6 _' e7 v( _
- * edma_test.c! g; ~8 @; Z* l& p6 `; I$ Q$ ]1 y
- *
% s" `* c/ d9 S' f% m) m5 l: ` - * brief EDMA3 Test Application
- N, z( ?7 X! ^0 O* V9 ?6 h - *7 ]$ I1 @+ U/ M
- * This file contains EDMA3 Test code.9 Y E$ b# M% c! z/ W! \' [
- *0 d# O4 G( }3 d0 b+ x; J# J- \+ R
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: }5 e! D/ a R' a - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; V" r' v5 O. g$ U% y* J. n
- * TO CHANGE.4 m O3 T% h9 I/ ^" h9 l- ]) K
- *( W1 D* _1 t+ p- f. T4 w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' Y( @& q# g4 L0 G0 e5 U
- *
/ b7 H) z( o: X; Z# h6 d4 |8 m Y( w - * This program is free software; you can redistribute it and/or
5 O* A* T z( ` - * modify it under the terms of the GNU General Public License as
& D2 M. K5 b5 V0 L - * published by the Free Software Foundation version 2.( S; S1 m$ c* W4 m7 a7 c, W
- *
7 k9 g1 | R0 [! x/ }- k$ H( s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" ?3 s+ _& h" u - * kind, whether express or implied; without even the implied warranty
( b$ u8 L4 K2 n: X- f - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( Y# @* ^# t) w0 x4 z1 u
- * GNU General Public License for more details.
8 b: [9 q+ E7 T, _3 K$ \7 a - */. |* g. }: \) U% f2 \0 G) a
- , p7 T1 @/ Z \- ]
- #include <linux/module.h>+ O6 M* d1 x' g, l+ U
- #include <linux/init.h>% ?7 E. @5 [5 N7 {; A
- #include <linux/errno.h>- n& G* \1 Z; b( Z' r8 W
- #include <linux/types.h>% k% z! y! V, t$ K2 `2 ~
- #include <linux/interrupt.h>9 Q8 C% u2 _; f$ Q! v+ v
- #include <asm/io.h>
c# E2 m* Z- d# Y; x - #include <linux/moduleparam.h>- T" g9 C& [' d% L2 p2 C" J7 e
- #include <linux/sysctl.h>% {7 ~- n. b( u5 I& \ {
- #include <linux/mm.h> k/ i1 ~- r7 E* g: M; v
- #include <linux/dma-mapping.h>: X7 X" D4 o. L, \
- # w7 M+ P* \( i
- #include <mach/memory.h>
8 [. M" i; y% X8 ^3 e+ S* [ - #include <mach/hardware.h>+ r7 }% Y f/ b) r' _ e
- #include <mach/irqs.h>
3 \) A3 q1 Z4 i( r - #include <asm/hardware/edma.h>
4 P% U9 Y! {( M; ] ?: y* b; O - 8 u$ H/ v8 X9 y; p+ W
- #undef EDMA3_DEBUG
3 i, J% B# @& k1 t- A0 [ - /*#define EDMA3_DEBUG*/% q2 G5 ]' R& J; O$ ~
+ e, T$ N% h* \1 N7 i, u( @% |- #ifdef EDMA3_DEBUG. f$ P- p' y# p7 d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 d' X# _% q' v" l! D: O6 v - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: C1 A4 f" x' \ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 c0 B8 }) L- r4 w& d i, S6 C5 K9 I - #else
. u7 R+ ?2 f5 U - #define DMA_PRINTK( x... )
* Z" D' w( ?/ h, i4 E# e. y) P - #define DMA_FN_IN6 S& `1 o! ^0 o9 x, p6 o+ b6 k
- #define DMA_FN_OUT
* M; Y3 O& |/ b' B. _. p - #endif3 j& ?2 b* I7 K3 p4 X7 u
- O/ r. C+ h* F9 o, U1 q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. }% o; x6 A8 u' m - #define STATIC_SHIFT 3; V r/ R; o& {6 T
- #define TCINTEN_SHIFT 203 Z" \9 u1 ^# Q$ E
- #define ITCINTEN_SHIFT 21
0 f0 ~9 z4 C% L. I. a4 A; ~ - #define TCCHEN_SHIFT 22
+ }1 R8 P) Y. @/ v( i' N. o1 m - #define ITCCHEN_SHIFT 23/ d' K( W2 B3 p4 h: v1 D
- 2 `* c! _6 o- c& l. L
- static volatile int irqraised1 = 0; T2 q3 ]8 M1 A
- static volatile int irqraised2 = 0;' [3 K$ v$ k' G$ B( m7 B- x
- : \8 S2 d% S4 Z1 b2 V
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. M# {1 H9 n& L$ u% M4 O- v( [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" h4 }: F4 p0 H: [ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( J& D/ p( _ Z3 t3 m& X9 R4 y6 M& a
- % b W4 { z. L
- dma_addr_t dmaphyssrc1 = 0;
/ [0 W' k7 G5 F( T; F/ X9 h - dma_addr_t dmaphyssrc2 = 0;3 [2 _% ~, b) @# Q; a
- dma_addr_t dmaphysdest1 = 0;7 t; o( q6 ~' B! m4 ?0 [
- dma_addr_t dmaphysdest2 = 0;8 e" g# q2 x& P! S# h: `- B
- 8 i- Q# h9 [& A6 l
- char *dmabufsrc1 = NULL;" K5 l ?$ `. N# o
- char *dmabufsrc2 = NULL;
9 J0 O a) t* ^% y - char *dmabufdest1 = NULL;2 Y! ]- X. I6 P' t
- char *dmabufdest2 = NULL;; g" m: o$ V# {- e* b! \& A2 s
. T5 r" N7 k- F* K- static int acnt = 512;
5 `7 \$ a+ I) S+ b - static int bcnt = 8;1 M8 s i- i% }/ Q' d
- static int ccnt = 8;
7 h) }5 }' O* y0 E" Y3 Q
/ A2 C% l& {0 L7 x" A7 L- module_param(acnt, int, S_IRUGO);
" d0 h5 N' L* S% z) M6 C% R( P - module_param(bcnt, int, S_IRUGO);
0 C9 b9 M, b( } `3 g6 I: e w3 t - module_param(ccnt, int, S_IRUGO);
复制代码
3 [/ ~$ Z' u% L2 r
! |% r, A0 L5 U6 g" i 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, B/ I+ [- F" d: [* c+ O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* I2 j- e0 A% R- K2 Y6 [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ J( c4 J: A/ N0 }3 S
/ K. b- [8 [0 e/ r% k
/ i5 n; @2 U! O |
|