|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" z3 B5 e2 k& c0 D- [code]EDMA sample test application
0 U4 _3 _% ^+ W" @) } - /*; s/ y4 W9 }4 l& N& ]! {8 Y
- * edma_test.c
' D$ N0 T1 b) l/ Y8 p; B - *: v6 P5 P0 a$ E: Q' j
- * brief EDMA3 Test Application
$ w6 q& v) O" z+ ~! o+ y - *
2 W4 x- D a- }1 v. y - * This file contains EDMA3 Test code. Y* [8 W5 e5 e. D
- *! c! M. s+ v: C8 e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ o) t1 c2 E2 V2 Q9 b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 \2 C, G" j1 ^5 I4 r - * TO CHANGE.
! n. V- U# A: ^6 C. q" D - *
% Y' h# x- w' ~: }, w6 a) x - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) }5 u9 p1 `; K& B4 r- o4 O
- *% f; V2 j( k) D( C
- * This program is free software; you can redistribute it and/or/ }, a6 ]+ L) f7 p% D7 ~
- * modify it under the terms of the GNU General Public License as7 d# [4 {% ?1 R3 D s: _* T
- * published by the Free Software Foundation version 2.7 p8 V7 w) z' @5 f2 L
- *
, |# J! @: ~( p" e L8 w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 E- {$ w% e) o& g% G - * kind, whether express or implied; without even the implied warranty( q9 B4 }/ [% B$ C# u( B8 D% D, ^
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- o7 i7 C) T4 j
- * GNU General Public License for more details.& F' {% H7 @- M8 H# O0 P8 }! q
- */: c6 f8 r, o# A( u X
- # d! A$ Q2 ?8 f) W2 t' F: c
- #include <linux/module.h>
3 K. `0 I7 S5 p; d3 T' ? - #include <linux/init.h>- L0 v& ]: R* Z/ ^/ B
- #include <linux/errno.h>
1 I7 Z6 l% j0 d P+ x; P' J5 B& A - #include <linux/types.h>
/ O! j$ L# T+ m( j* n0 H - #include <linux/interrupt.h>* w8 B! G+ L9 e
- #include <asm/io.h>6 ~7 y5 k9 f( d9 V- ?% d
- #include <linux/moduleparam.h>
* m/ q- R: g8 K8 y+ Z0 ~7 J" l6 u - #include <linux/sysctl.h>6 _/ k1 y. Y9 s4 j& D- Y& J4 k9 h
- #include <linux/mm.h>. ]7 l8 f" y2 \( \& x* ^
- #include <linux/dma-mapping.h>+ x" R* W( I% T/ B* t4 T9 Z3 V. H
- * m# M( R v2 i$ \1 \4 k
- #include <mach/memory.h>/ m N5 | h" h3 g1 \
- #include <mach/hardware.h>! }' T) S) \+ q: |# O
- #include <mach/irqs.h>0 f/ c- @& a& z u k% b2 I
- #include <asm/hardware/edma.h>
. L* V5 S+ {: J
* {9 |. k# B3 a" m- #undef EDMA3_DEBUG
# J1 x" s* f/ H, w" J7 z' r5 @ - /*#define EDMA3_DEBUG*/
3 o( Y. D' _/ D ?/ d
, _! [; r2 k" R% c- #ifdef EDMA3_DEBUG* q0 t* o: M( u9 ^5 e$ s0 p
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- e/ o# \: F+ Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 C+ H8 S2 N% j5 t, Z' q9 Z" t3 ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& b/ A0 o1 ?5 B5 K; B! v) m
- #else
- J/ ? _* o# t' G) K$ v - #define DMA_PRINTK( x... )' A. @4 Y* O2 O- [9 z& A: ~
- #define DMA_FN_IN" I$ r/ a( R! u5 m) Q0 M. W
- #define DMA_FN_OUT: C4 A5 Y6 Y/ ~, P I' @
- #endif
8 @* F* W; x8 ?4 V- a+ d q - % X+ Q! H, g( c% \+ p
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 @# z7 S' s+ X! C' o9 ]9 ] - #define STATIC_SHIFT 3
3 i! I/ c. r# u. g1 m* X - #define TCINTEN_SHIFT 20% \# ]2 a! I0 D6 b" c
- #define ITCINTEN_SHIFT 21
3 [; M5 n1 {1 n' {" g; p - #define TCCHEN_SHIFT 228 h- i# o, h" u; D; {3 k& L. u; g
- #define ITCCHEN_SHIFT 23! g3 }$ J# E) x* f# k6 o( D
- f( N) r8 z8 C; f9 X$ c$ b7 L- static volatile int irqraised1 = 0;
2 ~) e% S) i/ x: k/ w- } - static volatile int irqraised2 = 0;: j0 X3 o1 c4 k$ ?' B( @" _. D: r
- ( q0 {" ]8 ~1 n) x/ c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); J# o! q! W1 l# B9 `
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 w, x. b: D4 o- ] - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 ]3 Y, v% m) ]. P( b( H - 8 ~# ], z- l. T9 ?1 ~, n
- dma_addr_t dmaphyssrc1 = 0;- [$ ?( |) [5 |- e
- dma_addr_t dmaphyssrc2 = 0;, _0 k G9 q7 I6 s- Z
- dma_addr_t dmaphysdest1 = 0;
0 E8 [0 l0 l, m( f }7 F - dma_addr_t dmaphysdest2 = 0;
: [" a) r M; `4 M0 p+ T( W' r* E
+ O$ }0 e7 \5 P4 @- char *dmabufsrc1 = NULL;
s: O6 m- ?( C; Z! Q( g' V! X - char *dmabufsrc2 = NULL;
' Z9 N) O$ Y+ C# B - char *dmabufdest1 = NULL;% \: o u( c) M. R0 K! ^ G7 @' f
- char *dmabufdest2 = NULL;# I. o4 N0 g$ `( f: {0 l
9 S' _9 R: e% m6 ?0 ]- static int acnt = 512;8 q. y/ `4 r2 i
- static int bcnt = 8;! K* h7 I- X/ ?; u" ~
- static int ccnt = 8;
/ I f& e+ ?* N+ B/ U5 x/ v: h- G& K/ V
4 b; F" k$ Z& E( d. x- module_param(acnt, int, S_IRUGO);
' N1 q, \, p! L$ N& q - module_param(bcnt, int, S_IRUGO);
& M& z2 j+ d/ v4 g - module_param(ccnt, int, S_IRUGO);
复制代码 ) U2 E: b# G$ J% N) a. Y
7 b. o% o& C8 r' j, L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 y- G4 S, S$ G, i9 g5 |4 U0 [0 n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 v4 u7 V4 J; `/ q' Z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
Y6 |. X" j. V" J3 ]1 p1 `" B
! T0 G' O. q3 x2 Q
9 b ^% d' a/ V- n& n |
|