|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ i0 p: B% B9 @- [code]EDMA sample test application
' l! D0 `7 K' {+ \2 T" Q, a { - /*
1 W. C7 e5 j% Y V" `, J- Q9 D$ I - * edma_test.c7 d4 X G! T( B# Q5 S! w8 ~4 |5 j f
- *) X# t* n" Z1 `4 A: F
- * brief EDMA3 Test Application
) V/ s+ k. h4 l; _8 w8 q - ** g5 i7 H& d% m* u1 h; J8 S# H+ A
- * This file contains EDMA3 Test code.
% e, G- h4 L# J9 @2 U7 v* s/ j - *
{9 G7 J. y# L0 n1 ~! M; Z R3 t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ D: A0 \ [1 l8 r0 a* x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( C' C" i9 e6 v5 L" ~
- * TO CHANGE.
/ h& d$ M1 U6 n- p( x' V3 C - *
- `9 n! t/ x$ ?. s c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% A0 k" q$ I! K+ x/ j$ B
- *, a& |% ~1 f# U+ o5 c' I5 V
- * This program is free software; you can redistribute it and/or1 g; W; m8 s! O
- * modify it under the terms of the GNU General Public License as: C' p! v7 k4 H# Y$ z
- * published by the Free Software Foundation version 2., x5 Z% h/ S% U4 [
- *4 V& [5 a& j1 p* o- y7 V0 X
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& ]; L: g7 Z/ J
- * kind, whether express or implied; without even the implied warranty2 R" W: p. o) J( u
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; e; z2 |2 P2 L. `$ w* P
- * GNU General Public License for more details.
6 b) x# S; ?+ H; p' O% i* p$ } - */" A9 m3 M1 L% F: f: ]0 Z7 W/ K" q
3 J( L' b5 u, M+ l) w0 M0 H- #include <linux/module.h>1 e9 j: k) T! L+ `, p+ }: L/ p
- #include <linux/init.h>
/ r! X( g" u3 [6 T6 L- S. g - #include <linux/errno.h>. q% L# o6 J+ }& J0 N
- #include <linux/types.h>
" ]7 [3 F# R4 K! _ - #include <linux/interrupt.h>
9 P# H3 a. Q3 @7 Z# w) x4 n/ V - #include <asm/io.h>
3 Y* e0 [1 g) \9 L- z - #include <linux/moduleparam.h>* _- T1 P8 @0 G+ z
- #include <linux/sysctl.h>
( m5 H2 r) l* J" @# ~: N# s( ?: e - #include <linux/mm.h>
1 e, m7 ?1 V- Q q2 ~$ j - #include <linux/dma-mapping.h># p8 Y, K0 o3 Z0 ~4 w+ z
- ! r0 D/ M9 w. ~; Y% y; p, R& ?
- #include <mach/memory.h>1 c( x- H2 u9 S4 S! g& s) u& v& N N
- #include <mach/hardware.h>
8 j& R. ]! I/ N8 ~ - #include <mach/irqs.h>. F6 v6 } r$ K6 C8 O2 r, U
- #include <asm/hardware/edma.h>6 U0 |/ m7 i" S$ _9 [
- ^8 A) p+ X/ f: k9 q: Y
- #undef EDMA3_DEBUG( N* H3 j" r* r( i
- /*#define EDMA3_DEBUG*/* C. ~) U7 f. G8 G; r, B. n$ e
7 U- C- F6 W9 ^9 v' H# c- #ifdef EDMA3_DEBUG
3 K6 e' o0 M. @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 x6 Q# | z2 E/ |2 t9 A
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( H6 X6 ^6 Z: _2 c - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ f$ P9 E2 y( a' [' J! }. I2 |
- #else
: d- g6 c3 o6 n- a i { - #define DMA_PRINTK( x... ). I4 k( {/ @3 A6 B/ ?; Y7 O
- #define DMA_FN_IN
, h( H: R0 r& l$ B3 B. U0 c# ]' d - #define DMA_FN_OUT
. Z: Y! }4 ]6 u- i A0 m, c - #endif: O4 i) |+ W; w) W
$ z2 d% }4 Q7 j" _2 U" e5 m- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& z* a e1 ^- T: j0 ]2 v# m6 D - #define STATIC_SHIFT 3
# h/ }, m0 W6 D* g7 D - #define TCINTEN_SHIFT 202 E0 R; I1 {, S3 u. W
- #define ITCINTEN_SHIFT 21; ^, |. A7 B4 a0 ^
- #define TCCHEN_SHIFT 22' x' i @! c6 d5 V/ C
- #define ITCCHEN_SHIFT 23
/ B [: @% M! F% a, R+ f7 M - - n4 N l* J) [3 p4 F0 @0 A7 M
- static volatile int irqraised1 = 0;
, Y. y0 g# @* q+ r# O( {/ @, s - static volatile int irqraised2 = 0;
6 l! ~' }' F- S, \3 k- I( o& W
* ~/ H& k7 ~, S" \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ [+ m$ u. w# U8 \4 R* c
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ ^ k2 `5 s- A2 I- O& [& @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& e2 m% q$ Y, y# z" K5 w
) [! N; v+ ]7 f- dma_addr_t dmaphyssrc1 = 0;9 {- @$ Y. y# Y. t
- dma_addr_t dmaphyssrc2 = 0;2 J0 O8 L+ Y) G2 E0 r$ B
- dma_addr_t dmaphysdest1 = 0;$ H+ Q: r8 p! c1 U/ i
- dma_addr_t dmaphysdest2 = 0;/ ~! k" u5 z ~8 J
- 0 l- e. V# V Y; A' ^6 {0 q
- char *dmabufsrc1 = NULL;
6 a; }1 k5 M* g; R5 }2 @ - char *dmabufsrc2 = NULL;/ i4 }# [$ l+ D' I3 o
- char *dmabufdest1 = NULL;
& s% E: T% y, Y. P) w - char *dmabufdest2 = NULL;
3 F7 N1 a( M* T3 \) c3 i9 q1 V - ( a$ U7 {3 A5 f; R, S, V
- static int acnt = 512;
2 G! a- P' Y' \8 D* U - static int bcnt = 8;& i5 ~, Z) z7 P1 _2 }. O
- static int ccnt = 8;' u! H. c& V+ D! R; d% L
- + v. `: q0 o$ G3 H7 V0 f. {& o: a
- module_param(acnt, int, S_IRUGO);
& q {/ G: U7 [& K - module_param(bcnt, int, S_IRUGO);
1 O& H$ s) _4 C - module_param(ccnt, int, S_IRUGO);
复制代码 ; E! \ w6 Z% i: y
1 a P3 ], I# L) H+ a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 G3 P* v. H, F; m3 m0 marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ Q8 g0 x4 H; j2 g, \4 U 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! Y4 H4 y7 S3 j( m3 ]8 P! ?) n; I2 O# S! u8 `8 T Y' \" x
: H; i/ D& C! ~5 B2 G |
|