|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 q' }' l! A, ^* }6 l5 [
- [code]EDMA sample test application
! M/ a8 }( ^# o* k - /*, x: m4 g& j. W
- * edma_test.c3 ]5 J [* B, M G
- *
% }* i/ Y Y0 ~ t( h - * brief EDMA3 Test Application0 _7 p2 z4 ?* i v
- *
5 @& W3 M. l, ], }# Z - * This file contains EDMA3 Test code.9 `, w. F5 `& T( a" c7 [6 N0 B
- *
5 L. e7 w6 v% S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ F# g! r9 g; t
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 u5 W$ ? t- e& E3 H
- * TO CHANGE.
u; a- U7 ~( P1 M+ M - *8 J$ A) t+ a/ g
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 P1 V! w/ v$ f" G$ k2 D
- *6 Y$ G5 a8 a4 y* C3 v& @! T- z4 C
- * This program is free software; you can redistribute it and/or
' ] }! |. b% w( M& O4 k - * modify it under the terms of the GNU General Public License as
2 {; b6 n a6 J% a - * published by the Free Software Foundation version 2.8 ~, i8 u; q/ k, M- s
- *
: a# q5 r! q7 `+ D' D; W) h1 w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 Q/ l/ G/ n# R) O/ b
- * kind, whether express or implied; without even the implied warranty
3 k0 f. I6 |* \! V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 P, c7 x) n) o/ u
- * GNU General Public License for more details.' r; H* g: Q( X. r' [" L5 D9 P
- */
# M) J- y' L+ l; r
/ F5 a! s) I) a, x- #include <linux/module.h>7 I8 T" g# b- v% T
- #include <linux/init.h>3 f' b: y# `1 W8 N+ K9 g( h- s
- #include <linux/errno.h>
/ t" x6 G) j0 q$ U' R - #include <linux/types.h>
* L: @/ n: J2 e- X" c - #include <linux/interrupt.h>
$ |) T( t2 v4 A$ v - #include <asm/io.h>
) V' [, F9 Y: P' a* z - #include <linux/moduleparam.h>/ k$ E8 t% a- j& j
- #include <linux/sysctl.h>
+ w! H$ v3 k2 u' g+ h' ] - #include <linux/mm.h>
" b9 ~+ Q+ A7 s: O4 `& z) U$ X - #include <linux/dma-mapping.h>+ X7 Z# Z8 C, Q! |5 j
- ) T6 o5 w; s7 z7 u T2 H4 F
- #include <mach/memory.h>6 O! M2 e3 B4 I' v; n, Q7 T2 Q
- #include <mach/hardware.h>( R6 k9 m* o3 C) K2 ^2 r
- #include <mach/irqs.h>
2 E) }* H. [( Z- P - #include <asm/hardware/edma.h>
5 X- [- G0 j" ?( A0 j. Q) { - ( U, F; S6 L, H% B9 M
- #undef EDMA3_DEBUG
) N1 A5 A. u g0 ], B* e4 s - /*#define EDMA3_DEBUG*/
/ P# B# Z' q+ p0 X7 {! q& S - 1 h: N+ c, ?3 ?/ s, P
- #ifdef EDMA3_DEBUG5 e) z& n9 t7 {5 c, {6 n; e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# v" `+ B. N8 b5 z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 U0 Z( E! Y1 P - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: ?2 R- C% h) u6 h; G9 @ - #else) Z" H2 y$ E8 @% X5 C
- #define DMA_PRINTK( x... )
0 s; a. l0 W6 B6 |. v+ u3 S5 ~ - #define DMA_FN_IN3 Y( A& ?- d1 h: a( n8 m5 p
- #define DMA_FN_OUT' K: s9 ~8 w/ L8 z# B
- #endif9 A' B; s' q7 n) F& t# X
/ L3 d3 S! U& P' `0 |( U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 K1 T( H4 c+ y) W - #define STATIC_SHIFT 3 ~ z: c( Y8 O1 P8 y g
- #define TCINTEN_SHIFT 20' U. l% q+ f# U4 {& ^
- #define ITCINTEN_SHIFT 21
8 O; A$ L1 L! G0 I# y3 ?. d1 G9 G - #define TCCHEN_SHIFT 22
% C$ o" x+ l8 N5 c8 C5 y; g - #define ITCCHEN_SHIFT 23, D5 C( K5 w# [) x# \
0 u: h# m: X4 g% k, g0 C- static volatile int irqraised1 = 0;7 }; N* O9 h; m" w, t/ N
- static volatile int irqraised2 = 0;: _: E1 i' V! t# J* x: o; q
- , k" u' K3 Q3 h; L! ~: c/ K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& O) |0 F7 o; ?9 N# A% ]5 | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); [& |" x/ O v! J: g" h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! q8 G- R# _( h/ G
: z8 j( }+ i0 b3 _' c- dma_addr_t dmaphyssrc1 = 0;
% K4 B$ s& h# e7 P - dma_addr_t dmaphyssrc2 = 0;
9 T d3 @! e3 I1 {. }( _1 T# V( E$ W - dma_addr_t dmaphysdest1 = 0;
1 P7 g/ F, u, ?( ?7 e; E - dma_addr_t dmaphysdest2 = 0;9 y! b7 C% x3 T; ^; A2 `
- $ e# l0 H6 P7 K- d' w1 G# Y1 D
- char *dmabufsrc1 = NULL;* U3 v; O' v! R; a( Y* C8 \
- char *dmabufsrc2 = NULL;
% ~6 G+ D9 ]: ~ - char *dmabufdest1 = NULL;* V6 G. y# _. _3 J$ p t; r
- char *dmabufdest2 = NULL;
4 V( T$ m! |" A# }% ?
6 B- L( K" B. m' N. x7 n# b0 l( j- static int acnt = 512;; ?$ M' |: f9 o4 y
- static int bcnt = 8;1 a, q( t5 q( ?' D
- static int ccnt = 8;
$ x% N5 _+ e+ m. h$ _( v1 V; l1 ?
! _5 R, [2 |/ O3 A) H- module_param(acnt, int, S_IRUGO);
) A2 H3 x) Q2 \5 ^ - module_param(bcnt, int, S_IRUGO);: {3 Q/ I9 Q1 y. h) k; V5 k8 |, j
- module_param(ccnt, int, S_IRUGO);
复制代码 8 y% X0 S9 ^# V M+ I$ o: w
: L2 J# D; s( U3 `
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ _/ @) g; U4 m+ t% r) Y1 V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- X/ L" x9 X6 V" Z; C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, z" P6 @* _7 q' X$ T! @% n" X- a& Z5 |% e D6 c9 p; p
1 X3 I s" M4 t+ u1 l0 @5 c
|
|