|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; M% n5 O; \0 @" z: {; e- [code]EDMA sample test application: a# s; f2 V, R# c W' c- V
- /*
' A3 e$ t" D- J' @0 R, d - * edma_test.c
2 W, x' @6 ?$ e. w - *2 N! X- F8 U6 g0 y
- * brief EDMA3 Test Application
/ [7 B0 |, A" a- s. ^( W- m - *
4 k% ?7 T) L( u1 i - * This file contains EDMA3 Test code.
1 I3 ?& m0 @$ q - *% ~6 m. {, |4 Z* @! V4 l! n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 M7 Z* c, r9 a- c' N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: q: s* _ a2 o! g1 l
- * TO CHANGE.2 k) h( E7 `6 N. f/ i
- *
# n% r& P+ r5 N! \* T& L; G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: c! O- O! u' W D/ E' \' W+ I
- *
8 m. F* K F( K" y& w - * This program is free software; you can redistribute it and/or, d# g; I* S& ]3 x/ G
- * modify it under the terms of the GNU General Public License as
. u7 w1 @6 L9 g5 s! H: r0 l8 Z - * published by the Free Software Foundation version 2.6 T: K+ w- @- [- l3 E
- *
. `, |6 C6 }" O5 r* w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 P$ S, L- O( S2 p
- * kind, whether express or implied; without even the implied warranty! f3 m4 Y; R- L; J) E4 R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 ?3 g4 J. Z, x( y' E0 o t
- * GNU General Public License for more details.
6 M2 m0 v* Q9 a5 l1 v+ e0 f' g' E8 | - */
/ p1 \" f; @5 W; [' s, _ - 4 R+ n; ~1 L! m8 ~+ q2 `+ \3 g7 W! l
- #include <linux/module.h>
% g+ `+ z9 Z- m3 v - #include <linux/init.h> S# z# y. _" E u
- #include <linux/errno.h># B- C, `* p% Q, F& N
- #include <linux/types.h>. S7 |( [/ g4 N$ k5 \( Z
- #include <linux/interrupt.h>; M* N" V: K1 f, x7 z, k
- #include <asm/io.h>- O' q2 n( R( I, w7 ~
- #include <linux/moduleparam.h>/ E5 ~- @6 E4 q3 w& ^
- #include <linux/sysctl.h>
: B' U+ x# S7 @ - #include <linux/mm.h>
1 X- X; t9 L. F9 D7 z - #include <linux/dma-mapping.h>
$ @0 U9 L0 X$ v6 [9 b' m
; F. A$ G$ N, @0 [! X4 m- #include <mach/memory.h>/ } P n# a( z& P: w0 c
- #include <mach/hardware.h>
5 }; J* d/ v* S - #include <mach/irqs.h>
3 y# p, {7 X6 W+ k1 l - #include <asm/hardware/edma.h>
M2 q6 }: T8 z% J" a; F; t$ O
4 o B& M& j- n" F5 z1 e% S. }- #undef EDMA3_DEBUG
% D' E' L, D5 L; P; s, r - /*#define EDMA3_DEBUG*/% I& N0 \0 g l
u! _* P# T, M: Q7 Z- #ifdef EDMA3_DEBUG
0 o, T! W% _ K: u/ q2 e+ E - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- R3 S. ~0 V+ Q1 ]- L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) ~% b6 P( ^+ H) d' X- u. a2 Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* I" a! K; Q& f% y5 i3 u! ~& M9 a
- #else& c. | D( @! \3 o/ f2 R
- #define DMA_PRINTK( x... )
, ?9 A5 D$ |$ ?4 Y, l& L/ i - #define DMA_FN_IN
" T) _, Q! r" K1 v, v( w - #define DMA_FN_OUT! r5 s5 T7 q. f5 n, @# p1 q
- #endif
! `. q E; ~7 K2 T - , w2 \( P9 J4 r* W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 q3 {0 y- f7 r2 b - #define STATIC_SHIFT 36 C. g0 S" ?+ D* f
- #define TCINTEN_SHIFT 20+ U9 R. ], ~* I- C1 C7 f% z2 j( E
- #define ITCINTEN_SHIFT 21$ t# D6 x5 `1 X5 T0 c
- #define TCCHEN_SHIFT 227 `6 u7 G* c* ]1 k9 N. q9 H
- #define ITCCHEN_SHIFT 23# Y' U& q: v+ R
- 4 b: h2 m e( S! p3 h6 d2 I) A
- static volatile int irqraised1 = 0;
) R: ~9 A; f/ C( I% U - static volatile int irqraised2 = 0;
" ~0 F. h* Y& s$ I. j4 K& ^ - 0 d6 G- N# X2 o( c# P, o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); ~% p5 o- ?6 _! a6 t! @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 @/ p S/ n3 w - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 R" F8 x7 j! p2 w) J
- a4 c( q) J1 D) A& c5 X- dma_addr_t dmaphyssrc1 = 0;9 [4 G% {( ]/ j8 W4 k+ @: O6 r$ c/ T
- dma_addr_t dmaphyssrc2 = 0;
6 r9 a/ J3 e! \! ?) d3 o7 R - dma_addr_t dmaphysdest1 = 0;. M: G+ c8 f( c; u7 _) T& t
- dma_addr_t dmaphysdest2 = 0;+ {$ |8 w- K9 Z, y
1 s- L+ z2 l4 Z5 }8 H n- char *dmabufsrc1 = NULL;9 \, w' g9 w6 F& e" _, Z! y; z
- char *dmabufsrc2 = NULL;$ I0 [+ h7 b" E! ^1 t& K/ s
- char *dmabufdest1 = NULL;
! H. n& G1 L! S9 z - char *dmabufdest2 = NULL;
$ N: N X8 b3 X, Z ^% e& ?0 f3 l
9 @6 C" i; X0 c% L5 }- static int acnt = 512;
, P7 D. Z0 _1 C7 a% \! K: d - static int bcnt = 8;
4 S8 Y/ R; N, d) y) Q u2 B9 a - static int ccnt = 8;
U( U0 ^8 B4 o. u+ Q) l. q5 Z# W" S - : v3 T4 M2 G: k# k# e, l
- module_param(acnt, int, S_IRUGO);
6 O" n# J" m' `1 c/ Y - module_param(bcnt, int, S_IRUGO);
3 G; f; E! _4 P: I2 j - module_param(ccnt, int, S_IRUGO);
复制代码 ( G' P6 Q$ r- @. O
$ X2 a7 X$ \- y6 X( w 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& d Q) W! ]* M, _. A, c3 O9 d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
\/ B. J! r7 k1 O J9 o 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 X {* M y. ~1 k# G) \+ Z: {
$ B6 Z) N+ U7 g2 y+ }7 E6 [! V- i
|
|