|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * D" w* \% z6 {: C7 Q5 R% y, E6 Z
- [code]EDMA sample test application
" z! C' Y) Y) Z; y, I - /*
2 j8 R2 ?. \3 L. e* N. F+ r- X- w5 P0 _ - * edma_test.c
4 q1 R# L/ b6 G+ M. ?; [$ j+ f8 f - *
' h. s% x: m) U4 U- u* J, I6 U1 @ Y+ n - * brief EDMA3 Test Application8 Q# u3 J- e3 y! L0 U; [: \
- *
* T D5 S- y5 Y% Y# A - * This file contains EDMA3 Test code.0 n$ U" h3 P0 W6 ~. ~
- *& S$ q* e$ O! ~( a. [5 z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, U Q1 k8 K( ^ f- ?. U( U. p
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 q/ |, x2 G4 T* C3 D3 z
- * TO CHANGE.+ u5 j- Y( y* z5 c
- *& g" j4 Y" }3 `* p% [0 x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# l( E& }2 I8 t7 W6 C
- *
2 c8 N+ x7 @7 X) }0 ~' f - * This program is free software; you can redistribute it and/or
! H; Y+ `5 Q9 E; Z6 \& m- r x - * modify it under the terms of the GNU General Public License as
1 e6 f ]# {2 ]' X% M# v - * published by the Free Software Foundation version 2.
; g* n* |) B+ `* L9 W - *1 s- }* R! m- E; n$ K& u- z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ q: M1 K: s; R - * kind, whether express or implied; without even the implied warranty
5 D/ Y: u9 { O - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 r! R- V- v% K3 m2 P$ z" G* @% x - * GNU General Public License for more details.9 _# S% E, A* ]: \
- */
8 G" w, `& `; p3 c. }# L$ P
: b# m- @8 {& p4 O2 b. T+ ?8 A- #include <linux/module.h>
$ ^2 v: @: v1 G8 q - #include <linux/init.h>! Y9 t3 V3 }! c6 Z1 f7 g# c
- #include <linux/errno.h>
, |$ d i( p$ I3 f - #include <linux/types.h>: y' R- X6 ~1 w$ D6 H: i: x
- #include <linux/interrupt.h>% h1 W6 k8 D4 t% S. ]7 r: i/ m0 p
- #include <asm/io.h>0 \* K) E5 W8 n7 _9 ]5 [% ?8 S
- #include <linux/moduleparam.h>8 H; c7 k% y5 _0 q
- #include <linux/sysctl.h>, n2 s( K. ~/ D
- #include <linux/mm.h>
' k& N2 W# f2 V z - #include <linux/dma-mapping.h>' Y: U$ I7 a! I3 \& J F
- 4 B4 n6 _: t9 i5 c- B/ H3 h6 D
- #include <mach/memory.h>2 H# v5 d8 U2 V9 w$ V
- #include <mach/hardware.h>! _" H8 e+ \5 R. Q. y
- #include <mach/irqs.h>! o& o4 R* r/ O. A. O; y
- #include <asm/hardware/edma.h>
; g0 ?0 Z, h; b/ h - : l5 g0 ^6 T/ K+ S5 z+ E: }
- #undef EDMA3_DEBUG( F8 d c7 L0 d- ?8 F+ m1 c# }
- /*#define EDMA3_DEBUG*/
7 }# }8 o; a. @2 @6 `6 w4 z0 L1 L$ G
* f" ]2 Y7 p4 W- r6 H- #ifdef EDMA3_DEBUG) B3 y D* Q5 B$ I# ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); O- N0 ^, o2 f2 u' X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 l& o6 A0 ~$ J! ]% h4 N
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) |. d) J4 P* D - #else
6 u' g) V5 A7 c7 M - #define DMA_PRINTK( x... )
3 {' e+ | ^7 } u - #define DMA_FN_IN
) J; a8 V& I5 c6 W# h# M. U' Q - #define DMA_FN_OUT
2 l" U/ V& I7 j2 ~ - #endif
1 e8 _0 L- y$ j' q+ ^9 r3 p m - + M8 U9 G2 ` L7 W* V6 ]5 U
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ r3 p; k8 u4 _! S
- #define STATIC_SHIFT 3! i/ k0 s& j6 { N
- #define TCINTEN_SHIFT 20
/ A7 t* P4 O5 L4 V" e6 f7 N7 t - #define ITCINTEN_SHIFT 21% X. i& {* V; T d/ o* p+ m
- #define TCCHEN_SHIFT 22; H" q3 D* }: ?+ Q
- #define ITCCHEN_SHIFT 23
; F' H" b* ]2 j8 _5 m* H/ Y) v
4 I; \5 s1 I# b) ~5 M0 F- static volatile int irqraised1 = 0;/ m x3 c5 ~+ I1 B; A4 t9 A& S# r
- static volatile int irqraised2 = 0;
9 u4 t% {" u- h
+ p& M6 \6 Z! E. u: G% o& j- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); E" j" @% S( ~0 G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" x/ e( m! ?; x! x9 } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& j7 N) |$ J) F* c7 s; | W( d/ M
+ e* H) }- T# z+ t! j8 d; D. F- dma_addr_t dmaphyssrc1 = 0;
+ S5 O8 D l# v }' I - dma_addr_t dmaphyssrc2 = 0;
, {7 N7 C2 o; `/ X - dma_addr_t dmaphysdest1 = 0;
4 R: @$ x9 p% o7 l6 D0 { - dma_addr_t dmaphysdest2 = 0;8 e0 {& J: {9 \2 \, ~% [& J
- , P8 j& O, m* T; F! x0 w9 Z' J% j
- char *dmabufsrc1 = NULL;
" s3 P% P, C9 @ h: q" y4 Y - char *dmabufsrc2 = NULL;
0 U- _* p( y0 d* U - char *dmabufdest1 = NULL;
0 H1 f0 R: v' A( T7 Z) r; w - char *dmabufdest2 = NULL; q, \! l) u, Y# h
+ ^: u7 f* \5 i' v9 I- static int acnt = 512;1 A2 @. V) A7 _7 Q
- static int bcnt = 8;
, H2 k3 C8 L3 _1 z2 b2 E - static int ccnt = 8;9 U% H+ d8 E n; l& f
* J% X$ l& k( }: s- module_param(acnt, int, S_IRUGO);: j7 p7 d" J# f$ ~2 |7 a
- module_param(bcnt, int, S_IRUGO);. j* \$ s/ D$ ]5 x% J
- module_param(ccnt, int, S_IRUGO);
复制代码
# M! h& r, Z# ~" p
7 s$ m, {% C; c, U I: n Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( o' {6 i+ n( p; ^' a4 U& [( p
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 w4 ?# G- E& n. M; X. @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 c; V5 d A& G6 H) A- t
6 X. E- S0 N9 L: [5 K7 x# m
0 o8 k* a" N. f" z. n( P; o6 E3 Y/ g |
|