|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! d9 a- d3 v' H* f9 F
- [code]EDMA sample test application4 L% p9 @2 e, C
- /*
; d' }, t. d$ [9 Q. d - * edma_test.c
" a% i& W2 M8 y' @7 G Q) k' u - *
8 c# U' v9 U% b9 c- v - * brief EDMA3 Test Application
) R* d1 g, M& S5 p - *; j4 r& u) }( t) t% s1 ]. t
- * This file contains EDMA3 Test code. w+ w( L( ]4 W! _
- *
5 j# f7 r+ x4 k; I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 }1 L0 o y# k- k) V! v" s - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, z" y$ Z* N8 z* r+ p, k
- * TO CHANGE.* P- \0 Y' i( D6 c" U+ X" b* t
- *; z/ h4 L* }* o3 L5 W
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; u6 L8 }8 c/ G. Z# L
- *8 \# x9 `; l* L) z; |1 C
- * This program is free software; you can redistribute it and/or% P3 H" o7 w% D# W8 `* S. D! F* V
- * modify it under the terms of the GNU General Public License as- s/ D: `+ X8 ]! A7 B
- * published by the Free Software Foundation version 2.
- l0 c8 |( _$ [9 z0 e# Z - *
% Y! F( U G3 U2 e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 d% L, o; E5 E - * kind, whether express or implied; without even the implied warranty j1 @% v+ d( w# A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 P e4 e4 {8 E! U+ ~" q4 X - * GNU General Public License for more details.
& R. w4 {& b: ?. ^; A- ]5 S/ c - */7 j7 D% G0 B1 N% t+ G7 `6 e* Q
- 6 {* B* N' Y8 N+ V
- #include <linux/module.h>
) Y1 ?2 T. v$ V& f* [$ x) M - #include <linux/init.h>
6 k* _* r2 r) F) X' I6 u - #include <linux/errno.h>- ~" u& ~& I2 S9 r
- #include <linux/types.h>5 v q H6 F4 s# k! {% c
- #include <linux/interrupt.h>& t! B9 K9 m) V' g( v
- #include <asm/io.h>5 y; f, @& v+ _+ V
- #include <linux/moduleparam.h>; b: l) d% E' ^5 j
- #include <linux/sysctl.h>4 ^. F% G: ?) F0 h
- #include <linux/mm.h>! }+ i, O( m+ h# U+ t2 e2 c
- #include <linux/dma-mapping.h> a# d( [ m) E) j) I; g# m8 H* g4 w
- ; K6 Y+ M$ G( x& l) {
- #include <mach/memory.h>
! ~, n$ I- }1 Q* E - #include <mach/hardware.h>
* _; z7 ^6 f$ R6 ?) x2 f - #include <mach/irqs.h>
' T7 w: H$ K+ x/ M) K - #include <asm/hardware/edma.h>' z$ _. Z$ E8 T
`8 A v9 x# g3 s- #undef EDMA3_DEBUG* e! i- m1 z& r Q. v; q! l! D
- /*#define EDMA3_DEBUG*/
$ X% u6 v, {; k! B$ P: w' j - 4 E0 ~: D. l" G
- #ifdef EDMA3_DEBUG
$ C( d+ G- r9 c/ u$ |5 _/ U$ k A$ @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( W" Y9 {/ b. { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- g7 O: ]2 Y1 q, x6 O. H& r' J
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
H, V2 M( z2 T6 K8 _- q' F: ?5 s - #else
! e2 ]* I3 ^2 Z! I( D% T - #define DMA_PRINTK( x... )
/ v2 \! P8 t& i/ n - #define DMA_FN_IN
) w+ v6 a7 p* Q+ e( j j* M, t7 L - #define DMA_FN_OUT2 f2 v- B9 k( M5 @/ `# X% Z
- #endif
4 `& [( X5 U" Y
+ I: s3 J% t8 u6 J7 F+ o! O, U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- [: S9 T. d7 Q3 s1 A* c& K3 _" I" r8 y - #define STATIC_SHIFT 3
" V% w3 @* G2 k) v - #define TCINTEN_SHIFT 20( X& \$ k* ?( H# v
- #define ITCINTEN_SHIFT 21: G' W. ]- R' i. L: T p' n2 J. S
- #define TCCHEN_SHIFT 22
4 y; {+ T. ?9 S$ K4 |0 M* A - #define ITCCHEN_SHIFT 23
/ I& w8 j0 U4 v# r7 _ N - 1 p5 P' w) O5 }9 S+ z
- static volatile int irqraised1 = 0;. x+ q9 G0 ?' T- v7 T3 B" _. T
- static volatile int irqraised2 = 0;
: \$ Z# c3 g5 w* `/ a$ L# j - # j/ P# t+ } g: P$ l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 ]9 d- F7 Y' d9 i5 ^# Q [. A - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; k4 e I I, f g, P0 h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); v$ x, h- l" A$ Z: R
; G C, w5 Q7 K) a% ?* y/ [- dma_addr_t dmaphyssrc1 = 0;8 v) H$ N8 z9 P, t) `) y
- dma_addr_t dmaphyssrc2 = 0;
, M0 P+ [* W1 u, ^ ?! u9 C( f9 s - dma_addr_t dmaphysdest1 = 0; C2 L9 H) B( ^) o( N
- dma_addr_t dmaphysdest2 = 0;
! N6 _7 t$ l# C0 p( V* d% `
& w4 D0 @/ p: |7 `- j" h5 f6 @- char *dmabufsrc1 = NULL;
1 u8 P6 P. ?% r" f) U/ {2 w+ ~0 u0 D - char *dmabufsrc2 = NULL;0 w, i, ~9 Z" h) k9 g) |1 S( X
- char *dmabufdest1 = NULL;
: e$ g* j+ R& ^ - char *dmabufdest2 = NULL;
2 J5 ^+ h5 ~- H T" C) f1 C5 _1 ], ]
! ~4 a# Z: ^( C* F g3 c0 b- static int acnt = 512;" g) b, b, q! i/ F& Z" |
- static int bcnt = 8;
1 [- X2 _$ y' w/ [8 z - static int ccnt = 8;3 ?; v5 M2 v9 [- Y$ {' e0 G
- ' I/ j8 r- |- y( o5 M" g
- module_param(acnt, int, S_IRUGO);
8 w. L9 Q9 K/ D0 } - module_param(bcnt, int, S_IRUGO);
N$ C2 f7 `/ B+ N7 R" t+ j. l - module_param(ccnt, int, S_IRUGO);
复制代码 7 I4 s+ z. q; G; N" l
" _0 P& i% O8 j8 w1 l: }
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: z/ w$ Y6 ~; q% Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( x/ n) y r' N/ [% ^1 O6 Z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. G8 |) I( ]" @4 \; m" l, j: P4 { U. y' d
% e1 @) x( ?3 l
|
|