|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 |& k1 q; {6 x9 }! L0 A2 H- [code]EDMA sample test application! e; E, D- |- `1 | T/ ]4 Q$ o
- /*
1 ~6 E, [' r: t) h. U9 Z7 Q - * edma_test.c; J8 @( i' ^2 w% b
- *1 J# k$ s# T% B7 C
- * brief EDMA3 Test Application, _; ? e/ i- C0 M
- *7 N% y' e) N6 U c" Q4 ?
- * This file contains EDMA3 Test code.0 S! q9 Y2 o; }
- *5 p# ~+ t- w' G( e- t7 \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) W) m- T) `. {6 [; m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# V; V* L/ W! y6 ` |
- * TO CHANGE.
2 b' ~% u9 a' Y8 l& W: G( c - *
2 J2 [% u% _4 I2 J/ e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 N4 P. S) |+ H8 k6 C9 M - *. }: X& |! I, d( i
- * This program is free software; you can redistribute it and/or
' k% x+ y& F( H+ G) {) ^ - * modify it under the terms of the GNU General Public License as
( S9 u! Z0 D9 h. m3 m5 Z - * published by the Free Software Foundation version 2.+ t; w6 o) ]$ N* S2 B
- *
7 u* r8 Z* a, R2 m8 H8 b, W6 [5 Z9 H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' W& Q. G M5 z
- * kind, whether express or implied; without even the implied warranty
/ h( O$ C& p7 K# Q0 Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# h. Z7 E* s: j+ G a0 A - * GNU General Public License for more details.
X0 j8 M; N+ A1 c$ R7 n* G - */
. r8 r$ D/ w$ v% g - 8 x0 Y5 `% ~! M& @
- #include <linux/module.h># w0 w q8 s% ]: ]( r
- #include <linux/init.h>
* E" r2 w: k9 k+ Y! c, q - #include <linux/errno.h>
( S# b7 B! T0 ^1 \0 v9 b# x - #include <linux/types.h># m- Q/ V8 K" m& C; h
- #include <linux/interrupt.h>
7 G- q9 Z% x* z N - #include <asm/io.h>" E7 D2 u5 W7 L# W. I7 g
- #include <linux/moduleparam.h>+ D1 k5 r3 f) \
- #include <linux/sysctl.h>
# V5 B6 D9 } c2 j' G& Y) X - #include <linux/mm.h>" b2 V; ]# I; V* ^* ?
- #include <linux/dma-mapping.h>
2 S, `1 I& ~- {: ?6 x! O, E% R- @) }
( p# W5 l2 L4 C- #include <mach/memory.h>$ J4 `: j3 O# l7 s
- #include <mach/hardware.h>
9 {8 s# g7 h* B2 V: ]9 j5 [ - #include <mach/irqs.h>7 ?2 e" ?5 \* v8 N$ S
- #include <asm/hardware/edma.h>
$ |9 @( }9 n2 c6 Z- ^. I$ v a
% w& Y* U; c9 t3 d- #undef EDMA3_DEBUG7 Y7 ], B0 \+ p8 M
- /*#define EDMA3_DEBUG*/
4 ^2 @, h, s" c- b - " [4 t$ ]) J9 ^; r* A J `9 Z4 G+ X
- #ifdef EDMA3_DEBUG
( }- k$ c. i9 m7 m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 \+ n8 x( x' B7 g F
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 I7 ~1 H" @+ P: S' P7 \- a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" h) U) r% @/ Q3 G+ D - #else
. T7 F0 C) ` ~; [5 W, o$ F - #define DMA_PRINTK( x... )
0 _' O+ @/ E6 j( w - #define DMA_FN_IN2 X# n( w) _( {8 F( g( V3 `$ C; H
- #define DMA_FN_OUT
$ M. O o* Y' m( ], h3 g - #endif1 F8 e& ]" X/ `
! I' L7 c4 w. N) `4 e! u! F- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 n& Z2 ]) D. W# l/ K" r: F - #define STATIC_SHIFT 3
+ ]) ?% v8 k' V$ t! u - #define TCINTEN_SHIFT 201 Z; d% t9 d n" M. F- a" i% \
- #define ITCINTEN_SHIFT 211 t, A$ t* n1 a# }9 k
- #define TCCHEN_SHIFT 229 X2 r) ?4 D+ f$ P M
- #define ITCCHEN_SHIFT 23
% M$ O' j8 D/ n4 y5 O( q i
G1 r$ b u) P- static volatile int irqraised1 = 0;. g; r- H! C2 i5 J
- static volatile int irqraised2 = 0;
! Q# H. `3 Z$ |* M: O! K; }! g
3 G$ G. @" Q! ?4 x7 b& Q2 W- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) h2 |, U% H+ Z1 L I d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# R9 B/ \5 `) m& Z" b$ }. q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& g; H9 r. _5 x( S* z$ D
/ D9 s F Y9 U- g: C( g- dma_addr_t dmaphyssrc1 = 0;- T' `4 O- D/ F4 E/ v
- dma_addr_t dmaphyssrc2 = 0;, q$ {+ f# w9 ^3 q5 z# N
- dma_addr_t dmaphysdest1 = 0;
* R4 F2 `' L, o1 w: C0 V - dma_addr_t dmaphysdest2 = 0;7 F0 v3 E5 @& g: C5 a
- 2 D* q/ b$ i+ G6 Y% U
- char *dmabufsrc1 = NULL;7 E" n. c9 \) w+ M0 x
- char *dmabufsrc2 = NULL;
- _9 s, o. A L+ [- ]2 X4 C" o, V - char *dmabufdest1 = NULL;+ s3 E' }9 @6 P v: l- ?3 H6 m3 D
- char *dmabufdest2 = NULL;0 r8 u8 e' l7 x) g
' R5 a* q, J* B9 C; U/ n3 K. W- static int acnt = 512;
+ o. C- l; k& ], [9 V9 | - static int bcnt = 8;: X5 c4 t" v/ `4 j
- static int ccnt = 8;
" r+ a/ A- ?, E* i3 ^ - 7 d$ {3 C7 c7 W ~" R5 ~2 M9 M
- module_param(acnt, int, S_IRUGO);, @ Q" b0 Z/ ]( [
- module_param(bcnt, int, S_IRUGO);
# m" _( j f* `* |1 k0 r& Q - module_param(ccnt, int, S_IRUGO);
复制代码 3 n# f$ u% {; f" b
9 x. @2 x4 K/ l$ I+ b
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; F7 y0 |5 A7 t8 v, m3 ]+ Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) y* d% }$ }8 ]9 c1 A& G' ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ ]) P+ j' j6 x# i
1 i9 x6 S) [+ O8 f. p
6 i, V* o5 O& l- V( b
|
|