|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& W, c! c5 P& w* N. _- [code]EDMA sample test application
( b ], {0 {- | - /*
. K( ]. a H- L" j' c; q; g - * edma_test.c
r; ^' n1 U, I: _- ]. c) ^$ T" o - *& E! X4 X/ ~5 |
- * brief EDMA3 Test Application( C8 f U, |+ o- a- k
- *( o9 }& y$ ?/ i, ]9 _# `
- * This file contains EDMA3 Test code.
. ^! t1 i) p( z) A+ s6 Z - *
# F4 P; i* Y1 R3 x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% ~. A- z7 n/ Q6 x5 @: N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ p% b- X3 b! e$ ?$ `; ?
- * TO CHANGE.
( Y" x0 g6 W- g9 E+ Q) i2 j( P - *
/ K3 N1 n% i! H4 D$ J - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 n9 Q+ I' Y$ H. h - *1 z$ z- Z* H' t) K9 Z9 L+ a
- * This program is free software; you can redistribute it and/or5 V9 i4 d0 e$ K
- * modify it under the terms of the GNU General Public License as( a3 \& M/ b) O
- * published by the Free Software Foundation version 2.2 u8 I& X. \) Q+ V6 m
- *
9 V/ N! E4 n1 q; S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, I$ a4 V1 J8 ^! C4 |' \ - * kind, whether express or implied; without even the implied warranty3 M! {+ Z( L9 `7 q5 |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
t! g" I& k7 x" r - * GNU General Public License for more details.
! R6 A# u+ s7 e7 ? - */& @2 ?6 x* f: c, Z
" O k: r* y I; [) y& F! Z- `- #include <linux/module.h>( ?7 W i: ?6 o3 L
- #include <linux/init.h>
) c" J# [5 U8 W! {4 R2 ? - #include <linux/errno.h>
8 G: ]4 K- \$ a; P# B+ K - #include <linux/types.h>
- V2 E. x, b# r* u" { - #include <linux/interrupt.h>
. ]( L0 v+ j9 M2 M1 G* N# J - #include <asm/io.h>
/ i2 W# k0 P/ _5 G! I! U7 R/ t( f' [ - #include <linux/moduleparam.h>. x" k, t# f- b. A9 z" O+ _6 U' d \
- #include <linux/sysctl.h>
3 j/ ~ {9 y! h. Z) O2 {5 Q - #include <linux/mm.h>
* ~* U; n& V/ [3 n. J - #include <linux/dma-mapping.h>
) _' @, R8 o+ @+ e - 3 u- u2 N0 M4 `$ V1 T
- #include <mach/memory.h>9 j( _; V s) s& E- [1 j) f, O
- #include <mach/hardware.h>6 c t3 j5 A; O B& F5 a% H
- #include <mach/irqs.h>
8 t( U$ ?+ l' z0 w - #include <asm/hardware/edma.h>3 N' z3 s+ \# U. O U, b% d& B, j
- * v; I0 m# t+ E( N- Q
- #undef EDMA3_DEBUG& l6 L" d+ U/ W. c T
- /*#define EDMA3_DEBUG*/, k* a) S0 i" j1 x6 T3 h5 o4 X
- % v* _1 S# u( m) |/ f
- #ifdef EDMA3_DEBUG' Q% V" V& k6 t. J2 J+ X* S
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 r" m7 ^2 _/ h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& L! b/ P" L+ \" x7 N
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: X2 q" z: p/ O6 P. C' R2 I - #else
4 n% ^4 p( w9 a - #define DMA_PRINTK( x... )2 M* ^2 @* Q3 S( A( E4 J
- #define DMA_FN_IN
5 G% z; k! G0 k B! Z& F5 |8 L - #define DMA_FN_OUT1 \5 O$ O4 Q+ Y0 y9 {
- #endif+ S3 |. K: ?) @9 d# }
, V9 @; K B4 H' ]0 c; H7 X- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 v* }) x/ z0 w4 L5 y - #define STATIC_SHIFT 3
6 X1 h8 i6 H( P% \! S" M - #define TCINTEN_SHIFT 203 }2 O5 ?* @! |+ h/ \
- #define ITCINTEN_SHIFT 21
) _6 P6 T1 g! I8 T! R( V - #define TCCHEN_SHIFT 22
% y% Y# s5 F( w: `! h3 D; Y: p - #define ITCCHEN_SHIFT 232 p2 k" _8 [1 P$ T! k ]: Y
- s# ~+ `1 x; `0 u- static volatile int irqraised1 = 0;. A8 Z' Z7 w" I1 T) _- ?- q4 M2 ]
- static volatile int irqraised2 = 0;
5 m- }. \1 a3 k* @& g3 j4 Q: J - : s5 y [" }. s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ W" S# h7 f; H4 C7 c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; a% c1 S; Q, i9 E0 s7 W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 G0 c3 d2 r) x
( e7 S9 m9 ]# H c$ q- dma_addr_t dmaphyssrc1 = 0;
F6 n3 [, X* W ?+ ` - dma_addr_t dmaphyssrc2 = 0;6 x- q. _4 O% q
- dma_addr_t dmaphysdest1 = 0;
# M( ]. M4 y! M - dma_addr_t dmaphysdest2 = 0; T1 I3 o* D# d0 u4 ?6 j& I7 ?
- , Z. p6 y P" ?* Q0 f
- char *dmabufsrc1 = NULL;
# M" Y' C- D4 g - char *dmabufsrc2 = NULL;% g/ v: l: q- P6 p
- char *dmabufdest1 = NULL;% I7 Y5 ^% R1 X& A$ o
- char *dmabufdest2 = NULL;$ f5 r9 A- X5 w! O
) l1 f8 Q% `1 l! K- static int acnt = 512;
0 p% M. u3 S, }5 Q# {* \, s - static int bcnt = 8;0 q. W% s" q) e1 i |" v
- static int ccnt = 8;9 Z6 E: u" z1 O8 C4 h$ E) {
- ( @6 o3 I& k+ c9 u% @! ?; O, }7 R0 l
- module_param(acnt, int, S_IRUGO);# O; p. {+ \& V1 j3 C m
- module_param(bcnt, int, S_IRUGO);, [1 l! ]% _3 j+ @
- module_param(ccnt, int, S_IRUGO);
复制代码 ! Q$ y- a- n) C$ G7 c
: h7 h+ ^; Z; \# l7 ?/ N, ~/ n6 T
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 U+ z2 o- y5 s: g3 o$ q. \, p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: }' w \& v( f# ` 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, c* |0 Y4 H. k9 l9 p- \
0 x2 G3 H+ y7 h/ c* a* N3 a9 C( w I5 ~/ A+ E' P8 a
|
|