|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! T3 o D$ O1 Z5 P5 W. [ E
- [code]EDMA sample test application1 B5 ~! d+ j; j
- /*/ Z7 c9 T1 [$ X, I% X' K
- * edma_test.c5 f) S. Q+ L, A$ A" d; q: t n
- *
6 p7 w8 B1 t2 b' H* z: g3 B3 X* N - * brief EDMA3 Test Application
# G7 ~$ f, J! ]9 R - *
3 e' w h; W% A) }. T - * This file contains EDMA3 Test code.
; X1 Q: y! Y, i* C: O( C* Z - *
" ^! A; \" R6 k: e$ u+ `' V - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% ]" ~- f; g- P, y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: r8 J( ?6 O& o0 d& G - * TO CHANGE.
, c1 d. b2 k; b1 L) l! O - *8 j, I3 Y6 P. C; h4 c( l7 F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& Q5 l. a- b0 l- [3 B9 I0 W
- *$ g0 ^6 \6 F& H4 ~* |
- * This program is free software; you can redistribute it and/or
) {6 D; B, E0 Q - * modify it under the terms of the GNU General Public License as7 d; F, i+ H, O* J4 m# Z& t
- * published by the Free Software Foundation version 2.
3 `* h$ L1 ]% C+ J- l$ p) ` - *7 B; h2 G: r. c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& k F& W* F4 a2 C$ f! C* g - * kind, whether express or implied; without even the implied warranty1 C: G/ r) C2 H4 t$ W
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" x0 V3 f+ Z+ A: F2 h- ?. D- z \ - * GNU General Public License for more details.
: y9 ?9 i. c4 ]1 a- |( p - */
1 z4 e1 C3 ?. q - 5 L- ?* b8 X) m3 I% K' S
- #include <linux/module.h>
1 g3 c1 V: R% L6 i) \ - #include <linux/init.h>1 E! g( j6 |, Y" U- ?' `' W
- #include <linux/errno.h>: A* w& h$ ?: d8 Q: _1 w
- #include <linux/types.h>
( f a! @ X* n) j - #include <linux/interrupt.h>& {9 d \ u' }/ `. R# u
- #include <asm/io.h>+ v' W0 V3 M. K) S5 S
- #include <linux/moduleparam.h>/ R+ h" g: S+ J( M
- #include <linux/sysctl.h>2 t; H" j4 O+ L# N" I4 c
- #include <linux/mm.h>" o' i8 F9 M- w
- #include <linux/dma-mapping.h>
- M5 @& G+ c3 r* l' E9 v2 ^
M' o- B9 f9 r- #include <mach/memory.h>* v) I' o: b m- M2 J. C1 u P
- #include <mach/hardware.h>8 J2 k: {+ w' V) b! r7 L
- #include <mach/irqs.h>
! H! X: ^# p; P5 B - #include <asm/hardware/edma.h>. r2 {: c1 `( T! V o
/ _8 E) {, k$ D B- #undef EDMA3_DEBUG* N3 ?/ O& ]+ c! q. ^ ~
- /*#define EDMA3_DEBUG*/
8 Q" d$ T1 V& T0 | - 6 u' h" o; |0 e. j5 M' P# W$ E0 d
- #ifdef EDMA3_DEBUG
! {8 D* G% H! U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 q( A* C+ ?/ e) Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& O5 [ Z& Z8 U- L
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 r3 ]; `$ ^5 U6 k
- #else9 A/ R; w \7 w$ v% [1 K3 t: _' j
- #define DMA_PRINTK( x... )
& w3 N/ T7 n6 C - #define DMA_FN_IN4 c: Z& S& }. b+ }- E5 E. _6 ?% x1 G
- #define DMA_FN_OUT
1 X g; j4 R: I$ g+ \5 ? - #endif; T% i! P) W# j/ b9 U
9 Y9 W/ s3 v) U4 C3 z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 T! J& f) l- F) a
- #define STATIC_SHIFT 3
1 R" _# K# h1 {, t- I% G* k - #define TCINTEN_SHIFT 20 W2 ~, w& W! k% ^8 d8 R5 m
- #define ITCINTEN_SHIFT 21
0 N5 v+ p- t' N0 o5 Q - #define TCCHEN_SHIFT 22( x& C( n. L9 U5 y
- #define ITCCHEN_SHIFT 23; {6 y( |" E# O4 ~2 V+ Z
# o+ ^ w. \9 j; p7 ?- static volatile int irqraised1 = 0;
' o) c; n5 T, } - static volatile int irqraised2 = 0;
# k! s% M8 ]& X, G2 C - . F( J2 ^- U5 n4 f- K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' @* t8 s5 B) n- R: F
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( i, F$ L, X! H; @5 x( t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" C/ N2 q. u4 M/ w/ P( M! S - / f; H) [4 d' g- j
- dma_addr_t dmaphyssrc1 = 0;0 C* @0 R8 b0 _* M0 o) `- O' r
- dma_addr_t dmaphyssrc2 = 0;
( s& d! M' A# g9 q- q - dma_addr_t dmaphysdest1 = 0;5 L0 l- {& F4 h4 E( y; y/ w4 b7 q
- dma_addr_t dmaphysdest2 = 0;0 A# i% h5 o% o# Z9 J
! b( j& g2 c2 u) d9 ]- char *dmabufsrc1 = NULL;
- c' G2 u- R8 k: Y. I% Q9 i - char *dmabufsrc2 = NULL;
* @' \8 K" D' u - char *dmabufdest1 = NULL;5 F; L% c) M: K% v5 L. T
- char *dmabufdest2 = NULL;, P0 |$ x: f( |( D
" l2 D3 L; n' x2 c0 [+ B' l- static int acnt = 512;( x5 K! H8 S3 P/ l5 \
- static int bcnt = 8;# Y; G, U" |6 F1 E1 Y ?* @6 K/ y8 ^
- static int ccnt = 8;' q; M8 t" x1 |4 B: _
- ( h/ d3 A$ n, D# h
- module_param(acnt, int, S_IRUGO);
4 J' { j' U0 X( f" | a5 v) Z - module_param(bcnt, int, S_IRUGO);
; r5 a" {( b& V3 A+ R% l. U' {) x - module_param(ccnt, int, S_IRUGO);
复制代码 3 t* c- j$ B5 u. z! W
K$ K8 o$ E0 b* {, L4 Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ U7 t) W% @! G. T2 i- @. Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( d- y3 P! N- u( P 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" W' C2 S9 c9 S4 g/ L! A M# y& e$ G n# [ p
$ W7 Q C8 x4 b |
|