|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / |5 U! B/ H6 H( G
- [code]EDMA sample test application
) W! [# k: C; W2 w% W; j - /*
* z8 O. z2 v. e# a - * edma_test.c/ Z# I/ ^- ^& t! p) S
- ** ^0 O* j( l' Z# `! ^
- * brief EDMA3 Test Application( `. [5 G! R: _8 k! H
- *
4 C2 D4 i6 Z) {1 K+ j6 e3 |& p - * This file contains EDMA3 Test code.
+ y9 y: F* u1 b - *
r1 g" g9 E M! H1 Z$ c( A7 b8 v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( S* S/ q) k- G0 I9 {. z7 l' h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% X5 l5 r9 G+ f/ ~, K - * TO CHANGE.
" y+ v7 z/ i. K" ^ - *: ^" j! {8 Z: @& E' ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, \8 y8 a3 S( a! b8 a - *5 M8 S: Y9 [% L* o
- * This program is free software; you can redistribute it and/or- f) ~; a5 ] M" C4 h; ~
- * modify it under the terms of the GNU General Public License as2 J7 z s( j1 j4 i, i& E8 t
- * published by the Free Software Foundation version 2.& u$ n) Q& d7 u8 }
- *; x0 J2 D4 F5 u7 T$ L" l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any R# x' ]. n: J/ K# O: D+ p! k
- * kind, whether express or implied; without even the implied warranty
& ^" T) \' \- n8 Z, }2 O( m - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ x7 p1 K. {$ C4 O) }: T& } - * GNU General Public License for more details.
& Q, n4 \4 F# m! `" d; d) ^ - */
h1 @$ C* Y& B' n0 P( G/ Q
! e& c' S! I/ ~" T: G. ~: ]2 k- #include <linux/module.h>
" P5 h; k' g" @3 L - #include <linux/init.h>
- w& @$ f5 M$ x6 {3 R8 L0 ? - #include <linux/errno.h>
+ t; @, M3 j0 L$ b" M9 ?) V - #include <linux/types.h>
2 h3 u/ r5 s* D7 N - #include <linux/interrupt.h>6 Q& M- M5 f" F L( D ]
- #include <asm/io.h>
# l4 m) q$ q C5 h* f5 J9 S( ^ - #include <linux/moduleparam.h>+ T/ o: `' M @8 \8 ^) l0 g
- #include <linux/sysctl.h>
( r7 [2 N g! h, K - #include <linux/mm.h>
7 F# ^* F, u1 G4 U - #include <linux/dma-mapping.h>, Y0 B9 Z. k( W8 I% ]
- & Q$ |6 O, F- W: r7 Z5 A$ r
- #include <mach/memory.h>4 l: h- S$ `6 a7 D6 u
- #include <mach/hardware.h>
$ s- F! D. f" V0 l; S: M. X - #include <mach/irqs.h>0 A4 N d0 i: h e! ^
- #include <asm/hardware/edma.h># E: e" C4 X- H( i2 W- k
0 n5 _# R+ q2 D! i" [ Z' x" M- #undef EDMA3_DEBUG
6 a& l2 L7 I1 I5 m+ g - /*#define EDMA3_DEBUG*/, H6 K3 {" @" a# g
% B& {9 c1 ~, U: q2 c- #ifdef EDMA3_DEBUG
& a: K4 a5 v+ ^' {; n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ G9 g" R9 a! D' L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& [; [9 u% T) q; U3 K0 S: ^8 I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 {% }0 v9 ~ Q/ h; P+ u
- #else
4 N: @3 K" R. g3 q4 P - #define DMA_PRINTK( x... )
, q- H" D+ ?1 U. k/ m, W5 A6 F& n - #define DMA_FN_IN+ l5 _4 h& ~; Q( B
- #define DMA_FN_OUT) D, c3 G2 r5 x1 d) Z4 j' }: G
- #endif
1 s! n, u& e, l - . a3 ? b0 d& L- {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 x' O2 ~/ D, ~! k7 I8 ~3 N
- #define STATIC_SHIFT 3
1 K' o3 u! i) @+ ^0 ]4 w$ Y - #define TCINTEN_SHIFT 20
8 z3 \1 [7 D5 i8 z2 M3 w2 P$ L - #define ITCINTEN_SHIFT 21' b3 v! A( A+ h
- #define TCCHEN_SHIFT 22
& P3 v9 ]" t* j3 |! G - #define ITCCHEN_SHIFT 23) [: M- C9 D6 }# C/ y7 Z
( t) }1 Y" ~( _3 g/ {) ~ Y- static volatile int irqraised1 = 0;$ G: X. K- m( h; l3 ?0 j
- static volatile int irqraised2 = 0;
" f& P* z$ N' G* u. P4 Z t - & I! L( B- r2 e- ~% g
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' M5 a+ |7 _+ P+ B! U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" k% C# l8 O& y3 n. D0 y( | - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ]& q( ]* L- X; e/ h; f
+ V0 h; w3 W- F+ }' G/ m2 l- dma_addr_t dmaphyssrc1 = 0;1 e! H v/ [$ o# H. ]- C- B
- dma_addr_t dmaphyssrc2 = 0;$ x# e" y0 S7 B/ y8 i5 k" D
- dma_addr_t dmaphysdest1 = 0;
) t: a6 @& B0 {) N - dma_addr_t dmaphysdest2 = 0;7 @/ s# `5 `6 d5 X7 h, p$ f% ?5 g: D
+ I& c! i2 x. J* [4 F! {/ R6 b% h- char *dmabufsrc1 = NULL;5 s. z. f& K1 b6 { v+ t/ O4 G
- char *dmabufsrc2 = NULL;
' B- q; _( c8 U- h9 ?8 f4 Z( ^ - char *dmabufdest1 = NULL;
. _. u7 [" e. `! Y - char *dmabufdest2 = NULL;
$ I% W9 `7 w( Z" s. |% w% Y
) m8 F' }% H' Y2 \/ I- static int acnt = 512;. Q- X3 A; \ }* _9 Y7 C! Z$ n% S
- static int bcnt = 8;
! y8 p. _* T: A4 {; H - static int ccnt = 8;
9 p L2 [0 b! h4 K - % ~. v- [* Y2 ~/ I. Q3 } L
- module_param(acnt, int, S_IRUGO);9 [: @5 S T. `1 b* v" h& t
- module_param(bcnt, int, S_IRUGO);
: d* N: U. {) ^- v3 k - module_param(ccnt, int, S_IRUGO);
复制代码
$ \# `) k5 i; E9 |8 k) B% Y8 b2 J# v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ q' M$ {! M9 }2 rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 l+ o9 N: M! C8 X0 O9 U5 {, ~ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! G' \# u* H% P: x4 h! o
, J u. w) F9 h% F0 j9 w9 i
6 j1 o4 m3 o% p" {9 T |
|