|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. ^; z: u! ^' k3 g. G/ t- [code]EDMA sample test application
" z: T. K$ B# H Q, j2 P# w - /*) K. }" m5 X, d
- * edma_test.c
; ]( M$ ^4 L, R - *- h9 Q( f; t( } Q; `) w
- * brief EDMA3 Test Application/ _( {/ a B, e! E% l! c2 v
- *$ H3 B" k* y" j
- * This file contains EDMA3 Test code., f! d; k% J6 {
- *
4 R% c' Y/ y1 ]3 {) l! l- O* w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 c' b0 m& w3 m' n+ }( | - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- }+ U8 q' x8 U; z2 i1 F - * TO CHANGE.
# W5 b# s W+ x& P# i" d6 Y$ Y' S - *
1 x0 y; u7 z4 c; @- N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 s' l+ i$ ^ ?+ N - *+ v% ~5 {1 V% r/ y+ R5 K! L
- * This program is free software; you can redistribute it and/or
# X5 j7 i# R8 l. d4 C - * modify it under the terms of the GNU General Public License as
2 O4 p2 ]) V' M - * published by the Free Software Foundation version 2.
0 L5 p( M b; {" @/ D - *
( S$ A* ~' T2 I7 g% {; G+ F+ W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 g% l3 ~' ^8 B) c/ J - * kind, whether express or implied; without even the implied warranty
3 N0 i* W3 X' Y2 i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the C0 C: v L; v1 i4 s( ~
- * GNU General Public License for more details.
' w' m$ \7 j2 B o& r- K - */
8 ]0 G5 v: y1 i! |* C- {
* r0 B5 M9 N O) J) ?& F+ z Q2 J$ B- #include <linux/module.h>& }0 m! g( ^1 g$ ` N. H4 {7 E9 j
- #include <linux/init.h>4 G p% r% \( p$ h' ^1 I- T
- #include <linux/errno.h>
& _2 b: M8 S' u$ K7 a - #include <linux/types.h>
2 [4 E/ K) {5 F. ^* Y - #include <linux/interrupt.h>6 Z2 H5 X$ u. y2 S4 x F k
- #include <asm/io.h>
4 x- m' O. U" |7 \3 x - #include <linux/moduleparam.h>0 o! a+ `. Q' o0 }# w* f4 V
- #include <linux/sysctl.h>% F. t3 I& m2 D% j% Q* F/ u/ g. X
- #include <linux/mm.h>1 k1 J. W8 L/ |( l# h3 W
- #include <linux/dma-mapping.h>& s/ L3 A' d: t+ `7 Y/ d& i, s% U
. n t& o q$ y! r; z) B# B- #include <mach/memory.h>; D! T5 d+ F: b) f4 H
- #include <mach/hardware.h>
0 [, v8 l* k7 i% l3 q& v) v9 R, c - #include <mach/irqs.h>& ^8 b1 Y# }; q) w$ T+ ]
- #include <asm/hardware/edma.h>
4 X9 q v5 G/ b
' i* c8 @' e: v( v( _- #undef EDMA3_DEBUG. j+ S/ }. w* n: z
- /*#define EDMA3_DEBUG*/
, ^% h7 b1 L7 m& t6 ^$ d - - N4 G9 Y S, e' Y
- #ifdef EDMA3_DEBUG
! S( _7 b" o% Z: T - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ u0 W: B G. k9 n! J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 @( o4 K3 E r- F: K: T8 e, r - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 a: N& j- J& ]$ J
- #else! H1 q3 P# a. @1 y
- #define DMA_PRINTK( x... )
; e) l9 h- @% w$ @7 z5 ~ - #define DMA_FN_IN4 g Q/ L9 H2 m% k# k# U1 o& ~3 f
- #define DMA_FN_OUT
( a$ m! J% ]+ g! k' _ - #endif' q6 i' L7 q. g q
8 O3 ^ \, o% ]5 V' D7 n7 k- #define MAX_DMA_TRANSFER_IN_BYTES (32768), ~, D' R# Z- e9 c ]# W. c" m# M
- #define STATIC_SHIFT 3
2 P: ~/ _3 b, N' o - #define TCINTEN_SHIFT 202 {* i* p) I8 q8 N
- #define ITCINTEN_SHIFT 21$ M6 H: g. e- N, x% a! k
- #define TCCHEN_SHIFT 22
0 `5 W, @" @7 s - #define ITCCHEN_SHIFT 23
, e8 g( j$ x) V* e; D/ Z' J
) Q2 X! ~9 S+ @ B7 o1 u- static volatile int irqraised1 = 0;
) _2 p- C9 [# n0 s6 O8 m - static volatile int irqraised2 = 0;% n1 u3 I# _* I) _
- ' W7 B) i) K4 m3 ]
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! Z! p9 G3 y' L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 }1 E! D; k. E2 u9 Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 E c' }3 G) `: x
6 b- e% b, T' T7 h3 V7 }- dma_addr_t dmaphyssrc1 = 0;
) N7 R2 x8 K% i' f - dma_addr_t dmaphyssrc2 = 0;
4 \" q' k7 K" \& X! p. h# Z - dma_addr_t dmaphysdest1 = 0;
* z2 h+ I* q/ d: I - dma_addr_t dmaphysdest2 = 0;" [5 }2 h7 L: g# c
- : e* |9 J3 ^! P5 e; `+ ~
- char *dmabufsrc1 = NULL;
@% I8 C; H0 O" D5 [% F q - char *dmabufsrc2 = NULL;
* y" u0 U8 \+ `+ s/ ?# Z - char *dmabufdest1 = NULL;2 q6 K& J0 J" o V. ?8 C! g
- char *dmabufdest2 = NULL;
" l9 M% G, `5 L9 V
5 O: C6 h9 \4 h7 ~% W8 F- static int acnt = 512;6 {7 h M I7 y2 Y( z% ~; P- U& n
- static int bcnt = 8;
9 X4 r- i: ~, s1 Y% A# W - static int ccnt = 8;. I `9 c- B5 k' |
9 i3 O Q4 b- _1 b- module_param(acnt, int, S_IRUGO);1 j! X0 Y6 b$ L7 v- Q+ h: M
- module_param(bcnt, int, S_IRUGO);/ c2 P* W; z+ R$ s! C9 V5 c% m4 \- `6 G
- module_param(ccnt, int, S_IRUGO);
复制代码
$ J! [/ c: b7 s+ e V( P- B* v; N9 f9 A/ a* r- x5 |8 \
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- n' U# ?+ s% ^* v2 E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 w2 s. H5 t6 K8 w& w 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- o# r/ n/ u5 \ H* [+ z- ^
# C/ u1 o& Y* @- T8 z
% X$ J& @$ f0 ^/ w! p9 Y5 d' {; g& v3 G |
|