|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 h8 E2 p, P; a; h( l
- [code]EDMA sample test application8 _) {$ D! H+ L+ M" D% U+ P' K
- /*
6 a+ [3 e( b! H" m5 G. ^ - * edma_test.c
. R" `1 k9 m6 E: N - *% T6 S9 b* o- ~( P6 p6 ?% t
- * brief EDMA3 Test Application
6 g( w* O6 i1 L1 f - *; w1 w7 F6 k/ b
- * This file contains EDMA3 Test code.
7 y, Q1 \# L$ S$ h$ [) [ - *; p! C: ~( K) t: e# r, x/ I# X
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" }$ u' p' \+ {8 p# A' |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! | H+ g( P; Z+ X: s
- * TO CHANGE.8 F/ z# V/ F; a5 W9 Q
- *8 t( R/ Q4 J) i; I% p2 ?' F9 f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 W6 f2 Z1 P: M1 V
- *
7 z' p) L3 M' z" y* @7 d - * This program is free software; you can redistribute it and/or8 y1 e) @1 k) U) d
- * modify it under the terms of the GNU General Public License as/ W: \# v% i: p9 Y& G# y' N
- * published by the Free Software Foundation version 2.
9 Y* o2 Z& n# Z3 f - *) S9 z ~, l9 l5 C! c: }! U
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, Q$ v" a' h% w1 d" o) {+ z+ r$ Y8 \- Q6 R
- * kind, whether express or implied; without even the implied warranty
- t2 U9 C: }6 C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# K4 f! b* }$ U
- * GNU General Public License for more details.
w- ]9 M' {, f2 h5 N - */& N+ W. l3 k/ Y3 i# K+ @
3 m/ C1 x" ]/ D0 A+ r% l- #include <linux/module.h>
5 p Z; a5 V, h8 @+ [& k2 A: O - #include <linux/init.h>( }" D& }: X- F3 @
- #include <linux/errno.h>5 y: l1 Y1 u6 q0 S6 V7 y
- #include <linux/types.h>. X* j# U, X0 D. D$ E2 T
- #include <linux/interrupt.h>7 M6 e' p9 h7 S
- #include <asm/io.h>0 w% f: t9 x5 h
- #include <linux/moduleparam.h>
. g j/ Z' K/ W2 ^1 m' ?6 @: m4 Q, g - #include <linux/sysctl.h>
0 H" [$ E4 x, G! e$ n1 G/ n& q - #include <linux/mm.h>
2 B3 K7 w1 x7 N) j% A - #include <linux/dma-mapping.h>
1 f h* q3 a6 M3 \. t9 L, C# @
& f1 ^5 T% U1 E7 L( b) V- #include <mach/memory.h>
0 s2 Q o& {7 `* n5 P - #include <mach/hardware.h>
) h% w+ ~3 d/ ^8 c - #include <mach/irqs.h>
9 u' ^: U2 m0 H - #include <asm/hardware/edma.h>
4 H2 C6 p! z2 b* H* _
# [4 ? ^4 [# w' ~- #undef EDMA3_DEBUG
+ b& H/ d0 g1 F5 U$ Z# I - /*#define EDMA3_DEBUG*/
% H9 z" K/ ~/ D2 |7 M$ O5 w
5 S* o- o9 c3 O4 C. p$ b- #ifdef EDMA3_DEBUG. P1 x) ^$ w& m4 U; f
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- {1 ~8 T3 e) ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ X3 X% j! l B% r. k4 W: h$ h - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) O5 I1 P- o' T - #else
" e, r$ |( d* G E - #define DMA_PRINTK( x... )* ?8 O2 Z* Q D6 ?% N) m7 v
- #define DMA_FN_IN; x: m# M# o$ n" m, O/ P8 j* r9 s
- #define DMA_FN_OUT
# Z, x7 q9 g1 O& a, p3 H - #endif7 m/ {, S: ?2 E2 y* k
- ' Q) @5 p# y, w; O6 p1 O( Y6 l% w
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# _- n2 o% K+ s6 b4 I# c - #define STATIC_SHIFT 3
* g2 @, x* z8 B0 v, X x$ e+ g - #define TCINTEN_SHIFT 20/ s% l: ~0 X1 b4 b
- #define ITCINTEN_SHIFT 214 y& a( t3 M2 ~3 {( S. I* e
- #define TCCHEN_SHIFT 22
7 q' t8 N% a4 F6 ^( C/ Q' X2 T - #define ITCCHEN_SHIFT 238 X6 A3 {7 ~( k) B
- H8 X3 E, f' ?- n* i2 ]& }- static volatile int irqraised1 = 0;
' k5 L" q$ m O" @ - static volatile int irqraised2 = 0;3 k' [ M& t2 _& ~7 ?+ G
- $ P! X' `7 z. m! Y& ? W+ L. F, D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 \( B k( @7 a" y* R& G3 L) U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 R# O# |1 b1 }& y$ F0 l
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ j+ h" X6 ~: a& A& I
$ W) F; T) E) Q" u8 S% J8 S- dma_addr_t dmaphyssrc1 = 0;" x- j! K: d* M
- dma_addr_t dmaphyssrc2 = 0;
, g0 [. ?2 ]& P5 U b/ Y- i& M - dma_addr_t dmaphysdest1 = 0;
# ~4 x9 Y( B% V - dma_addr_t dmaphysdest2 = 0;8 H. z$ U- I! a
. j D" S2 H9 L; n' D5 h- char *dmabufsrc1 = NULL;, b4 N9 k" t/ O2 r* [1 t
- char *dmabufsrc2 = NULL;! U2 B, l9 X( f0 _! u* s J
- char *dmabufdest1 = NULL;
9 `' {. h+ l$ P; v& L3 R% L: t - char *dmabufdest2 = NULL;
# R% y2 `8 f2 w+ h! e! J [ y* K
* Z. `* H# M2 M9 e1 Y% e- static int acnt = 512;
' Y- V' L( R' N" B* m - static int bcnt = 8;
2 G( d! _! D* I- _3 y - static int ccnt = 8;. O+ k5 _5 G: E. x
- : h, W5 C1 [' l# F' k4 O, B) g- w* P3 s
- module_param(acnt, int, S_IRUGO);
, s5 F* T+ S% {( |# L - module_param(bcnt, int, S_IRUGO);; w! b7 t5 [/ e8 o1 y0 G! N
- module_param(ccnt, int, S_IRUGO);
复制代码
) P7 j* `, d* t: A! r% |/ ~. `; `
* {* ^- [ [2 }7 D6 W. H2 g9 b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ ^6 F- b( p; G4 P: oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 S' ?; s& B1 Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- i7 s. |8 M6 s3 S/ }
- J6 _4 y, A% V% F# g) E ~+ B ^% `" b2 Q" e$ g. c& Z4 P; _1 ^
|
|