|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 t" W6 U& Y6 U7 q% B9 t1 p/ [- [code]EDMA sample test application
8 i. v3 y8 R, r G - /*8 X" F/ v' B M( `: @: ]% Z
- * edma_test.c. q1 _7 l# x- d2 t! D- r
- *, }* |' J- c5 F% z
- * brief EDMA3 Test Application) m" S# c6 S/ }0 }. T( N
- *
( l; Z) w2 K3 P5 O6 C- m$ S0 N - * This file contains EDMA3 Test code.
" m7 [1 T' { U) w3 S# q! ^ - *; i4 j; `, \" |1 a
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: {, `8 ~( M) ]; \
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 z/ y' H: j4 ~# `" O* q" K - * TO CHANGE.
) i: }' \! F# c0 G. E6 k [ - *& ?- `9 i4 p5 W$ T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 y+ M/ J4 d% u5 G2 T - *
( d& `, m% c" s" h' v8 o - * This program is free software; you can redistribute it and/or8 M# {8 K: R6 L
- * modify it under the terms of the GNU General Public License as
+ x* v% f `* U+ h - * published by the Free Software Foundation version 2. L# L# U+ p/ S5 O
- *
' U# Q# ^$ R, v( t# u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' @# e$ V o/ a- |! G - * kind, whether express or implied; without even the implied warranty$ |/ n6 H! v& t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ \4 L) ?: L$ A" Y
- * GNU General Public License for more details.' b0 g% Q' j n. z% a2 Q
- */
: j2 m* J- {* G% ~
4 H: L( V4 o8 z( M1 O, G- #include <linux/module.h>
% F6 u9 {+ `2 D# L a. [ - #include <linux/init.h>
; p& \+ z. D& s$ H- H8 {, A - #include <linux/errno.h>+ A0 b6 s( y5 e! v8 H9 T
- #include <linux/types.h>0 Y! y1 D. L5 C9 S% G( D
- #include <linux/interrupt.h>
5 L8 I0 `5 D: I& B( R6 ` t - #include <asm/io.h>
* p" R3 r u8 U+ k- w2 E; D B - #include <linux/moduleparam.h>
; T; p. w, Y. Q, }1 p, h - #include <linux/sysctl.h>+ c( u' z" y! Q8 g- ~% n/ q4 j
- #include <linux/mm.h>5 s$ q- K2 o; ? D: n. V
- #include <linux/dma-mapping.h>% s- X, N# e4 T/ c* m4 N( Y+ Q
- ( f J6 Z: a" a- O$ C$ J
- #include <mach/memory.h>
5 L+ o& m$ `2 e- n - #include <mach/hardware.h>4 {5 y& z9 J9 ]5 S$ P( L( X1 I
- #include <mach/irqs.h> T U* q+ @+ M* C& W
- #include <asm/hardware/edma.h>
2 q S3 J8 T( ?3 L5 D
2 |- b! U6 @. _& P6 X+ \3 n5 X- #undef EDMA3_DEBUG5 H }9 d8 Y6 [: X4 H
- /*#define EDMA3_DEBUG*/) g3 p5 {: y" E J
- Q' Y) m) B8 B$ }' V3 i: k# ?
- #ifdef EDMA3_DEBUG
$ L& J+ @' Z- T/ W - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 V. F" M: O0 R: G+ d; l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 Y1 d0 p% _; Y0 X$ x6 j0 G( E
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 R( d9 n" j- n! J
- #else# m( v/ N/ t- H- q' s9 {
- #define DMA_PRINTK( x... )$ y* K2 X7 v- w
- #define DMA_FN_IN
! k0 W. d5 l3 `* \3 c7 b - #define DMA_FN_OUT1 O. Q2 W# G$ A' s! @* E
- #endif
. `% N6 f8 e1 y3 Z, K# P7 l - , T/ \6 t- A/ B9 C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ P4 d% O' P2 K
- #define STATIC_SHIFT 3
; L+ v9 h+ o3 b7 I - #define TCINTEN_SHIFT 20/ g/ H9 ^7 |- k
- #define ITCINTEN_SHIFT 21
0 h! w/ O7 f# Y& u - #define TCCHEN_SHIFT 22
# F9 `- Z, e* v. x/ F8 f5 f) V - #define ITCCHEN_SHIFT 23: q( A4 I7 W7 R8 L' y+ {" O! U! [
- 8 G. g& u" h3 H/ }
- static volatile int irqraised1 = 0;
! W* e! z) E P B& c0 Q# ? - static volatile int irqraised2 = 0;
& q, V0 I' T5 A' Z% P/ I
. j: j9 a1 q5 s! S- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( |" I$ ~. ~# Q/ d3 p. s; _ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( }8 {% G6 o2 V. h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* I3 c* B. _) Y+ m. x
# T% _7 l, y+ F8 \& B( g' o4 k- dma_addr_t dmaphyssrc1 = 0;
+ t$ D& |( A; c, r$ }9 D - dma_addr_t dmaphyssrc2 = 0;
/ w( s3 g0 l9 }$ p' n! p - dma_addr_t dmaphysdest1 = 0;% J: A3 \* g9 K# |( j d* \
- dma_addr_t dmaphysdest2 = 0;/ Z4 f1 q( {% m: S) V
- * M8 W b! M0 G* @/ m8 e
- char *dmabufsrc1 = NULL;
, [1 n1 s g0 m - char *dmabufsrc2 = NULL;- {( G( H1 ~/ e$ V9 e
- char *dmabufdest1 = NULL;/ z( |9 S# e6 m. J
- char *dmabufdest2 = NULL;8 l$ ?8 l1 }* f! {6 r" q. b( q8 v3 n
l. X, F/ b! p2 Z9 i- static int acnt = 512;6 d/ y$ B6 I& Y/ `. a
- static int bcnt = 8;' C7 H; ^' p2 b( T1 V% N
- static int ccnt = 8;
- v' s% g9 S( {
" g* E0 H" K7 w4 M' f3 p" m" W- module_param(acnt, int, S_IRUGO);2 a) N; @7 l. l4 J$ x
- module_param(bcnt, int, S_IRUGO);8 K3 B! H& J) z3 g' g4 a
- module_param(ccnt, int, S_IRUGO);
复制代码 $ _' o1 v- D& Q7 C
9 ^3 J- R3 @2 c y6 X) J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( }" J$ V+ K7 \" c* n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ Z E+ p) L( R, a( U: n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 K4 K" e; L( w( o4 F5 _' d& o4 A' [ {- m* M( O2 ]
" u( X. k4 {: c/ Y# b |
|