|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" e5 C8 g3 Y" a5 Y/ ~- [code]EDMA sample test application
7 P! T; c. ?; L - /*
: Q: O/ L/ m- K - * edma_test.c' u Y' o% H+ J3 J
- *
# u6 |) X. S) f2 A0 y - * brief EDMA3 Test Application" x1 {4 F" m9 Z+ @) X, i5 i
- *0 ?' K; O" M0 ^% ?4 k
- * This file contains EDMA3 Test code.' C! x1 H& s0 U% Z: G8 x2 L
- *1 M% R7 Z# ^. ?4 n* K* }7 y' i/ f: O
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ {2 h$ v; t3 e8 E( U: r7 T - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% E. i8 C7 N" t K9 [
- * TO CHANGE.
3 x( ] u# W; U- t- O% H - *
) g5 Q/ L$ S0 o) P* G+ [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 J/ a! i, T! g3 W3 b' c! |
- *
0 J1 d/ k$ S; |+ ` - * This program is free software; you can redistribute it and/or' s: J. Q2 L+ L3 u5 O2 \2 f
- * modify it under the terms of the GNU General Public License as
/ }) t( f8 @# i+ `1 f - * published by the Free Software Foundation version 2.
( N9 Q9 K* G$ J9 f7 x6 s( I; r# M - *" k. m5 C, C# D
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 l! v& \8 M9 @# Q$ g% g0 [/ U4 t0 f - * kind, whether express or implied; without even the implied warranty6 f4 i- {7 Q7 l1 n4 o
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; K/ M' o ~' h$ M) X
- * GNU General Public License for more details.
$ [* i: R6 P$ S/ f% g" I6 y - */1 l+ S+ N. l! `1 P* W/ M+ @ b+ K
# w, @, }6 M1 p; f1 @3 ? S/ d* V- #include <linux/module.h>
% ]% m" d4 X, v- Z9 O$ N ` - #include <linux/init.h>
4 m3 Z, w6 p, J) V. M. N) q- ? - #include <linux/errno.h>8 y1 r" q% |' t- @+ Z. O. U& M
- #include <linux/types.h>
+ k, J9 ~) @& z- H! E, t - #include <linux/interrupt.h>4 L/ j( Q H1 ^& ~, n+ s; V" U
- #include <asm/io.h>4 e; m9 D6 ?+ l2 h! N
- #include <linux/moduleparam.h>
. w1 m H) X9 Q) n! u' T3 h1 M- W, d - #include <linux/sysctl.h>& D; ^$ [: D9 l6 x
- #include <linux/mm.h>
* y7 D- ?3 W. ] - #include <linux/dma-mapping.h>/ {" y4 ` Z0 B% c4 {
- & |- J# a( [7 @- _, H0 T- f
- #include <mach/memory.h>
) K( X" g' D9 h; Z. z" Q - #include <mach/hardware.h>
. @' p( I3 }1 {3 m3 F - #include <mach/irqs.h>
+ v' m" C3 w! t& Z; z$ ]; | - #include <asm/hardware/edma.h>2 F0 H$ H8 d% z1 n; l& [6 d6 g/ }4 `
- 8 @; A+ k+ e3 a8 j; ^* k+ Z
- #undef EDMA3_DEBUG
1 u5 W+ y- r! n5 B - /*#define EDMA3_DEBUG*/
' ]$ {; ]4 D9 r1 ?* X0 R( L
+ [. _+ n& }- I2 @ q. I) o0 G+ C- #ifdef EDMA3_DEBUG& ]" I1 P: Z l# L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). v8 L# H7 t3 |# x- ?3 s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! y) S. j0 i$ f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 q" F: y# T4 H1 {% R) G/ B' Q; Q3 A4 R
- #else, a; ?) j" N. }: H* U
- #define DMA_PRINTK( x... )
6 Q# Z/ j: o1 j1 C; u0 `( A1 B6 R( g - #define DMA_FN_IN
* N* R' h7 H" z9 i - #define DMA_FN_OUT
+ f! s6 m [! G. i, b& h& q: L - #endif
6 c3 T! z9 P. ?. @4 |0 d
. O; o6 J. ^& W" h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* W" m4 v. P, `. G( C9 ^, e - #define STATIC_SHIFT 3. o6 j0 h' |, o; L% L
- #define TCINTEN_SHIFT 20% c0 h2 A7 p1 j9 O: Y& w; K& F/ z
- #define ITCINTEN_SHIFT 21
, n, O0 G0 T6 |! B: Q5 A - #define TCCHEN_SHIFT 22/ n: O0 c& ?+ @
- #define ITCCHEN_SHIFT 23
# E; \* z% Q- j - ; g& s5 \9 u- J* @
- static volatile int irqraised1 = 0;( T5 B6 t1 `4 e T
- static volatile int irqraised2 = 0;" C6 x; W: C8 \4 ~
7 l2 D/ n+ a7 ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; `+ W7 {- j: F& [$ p& H, \/ @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) p j, o% k1 k- |7 I" L; Y3 v
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* O1 l2 G% `! k8 b! }( X% Q
- * p3 g$ x/ C% Y7 R: U1 b: |
- dma_addr_t dmaphyssrc1 = 0;
! }. t' ?% K0 s& y9 h8 ]; i - dma_addr_t dmaphyssrc2 = 0;8 l! z/ h' z$ W* Z- F* ^
- dma_addr_t dmaphysdest1 = 0;$ N* W1 [, |& ?1 U
- dma_addr_t dmaphysdest2 = 0;2 |+ g7 W$ Y. _
- 8 J) r6 m4 X } g) b, e# |
- char *dmabufsrc1 = NULL;
3 A# B% B# c" S" _, d - char *dmabufsrc2 = NULL;
9 R4 R; V/ m, U8 d% ^ - char *dmabufdest1 = NULL;# d% Q2 `7 u9 F6 M0 E& K7 v! p
- char *dmabufdest2 = NULL;( |7 F" W+ b( V0 C
- 5 G, S6 ^; P& T4 m5 y
- static int acnt = 512;$ g, y/ O/ @; i! P2 i
- static int bcnt = 8;
& p" Q* f$ _& R% R [! c9 l% B1 i8 N2 e* G - static int ccnt = 8;( N0 l2 p# S" c
: ]. W- a8 l: }6 V! c K" R- module_param(acnt, int, S_IRUGO);
0 e* d$ e& j! ~9 l* b, x) h - module_param(bcnt, int, S_IRUGO);
- R, d) H9 N t0 Y! F - module_param(ccnt, int, S_IRUGO);
复制代码 7 A S: W0 H0 d; n/ q
) f& {! K7 B" T: t. O7 g) w 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 I% Q2 G, f7 d" S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, I' R: U; X& `3 {) {( V0 S5 w7 Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 R% I. R$ N! t2 Z4 z/ F+ ?* [5 B
$ F9 H5 u: v5 m1 Z" V8 e. z- I! l' p$ Y- R$ A* g* m9 C' s' ^3 j1 c
|
|