|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" M& r/ y- B5 e: _1 s% n0 @+ ^; L9 U- [code]EDMA sample test application3 H t0 H7 r6 y3 Q9 R2 j$ S
- /*
8 R" _8 N4 v# q2 h - * edma_test.c/ _# Y6 ^$ H s! i' o
- *
. @# H# N* \- [1 n6 {* O4 e - * brief EDMA3 Test Application& ^( b+ o! p# R7 v" h
- *
2 p* ?4 o3 Q. M" E% k5 f - * This file contains EDMA3 Test code.# B! S; q7 ?9 Z& g3 U
- *
' n5 {' o6 ?" S4 |8 \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ n" m" }; D- n; o2 h* \9 V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( k0 T% ?, e, `) t2 Y% [0 U0 i# l - * TO CHANGE.
. V1 J. {+ V8 \4 k+ Q9 X" o3 o7 v - *
( u8 o7 E7 k5 U5 K! Q# E - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 L# ]( E8 o; P$ O/ e; J
- * Z6 u5 _! L9 x; ~
- * This program is free software; you can redistribute it and/or
* z( F2 S( ~& j/ T - * modify it under the terms of the GNU General Public License as9 D3 n8 o+ @* m/ f# l) x* |
- * published by the Free Software Foundation version 2.3 f3 l2 a! [0 [$ O* _
- *' u' V* U) x7 z. A W) Z: k5 G+ |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any t% a6 a" e( W" M7 L6 [
- * kind, whether express or implied; without even the implied warranty
]. ]/ Z5 B/ v( L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# b: z' N3 h& z - * GNU General Public License for more details.3 M5 O7 g1 M8 | H4 ^
- */1 @8 J r% }: d* `3 f I
% B% C8 F" z9 w: u; M0 C- #include <linux/module.h>4 a( U3 ^: ]6 I' d" t( i
- #include <linux/init.h>
) R- [* N: M% m3 A5 m5 q - #include <linux/errno.h>1 y' e% s. X2 g6 G# ?) y
- #include <linux/types.h>
) E( j A- B, \% S2 P) }+ j - #include <linux/interrupt.h>
& I3 L; W6 h, J8 z! y - #include <asm/io.h>
, C" m. u0 I6 _1 t( I - #include <linux/moduleparam.h>
# {+ e" C" f8 F' D9 z: }2 _ - #include <linux/sysctl.h>& M( K g* A `- N
- #include <linux/mm.h>
; a x. n" b- x* a, T2 w! F - #include <linux/dma-mapping.h>
4 \' \/ L6 D/ C N0 J$ ~ - ( e& K5 d" Z2 E/ @
- #include <mach/memory.h>& P7 Q: ?5 \" |: [ d, {1 W5 Z
- #include <mach/hardware.h>
" C) L( ?5 Y M1 b) f# r/ L - #include <mach/irqs.h>) R0 p6 ~5 Q1 Z0 T. r
- #include <asm/hardware/edma.h>
. M0 S* O1 Y+ |$ Q; g
+ a" N4 ~0 g+ D& y6 C- #undef EDMA3_DEBUG
+ O* P- p, q9 H2 z# z - /*#define EDMA3_DEBUG*/: Y4 C4 `9 Z( |2 X* o
- 8 h8 H0 H- ^. h- V# l# h) B$ t: j
- #ifdef EDMA3_DEBUG
' c8 y, h3 }( G: G( w3 j; Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& O' s) T# h' I' d$ L* `& r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ S5 ~! O; v3 H8 S
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 u; e% \) X- N. c) t) S' J" ^2 d) w - #else
, ]3 m2 e3 Y# C0 F, O - #define DMA_PRINTK( x... )7 S3 S# q$ L. M6 f
- #define DMA_FN_IN
9 c/ c6 s5 x# F2 A2 Q - #define DMA_FN_OUT
9 L2 ?6 P( {; y+ X" r - #endif
8 G3 ]( r# @8 y) J! X - 0 v! [$ s7 G1 D3 O9 q ~3 q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 [5 A2 E, u8 [6 F" _/ {
- #define STATIC_SHIFT 3
$ V+ F' w. F+ M - #define TCINTEN_SHIFT 20
7 [% V6 t) I* P7 i, e( V - #define ITCINTEN_SHIFT 214 S9 P8 j7 x5 \9 W9 \1 ~+ u
- #define TCCHEN_SHIFT 22 H5 K% c( a! w" A+ ^
- #define ITCCHEN_SHIFT 23; x% [6 i* X1 @& C% H6 c
- 8 _$ g7 ~0 C1 `/ o2 q! S8 v
- static volatile int irqraised1 = 0;
! l3 @: ~; i( k! L- P - static volatile int irqraised2 = 0;! v! j$ `. {4 i1 a
- / L$ Z% ?4 R* f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 Z% ^2 L% A o1 [2 C; L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' B/ U0 L- ~. O2 z0 V6 U! Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 X: M% b/ p& W
- * J2 l& |5 K ~2 l7 D8 z# ^' h2 I
- dma_addr_t dmaphyssrc1 = 0;
7 J5 y; Q9 O# q: G5 @7 U - dma_addr_t dmaphyssrc2 = 0;
9 z0 w% B$ N0 m5 z# z - dma_addr_t dmaphysdest1 = 0;
3 `$ `3 A7 k- H% j" w, B) k: {4 n - dma_addr_t dmaphysdest2 = 0;8 o" A, x( u m, X @; `/ ~
3 U) V/ K* c0 G, _- char *dmabufsrc1 = NULL;
' m# M$ A; f- s - char *dmabufsrc2 = NULL;' F, k' w9 f& V8 X; f9 w
- char *dmabufdest1 = NULL;# _# A; |2 } o4 x9 f- l/ s! D1 A8 L8 H
- char *dmabufdest2 = NULL;
1 n+ @) r% a5 J# T: ^
: C7 m) O0 J7 e8 u% j- static int acnt = 512;! g; p! s) Z I) @% u
- static int bcnt = 8;$ V6 B" s: T+ E+ y( S; r: ~- [
- static int ccnt = 8; p9 x& S$ H, f, \3 ^) K
0 ]# }+ @: J# T0 F: I- g; ?' b- module_param(acnt, int, S_IRUGO);
* j8 r, |5 O) i: R8 V - module_param(bcnt, int, S_IRUGO);
3 X X/ K+ I3 M) D( a4 \& p - module_param(ccnt, int, S_IRUGO);
复制代码 / `) V8 K t2 c; ?; ]
( j% b! k; A v2 v' s+ H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ P, G" c+ X! a% R) ^- R5 Y5 Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 Q; |& ]2 ~ T& m* Q+ f
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' D- [$ [& T1 ~/ d+ W1 d
" \' e( k3 d, ~
: x4 r1 f" _- v |
|