|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , H6 K) P7 l0 l+ z, Z
- [code]EDMA sample test application
6 g* A' w2 _! s0 u) u - /*6 @% q1 ?5 Q$ ]7 l5 I7 s
- * edma_test.c
, i, u" T/ p8 G# ]6 Z5 } - *
9 e/ ?5 M3 p; H - * brief EDMA3 Test Application S$ v( h2 Z! p8 k
- *
& s+ Q9 D, ^1 j9 E" ~ - * This file contains EDMA3 Test code.
% c" C# z g& I7 j+ W, O K" b0 \ - *
- o- t6 D, m8 E' F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- ^$ Y& m7 C9 s2 x% ]0 C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* j( f- p ^: O$ o% j6 \. R0 f& C
- * TO CHANGE.
5 t& C$ S' y* K& ~1 _/ g, h7 o - *
! U. }% S2 U+ @/ E- b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 t0 e, ]( }& G9 D
- *# t7 D/ ?7 K) A: e
- * This program is free software; you can redistribute it and/or
# j# J& a- Y5 H2 ?4 t2 B0 _* f0 ? - * modify it under the terms of the GNU General Public License as
: n. a. Y, T# U9 H1 u# h q9 ? - * published by the Free Software Foundation version 2.7 J- K( g0 ]4 m j7 J/ C) {6 y
- *, |! ^( }8 x/ e/ [8 U
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ h# n% m: G0 p9 { - * kind, whether express or implied; without even the implied warranty
% [! R1 M( c$ F- |' O, L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 X I( r% P" G4 {' f
- * GNU General Public License for more details.) j' G5 n/ X3 |
- */) G% F: O0 l( ^0 V ?: L
- # z3 ?$ o$ ?9 |7 R" ? a( e( A
- #include <linux/module.h>
9 ^4 A1 n3 M8 b4 G1 |# L - #include <linux/init.h>. e! k) B) ^5 }" D6 B2 J% K
- #include <linux/errno.h>
- Z; y, S. T# z5 i* ~: [ - #include <linux/types.h>
# }1 J0 f% @' d& `, n% U - #include <linux/interrupt.h>
: e5 p" x2 O1 N8 {' a9 f( k - #include <asm/io.h>& A% ]. m; g; D. |7 v3 X
- #include <linux/moduleparam.h>! v1 V: B6 w# [, U8 W
- #include <linux/sysctl.h>
3 s' A" }0 [7 [+ W( p- q - #include <linux/mm.h>; h7 R/ |8 M: e6 t& H
- #include <linux/dma-mapping.h>" [* K7 U8 ~; Y! j
- , R: c A6 |5 P7 I6 `6 }: n
- #include <mach/memory.h>
. x' A: f. t5 Z+ L - #include <mach/hardware.h>, d' O. Z9 G. {; r; {- y
- #include <mach/irqs.h>
. k! b. P6 N; ]6 n8 H: O# r; { - #include <asm/hardware/edma.h>
5 h. }4 {- J- `, P8 c% y
4 T |* b3 H% j6 F) v4 R- #undef EDMA3_DEBUG4 C9 w5 Y1 ^ u' {+ j
- /*#define EDMA3_DEBUG*/. N$ C9 P$ M9 Y6 t" y6 u- D a
- b# @% S l; V+ a9 _4 [
- #ifdef EDMA3_DEBUG4 }; ], c9 K/ h$ p) I; L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' a1 G/ a& ?; [, C- ^- ^4 s - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" f4 i) z+ ?0 w; n1 B& @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" g8 u& x) j, [% j4 \2 ]: ~: ~
- #else
4 f1 h# Q( Z, v+ `0 p/ [ - #define DMA_PRINTK( x... )
1 Q3 @$ [) Q( U& U - #define DMA_FN_IN2 ?% L- Q# m2 j5 N% ]
- #define DMA_FN_OUT
8 s& J4 E+ r* j5 p7 ?3 G3 @ |& \ - #endif1 V& J$ { E" k. _; S
c# O3 }; a3 D+ \* r+ R. d- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 E& P/ w- m5 n/ b% K& w
- #define STATIC_SHIFT 36 {, T# s8 B8 |) |: n6 O, s
- #define TCINTEN_SHIFT 20
/ {8 @; W# O N - #define ITCINTEN_SHIFT 21
- J# g- t! _: `3 v4 H - #define TCCHEN_SHIFT 22
+ B* C8 ]/ Y! U- p# Z) G - #define ITCCHEN_SHIFT 23
9 q2 G& u9 R6 U- m; L - - m" C! }& c/ t! T7 t' @
- static volatile int irqraised1 = 0;
1 [+ j3 h Z: [; X" I: P# X4 m - static volatile int irqraised2 = 0;
% }2 i* w; w1 I% \+ X* {- t - + {% v' Y' h" Q W. M6 ~( u! w
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ C0 r' n& z5 _ q7 X1 Z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( S! r) u* u6 k: B, M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( p4 O. @7 o! h' r - , f. O# E; }0 O/ r5 W
- dma_addr_t dmaphyssrc1 = 0;
2 N! l5 n! ]8 x" h - dma_addr_t dmaphyssrc2 = 0;
" E) Q! l. K: q* O! Q/ M3 Y - dma_addr_t dmaphysdest1 = 0;
" ?6 K5 H# q" t" s6 h4 ? - dma_addr_t dmaphysdest2 = 0;
, S& S& F, Z. ], P- T ]; ~ - 0 V" |3 E/ ^& _ F6 U* S0 W# w
- char *dmabufsrc1 = NULL;6 o" K6 P. N" X
- char *dmabufsrc2 = NULL;
* i {( ~( N# ~. u - char *dmabufdest1 = NULL;
9 Y0 _/ {4 N! k* ?0 _2 [ - char *dmabufdest2 = NULL;# e$ a O- ?+ J
$ z3 k. S" H# m/ C1 e& u- static int acnt = 512;
: K2 \! j- p7 d& p, n% _ - static int bcnt = 8;
4 t) X( K( T7 ~/ b9 n - static int ccnt = 8;6 m3 H# f$ F% M. t, j
- 7 Q9 o. i! e( {. A
- module_param(acnt, int, S_IRUGO);
& l$ c. q$ j; w# a. n5 m - module_param(bcnt, int, S_IRUGO);
) |5 m0 X1 R `( H( n7 ]9 F7 u - module_param(ccnt, int, S_IRUGO);
复制代码
/ Y' `; F/ s* H, ~: Z( V$ ?: U6 {
- E J* _- |* `& y4 c+ e 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ O, X0 C3 o" N* Z! j* K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& g, l2 f4 g8 c# _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; B6 a* G' H0 _: \3 g% n$ r: d9 M
) N6 }7 g/ k* ~, @' O: _
|
|