|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- S+ G; b: _( J7 }3 k9 d- [code]EDMA sample test application2 a' s. B* ~/ o& \+ b
- /*
_: ^3 X1 T: T - * edma_test.c/ Z8 [2 n7 b$ j8 \, ?. G6 o
- *
H0 \$ |# y$ ~7 Z3 n' } - * brief EDMA3 Test Application
# Z, x5 f* D" H - *
0 o. K7 t& ?7 S) ]0 g" T - * This file contains EDMA3 Test code.
! t" V" g5 m+ ?6 _% S1 } - *; B" F' `5 r: i1 `4 }
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* j; N4 K0 I* Y* R% u# k$ X1 P! ]
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; u) K4 A3 a& s
- * TO CHANGE.# i% i2 _0 z; ]
- *2 V7 `( z6 _) p7 D2 x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 H$ \& ?- F9 r% E/ O6 P1 {+ m1 B - *
4 G+ r3 I9 X, @/ h - * This program is free software; you can redistribute it and/or5 Z4 m1 l( z0 |% X% O6 |
- * modify it under the terms of the GNU General Public License as
/ A1 h8 B1 t0 a2 }8 t, J0 W1 l - * published by the Free Software Foundation version 2.- P* j+ z& ]; f! d$ r' W/ w
- *. p0 { H/ w9 Q% X! h( C3 M% u! s
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ {+ o& Z i8 Z5 S0 e2 g5 S8 _ - * kind, whether express or implied; without even the implied warranty
' w m* D! k0 N' V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ V+ \4 ]( x+ \" i4 u
- * GNU General Public License for more details.. F, x5 v. [. v! o' V; { w1 K4 z4 P
- */
, H+ L" M! P. p. C
2 [: ^- h x7 ^- #include <linux/module.h>3 H: k+ }' |' D! z8 V8 U
- #include <linux/init.h>5 v7 w5 o0 h, e" Z
- #include <linux/errno.h># x m1 w$ q6 }/ E3 L. C
- #include <linux/types.h>$ D; @& K9 z3 K. W# D" I
- #include <linux/interrupt.h>
6 v+ ]9 H( H& a. P - #include <asm/io.h>& a; G5 G7 L3 n& _1 V+ H% A2 l9 w g
- #include <linux/moduleparam.h>) Q3 f7 K5 _3 j
- #include <linux/sysctl.h>: d6 c* t2 w' E$ B/ ~
- #include <linux/mm.h>
8 i+ S) c2 @3 I C; J7 C - #include <linux/dma-mapping.h>' y( Q$ Y5 R5 X5 ?3 ?
) V7 W. |, V' h6 ~) Y) j9 b- #include <mach/memory.h># P5 Q& O- H: e7 Q" `# T8 \4 ~
- #include <mach/hardware.h>, q+ F4 f0 d J' g9 L/ t2 \
- #include <mach/irqs.h>
+ k+ q' F6 E9 l - #include <asm/hardware/edma.h># B8 y. m. u9 v0 R
- % \, w9 W% I! T6 [
- #undef EDMA3_DEBUG
z/ i6 E6 W2 @ - /*#define EDMA3_DEBUG*/5 H+ I2 m& ^: u# t
- % p! g5 q! Y7 i2 c; _
- #ifdef EDMA3_DEBUG% Z* }! _5 i0 x" P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 ?, l) N9 J9 l& T, I
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). \1 {$ {; F0 \+ k5 f" J
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ C7 \9 p& s+ t) \& }
- #else6 s K% F X5 Y' P
- #define DMA_PRINTK( x... )
" ~ h H3 s/ N" ~6 M - #define DMA_FN_IN( ?$ T: a8 ~' N0 d
- #define DMA_FN_OUT
. `' d/ C6 o& Q" B) z- M( E8 f! E - #endif: Q3 x: M1 M7 J6 l7 T
7 p ?) x7 b! p. x" _" Y* |- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' I V/ D& \$ G) S" u - #define STATIC_SHIFT 3# ?& S$ F: k' s8 d0 g
- #define TCINTEN_SHIFT 20
% q" l& R# c# o, f2 Y' o - #define ITCINTEN_SHIFT 21
- v% X* Q5 M: x V# T( [ - #define TCCHEN_SHIFT 22
( ^# M- O1 r. h' O; } - #define ITCCHEN_SHIFT 235 m5 O( \7 \$ t* ]8 J
3 x$ T0 U6 A. q0 Z7 T$ K- static volatile int irqraised1 = 0;
- ^2 j, E# N" j2 W; _ K - static volatile int irqraised2 = 0;
9 F9 n. U. ^4 F' d+ U+ j
) U6 U! Q# A* ^4 [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 R: }9 {, K6 b - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 N$ E" @% u# M- N) Y. s - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* }) r3 V$ v& g: i5 J - & Q( `, s& ^7 E" K \$ ~& t( m+ O
- dma_addr_t dmaphyssrc1 = 0;6 o9 l( {7 F; w8 W7 k
- dma_addr_t dmaphyssrc2 = 0;
- h% O( e" `, a) Z! B" L4 R" ? - dma_addr_t dmaphysdest1 = 0;) g v8 E2 [& g, @
- dma_addr_t dmaphysdest2 = 0;* P7 P) S/ D C$ b/ z
: t1 c- x5 I3 K- o& D3 W* `- char *dmabufsrc1 = NULL;
. Y$ n) ? D+ n - char *dmabufsrc2 = NULL;( Y0 o" o6 S3 U. c
- char *dmabufdest1 = NULL;
! L7 {! X `. _ - char *dmabufdest2 = NULL;
/ O& h7 M# q* a, ~9 u; W - $ H+ U# Z; O) c$ N' E# q& z
- static int acnt = 512;; e' a2 _/ ^9 M" g3 T% J2 E
- static int bcnt = 8;
# v" n6 O6 w8 ~" z* x: Y, F# Z& o - static int ccnt = 8;7 [% @6 k, a& X$ B0 _3 h1 `
4 v3 E7 @. O% R J3 E7 ?* A- module_param(acnt, int, S_IRUGO);
A8 j: s2 p+ ]8 N1 [, k - module_param(bcnt, int, S_IRUGO);, d3 J. _2 h# F$ Z, s
- module_param(ccnt, int, S_IRUGO);
复制代码
! A4 p0 b+ L: E9 s& U& [# Y, R' n, _) b, D' b& O1 r5 a1 n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
T% W& i+ p' j' J$ Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" O( `1 f U0 ]/ ^: y* R7 W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 C$ o, S) K7 H, T0 W
: g( s/ W9 W# }0 g1 T6 r* ^% f
$ h5 D1 j2 `$ w ~4 r, c |
|