|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! J2 R$ c" z& {. U8 ~8 S! G" d
- [code]EDMA sample test application
( }, F$ P/ y& w% {) A. Z - /*. P0 v, i0 v1 @
- * edma_test.c# }) Q/ ?7 ^9 J) T8 P! K
- *
}' n n3 l' l% E - * brief EDMA3 Test Application( J4 m9 s- I0 ~) {5 \# v& m
- *
% R, \5 n! e& O4 J* p+ z - * This file contains EDMA3 Test code.: u( ?6 l8 }3 U2 ~, ]! X
- *& J: K8 |( @% `* }3 K! a6 Y0 ^7 Q3 c
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 T# t. T6 c$ m8 P; r% `2 e# ]1 H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ i* f. W% f& a" z6 w7 P! Y
- * TO CHANGE.
2 n( |8 S( g% q: f3 C* e - *# y) r9 ~" _; R, Z2 \/ o! N) D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ i. J8 [" W3 J# L! |- O$ n - *7 \3 y% x) `2 {; h% b, [$ n) A
- * This program is free software; you can redistribute it and/or0 ~/ ~1 K7 a3 l6 a9 Z
- * modify it under the terms of the GNU General Public License as
! K; C. A. j8 e- k2 F - * published by the Free Software Foundation version 2.
2 ^7 s- E) o) H' z' H4 C% F: O6 ? - *& h! Y/ q4 v5 s! N( P- s+ a: o
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, ?# c0 {7 [. u6 u6 b$ C) m - * kind, whether express or implied; without even the implied warranty; j q6 t5 h$ }5 M( v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. [: j4 ?2 a, e7 ~ - * GNU General Public License for more details.
# X5 l; [* T7 r - */' U+ B6 l! p, Q9 H5 B, A: P) n0 N
- # K5 D' x; V6 Q3 }
- #include <linux/module.h># Z% f0 U7 @) g% \3 R5 p$ B
- #include <linux/init.h>$ F5 R8 q/ Z# H2 w) r9 d; s8 q
- #include <linux/errno.h>
' C* ~! I6 M1 Y- G5 J% f9 g - #include <linux/types.h>
4 ]6 V2 s# ?6 c - #include <linux/interrupt.h>
2 D5 s. ^! v* Z$ j9 @* T - #include <asm/io.h>
, M6 `; f x% W - #include <linux/moduleparam.h>
9 z7 Z1 I7 T) N/ B - #include <linux/sysctl.h>
# H+ w( M9 S4 j - #include <linux/mm.h>9 R( U+ Z6 `/ w
- #include <linux/dma-mapping.h>- f F* n9 ?0 k. t+ N' r4 w4 h3 \
- ; l8 e3 ~ O. |% l8 d
- #include <mach/memory.h> ?7 k: @' [# ]
- #include <mach/hardware.h>1 `' K8 p7 {0 S: ?9 z% M) S
- #include <mach/irqs.h>( P* F. W: X, j; A% ~' e5 b
- #include <asm/hardware/edma.h>
; d+ w1 n3 P' ]4 t I, n
: L- [# L$ z: }& `2 ^' [' H- #undef EDMA3_DEBUG
& Y' P. m" E; f - /*#define EDMA3_DEBUG*/0 A! o& e, F9 k$ v
/ R R ^/ }. o- Q- #ifdef EDMA3_DEBUG0 i O2 C( d1 Q. s1 }/ _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 s5 j+ n( W5 p5 \ n9 W" p, F
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% a+ [6 P# u; G' x$ f
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ r I( v' ^' C8 n
- #else
3 h. W& d6 X$ T: ?' o- Q+ ` - #define DMA_PRINTK( x... )$ |7 j A: |& ~5 D H- p# \
- #define DMA_FN_IN# z6 V8 a- O4 a
- #define DMA_FN_OUT
1 Z4 _3 R( X+ A/ k+ T2 X - #endif
# n$ }# o0 U+ R6 G6 `; f' s, B - 2 [4 u) y! W$ s6 d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* Y' R1 g& ^/ j1 d. h3 K
- #define STATIC_SHIFT 3
: f4 Q0 l5 N/ ?( r' l/ ` - #define TCINTEN_SHIFT 208 V4 L/ ~+ \0 Q3 f5 T
- #define ITCINTEN_SHIFT 21
8 W7 k3 A; k6 |; B9 q9 F' R3 @ - #define TCCHEN_SHIFT 22
$ n$ `' F t& Q - #define ITCCHEN_SHIFT 23: q; T8 n: [8 B$ J5 a9 m" E; V/ ~
0 G, ^2 }, p1 H- static volatile int irqraised1 = 0;
* X/ m0 c8 Q. Y4 {) q% l - static volatile int irqraised2 = 0;
5 a4 m4 k q% f1 L9 K/ X
8 f3 C7 g+ i8 { M4 D- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ x U! B9 K; O. s5 l( C - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 ^0 |% I7 i, W7 M7 v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, A5 A7 I- ^; F3 M; l( C' O) U
# @* ^& u0 O$ M3 A) {- dma_addr_t dmaphyssrc1 = 0;
6 q3 @. W3 ^: q. W - dma_addr_t dmaphyssrc2 = 0;
% _( M" E- }1 F. O - dma_addr_t dmaphysdest1 = 0;. ~6 L4 R2 m: {/ y
- dma_addr_t dmaphysdest2 = 0;& s3 K9 M0 _% z4 S& z
5 `# A6 { _ r8 G8 ~5 Z- char *dmabufsrc1 = NULL;
% O' v- J% h/ k" d5 g - char *dmabufsrc2 = NULL;
; ], N3 b* j5 S - char *dmabufdest1 = NULL;
* G1 d; i6 p2 F. b/ _/ n/ T4 Q& w - char *dmabufdest2 = NULL;
/ n% v0 J9 g3 R/ {- k% |: F- e
, P/ f* q; _0 D6 B2 Q, W- static int acnt = 512;
! B/ M# e0 a: Z6 L k - static int bcnt = 8;
$ @* f: ?* a/ ^: G8 u - static int ccnt = 8;; \3 V0 j; Y5 \* J/ M2 V: h: O
- ! d7 @) A7 o6 w0 [
- module_param(acnt, int, S_IRUGO);1 m$ I) G4 g7 F9 c5 H# L
- module_param(bcnt, int, S_IRUGO);+ E1 |8 l2 d, U; C5 ]7 k
- module_param(ccnt, int, S_IRUGO);
复制代码
" \: j7 v8 Q6 H) \* z/ N5 u" C) _7 _! F* ?( w! v5 c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! c* q$ ~6 X- P h7 L2 @! }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. E* I) P4 v; X- w% R3 G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, K4 [0 e c9 d! x# {0 S
# [% ?4 f/ [+ p8 B# Z8 L' _/ W& W
|
|