|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # @% M1 c7 V5 y( e. c4 v
- [code]EDMA sample test application. O9 k, b x& D
- /*
, s; V+ ] }, C- o) {" q - * edma_test.c9 ]; o5 z# w' Z$ Q/ ~) s
- *
: q' k* F$ G( z, v2 C+ p3 b5 l+ p - * brief EDMA3 Test Application2 C; W* R# E* \9 @! b( @. n
- *
; A* n8 t/ x6 S5 X: X - * This file contains EDMA3 Test code.0 r# w4 h) L( w0 l( B' C% q% U' P
- *& H- f+ B% P* M
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE z* D$ ?8 V& m$ b! R1 n1 O' K& |% w
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, J, ] y, y( w% } - * TO CHANGE." e }: {# F9 j" [# S/ `# v% b2 j
- *5 J1 x( [8 a- |$ l8 p# S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( w- G+ @* g1 Z+ v& C4 g1 `4 p
- *' ]% k& r9 ~: [3 Y6 T
- * This program is free software; you can redistribute it and/or5 s4 S: J; {- \) G) A/ s0 _' l
- * modify it under the terms of the GNU General Public License as
; W- U4 {, m+ r( }& a5 }) W - * published by the Free Software Foundation version 2., @. l. K( K$ z' v; [5 \
- *
; m6 {, c- B2 ?' x9 Y+ `- l - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! K) T5 M J% u2 k6 i% s8 B - * kind, whether express or implied; without even the implied warranty }! T. D* L/ V! T$ t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( ~+ f& O6 y4 E+ Y, ~" N( G - * GNU General Public License for more details.1 }& j: U" k1 B$ ?; u0 N
- */
# \2 n* W' g1 f" s9 P( X
4 @6 I6 N( l \- #include <linux/module.h>
4 _0 J3 a! b" z& y - #include <linux/init.h>5 X! M$ p' H! P$ E( a! i- t; {
- #include <linux/errno.h>8 x& h: E1 G. o4 `3 q+ ^+ T
- #include <linux/types.h>
, V$ x% o5 A: Y1 c* P - #include <linux/interrupt.h>: B9 t2 l m7 b, y0 ?" [, l
- #include <asm/io.h>
+ p( r' h9 D0 o - #include <linux/moduleparam.h>
% Y/ Z5 G0 r" \! k% U: \ - #include <linux/sysctl.h>" Y% g0 R3 e9 H1 I, T* l" d5 f
- #include <linux/mm.h>
& k! G/ \ x# e+ q7 R - #include <linux/dma-mapping.h>" u! ^; ]$ \0 D0 q
( l; N3 }9 G; T- #include <mach/memory.h>1 ~0 V4 o! T9 S! `; p3 V& u( y5 Q
- #include <mach/hardware.h>
% V1 u) H0 F/ t# S - #include <mach/irqs.h>
* _' ~, ^) D4 G! n# \" ?4 r' ^ - #include <asm/hardware/edma.h>5 V" c% A) U+ Q$ ?9 D
- $ `0 T0 `+ O. ?
- #undef EDMA3_DEBUG5 m1 J/ L' {6 g2 ^
- /*#define EDMA3_DEBUG*/
! i' K: u8 U/ \9 h" y m( x
- Q- d4 q9 O. g: l$ w( q) k s# t- #ifdef EDMA3_DEBUG/ G% p; r' v. f
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 v0 Y" }% d& L- j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 m+ G& C/ @8 J3 | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ G( y$ }, E8 Q8 w
- #else
' |+ j% a8 [+ J" _8 c - #define DMA_PRINTK( x... )
4 z& j/ X0 x, Q& j9 M4 j: k3 {/ f* T - #define DMA_FN_IN
& Y3 L# f( {' ~ - #define DMA_FN_OUT
* h6 P+ G3 E' H- a1 x - #endif
) K$ v' M4 { j
" _/ X; L- q3 R! \( [$ O8 J* o3 w- #define MAX_DMA_TRANSFER_IN_BYTES (32768). t+ ^" \" l! `5 L4 D
- #define STATIC_SHIFT 3
0 t/ x+ S7 x, U0 h - #define TCINTEN_SHIFT 20" O1 g6 c. `' q3 U" v
- #define ITCINTEN_SHIFT 21" U0 q6 A; K' g1 c* I
- #define TCCHEN_SHIFT 22( R/ E1 v- V8 r* }) {1 ]2 g
- #define ITCCHEN_SHIFT 23
3 u D3 o8 Z) |5 Q- H; y3 F
3 e. F8 w8 M% @( C6 a E0 e- static volatile int irqraised1 = 0;+ G# j" I' [& S" Z% W4 `0 \3 ?& @
- static volatile int irqraised2 = 0;
; B2 y1 M2 s# @/ m' d- ]/ v, h
; u3 H+ G6 f" ?8 A- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ T& m6 d7 I0 J! t4 k$ W7 M8 L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% B' Q/ _, s& s4 J/ i3 g6 X
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: W1 Z: u7 C9 ~ g. F5 [ - ( N1 B8 D; V/ H3 f$ N' d
- dma_addr_t dmaphyssrc1 = 0;
8 e6 j3 m: J# s$ I5 X - dma_addr_t dmaphyssrc2 = 0;
5 [, I+ a% O% m, X8 k - dma_addr_t dmaphysdest1 = 0;
- ~ K% c/ J. y* _# r* f I - dma_addr_t dmaphysdest2 = 0;
8 D. `, D6 x) @$ R) k
$ }/ p1 D5 Y& z0 W) ?- char *dmabufsrc1 = NULL;
6 K9 L' ]5 e- i" e# I- j% [ z - char *dmabufsrc2 = NULL;
2 S. ]/ n6 w9 F" B - char *dmabufdest1 = NULL;7 N3 y* u! C! @- P
- char *dmabufdest2 = NULL;
0 o; L5 G- t" {4 W$ O
+ u$ `7 E+ ]6 f" C4 X+ f7 {: ]- static int acnt = 512;, m3 Y: |# A# c) ]# f
- static int bcnt = 8;
( @; e; y; E9 G - static int ccnt = 8;2 A: q; H2 x1 H, M" G
3 I, J( E p$ H! }- V$ \- module_param(acnt, int, S_IRUGO);
# x2 c' ?$ ~! S" |. t - module_param(bcnt, int, S_IRUGO);- Q- Q4 P+ t- k3 c4 `& G1 y
- module_param(ccnt, int, S_IRUGO);
复制代码
0 U1 W2 Y2 s; R
$ \6 e$ Q2 b% h! U8 O3 g/ m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* s8 R3 c4 t( ]' p+ a3 G% ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. \' x h8 r# }) W1 r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 G3 g' h2 B, \* `/ k9 ^
! i( {4 R4 g. s0 ?3 i* `2 |% s5 _: j
|
|