|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ A/ ^, R. g1 p) _$ [, H$ {; i- [code]EDMA sample test application
% [. C3 n4 X! E+ }) ^1 O - /*
' ?6 z) P9 y- B/ @. m - * edma_test.c# L; G1 r5 V3 P- j* }
- *
+ K" U* S% e; n$ { - * brief EDMA3 Test Application
( \% X" i7 Y5 \7 T/ _+ h - *
; W ~( i: r! P& U - * This file contains EDMA3 Test code.! w3 e6 F$ V9 E
- *& ]3 z5 ?; B; r: R3 x p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 Q4 g3 K1 m! C: L8 Y( q# L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! \' K3 ?- O2 F5 t6 n- N - * TO CHANGE., h2 m$ K+ D* z5 b1 ^0 d' |8 x% z
- *
) M* v% X) H4 g; @ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% l. u/ {2 p$ M/ x5 t9 z
- *8 `0 H& h7 j8 e) n( H3 Y
- * This program is free software; you can redistribute it and/or
, Y: N) T5 ?. h7 w - * modify it under the terms of the GNU General Public License as
$ R( O p) } U9 Y* \0 x - * published by the Free Software Foundation version 2.9 t" j* C2 I7 ^, z
- *! T8 |+ z1 D' \5 r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; C& o/ Y2 p9 ~. L
- * kind, whether express or implied; without even the implied warranty: J- n! _# }) ]: C8 ]4 Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- b% `/ C8 W; q- R) Q3 V
- * GNU General Public License for more details.1 |$ g2 N: m$ |! X
- */" g3 Z% o$ e! M6 g8 ^2 ` Y
- ! q0 p, C; z; Z4 T
- #include <linux/module.h>
1 t( q! k: _8 w. e6 S& k; o - #include <linux/init.h>
1 b" q2 Q& u* p& c# _7 c# T# G9 O c - #include <linux/errno.h>
4 l% x/ f1 H$ w; b6 b. Z* T - #include <linux/types.h>
$ Z8 N8 A3 X$ L+ T0 d: z i( H - #include <linux/interrupt.h>
; |1 A% `! o( e8 `9 T6 W" X; c - #include <asm/io.h>
: B3 F! x- y+ L" a4 m) p - #include <linux/moduleparam.h>
) Z" {% v; f( W0 ~ - #include <linux/sysctl.h>
3 r6 Y' p! a* f _& p* _' I - #include <linux/mm.h>
2 |9 {, n' }. {% }8 V6 B: [ - #include <linux/dma-mapping.h>: p$ [" F! E5 u# F4 F. b1 U
- 2 S, R* I8 C& S8 S* \
- #include <mach/memory.h>
3 ], ~ C& ^7 U9 m0 g1 | - #include <mach/hardware.h>
3 z& Y d" d: [$ R8 ]: j2 F - #include <mach/irqs.h>
$ B4 ]/ ~3 `0 p! P" v - #include <asm/hardware/edma.h>
U! q' Q% b8 {0 `
* H. l$ m0 v! p3 l- #undef EDMA3_DEBUG/ X4 C6 i8 J2 a g1 O4 `
- /*#define EDMA3_DEBUG*/
+ w, o$ N; M* `5 _: v - ; L5 A0 d, u w. a
- #ifdef EDMA3_DEBUG
- G$ `2 f$ } _- f- K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# |( P0 |% F( m' w) t - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' b5 i6 S4 R! ], w6 T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 ]% I! L/ n' }) x( ? - #else9 W7 P* Q, e4 u9 u! g; o4 n
- #define DMA_PRINTK( x... )6 d: T/ D; [1 N& j: h* r
- #define DMA_FN_IN
, }( ~0 Y2 L8 B# g% w" n5 `1 g - #define DMA_FN_OUT
$ B* N& d8 T: \2 m. V - #endif& J( R& l3 b% _! v+ D y
T6 [& j. q7 a3 D. K' n- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 m4 p+ Q/ B5 m0 N g/ n! o6 e# g
- #define STATIC_SHIFT 3
0 p) O) V% y( V: _ - #define TCINTEN_SHIFT 20; M' h) [6 q' x. z) Z
- #define ITCINTEN_SHIFT 21( y" t& B1 ]2 U% c- O
- #define TCCHEN_SHIFT 22
$ \$ M/ U- \& A4 i0 O9 I' o/ t - #define ITCCHEN_SHIFT 23
6 Z: }5 C6 I& ?1 h% I+ V7 i& l+ u
& p6 s- X$ O. a- m1 v7 Z- static volatile int irqraised1 = 0;9 I! m1 k# c& a6 M9 O. z
- static volatile int irqraised2 = 0;$ v- x: Z3 {$ }5 Z. C
5 S2 r, e0 i" g! [, k" @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 [6 b4 o8 Q7 z- b* S) U. o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ {6 w! z' J; K - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); B- d6 Y3 i& E1 g
; h: H. d0 T( _4 ]- dma_addr_t dmaphyssrc1 = 0;
8 D3 m, o- u; ]) V8 q7 O" j0 F - dma_addr_t dmaphyssrc2 = 0;
5 y. \4 R9 C( H4 s2 g - dma_addr_t dmaphysdest1 = 0;
2 z9 O6 K1 m+ `# H6 y/ d- Z1 \: M - dma_addr_t dmaphysdest2 = 0;
& v/ i( a) b4 \$ [( p, Y - * @' V B- W, w8 t4 f8 |8 A
- char *dmabufsrc1 = NULL;
* S- e$ w4 f# q F" |) P - char *dmabufsrc2 = NULL;
" ?) X' T7 L" `) _) A* X* K: w! T, k - char *dmabufdest1 = NULL;) s# s7 Z+ Y# v- c
- char *dmabufdest2 = NULL;
, U5 [$ `! G( w3 x - $ v* d5 u: {4 F
- static int acnt = 512;. i( E a: o; m; M7 H" J+ J! k
- static int bcnt = 8;
" N- M: Y- q3 ] - static int ccnt = 8;
0 Q- v+ B* K& \: O0 J! P. ^7 E - # |) s( s* _ q) S. E
- module_param(acnt, int, S_IRUGO);
- O' M6 a3 d2 i - module_param(bcnt, int, S_IRUGO);
v9 ? F1 ~# e* U - module_param(ccnt, int, S_IRUGO);
复制代码 / g" m0 i; S8 R( g
1 u3 v" V" j& L9 y4 T5 ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: O, W5 ~3 v: r# varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ s* k$ r H5 q; Y" w7 c4 w 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ G" u5 E) G% d
) t8 ^& [' L; l
% g8 T# _4 ]4 S2 H/ k
|
|