|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, M& P/ E" h' d) t8 b- [code]EDMA sample test application
6 R! B2 x0 f9 `& ?1 {* ]: J9 q$ q - /*
, t' \- ?( [$ v. c - * edma_test.c
* S8 D2 ~% a8 H/ e - *- ]& b; c9 I$ D" a3 ]+ w
- * brief EDMA3 Test Application0 o3 y3 A+ C; r. B
- *5 J/ h8 ?6 U0 @. t, L4 `+ k4 O
- * This file contains EDMA3 Test code.. N; ?9 l, m- s% ^6 J8 N3 w
- *
$ S' Y7 z% ~9 R& H. L L4 W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 Z+ Q5 S9 G0 ?" s7 G. @# X) V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* ?/ ~: x* `; N5 G2 M6 n2 B5 V
- * TO CHANGE.
8 h' A0 f: \3 Q* F - *
4 Y+ U- i7 h7 _# F L7 F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; x+ s, n' h$ A/ k" J( X1 C! H+ l, E* P - *0 G7 Y, J8 H" B& f* b: J
- * This program is free software; you can redistribute it and/or
/ P. R* o/ u3 q7 q8 N2 @' e - * modify it under the terms of the GNU General Public License as. J F+ @$ @/ R$ P0 a
- * published by the Free Software Foundation version 2.
9 B p# Y9 V" H) R - *
: l/ `4 }5 |7 Q! q9 l - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% Q: E* g' ` P8 G9 Z W: e4 n - * kind, whether express or implied; without even the implied warranty
& ^( ~' w) l% E4 h; G6 |' x - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: L4 [3 j. h7 {2 N( f1 C - * GNU General Public License for more details.
& v! Z! K6 G( M( a2 C - */
' b0 U2 g: T7 j
1 ^1 P6 Q" N8 {- _+ ~: S! W- #include <linux/module.h>
5 T- K+ c3 i1 k - #include <linux/init.h>
8 Z4 j! }: v v4 p& \7 Y+ r$ { - #include <linux/errno.h>
5 m6 d% _* }) l' o, P% Q2 ? - #include <linux/types.h>4 g1 I: i, o% |$ F
- #include <linux/interrupt.h>2 d) T1 l, d( l1 C/ i7 m S
- #include <asm/io.h>
6 ]2 o% P7 ^2 r+ B2 f$ R; |( j( n' ?! u - #include <linux/moduleparam.h>: W2 r. F& t) q4 O
- #include <linux/sysctl.h>3 ?/ m- x0 \) Z" k6 C1 g
- #include <linux/mm.h>. @: r8 o) W1 Q* C
- #include <linux/dma-mapping.h>
9 ]/ n" j" v, j7 v# s - & | r* R8 s/ ], [. g0 w) r
- #include <mach/memory.h>
S8 f2 D, \' N4 g6 _7 Z - #include <mach/hardware.h>
+ |2 _, b4 S1 o/ u4 L$ s - #include <mach/irqs.h>
2 j4 d8 s5 F% v5 s - #include <asm/hardware/edma.h>) f: y5 O8 {: ]1 y0 m% M+ N \7 U
- 5 t8 d2 @- m( `
- #undef EDMA3_DEBUG9 @4 u! o- r9 f. {' j7 y$ o4 Z+ g
- /*#define EDMA3_DEBUG*/1 I: a' L. k( [- |" H8 X$ @
1 x2 \# v7 l% R" N+ R5 ?1 g+ p- #ifdef EDMA3_DEBUG
3 D5 K( q _* o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" a# z3 \7 }. G4 v" Q9 B$ [) X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); Y) |1 H! q D
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ F# G7 m+ X C& i, ?7 A
- #else4 ~6 ]3 a2 x4 X
- #define DMA_PRINTK( x... )
) N* H/ n7 g: { - #define DMA_FN_IN
4 {' _6 M$ q5 h, r - #define DMA_FN_OUT
2 o8 t/ j1 O) U! c - #endif
& A$ Y; j& s# {, b - - h1 {' d! I6 C( _1 h( p7 r
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- i" t' w+ k1 f& g$ C# a0 X
- #define STATIC_SHIFT 3, L9 {* S L, w% i
- #define TCINTEN_SHIFT 20
' x) P4 ?& z" g' u) Z - #define ITCINTEN_SHIFT 21
' K$ t* X1 q1 o6 u7 |% U - #define TCCHEN_SHIFT 22 p$ v$ A6 K! z
- #define ITCCHEN_SHIFT 23% |9 C+ J1 n$ o% C- r' e5 ~
- 4 d+ K6 ]+ Z$ y& u) X- W8 m/ H
- static volatile int irqraised1 = 0;- A5 y# o& N+ T1 H: M! Y& B. n
- static volatile int irqraised2 = 0;2 G! _4 X3 @( X L* @8 p; }2 e4 L
+ p$ d3 _, X y2 k- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: B* y) O4 B/ v' s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 b9 \8 L' f2 _
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! H: c, }5 T1 p+ h
- - O& T$ G$ r5 H$ X; F ]1 J
- dma_addr_t dmaphyssrc1 = 0;
8 z" N+ v( P5 N% X - dma_addr_t dmaphyssrc2 = 0;
: r6 `7 G7 |+ i7 e - dma_addr_t dmaphysdest1 = 0;& g1 k, ]; c+ _; f% E' I+ X
- dma_addr_t dmaphysdest2 = 0;0 x0 H* ~7 C8 {
; n; z: ?+ a! o- char *dmabufsrc1 = NULL;) Z6 V& l' l- y! I
- char *dmabufsrc2 = NULL;
) G2 g# @( s$ Q - char *dmabufdest1 = NULL;. W3 h5 u: n+ D9 ^3 y# Y; I, U
- char *dmabufdest2 = NULL;; T1 a8 d* T3 V4 C% K& n- I
# h3 B4 S; E! N- static int acnt = 512;( X2 O% k9 P2 U" J1 `
- static int bcnt = 8;2 P. W! f- ~; ^' @5 A
- static int ccnt = 8;$ H3 V2 Z& P& H
, w( q4 W- }& ?- _! E% I- module_param(acnt, int, S_IRUGO);% j6 L7 ]7 R! x) e! H/ l
- module_param(bcnt, int, S_IRUGO);3 c8 c( J( e3 @! P
- module_param(ccnt, int, S_IRUGO);
复制代码
& q9 n2 K; d3 e
: b) K$ ?& ]& f, u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 W# Z1 w4 A, j' a9 Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- K, |6 C& y! @1 [ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" d6 h, i% b7 J. N& ~7 p# m2 ?% \. ]/ |/ r' {9 g
* e; p3 D% ~5 g) |; |8 [5 K. [
|
|