|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 t( }* N& D6 |$ g% I0 \4 A
- [code]EDMA sample test application5 q- `3 D6 N% N3 o6 g5 R' e& V- J' N
- /*
# D" x2 P* X/ V. a - * edma_test.c. m% C9 t5 k/ j' c* L
- *7 n i' H- i8 v) G
- * brief EDMA3 Test Application
@! C- U }* \/ ]1 |% L - *4 v4 e: j5 p/ m8 J2 J$ D5 T$ J
- * This file contains EDMA3 Test code.0 }9 }6 O1 i7 w T, }
- *' E r" }& E, D! z+ K1 X1 d R
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 A+ Q, m( q3 N8 @/ f' R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 X9 S- x/ J- l) Y4 [8 K l - * TO CHANGE./ B+ f( N! `* l1 E5 m
- *
, L( Y1 f2 e' W1 r - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 Z" l: O, T( o$ P - *
% Z a' o7 W" g: H% u4 v/ N' k - * This program is free software; you can redistribute it and/or
) W; L- M; n/ H& M5 C5 ?6 i! @ - * modify it under the terms of the GNU General Public License as
Q0 L+ e$ [7 F" P3 V - * published by the Free Software Foundation version 2.# ~6 g4 z& s$ L% U" v% |
- *
2 R/ n; P5 ]2 f2 W' v- I' S v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) ^' H' r p! q. P
- * kind, whether express or implied; without even the implied warranty" c) q5 a4 }! l9 B8 ^. g* i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* K/ g/ I0 f" o m - * GNU General Public License for more details.
$ {8 M3 s/ E# }5 |& X6 i: K - */! Z" W4 h! S+ T
- : O# ^ k+ g% `0 V! ^& s k% @
- #include <linux/module.h>
& r/ p* c3 _+ o) J F - #include <linux/init.h>2 W5 _, \; V8 b( H
- #include <linux/errno.h>
+ t. G; A3 L) G, ~" _3 e - #include <linux/types.h>
/ p _: R& U) r - #include <linux/interrupt.h>7 D4 V2 O2 Y# G) K" [1 y$ T- Q
- #include <asm/io.h>! X _/ g# b' t6 |2 U
- #include <linux/moduleparam.h>5 Z5 |- U8 @& k% S7 v. D4 y5 l
- #include <linux/sysctl.h>3 e5 s9 z m+ i1 x
- #include <linux/mm.h>* l q+ z- b: V# i6 }
- #include <linux/dma-mapping.h>6 u( w' }# [! M0 f
- + D- m9 a% ~8 H: R( p( x& h
- #include <mach/memory.h>
* _" f, G ]) ? - #include <mach/hardware.h>: H2 _ I. C/ d% o
- #include <mach/irqs.h>* z" s9 l( e+ @. Q3 f! R/ I
- #include <asm/hardware/edma.h>
- F8 q3 `1 h1 n+ v' d - + R( W! r/ d* Q" J
- #undef EDMA3_DEBUG. \4 b! {- J* J# {. ?8 }2 |
- /*#define EDMA3_DEBUG*/
: v! x+ v, E7 Z- n& Z
* J4 E& z! g# U8 f- #ifdef EDMA3_DEBUG5 d3 a m u7 W1 K5 O# u) I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% Y, I3 |- c/ V/ ~
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 e S d5 U6 n! F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 T$ _! u5 U' l0 |$ W* I! ?
- #else/ d5 j/ t3 {. L
- #define DMA_PRINTK( x... )
9 \& [: ]) i2 A* Q* [3 n6 ^ - #define DMA_FN_IN
P3 u% ]* z6 Y5 N t - #define DMA_FN_OUT
- [$ \4 A: _7 [1 @ - #endif8 \0 P2 q0 H! p- R% L0 ? y$ i
) S# e! r! ^+ R0 _0 W, C. ^" r- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 K: u& H* c0 \* V$ J& k I
- #define STATIC_SHIFT 3
0 _4 D/ g, `3 f& `6 q - #define TCINTEN_SHIFT 20* f f1 ~2 f5 q$ `
- #define ITCINTEN_SHIFT 21" d. P( E! u# {& a, ^+ i% T
- #define TCCHEN_SHIFT 22" ^1 q2 X& J [& t7 [* r1 g! W" a& p
- #define ITCCHEN_SHIFT 23
/ e5 g- N1 d6 I: d* S$ w: I) \, [ - & m9 c% ~, I! @8 R% ]) }
- static volatile int irqraised1 = 0;3 f5 a" f5 q/ ?
- static volatile int irqraised2 = 0;8 M& H8 g1 V7 Y* n* o/ S( l
' q- c6 x1 S U/ s2 Z# b. z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; u* y9 w& y/ w9 J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 Z1 A9 X* t, t0 f) R9 b - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( K) U! E0 J+ _
& l; G% Z) v& g2 D- dma_addr_t dmaphyssrc1 = 0;
/ H, M7 j1 Q8 m8 {- g - dma_addr_t dmaphyssrc2 = 0;
6 I( ]/ M5 d0 r. {/ B - dma_addr_t dmaphysdest1 = 0;
" x# k# A: E5 _* O - dma_addr_t dmaphysdest2 = 0;) _+ z" K. Z6 V& t
- 3 @) F9 S+ `2 k; o
- char *dmabufsrc1 = NULL;$ e* c" D% c. q1 {2 c; D- V7 K
- char *dmabufsrc2 = NULL;* i8 N5 S) D/ G, e3 x& ]
- char *dmabufdest1 = NULL;
2 g9 O* C4 q8 o% \2 Z - char *dmabufdest2 = NULL;0 c# [8 U, p1 t5 E2 a! q
- b! v- A7 r8 t. d$ |
- static int acnt = 512;
% x0 g' ?% }; r6 z8 T. D* T - static int bcnt = 8;- |; o% z4 M8 n5 L& L7 a! H' \
- static int ccnt = 8;( e3 v% p6 i2 c" Q* `1 s
- + g; | O/ [$ C' ?3 j
- module_param(acnt, int, S_IRUGO);
3 o, d. I5 m1 z" Y1 M8 n% o - module_param(bcnt, int, S_IRUGO);
$ O% N- P+ f+ A$ t8 x8 ] - module_param(ccnt, int, S_IRUGO);
复制代码
. m6 i5 y y; x
( J) X$ T% j& R2 u/ d0 O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 f* B, {2 T9 {% {; h2 r' Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 n0 F0 a T, Q3 Z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 u( Y# G8 P" B' A$ u
% R# T* H+ ~# N* c. F: F0 m
l' d W) c1 [: g% p: j1 J2 F9 G; W |
|