|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! Q* B, R4 L" O$ |( K% H k- [code]EDMA sample test application
, X; [' G& Q( {: }8 S( E3 B: e - /*
( N. ~$ t+ K# [, X# o - * edma_test.c/ G: \! D. [6 E) _
- */ }: d- F: P' A4 S% d
- * brief EDMA3 Test Application% e5 d$ _: x: V" P, D! N
- *
% b6 A0 L# W! B- o& R - * This file contains EDMA3 Test code.
9 G0 r2 t% t6 b6 Q0 S0 ]# z4 \: x - *
; L9 Q) B3 m. g! y* t2 l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 m7 S/ f/ }, q, b0 J
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! M; u$ o3 s7 _ - * TO CHANGE.
9 s- M9 u* |" y: _7 A! u - *
0 L; \1 `6 H6 P' J" O - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, ?0 E( y* h) A - *
3 t* `5 |4 O$ C. ~, a7 R8 T8 y5 u - * This program is free software; you can redistribute it and/or
# c) X5 ?- @% n% ] - * modify it under the terms of the GNU General Public License as
( f; g8 F8 G" `4 x; v/ K - * published by the Free Software Foundation version 2.& ~3 D8 E1 Q" i$ N
- *
' \4 n& P- a5 y0 j+ } - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 {% ^0 |1 F) N/ g: R% m$ c* e! h - * kind, whether express or implied; without even the implied warranty% R! T* Z9 o) _4 {! y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 b! e( a4 w+ t( {0 T
- * GNU General Public License for more details.
) i% i v' D* n) u5 x) a - */9 Y" h* d$ ^- Y
- / e3 g0 C' z6 C2 `3 H# Q- o
- #include <linux/module.h> t7 c' k2 B" s0 z( B' v
- #include <linux/init.h>
& n) u2 n4 W" y, N1 ~' a8 q. j& R - #include <linux/errno.h>
9 }5 P5 P% j8 {7 K$ H! v- r/ h% Y - #include <linux/types.h>: x5 B7 U/ n( R& n6 K: L7 t" n
- #include <linux/interrupt.h># O# {- Y3 a, n! ?9 J. @/ S
- #include <asm/io.h>
2 r+ U1 W1 A c3 O - #include <linux/moduleparam.h> [8 c; X! [- D1 N
- #include <linux/sysctl.h>
4 ^" j. P% v& o; b7 B/ D - #include <linux/mm.h>
9 R* D, e6 [) `# N - #include <linux/dma-mapping.h>/ h8 _$ O% j2 e2 B7 r& h
- ' v1 J* P, `1 i" c% t" ] }& i
- #include <mach/memory.h>
! e, C( J. \+ T9 `& R* V) _$ B) E - #include <mach/hardware.h>* ~) m# O1 c9 [5 V4 I
- #include <mach/irqs.h>
1 y+ a1 x/ x* q# m" S, B# ?, j - #include <asm/hardware/edma.h>
8 [( }( l- Z3 o8 _- m
9 D) V: ~9 ]; M# |- {- #undef EDMA3_DEBUG
% B" p4 S7 E$ @/ c2 h) E - /*#define EDMA3_DEBUG*/
6 Q+ D& H# {6 Y( _ - # j6 ` z0 F; J& z% ?( B
- #ifdef EDMA3_DEBUG
y- O1 ]9 Q8 p3 S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! Z. q3 I0 n1 ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 n# T! A- q2 [+ S, M5 O' X6 e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 |* s: p8 S) w6 e
- #else0 D/ k0 E& |* H2 U
- #define DMA_PRINTK( x... )
1 j d1 \. E' h0 r$ J - #define DMA_FN_IN0 z3 v$ g% h" i$ o
- #define DMA_FN_OUT" G3 L6 w! M3 [3 ?7 C6 Z7 E0 ?( [
- #endif
( m/ T" _- l9 ~: a- I, [0 C
+ k X/ e0 s% q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ M4 O% x: o$ \ T - #define STATIC_SHIFT 32 l3 o- j4 R* K* r) g
- #define TCINTEN_SHIFT 20! F) D, z3 \, B' [9 Y; a6 M( a
- #define ITCINTEN_SHIFT 217 U4 Z- g" H* X; D
- #define TCCHEN_SHIFT 22
: \& x& K' O1 v$ ^ - #define ITCCHEN_SHIFT 23
. ?, ?4 S9 g. N
0 G/ h/ \% j1 R+ w- static volatile int irqraised1 = 0;
* i# g1 M7 l$ ]( H, N L - static volatile int irqraised2 = 0;) m2 y) Q2 B" S
- K* s- K0 ^$ P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" V- _% A) r$ A* ]" E: ?/ ^5 }
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! x' N' F9 g) K9 ?2 J$ J
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% |8 R7 g9 h4 X+ k1 o) \- @% a S - ; ~% V' P( J( O; M& U0 S
- dma_addr_t dmaphyssrc1 = 0;
/ f, u3 x' T, J( b - dma_addr_t dmaphyssrc2 = 0;
: }9 R1 X& O1 v0 S8 y) P - dma_addr_t dmaphysdest1 = 0;4 L1 ], r3 P/ b2 f
- dma_addr_t dmaphysdest2 = 0;
( A% g9 l2 j: x0 x% @6 c2 j4 W - ; M6 f' h6 @0 D p9 F
- char *dmabufsrc1 = NULL;9 z5 [) D; I, G: ]
- char *dmabufsrc2 = NULL;2 l5 v" C# K4 p: r% c% @
- char *dmabufdest1 = NULL;
. R, i( R) b' n) S0 ] - char *dmabufdest2 = NULL;# e3 r1 m0 s. K) w# Z
- : S' g9 `4 u( s3 r. m) \
- static int acnt = 512;
# |% P7 Z7 G# H, r% F. M& E - static int bcnt = 8;3 G. e$ R( V% L
- static int ccnt = 8;4 ]3 y2 f" Y/ U& I5 ~" {5 `6 o- E) D
. Q8 m0 F/ l4 Y |- module_param(acnt, int, S_IRUGO);
1 p6 ~" S4 d! M0 `. x. g; y - module_param(bcnt, int, S_IRUGO);' j" @; Q( Q6 `& d! N4 y
- module_param(ccnt, int, S_IRUGO);
复制代码 ! T( r, M7 K7 x7 e, V: n- Q- F2 N
. C/ ^. Q5 h+ m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! f& t( C0 @0 t- o5 F* u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 V o. f2 i9 O0 L6 Z2 D0 L- i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- q5 O: u, x6 a4 b" R, ?
k) {1 U. h) o. a
' S4 |& _% h9 r7 L, U* G |
|