|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
S7 b$ F: t D- [code]EDMA sample test application7 J- m2 d$ u% P3 Y$ L
- /*
7 ~( l7 R, J% ]4 j- e3 D - * edma_test.c
; \+ s0 p% w! U# c - *
% [+ s" j9 N- i7 Y$ c. H - * brief EDMA3 Test Application
?" z0 }" ~( @* x9 d - ** g6 u* } d6 \$ e" A! o
- * This file contains EDMA3 Test code.
# H4 x9 M* E: k7 o4 \6 M - *: n: h0 Z6 }, W& f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. I5 t8 x! w& y/ \
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ u6 Y% R4 Y3 ~- x& ? ~
- * TO CHANGE.
& J& p6 V; U0 {4 D4 r2 Z - *" ^5 k& N# C( }( y7 s% s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* @, \2 G7 d c3 R, d- O1 c m - *
" x. P. n9 l% u - * This program is free software; you can redistribute it and/or
' P9 X H) @' y, y; s1 }- C - * modify it under the terms of the GNU General Public License as
( F0 |, H3 n4 g. N Q - * published by the Free Software Foundation version 2.
3 E0 f% X3 g* {- `/ u9 ? - *
' l) I$ H: K( e! ~# ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" u, S' E; E& h
- * kind, whether express or implied; without even the implied warranty
/ k& J. u0 ]/ I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: _8 M: |8 ?4 | r* s+ S
- * GNU General Public License for more details.0 I0 `" A3 s; z0 F: l) S
- */
. U7 a4 ~6 O5 ^6 l* a, Q T
( ^& r3 c$ j- C: y- #include <linux/module.h>
5 F V, M5 O4 g - #include <linux/init.h>' v" E W( N- o* ] ]
- #include <linux/errno.h>
) G( p/ U1 I) Q2 O. k& ~4 ] - #include <linux/types.h>* f- R- y6 j0 W8 |2 |' Q
- #include <linux/interrupt.h>8 H1 p P* h- [/ Y; q) @# d
- #include <asm/io.h>
7 G) E- J% u9 U, K8 v - #include <linux/moduleparam.h>
4 @9 k/ ~3 C$ Z" g - #include <linux/sysctl.h>: N, ^! ]0 U' J, {6 c
- #include <linux/mm.h>
+ u& S# P0 i" I9 u4 I5 R& h - #include <linux/dma-mapping.h>2 _ Y( T- U6 c6 S2 ]
- ( X' \* ^3 Y) S% P. j
- #include <mach/memory.h>
$ J" _6 Q/ `, V* I8 {0 _ - #include <mach/hardware.h>8 b( M2 G$ R% r/ T
- #include <mach/irqs.h>
+ l1 M E" Q w5 w" L F - #include <asm/hardware/edma.h>
7 U: V u9 z5 z8 d X' j
! s1 `# H5 M) l. e+ U ?- #undef EDMA3_DEBUG' f( p( P( W% j: _2 ^7 |
- /*#define EDMA3_DEBUG*/
* q1 W. g" }+ g/ P0 B
+ l& I; Z0 s( y# M7 A' T% C& r- #ifdef EDMA3_DEBUG
% e; X) m8 g) ?' a9 ~& Z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& M6 s) M' R4 d% {8 U9 ]5 u$ W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ k( f; x7 L# X1 A' C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 T3 B+ @. n& J/ m2 D
- #else
5 F" r" g$ V) D! H# w - #define DMA_PRINTK( x... )
! g9 H+ ]& x4 M; [ - #define DMA_FN_IN
, e5 j/ N1 }6 ~( \& W2 A - #define DMA_FN_OUT
# q" e6 O4 l! H1 N8 V! ~* j/ v - #endif1 T% Z* D& f1 V9 P, t6 }
, C) s2 a9 B9 p' v* ^6 C! D9 `- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' U3 w6 c" S7 D; u - #define STATIC_SHIFT 3
$ ~( P1 h, u. X; m4 W" l+ N+ p - #define TCINTEN_SHIFT 20% R& M- a4 p% m, ^
- #define ITCINTEN_SHIFT 217 F8 b$ l* D7 X2 w4 i
- #define TCCHEN_SHIFT 22
/ h/ v4 K: \2 z - #define ITCCHEN_SHIFT 23
: S. q, ` d" s- J; r0 C; K - - I7 ~- @' L# ?! }
- static volatile int irqraised1 = 0;8 j j- U3 S9 F. R7 T
- static volatile int irqraised2 = 0;* P' J2 S" d0 T D/ B
- 0 I }. R3 w3 a9 C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: t% t- p- n i D9 Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# ]) N. c1 L& ?8 g5 i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 {; W7 E9 o2 a3 Z
; V4 _& N5 G( H8 [+ p! I- dma_addr_t dmaphyssrc1 = 0;
1 p& R9 P% P; ~% M4 M$ E; G - dma_addr_t dmaphyssrc2 = 0;
8 k7 H+ z) B; J# M) ] - dma_addr_t dmaphysdest1 = 0;$ T) d: C- K' Z& a2 {9 W& U
- dma_addr_t dmaphysdest2 = 0;6 }5 i! W9 u* L' R# z
- # H9 O% Q$ e% g
- char *dmabufsrc1 = NULL; h8 z) w9 K% y
- char *dmabufsrc2 = NULL;, m F6 e* d: p' X7 x! G
- char *dmabufdest1 = NULL;9 Z7 N" y, x" H; m: s' h9 R
- char *dmabufdest2 = NULL;
. N6 _3 y, E1 q+ [ - : D" q- X' ]; z
- static int acnt = 512;, W: R: _) k) k/ [8 Q& D5 o
- static int bcnt = 8;( v; G5 g; [0 m5 c7 b6 t
- static int ccnt = 8;
- k- v# b9 B6 }5 S: W" } - " K. A( q+ i. l( B {- i
- module_param(acnt, int, S_IRUGO);) F% u: ~ j9 v$ Q, U: N: r
- module_param(bcnt, int, S_IRUGO);
g6 E6 P% r7 p: w# F( c3 Q - module_param(ccnt, int, S_IRUGO);
复制代码 ! @6 e& O* e5 }
x8 o' N4 V9 K& g+ u" W6 L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 `) E6 W5 @ K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# {, H* F: P' {0 N4 N9 q ^' x6 o8 u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 Q2 ^5 a: S2 @5 S1 J, h
# L q( I* w8 i$ q5 n
) Y7 [3 t- `0 f/ X6 S# Y |
|