|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & v) v% r9 N4 I. ]$ k
- [code]EDMA sample test application+ R/ d) Y9 _7 q3 H
- /*
* l0 ~1 H/ x" {, Q" }3 d - * edma_test.c
' T- t2 | C" e5 @3 ~' G - *
" u& c1 O& X& K. c - * brief EDMA3 Test Application( I/ Y' F/ ?$ g9 _5 Y
- *
5 k) P6 g# N2 A5 x( T. L1 d - * This file contains EDMA3 Test code.
2 q. t4 o% V {& Z; p6 d - ** D; g, I+ j5 Q6 C: [4 s7 A% I9 S3 G1 J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# q! v- f& `; l# Q! q" Z. Z* F - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 V: f# O% S* T. Y" D1 K0 @
- * TO CHANGE.7 ]& `5 }% c& Z) u
- *: ]# S* t3 c0 [7 D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; C+ e! @$ A# ^- T5 o+ `" v
- *
9 p4 n$ a1 |- R9 a6 u - * This program is free software; you can redistribute it and/or
! `- V+ c- c, j - * modify it under the terms of the GNU General Public License as
% E9 R- g9 w* w' n- @7 d3 E - * published by the Free Software Foundation version 2." Q6 z- S1 j/ |. W% a. S4 c' @
- *! b- U+ N7 {" ^# C0 X0 P0 D. P, \0 J3 H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- M; H& Q3 |! s4 g9 c$ o
- * kind, whether express or implied; without even the implied warranty k9 D' I$ y4 J" G3 p3 {2 k9 M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 X6 L# J# J$ V0 o& ]- M
- * GNU General Public License for more details.
( T! X# B$ D2 Y' [" t - */
2 ?% s) |) z2 n; d" ^! f
2 |, Y- [8 D1 L$ c h- #include <linux/module.h>
1 L+ I' O2 y+ ` - #include <linux/init.h>
& R4 [8 Y5 o! F9 W2 Y - #include <linux/errno.h>8 f) I; u7 t3 [! `' {
- #include <linux/types.h>. j- M4 M( W, K& _8 k
- #include <linux/interrupt.h>1 @ Z. X; T6 Q- R: g' ~
- #include <asm/io.h>3 X X2 N- B1 x- ?7 q! J0 ^( K3 L( @
- #include <linux/moduleparam.h>
/ T9 ~" k8 k" P, [5 R- m - #include <linux/sysctl.h>
" V) l% k) @ \: c5 h- t - #include <linux/mm.h>9 l& Q! A# u# k4 P4 z( Y
- #include <linux/dma-mapping.h>
4 Z, u7 y6 G: K3 L) D7 c
1 y7 G( h9 [. _9 ~- #include <mach/memory.h>2 s6 l3 e+ Z# g/ ]; ^! ]# E3 G
- #include <mach/hardware.h># H! D% n0 ]. ^( e' `, P
- #include <mach/irqs.h>. E5 F& [6 l9 h5 M: w2 C1 [
- #include <asm/hardware/edma.h>
5 x1 O' ~ |, u - 9 V n( M: `) u4 o
- #undef EDMA3_DEBUG) t5 k( s5 H* Q P- b
- /*#define EDMA3_DEBUG*/
) `/ B# Y# a4 R, B2 m0 _# B
" K5 |9 ?" Z& i8 t2 d/ z- #ifdef EDMA3_DEBUG
% ?: v% n# ^+ \' u' I - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 n/ {8 e) d V! j8 ]) E, z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ W+ M& U. S5 e2 c7 ~* T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ g7 X2 \* u0 c. C - #else
( o. N# x% d, e5 ?! A5 b3 v; { - #define DMA_PRINTK( x... )5 D5 h# R# ~+ b! p# t4 j6 j
- #define DMA_FN_IN+ g! f0 x5 O: }% G
- #define DMA_FN_OUT
6 |& o" I# ]3 F1 [' u/ S3 p5 o - #endif
/ n; p) b* o6 y. e% y& n - Z4 p3 @6 N* Y: ~: I4 @% F
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 _6 }8 x% w9 `
- #define STATIC_SHIFT 3: p( T$ z( F. T5 ~; R& \; D/ \! a
- #define TCINTEN_SHIFT 204 p8 ?. k% g3 K( C" T( I* R
- #define ITCINTEN_SHIFT 21! q( r- m& m/ }" U( s2 g
- #define TCCHEN_SHIFT 22/ e) g* T& O$ g
- #define ITCCHEN_SHIFT 23. G2 f$ p+ U s$ ~. q& C
- 8 C: Z2 {6 D. G+ V
- static volatile int irqraised1 = 0;
z- f$ p: D5 U2 ]8 Z - static volatile int irqraised2 = 0;" ]- y7 E1 N: H8 T: ?! K
- w1 l5 `) [) F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& \1 c- r+ y- y! p! p6 v& I1 I$ }
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: L/ i. ^6 T4 y: C: l7 W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: |8 H0 T- }* v5 r( R
* r8 k' D: r1 H- s- dma_addr_t dmaphyssrc1 = 0;" _5 G8 e) _+ z$ D$ u
- dma_addr_t dmaphyssrc2 = 0;
0 b* P5 m M* v: J) w, [ - dma_addr_t dmaphysdest1 = 0;, E7 I, N, j7 U4 B& u3 O; j
- dma_addr_t dmaphysdest2 = 0;
) b w# I, M8 _; r% g+ @ - 8 \; S3 f: P: z }) `
- char *dmabufsrc1 = NULL;
, k, P0 f* |8 H - char *dmabufsrc2 = NULL;3 q6 C( [1 U' C! O' K
- char *dmabufdest1 = NULL;/ q5 B% a$ Z9 [( p3 f! C! J; P! U
- char *dmabufdest2 = NULL;
h& o( }; T z
2 X/ a' a0 s" P3 E- static int acnt = 512;, b) a D" ^4 `% ?0 R' E3 {
- static int bcnt = 8;
- e9 D: Z$ f) z! X1 ~ - static int ccnt = 8;
2 }& h; H/ F2 b2 f! W - * {0 @2 e$ G8 R: s7 Z
- module_param(acnt, int, S_IRUGO);! ~" D! B' f3 f# k3 x. g
- module_param(bcnt, int, S_IRUGO);
4 s7 b3 P0 c7 j( s - module_param(ccnt, int, S_IRUGO);
复制代码
- c$ P" m# U) E& Y6 E' S3 t8 |9 S; K t
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; c9 h4 a' i6 K& f, d6 Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- p( ~* G4 ~) B0 X! x* |4 d3 Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# q; u" n+ [0 w' j
7 b) S2 Y# _# x) b: U: G' T8 R2 D
8 `& v( Z, K% z* F0 J: E, Y |
|