|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # R* L: R- D n( v. O
- [code]EDMA sample test application
4 d% k0 g v. @, s6 Z# p' t4 Y: Z - /*% e; n4 J) {) R, H$ E+ K
- * edma_test.c: P4 `$ o' s& B# g* ~" Z+ y
- *
f- v+ |* l" r& ?0 t0 w* d7 u& ] - * brief EDMA3 Test Application
& {7 |4 }* n, f x9 Q" R# k+ f: D - *
$ [2 n% ], K$ C( n& p+ W. s - * This file contains EDMA3 Test code.& h( \6 [* C# h
- *
E# j( ^8 {1 @& L - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; ?) q! {. e, D9 V3 `8 \
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: m" F- M0 h8 X: y) X; y
- * TO CHANGE.
) g; I1 m9 \, e8 ~3 D+ N7 | - *
$ R( I! l6 g$ k2 h: q. j! c w+ c& k - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, h% N- g. Z! D" h
- *- I9 H4 E) d, M& M0 o7 ~
- * This program is free software; you can redistribute it and/or
) u ]2 H+ n* c9 a9 r% x+ P- \ W - * modify it under the terms of the GNU General Public License as* u! y" O/ i! X4 d: W K% q E* V
- * published by the Free Software Foundation version 2.$ \; Y h; p* u' x8 f3 n% A7 D
- *" W" X- _& D) @; K1 l* s! q4 O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& i; F- c1 h) | - * kind, whether express or implied; without even the implied warranty( t3 {" I" R+ g# c' b$ t& S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: g. g' D E' q) c* D. C E/ p& ?/ v - * GNU General Public License for more details.
9 J. _) _ z, p - */9 h. n {2 d. Q5 v
- ; [. [0 `8 s4 I: C& `
- #include <linux/module.h># L* o6 A% t- k" V& j4 O
- #include <linux/init.h>( Q7 j+ Z. j! A: {* P
- #include <linux/errno.h>/ l$ E# }. V7 W2 P
- #include <linux/types.h>
& ?: ? N9 C/ C2 d6 O - #include <linux/interrupt.h>, Q' X( G% j# T* a9 O. v4 M- `
- #include <asm/io.h>
4 F: B# H& I& r a6 ? - #include <linux/moduleparam.h>) ?3 _9 w. x! i# v+ H _
- #include <linux/sysctl.h>
. Y4 Q5 g' [, a K7 v' m8 O2 {( G - #include <linux/mm.h>" m8 y6 M7 y# D% L% _$ s
- #include <linux/dma-mapping.h>
- n- V. x% n ?) X9 u" Q7 V - - q( ^( {4 [7 ~6 ^9 g, M
- #include <mach/memory.h>
$ O- p8 L- v5 P: q3 E/ q7 e - #include <mach/hardware.h>
, S9 Z( K( B7 I% [5 s - #include <mach/irqs.h>
( C' @/ B9 Y3 Q% p+ ` C - #include <asm/hardware/edma.h>2 h& I* Z$ H6 Q3 Y1 y; ?: M6 c1 a( {
- 7 c. Z, ] E y6 {, C7 m
- #undef EDMA3_DEBUG# X, U t9 Z% f/ A
- /*#define EDMA3_DEBUG*/
( \6 M# w2 M! x5 @3 r - ! B) u! w9 E0 O7 Q4 w2 d
- #ifdef EDMA3_DEBUG, f" n: F' N# T. w/ J$ ?1 A4 ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) D8 j( s3 E/ q- [5 r" q5 |# N
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; p3 F# B+ j! P; W' z& ]9 f* ] - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( I) N; z9 u6 q5 j( d - #else+ P* o- w& a1 R
- #define DMA_PRINTK( x... )( P8 i3 L1 V4 {6 ^
- #define DMA_FN_IN9 o7 R/ A6 w, O7 a
- #define DMA_FN_OUT$ P7 A6 }2 l: }- h3 S9 Y, ~7 U% [
- #endif
+ B* I* a" e9 O - ( e1 O. [& H$ P4 e5 |% z, E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, f. z: D# q7 ~! g1 \ - #define STATIC_SHIFT 3' [. \/ f0 C7 L. k: \
- #define TCINTEN_SHIFT 20* k, q( e% A5 R: F5 \5 l: j
- #define ITCINTEN_SHIFT 21
* Z; L1 v) L6 k - #define TCCHEN_SHIFT 22
# w2 O( j' ]1 q+ h& Y+ o, X - #define ITCCHEN_SHIFT 23% K4 f8 z3 k& Z5 E# s
8 w% g+ G$ g2 a$ a: w- static volatile int irqraised1 = 0;
2 F C1 K$ g" J& |' K - static volatile int irqraised2 = 0;
* m7 ?9 E. n' X7 z: r$ L( J/ ?
1 f3 m5 N0 D9 M# _+ C$ ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% n: x. ]% r! l1 h5 [3 d( W y$ o% F
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" B) ?5 O+ w2 i1 r; m- J+ D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; l) h. [$ r! e5 B8 t, F
- 6 x- w2 u( Q# E. a
- dma_addr_t dmaphyssrc1 = 0;$ ]; y- n5 g8 o3 M, C s
- dma_addr_t dmaphyssrc2 = 0;
- Q# E( M" ]0 h - dma_addr_t dmaphysdest1 = 0;' ]$ Z* X; ?0 W* U
- dma_addr_t dmaphysdest2 = 0;
2 x# Z8 S5 I6 ~5 u
7 G* _2 D/ P4 p5 L$ I# f. c& r( B- char *dmabufsrc1 = NULL;
0 i% K5 W3 k1 L - char *dmabufsrc2 = NULL;' S& t0 B6 j2 [0 c/ j# \8 q3 M
- char *dmabufdest1 = NULL;
, Q) j) Q3 B1 A - char *dmabufdest2 = NULL;
: H7 I5 I0 I3 X8 {
. l2 y6 Q1 ~) D4 U& @8 F- static int acnt = 512;
+ B- c( {3 T8 g4 Q5 N% Q - static int bcnt = 8;! }# M- d! {9 d- s$ S' p6 w/ a5 z& ~
- static int ccnt = 8;
0 V. {9 }" c- j6 }! l1 r
: P D$ [9 x' G( q3 `: j! C! y- module_param(acnt, int, S_IRUGO);
: _- P0 C( I q) @) M - module_param(bcnt, int, S_IRUGO);8 R6 b6 {. X$ V; a; R
- module_param(ccnt, int, S_IRUGO);
复制代码 # |+ ~, P: y3 R$ M
8 i& ~) M- i6 _# [+ c 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 A. a/ _$ M4 o2 b5 M3 @6 harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 [' a' r5 n7 G: y n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 h1 ~% q5 l! S1 @( `7 S
. E8 ^- {* _* c& |4 w# ~/ F0 u5 m9 U( F: l. L) g7 `# h1 k- ?
|
|