|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " }( c/ k: w( m7 U
- [code]EDMA sample test application
1 v# C4 r3 X, d4 @ - /*
$ N5 R5 V! S+ a4 O - * edma_test.c
3 F* H) r/ w4 _8 p - *2 z2 j: l! e0 j5 O& p+ l/ C
- * brief EDMA3 Test Application( b$ ~7 x3 P0 {; ^" \
- *: K! t% D$ \1 y; K' t( j1 ^2 P; U
- * This file contains EDMA3 Test code.; G! `% ^+ V! j0 |
- *
5 y. Y4 s/ j# t4 J8 g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" f# L4 P c! \# K/ V& j3 F - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 g3 O( }5 Q1 A& m. W - * TO CHANGE.8 G% Q+ h m, E3 N3 e2 u: M
- *
: e2 ?) D% v+ ?/ E7 p - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' d* _0 B# w+ O: G7 N9 i% Q# T
- *1 [8 o: m' Y9 L {& n/ o9 w
- * This program is free software; you can redistribute it and/or2 L# U& W" h7 G) u, P" V- i
- * modify it under the terms of the GNU General Public License as/ \8 c( Q( ^ {+ \$ ^
- * published by the Free Software Foundation version 2./ ^0 h# a5 g3 L* W' `
- *+ R# b, v+ n& H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- }& Q8 ]. v! t3 N# K2 ^; ? - * kind, whether express or implied; without even the implied warranty/ h1 u3 {) ]8 [" t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ c; d9 X6 I; V! |1 ]- |) _
- * GNU General Public License for more details.
6 x/ g/ k: w! x0 T; ? - */
8 [# w* f1 x6 A
' @# t& y3 U" }% i- #include <linux/module.h>2 A. v8 f: M- A0 @" |4 U
- #include <linux/init.h>
0 r Q3 q: G: e+ F - #include <linux/errno.h>2 l4 M0 W; u7 E; _
- #include <linux/types.h>0 w+ v* l, B9 G: M, ?
- #include <linux/interrupt.h>
4 F# Z! [, d, \* J: ?2 C3 a6 g% w2 c - #include <asm/io.h>
& O) c4 X3 q$ x( ]5 |- }; n - #include <linux/moduleparam.h>; {9 X, ]5 q2 v) P! d6 q! ]/ [
- #include <linux/sysctl.h>$ }! i& Z/ X# X% k2 `* N
- #include <linux/mm.h>
. X1 g+ ~+ B! E7 x% T0 E1 h - #include <linux/dma-mapping.h>
8 R+ t e, O: F; l - 3 D+ Y) A0 N3 |7 k
- #include <mach/memory.h>
0 B; W) b5 Z/ y. m% `; t5 I" W - #include <mach/hardware.h>, H) u7 f; E% P, T0 y1 C
- #include <mach/irqs.h>
6 D* O- u7 k: @1 t; e9 x: H - #include <asm/hardware/edma.h>' y# j+ [/ ~# c- k
) J) l; H, w, G# y- #undef EDMA3_DEBUG0 c! e+ w6 _$ l' H. d- s1 ~
- /*#define EDMA3_DEBUG*/( T+ a7 I4 c: p/ j
8 ]% R3 E' ~/ D' q( h9 O- #ifdef EDMA3_DEBUG
* u m P" l( l - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 w( Y" Q o+ f, W, S4 P2 U2 x" V/ O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' w8 v( }& `8 } I
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* e" C( r, l* M# v ~* Y2 g: z8 J - #else
y `! [5 R. @0 F' ~7 ] - #define DMA_PRINTK( x... ), a6 e/ w+ G+ A. ~- u5 V0 C
- #define DMA_FN_IN7 c+ U; ?$ ? i9 f. m
- #define DMA_FN_OUT
' R9 d4 j) M: i2 Q3 j- f - #endif/ q9 r8 @6 ? Y/ Y( r8 k
0 m" k g8 S) f& P- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 z, s+ L' [3 ^9 T# Y
- #define STATIC_SHIFT 3
5 a ~! P* a9 a - #define TCINTEN_SHIFT 20' M$ Z& I; g- i* Q( v3 s
- #define ITCINTEN_SHIFT 21+ r1 ` }) t/ U, V( {
- #define TCCHEN_SHIFT 22
. A( z% G( r0 t& e7 W - #define ITCCHEN_SHIFT 23/ W h2 ]! R6 q4 W! H
- - m: j4 I/ o8 v/ U- Y
- static volatile int irqraised1 = 0;
, j- n; I+ Q1 O. |+ ?# v - static volatile int irqraised2 = 0;5 ?+ I. A- f7 G9 ?, _
- : h7 L3 p b; a% \' z" }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ @! w5 Y% X! ~0 r& m" u, @8 B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, [9 {; e8 j5 } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 A/ I6 L9 b6 A% Y2 D j - 0 W6 v, I* E( H+ o3 q' J
- dma_addr_t dmaphyssrc1 = 0;
: N9 D! u9 c+ `/ p! g; }, E& \* \ - dma_addr_t dmaphyssrc2 = 0;- M% r0 U# g7 K2 j0 O2 n5 F3 N
- dma_addr_t dmaphysdest1 = 0;- }6 ]6 v8 F/ [3 a% c, N6 z! }+ S+ l
- dma_addr_t dmaphysdest2 = 0;! ^& A! @+ F. s. _, a
- " ]3 [& J' `0 b+ i
- char *dmabufsrc1 = NULL;3 r! V; ?( W0 o3 H
- char *dmabufsrc2 = NULL;
6 d2 f- H/ C5 g W; p( o - char *dmabufdest1 = NULL;1 y% M1 ]; `) W; S6 k; ^
- char *dmabufdest2 = NULL;" v+ n$ F$ }- y2 s+ c6 g: l+ V4 ~
- 2 u/ v0 B! K9 H6 J! w4 B( k2 v1 J
- static int acnt = 512;
0 b) x, d9 U/ L! t# Q( V - static int bcnt = 8;9 I" G, C- g V6 ^, e! R) j
- static int ccnt = 8;$ l# G: r, c$ J# N' Q6 j! R
- {6 w/ }& g3 H0 w" L- module_param(acnt, int, S_IRUGO);
' x! w3 J! S' o! e. d% i& }' c - module_param(bcnt, int, S_IRUGO);
0 O/ H1 }6 F- p/ \ - module_param(ccnt, int, S_IRUGO);
复制代码 - `6 S0 K* V1 \5 @* H# q [2 x
: \) v: [5 K* d( ^; v. o& k
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. X! ~8 P* {. P; O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 x, P2 Y7 O: A! A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* X' w" V% ~; `% v
4 K; M$ }# O; g2 |* }
+ _9 ^* ] n: j2 D* L |
|