|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 f. ]' L, F9 B H3 V- [code]EDMA sample test application
& G7 g5 @+ p, T' v6 R2 n9 X - /*; S+ J8 K+ S" ?3 q- ~1 n
- * edma_test.c& }5 J4 I8 e6 ]9 @: Q, _1 y' E
- *+ T. S& o5 |3 X
- * brief EDMA3 Test Application
* s! s& B G& {! G - *
: K0 Q+ h& l' F4 O, @ - * This file contains EDMA3 Test code.
8 r0 A% D; e6 f0 ^ - *6 y, C T8 ^; t/ v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 `4 C7 O% U1 O5 U8 ~0 W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 D$ X9 s6 C& d8 ] - * TO CHANGE.
' i/ J$ @& C6 t$ X) H, R' }* n - *
( C9 A! i( H' r! O4 g - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 J% U9 ~1 i$ v; R0 f; m
- *
& z9 d3 ]0 l7 h9 o5 e - * This program is free software; you can redistribute it and/or4 w* q) @% s5 T8 E s7 J7 @
- * modify it under the terms of the GNU General Public License as
8 C) [' \3 w$ q. P - * published by the Free Software Foundation version 2.0 G" o+ i' i% g
- *
# E- d! c$ q1 g3 t! M5 f: D6 x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" u% y/ T3 D7 n) T - * kind, whether express or implied; without even the implied warranty* Y% r, Y$ @& b. @, t9 t, T0 v2 R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: T$ }* J. x, z% l# X - * GNU General Public License for more details.& r0 ]' Q7 s: U1 V" l3 n$ w \
- */' t# F0 ] s/ j, ?8 A: K
- A% ]& P! C$ z0 M7 }
- #include <linux/module.h>
3 |0 L+ E7 P9 l% o- l - #include <linux/init.h>
4 a! p5 h$ C6 ` [ - #include <linux/errno.h>
o* e) ]3 C- G6 y2 p. X - #include <linux/types.h>( p# Z; A4 i7 r! ]: r
- #include <linux/interrupt.h>
* o1 c6 M( o- `/ d- w+ ~ - #include <asm/io.h>
9 c; L6 y. u, y9 o, r. a - #include <linux/moduleparam.h>
5 M) z7 y6 h$ p) s2 J% _0 q; } - #include <linux/sysctl.h>
- m+ Z! o$ \0 W0 `3 | I. | - #include <linux/mm.h>
" ?( p% R2 Q) _% f; S/ t8 E8 G - #include <linux/dma-mapping.h>2 F0 X3 m9 I! @% w' z
" f* [& P" a& T- #include <mach/memory.h>4 i3 C' |' w8 M$ n9 \ l
- #include <mach/hardware.h>
( J2 g9 D- o7 Z5 [7 { - #include <mach/irqs.h>
! u* [, V1 ^, P; B X3 E - #include <asm/hardware/edma.h>
4 ~! q5 y8 ?6 v5 K - 7 E+ J' ]- }; B5 m! D8 M
- #undef EDMA3_DEBUG) M- t+ M. P9 O. k$ l$ R+ `3 @
- /*#define EDMA3_DEBUG*/; Z& M- u' c2 k7 |& [
- ' a0 g1 e9 m, _; q9 c
- #ifdef EDMA3_DEBUG n" C" l3 j f. u
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) ~, `% M+ v8 E( ~. i4 L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# @- {" @) M; H C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( t @& Z& { M& s# O4 q" x0 T
- #else/ p8 y/ }$ K9 b$ b7 ~
- #define DMA_PRINTK( x... )
2 u! j8 y! }, ^( W0 s - #define DMA_FN_IN
F5 ^* w* ^3 a, T - #define DMA_FN_OUT
, f7 X6 a* M% k' W. P9 C - #endif
/ C3 A0 g! m) W; g
0 W. }' p+ `. @5 Z u- #define MAX_DMA_TRANSFER_IN_BYTES (32768): F+ o" w/ `: ?5 i. c
- #define STATIC_SHIFT 3% [- @- t9 J% c" p4 P6 @6 p
- #define TCINTEN_SHIFT 20
) ]; c* ?( Y) t7 \2 l, ~ - #define ITCINTEN_SHIFT 21
+ ? ^2 L2 K+ ^" [0 j0 p1 Q - #define TCCHEN_SHIFT 220 O i4 r5 e9 T- P9 O
- #define ITCCHEN_SHIFT 23
; ^+ x' B0 a3 S5 X% E6 s/ T( g+ A6 O5 |
3 ~1 Y% U# Y2 l: s- static volatile int irqraised1 = 0;
2 a* h( @2 P2 Y7 m - static volatile int irqraised2 = 0;
8 |; e: B8 a0 `' u6 [& q - " B" z3 A4 r) X4 Q" Z) `+ ~
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 I4 o3 s$ @! p0 C g - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' g% }; L& u j3 Y4 i. l8 W9 ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 A5 f6 b8 T- P$ u$ l: n6 X
d+ V4 s* F. C: e" ?8 u0 i! S: b; [- dma_addr_t dmaphyssrc1 = 0;; `& t5 ]+ w* r
- dma_addr_t dmaphyssrc2 = 0;' u( [$ a4 w' V- Z
- dma_addr_t dmaphysdest1 = 0;
% f% Q p9 `0 R - dma_addr_t dmaphysdest2 = 0;9 P W; ~# A; B6 a2 n
- / c9 @. M; z6 x. b. a8 H1 B" z
- char *dmabufsrc1 = NULL;
. z! I: A% s+ v9 C! r# s - char *dmabufsrc2 = NULL;1 j- V0 r6 k! \/ m
- char *dmabufdest1 = NULL;
V1 e- o) [$ @ - char *dmabufdest2 = NULL;
1 Y4 f8 y; s/ o% A9 M. ?
- a; M6 B+ D- ?& k1 p0 z- static int acnt = 512;( v4 u4 h1 o4 o" W' g. b
- static int bcnt = 8;
- O* @) G' a1 f4 j6 y/ X - static int ccnt = 8;) B$ Q2 y/ [' \% I# E
- 7 R! @8 L! u* l* H) D5 a% Y
- module_param(acnt, int, S_IRUGO);
, ]9 ~ v1 O2 T' @3 _4 `, L - module_param(bcnt, int, S_IRUGO);
/ Y6 m/ [* ^7 H; u, y. W+ I' @ - module_param(ccnt, int, S_IRUGO);
复制代码 3 E% I l: }8 R1 I5 f9 @) Q9 u
# X1 W, T6 ]& _3 f
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 W! V ~# q" z* V. W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) I8 k. u% R) f 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 H# r* h3 n7 K
+ F# i# A" F3 s4 _+ F, w2 Y% p- }; O" f( I) r
|
|