|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 k7 i% N- C" @. u
- [code]EDMA sample test application
, p9 B4 w. ]0 p! G3 S. L - /*( m4 x3 u9 T4 m
- * edma_test.c2 `/ q& u; ~! I. Q* B) y
- *
' s: z8 d. c) q" V J3 |7 n7 W4 B - * brief EDMA3 Test Application
3 o8 i1 S$ f3 ^2 V& s+ u, L4 o - *
) S0 w, K! N* M$ H4 A - * This file contains EDMA3 Test code.
. }0 k+ \2 o4 u0 Q- `, F' {; | - *
W; F1 O4 a$ Q8 U/ h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 u( b' U8 S k5 P7 x: E - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 t/ R7 |% I9 n& Y
- * TO CHANGE.0 |" q5 _5 L# [. ]8 d
- *
0 s3 x Q3 `) {% t% Q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 W3 ^0 R! N" M# @* \; {- r - *
% i" K$ {9 e7 `3 p! W7 P5 M% I - * This program is free software; you can redistribute it and/or
0 b) E" p: z: A* m - * modify it under the terms of the GNU General Public License as
' F% F" y% m1 q a! g - * published by the Free Software Foundation version 2.8 T% W* m* ]* R+ ^4 l/ R4 F
- *5 o5 L8 F! @; j5 H* g
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* H* o7 d, s: j/ P! H3 Y2 Y& [& N+ O
- * kind, whether express or implied; without even the implied warranty
; ]" x% N& } O0 u3 } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# g$ q8 S/ P1 m* f6 e - * GNU General Public License for more details.
8 g$ |3 l# R0 w* Y5 D - */0 H7 y$ h2 `; ~& \( S% ]
9 U- `0 p3 D, C& C& y- #include <linux/module.h>
& u, s6 l& ?4 X. s1 L, c6 {2 i9 O - #include <linux/init.h>
: y; E$ H5 Q+ O! r7 p - #include <linux/errno.h>. n) \( O, `& `9 g2 W6 C
- #include <linux/types.h># o! T/ Z3 V' t# n. j7 A% E
- #include <linux/interrupt.h>
0 m/ u, [0 O' R4 N' H9 H - #include <asm/io.h>
; F, ~5 T! q$ K0 y0 X/ L- Q; y - #include <linux/moduleparam.h> F& h" o; o: t: ^, k
- #include <linux/sysctl.h>
( [ q3 k0 }9 A* J, O& E# P% d: j - #include <linux/mm.h>
% ~3 G; K. e9 f0 \2 { - #include <linux/dma-mapping.h>
$ W# s$ r. F* K# k# w0 u - 2 O( M/ M; I, E9 t0 X; U6 T
- #include <mach/memory.h>
7 g7 F$ b$ M( B% J0 R' c2 [ - #include <mach/hardware.h>
6 E5 ^- j) G9 Y: Z! x* j+ K3 W - #include <mach/irqs.h> d; O) M, r) K+ u# @
- #include <asm/hardware/edma.h>. n q+ u* n- k2 e5 K
- ; o. V" a9 u: y# Z# r
- #undef EDMA3_DEBUG
& G" s5 `7 E* I# F, h - /*#define EDMA3_DEBUG*/- G/ _" t5 V. P+ i4 n3 o
- 7 s! K& p2 p/ H! k
- #ifdef EDMA3_DEBUG
, Z! |8 O* t0 w9 n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' {1 N5 Y' O" r/ f. U( V
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ j3 ^$ v1 r# `4 N- b- x- b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& d; c% U( Z- Q: i; w. j - #else
- C. E: C- J: h# x - #define DMA_PRINTK( x... )
$ A) g/ |: J5 W& `# F9 V' v - #define DMA_FN_IN" P3 u. d7 |3 t8 v: X
- #define DMA_FN_OUT
5 z" [, Z1 p1 z; f: }" K0 D3 w - #endif
8 A3 y, L# C- F4 b* ~7 X1 \( g - 6 M* i# R3 w+ Q( N
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* S% [- U; `; a% _9 U( Y3 n - #define STATIC_SHIFT 3
- ]0 Q$ V" ?( o; l/ o - #define TCINTEN_SHIFT 207 X" ` [/ G0 S+ l) d) [
- #define ITCINTEN_SHIFT 210 A9 r4 d* X1 |5 `4 b7 F) Q
- #define TCCHEN_SHIFT 22: v6 U5 g' b' g3 T; F
- #define ITCCHEN_SHIFT 23
; U% N/ p1 e+ ~& L
4 q8 f6 S3 o+ O7 U" K- static volatile int irqraised1 = 0;
# p) K( ~6 L4 W* t' b - static volatile int irqraised2 = 0;2 V3 u* r% J8 @& {
- : L- e9 Q, X6 w& a+ C, q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; K, y& G( _& H' ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 F6 H8 N; F$ D9 ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* ?9 L: I" W: F6 T
- 3 y; i5 b: ?6 k5 s! y2 @4 R
- dma_addr_t dmaphyssrc1 = 0;. u5 E3 {8 r& P9 j1 ~
- dma_addr_t dmaphyssrc2 = 0;
' g! h9 h5 N" A' u - dma_addr_t dmaphysdest1 = 0;$ u7 D9 N& z8 D4 e
- dma_addr_t dmaphysdest2 = 0;! i! E' i- t! y6 C% Q
/ U- G: {# p0 h# L- char *dmabufsrc1 = NULL;
! \# k- f' G( j7 j - char *dmabufsrc2 = NULL;' h4 S3 W8 y2 u H
- char *dmabufdest1 = NULL;
' E( x- D* m( y' t; I6 F! ~+ } - char *dmabufdest2 = NULL;
+ E5 \5 f+ u8 q* e& F4 u
% @# P8 t% r3 {( T9 ]/ {- static int acnt = 512;: T2 A3 S5 s$ G* D6 _
- static int bcnt = 8;' w( x3 @! M" Z8 Y: ]1 R
- static int ccnt = 8;' z8 d6 v/ J9 f: x6 j; W4 c
- $ }, \; w0 b* C V
- module_param(acnt, int, S_IRUGO);9 X6 e7 |% N+ X3 u& I
- module_param(bcnt, int, S_IRUGO);
6 N2 N( y! E5 M4 u - module_param(ccnt, int, S_IRUGO);
复制代码 ! P) }4 v- |! Y2 H% x
! j) {& G6 X! |: W, q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. Q3 } S5 x* jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 J! S0 k" L3 D: ]7 e 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 T$ D( ?5 J, u" D. {: O8 X; \
4 ]8 I3 B+ v$ s- z" w9 T
$ J1 Q% V. g' c0 d$ F& U |
|