|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, ~# ?/ U' L- v5 e- [code]EDMA sample test application
/ g& | D% d4 X/ j4 U$ d, g3 h - /*
, F- J' c8 C$ b, F( n - * edma_test.c; F& e* i4 q. x9 |3 G; v e/ Z
- *
; _$ ~1 d ~" v - * brief EDMA3 Test Application
) g; @$ b& N! m2 R$ E( r - *) {3 Z# A( b& o; Z
- * This file contains EDMA3 Test code.
4 K* H4 b' r% s: f# V' y! ~, j0 t - *
6 ]# L2 r$ q+ E7 v$ R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 A% [5 t3 o3 w6 D
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 t6 Y% I- U# V0 I* e) a7 s8 O
- * TO CHANGE.
& Y8 O1 Y1 f+ a2 h - *
* ]0 {6 H1 k1 y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# v; }; g: y$ {& k1 t! c - *6 F/ p4 L. ~$ R1 [2 x
- * This program is free software; you can redistribute it and/or, U0 g& G% B8 f
- * modify it under the terms of the GNU General Public License as
/ b3 {- L0 p1 p4 \6 Y - * published by the Free Software Foundation version 2.; b8 S6 }+ ~* r& o' A5 A* a' d- l% F
- *, J; [7 w$ m& R
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 F9 V1 V4 E; m0 B' Q
- * kind, whether express or implied; without even the implied warranty+ C# h0 v' P. _! D% y* c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 Q5 r) H5 h0 l! p' c( r# | - * GNU General Public License for more details.
& j0 s5 J8 \! `0 k/ E - */
9 c/ i) _, \% K
1 r+ p& n5 X; _' z- S2 y6 s6 \; [- #include <linux/module.h>
1 n# }/ t. w, l1 E7 y - #include <linux/init.h>; P& G4 f+ P8 c
- #include <linux/errno.h>& Q! q2 ?) W: f- N. h
- #include <linux/types.h>
( Z8 Q! Y5 e' b: |, K7 S2 A - #include <linux/interrupt.h>
* \, j3 h7 w$ {$ f, ^ - #include <asm/io.h>. a. T- W" Q8 E+ ]6 G
- #include <linux/moduleparam.h>. B5 \% F0 d$ {- c5 R6 N2 C8 F
- #include <linux/sysctl.h>' n0 e& m f i' \
- #include <linux/mm.h>
$ L0 \: p7 L1 R& z+ o. J8 P1 v3 q - #include <linux/dma-mapping.h>2 O4 a# \! e" M
- : A2 T/ @5 k2 [7 R# X* _" F3 ]
- #include <mach/memory.h>
% p6 a- y/ G% [* R - #include <mach/hardware.h>
5 K1 E6 D- Z% k7 S - #include <mach/irqs.h>
R, v+ _, J9 |. b& o0 ~7 p8 w% w - #include <asm/hardware/edma.h>4 c- D+ J% e: Q! e) _& Q
% x5 M+ @8 |2 i1 n& Z/ u- @- #undef EDMA3_DEBUG
% I, \# o7 O# y2 h+ o0 } - /*#define EDMA3_DEBUG*/& \: y( j- \3 j @' k/ |. l9 X
( ^( D& ^8 r1 z- F3 U. U7 E- #ifdef EDMA3_DEBUG6 X) B4 S& [$ |$ U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 J( Z3 T; {: J9 H, D O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ L7 }. j! G9 F U) t6 V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 }: u) g1 X, h4 \; g# _* F8 j; ~
- #else
* c6 H7 Q I' G$ M9 [ X - #define DMA_PRINTK( x... ) _. r/ _! F, l
- #define DMA_FN_IN
6 Q; `# M+ ?1 G; g - #define DMA_FN_OUT* g `9 A# `* D* p( B
- #endif0 `6 T& U* q) I* e3 p$ H
- 5 R; D. N; m. m+ ~0 Q8 [6 q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 v5 I. R5 t" ]9 I; k3 T+ A9 E - #define STATIC_SHIFT 3# V0 I z' n, ?: `" y/ e4 Q4 k
- #define TCINTEN_SHIFT 20
6 e; T/ _( M# f3 } - #define ITCINTEN_SHIFT 21
1 g3 M+ n: j$ d& l6 e' u - #define TCCHEN_SHIFT 22
+ C' V0 [3 M* g - #define ITCCHEN_SHIFT 23
6 b# n& ^; P7 K/ d# `$ s - % m# H; r( K+ D1 E3 @
- static volatile int irqraised1 = 0;
/ v: n: i. K4 i4 u3 q. @% q - static volatile int irqraised2 = 0; x7 _9 _6 e) r, b/ r
- ' O/ I' ?9 b) I- g- t" e
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! [4 d2 i. N2 o* j2 y6 k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) w. H, M" T- r& E L - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ @8 F. s, J! p) J
2 F- M! E+ {1 Z: ]- dma_addr_t dmaphyssrc1 = 0;
5 P& t2 \3 W# \+ N! j - dma_addr_t dmaphyssrc2 = 0;. k. j: f8 _. U- R# ^( c1 n
- dma_addr_t dmaphysdest1 = 0;
3 c1 I' j1 n- ~- A* P# @ - dma_addr_t dmaphysdest2 = 0;
- @0 s/ a6 R% b8 J2 ~
8 _0 Z2 @" a9 j" r3 k; |4 Q- char *dmabufsrc1 = NULL;
4 Y5 d# |. R5 M8 N% _" T* o - char *dmabufsrc2 = NULL;! k$ u- t8 Y8 Y( Z9 F! ]
- char *dmabufdest1 = NULL;
) f9 w& k1 T8 [# ^7 A! m - char *dmabufdest2 = NULL;
9 m f* H) e1 q7 G
( Q: j9 l+ m8 V+ e# q. x- static int acnt = 512;
3 P: h7 q8 c6 M' J! j" M - static int bcnt = 8;
' ]) {" Z. |3 c8 f( f: R" Z% U) O - static int ccnt = 8;! ]9 f& P; ^8 Q6 @
/ U" F, o; m# r4 C0 j- module_param(acnt, int, S_IRUGO);/ I' a6 H9 s- p( M
- module_param(bcnt, int, S_IRUGO);
/ D% _9 t, J& @/ ?; B0 u L. }; j - module_param(ccnt, int, S_IRUGO);
复制代码 ) L0 k% ?4 K# \
( _" r- n+ i7 h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. m! U2 [8 {/ d, A1 X( p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 ^: ?% q! n% ]) i6 q! Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; ?/ R( W! a3 C' L+ b- ~0 N' M2 a& o9 B, r, y- ^1 P" }
3 Z3 c5 {9 p- W. j; M9 a0 Q |
|