|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " h: H; A/ e5 `1 r5 z
- [code]EDMA sample test application
' i5 M1 p* Q7 U" A7 d& ? - /*
( U( J! Q+ b/ v' t% s - * edma_test.c
# |- q0 ?2 Y' |) r - *
3 M6 k" }/ i. h! U& I - * brief EDMA3 Test Application
9 R- A5 X9 W- P4 Y( c* M6 w: ~ - *8 H+ I& @" J' x! ~6 H# ~8 y$ y
- * This file contains EDMA3 Test code.; f& z0 o% R/ Q# \: C3 [
- *
- v f h1 a6 }; v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ e2 _3 q2 g6 y: M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 D6 U' J. j. }2 w0 ? t* d - * TO CHANGE., G' u) p4 K" X5 u
- *+ j% L! y- \, t+ d8 F, l b) c: r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ @ `/ I( Q% @8 h. r! y: Y* c$ p
- * `' t* @' ?% I7 O
- * This program is free software; you can redistribute it and/or
" g6 U( m4 k" R9 n* Q( f9 T; O- D" B& I - * modify it under the terms of the GNU General Public License as
- I- a& {; b+ a! ~+ g - * published by the Free Software Foundation version 2.2 Z- T6 I7 j9 T* }9 B, x3 e
- *
# n8 i" D! N& g7 o5 Q( g' M) |0 D - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 l3 M( s# j3 e. ?: U - * kind, whether express or implied; without even the implied warranty" D$ ~8 ?2 s) p: {2 o
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 h' [* J4 g# b) h - * GNU General Public License for more details.; q, ?( u6 g' b P
- */2 d. ^4 m# u( u$ f. s6 ]4 e
, S4 z) R5 j4 r9 x5 F- y7 n! S- #include <linux/module.h>
! f6 Y9 Q' m+ r- \" } - #include <linux/init.h>
! c+ ]! ?8 h, ^) s% {! P - #include <linux/errno.h>+ n3 L' D4 i0 Z; T `
- #include <linux/types.h>; A# ~1 ?0 g0 p) H, L4 y
- #include <linux/interrupt.h># E5 h) P! L* b2 n
- #include <asm/io.h>4 t1 i; g# q8 P6 R. J+ J. s8 |0 y
- #include <linux/moduleparam.h>
7 p* r. K4 a# {/ s* S, I2 @ - #include <linux/sysctl.h>. ~- j3 q9 \! G+ t A
- #include <linux/mm.h>7 H; R' p7 O5 N
- #include <linux/dma-mapping.h>
: ^- \( Y" f0 F0 e
8 |( c% l7 b9 @& K# R1 Z5 V7 T3 n4 d# Q- #include <mach/memory.h>
/ [ W. A% n: o8 Z/ u2 h' l+ ~ - #include <mach/hardware.h>
# l0 @: G9 h' ]7 @! l6 F - #include <mach/irqs.h>, N( P+ Y' T+ J6 A- l9 c; i
- #include <asm/hardware/edma.h>
7 i. z% g9 _5 M' ?7 |0 f# @$ k - : h1 T o, O% P! T: _$ g7 f7 s
- #undef EDMA3_DEBUG
" s- |& @) H7 ^ - /*#define EDMA3_DEBUG*/$ w/ x) W' b! P+ W0 z. B
- ' t& ?- J3 e* _
- #ifdef EDMA3_DEBUG6 q/ ?0 \* B7 Y# G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. T! e" M( a+ e3 a - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* m6 M8 {0 _, R# P6 o; Z! ^3 ]' @
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 v% T. j8 }4 n6 L
- #else
/ H% t; E& W+ T" z6 x- W - #define DMA_PRINTK( x... ). H2 o# P0 u% G$ G( t, t$ V2 c- n+ m z1 N) X
- #define DMA_FN_IN4 ]: B0 x: R# J$ Z5 H1 \1 m
- #define DMA_FN_OUT
5 _! }7 |% i. l! ^; A: _ b* D - #endif
_6 B4 g s, v - 8 U5 Q( i& L0 T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% }6 p4 h$ ^9 t' g* t+ t) V
- #define STATIC_SHIFT 3
/ y( |7 [( ~9 q - #define TCINTEN_SHIFT 20
, C8 E% ] H8 n3 I9 R! p8 v - #define ITCINTEN_SHIFT 21
4 k- n; P' _( S - #define TCCHEN_SHIFT 22
0 j# }5 G6 L) y. A4 o - #define ITCCHEN_SHIFT 23
% u8 |* K( Z" E; b$ Y) d# o
8 T0 m" s+ [$ i( ^5 Q9 G- static volatile int irqraised1 = 0;& U: r1 h& L( K3 z9 b
- static volatile int irqraised2 = 0;
% c- ^% ~9 [" D5 _: {8 p
1 Z; f2 N. e* R( p( S9 L- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 s! ~/ [6 [, q- }+ h5 e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ Y: u. d6 c( A. B: N2 K7 A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 J1 q1 ?: H. H4 d3 a. ] - ! L4 K- B9 ~8 C* |- c
- dma_addr_t dmaphyssrc1 = 0;
3 p. A0 D) K! M& Q - dma_addr_t dmaphyssrc2 = 0;5 e2 l Z; t; c4 O% x' H7 A; s' H( ^
- dma_addr_t dmaphysdest1 = 0;
/ P* J! Q O9 E9 W A - dma_addr_t dmaphysdest2 = 0;
3 K( q9 Z, |. r' t) y
% [/ G4 F1 Q' W0 Q) W. a& Y- char *dmabufsrc1 = NULL;
) y5 [9 b( M, \9 A: l+ m - char *dmabufsrc2 = NULL;" r* v0 @% r& I7 j4 X4 m3 _
- char *dmabufdest1 = NULL;3 z, _- w( e3 k1 G" ]7 k- I
- char *dmabufdest2 = NULL;
8 `* C/ L, n" C4 e - , B" R0 n& M& b) z
- static int acnt = 512;( B4 C; n- K; D( n- P5 f1 H4 Q7 r
- static int bcnt = 8;# Y8 e+ S3 n$ W S0 ]7 K
- static int ccnt = 8;
+ J7 i3 r j7 b# @+ i1 o. z8 K - 9 h3 M& U, U* j. Y) t
- module_param(acnt, int, S_IRUGO);
0 a9 ?. W- J; t9 Q+ l - module_param(bcnt, int, S_IRUGO);
! y8 o7 d _0 U- K3 p0 V: m - module_param(ccnt, int, S_IRUGO);
复制代码 . F4 j' O& B; l7 L* l3 a6 E
! B3 n5 j& e* L! j' k- p* j; t
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 H9 j0 j3 [ K/ V2 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ g0 i- w0 a, K( h! ^6 U' t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
T; X. T6 ^, X0 K
) Z7 G5 Y7 t7 A7 R$ ^ [$ N: r* K2 |$ ^, c
|
|