|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 C5 _ e+ h& E% p3 b
- [code]EDMA sample test application' D( j# D! u; Y% t% a8 }
- /*& T2 Z, Z6 ?& U% q! ^6 L6 \
- * edma_test.c: t& R4 Z3 m% K2 p
- *" Y1 x4 a: D6 |) {( ] o5 Z' q5 k
- * brief EDMA3 Test Application
- i% ]3 Q' X& \ - *
' E: p; Q; v8 O5 j1 l3 r - * This file contains EDMA3 Test code.+ U; a% n: B# O& X2 I$ n, _. A
- *
% |- T4 S; k6 e$ H, `5 L - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) g# ]( x3 m' k6 I0 s1 K" h2 J2 N& D
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# G; t0 T5 P; u- W( e2 O# ~
- * TO CHANGE.
7 [) E) M; H( ~' @5 T - *
7 S/ b- W4 K$ e3 J; F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// x9 O1 C! x* G& }! t z& V
- *
' D) r+ i8 j; C, O- y/ E2 I - * This program is free software; you can redistribute it and/or
4 L+ p; Z( Z0 C - * modify it under the terms of the GNU General Public License as+ c3 Q5 Q0 h' T3 x7 S9 R& e
- * published by the Free Software Foundation version 2.
4 h! M2 d9 d$ C' f) S - *6 c0 w7 |' J6 q$ t
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% f& g' c- a& s - * kind, whether express or implied; without even the implied warranty* M& M) \$ a& V K5 } n
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 y0 i4 J0 _% I4 S Y3 D6 x( y; V! k! S - * GNU General Public License for more details.% P( m! S* e% H& O1 o( ~+ @: ]
- */+ p: E: s) ]/ W8 L1 `
- 7 k4 E( X# G# O* v, V# Q
- #include <linux/module.h>
4 n" X) l4 G5 Z - #include <linux/init.h>
& x& q# o- Y: W# t4 n - #include <linux/errno.h>3 ~6 ?2 c, q6 Z$ ^7 v
- #include <linux/types.h>3 a0 [5 u! o: }
- #include <linux/interrupt.h>3 @) N, C" D' Y6 x3 L
- #include <asm/io.h>% ^1 K7 H' [/ U% z! \" e
- #include <linux/moduleparam.h>
7 D0 ~! U* c' H3 h - #include <linux/sysctl.h>
* p- {* Y! E7 a& B% ? - #include <linux/mm.h>
) ], X5 E9 e+ C; X. q$ i. J( W - #include <linux/dma-mapping.h>
# t# X$ H2 Q- _8 d - 9 X" d, g% _) O* a
- #include <mach/memory.h>& `! z& D: W5 c7 K& O+ H
- #include <mach/hardware.h>' j2 ?/ ]( ~% i/ p) S) y1 P
- #include <mach/irqs.h>
( n2 I, M# T+ {- f' z' H. K - #include <asm/hardware/edma.h>
1 V9 O0 N6 q5 L6 t! k7 K
5 |& b5 C4 Y3 R- #undef EDMA3_DEBUG
# }' t9 t" p5 ?& W; Q' r! e& T Y - /*#define EDMA3_DEBUG*/3 U& x, r$ Y* l& r' g! H
2 g. v6 o$ T4 y/ {$ j4 \- #ifdef EDMA3_DEBUG* ^4 A; x2 s2 S( V$ `3 U0 x9 t& ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ d( E+ W7 C9 r! w - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ K# R: @' l9 ^% W9 b: S) y( |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% U% o% o v; c& s6 o' Y - #else* s. }$ O a/ L
- #define DMA_PRINTK( x... ): K1 G. ]4 b" m2 G. R
- #define DMA_FN_IN7 a' U. |* Q( j' ]0 R; t
- #define DMA_FN_OUT
( G7 _6 \1 F- p# u: x6 ^/ G. b8 d - #endif/ V7 a# }8 r& J7 a8 l0 W
- 4 k/ c2 F! S! o9 e# r
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! y; w2 t. N# D6 ?3 [3 H4 W - #define STATIC_SHIFT 3
$ F3 e5 B" m8 q - #define TCINTEN_SHIFT 20 c! Q1 U, W4 g1 X* o, j! \
- #define ITCINTEN_SHIFT 21% a5 c: r: m8 F/ R% T0 T6 }
- #define TCCHEN_SHIFT 22
" c; ]' u$ L! F; n - #define ITCCHEN_SHIFT 238 _: c2 k' @& c' Y+ N
! S6 O b0 x `) R8 j( S$ P- static volatile int irqraised1 = 0;
0 _# _+ t" _( ~9 ~& C - static volatile int irqraised2 = 0;
+ d0 `+ q# ^& j ] - 9 [1 D7 C- m" ?7 t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 j1 O+ G2 B1 n - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
y5 [; {8 d$ s8 v4 E% w$ m, M) \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' f3 H) o7 s( V- |5 z# ]
" ~. t# a1 v$ D8 |% e- dma_addr_t dmaphyssrc1 = 0;
, K0 E( p9 M' u* S - dma_addr_t dmaphyssrc2 = 0; r( o( R- t5 b' B
- dma_addr_t dmaphysdest1 = 0;$ X. U/ f8 h( v4 i2 b6 f5 f
- dma_addr_t dmaphysdest2 = 0;# x: a( N! p8 m. y! Y' Q; c$ ] ~
- / E" e) Q. e7 H/ X- r
- char *dmabufsrc1 = NULL;" h* U3 ~! p7 z5 c
- char *dmabufsrc2 = NULL;
4 \! _' R% J% [' k) N: W5 V - char *dmabufdest1 = NULL;
, p7 q/ m: t) ^; t5 j; J! R, h - char *dmabufdest2 = NULL;
5 L9 }2 K, r3 V" g# L0 M - ) O* [# W+ g5 I/ Q- q4 O1 E6 U
- static int acnt = 512;
1 y0 s+ T V# w0 l* z6 I - static int bcnt = 8;- x( k- D5 q0 K4 _* ]! Q
- static int ccnt = 8;
6 n# n) h; f$ ]& n1 i/ M: s1 i* N - " V* V& i9 N" L" h
- module_param(acnt, int, S_IRUGO);
5 a& U4 ~ p8 e+ {4 K; }& h& U - module_param(bcnt, int, S_IRUGO);4 k/ Y# v; ^% p$ n% F; o) u( `* `
- module_param(ccnt, int, S_IRUGO);
复制代码
' O0 U+ z* a& M: l7 N6 B! P8 R9 i" `9 d w: w& V/ H0 W
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
O0 r! {0 r) A! [9 S7 r9 R2 Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& e z) u. `2 O% ^9 ~+ M& K
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: E6 g) @" ^; V- d3 `6 q1 ^4 p/ |- o k
6 h3 ?+ s" e; ]7 C U- L9 }; R E* i |
|