|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* {6 Q# Z; [) M- [code]EDMA sample test application
/ U' R( @+ ~/ _& k g$ z3 }3 C2 V - /*
4 w) b& B# i" n; E" Y' m% N- s" R - * edma_test.c
+ e% h* {: U! _; w - *
0 Y* w+ K x% ?3 s6 W* }( [( N - * brief EDMA3 Test Application
5 x9 I9 F, ~0 [ Z& _ - *
7 V( m( c$ u/ ]; q8 o - * This file contains EDMA3 Test code.
# s, d6 h2 D& g `% o% S - *) `) S1 F x9 Z( T" @& Z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ i0 Y, f* s7 v3 w- ?4 a% M: G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# l% V! M% I( G - * TO CHANGE.1 F8 D, d, |8 P& v2 f: o
- *
$ E$ v/ b' j( e- f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* l; ~3 v7 j: q5 A6 W' Z& n
- *
, s3 O. n% |) m6 z4 {& ? } - * This program is free software; you can redistribute it and/or$ s5 Y6 q: E( V, y- Q
- * modify it under the terms of the GNU General Public License as3 G ~4 a& q! a1 R- h2 K
- * published by the Free Software Foundation version 2.
: v$ V. y! l7 y, N - *: `- G8 y0 V$ D" |9 |: |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 M+ f/ V! a5 R" i' p+ T) R - * kind, whether express or implied; without even the implied warranty* _) F2 \3 o& [( ^' B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% N0 l# U% ^) r. B7 {
- * GNU General Public License for more details.' k! S7 S5 {7 `$ {! G9 M) U' ?
- */
" |( j* Y& w! J8 A1 r$ ~# j4 w - A" N" m- T: Y g; s! Q) q
- #include <linux/module.h># v g6 `3 n7 p8 K* z' S; q
- #include <linux/init.h>7 p* a) L/ i3 a4 I# V. Y$ V3 E( l
- #include <linux/errno.h>
9 E5 x8 t6 l5 \: T% @ - #include <linux/types.h>1 @: W% i: I1 ?2 e' q0 ?1 d
- #include <linux/interrupt.h>
0 A" B& g4 C8 t- @0 k - #include <asm/io.h>% N7 B1 I: @) Z# _
- #include <linux/moduleparam.h># d3 ^8 W" N0 C- o) s1 o
- #include <linux/sysctl.h>
, `) d; |" s' ] - #include <linux/mm.h> N+ X( D" ]6 [ m
- #include <linux/dma-mapping.h>0 O, R2 e. m c) `1 R4 l
- - ] w8 U5 H7 M% a. S- }+ G" g/ f
- #include <mach/memory.h>
( \$ R. s$ J% ] - #include <mach/hardware.h>
2 W4 U& g N9 I- N - #include <mach/irqs.h>
: {4 q, Q6 j, P - #include <asm/hardware/edma.h>
2 X) T* J8 A# ?# c# T' J" ~( ?2 w
. y; }7 v+ A' `: E# W' E. b+ p- t- #undef EDMA3_DEBUG% T; R ~) I, C9 S- j
- /*#define EDMA3_DEBUG*/
# a9 z* j: X' m# {0 J: b
4 C, C, x6 `1 x8 F0 E8 p; ?- #ifdef EDMA3_DEBUG
, X8 y. H8 K0 Y: ]+ L% Q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! C) U0 t. e, c) c8 Q, t1 J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): [! Q$ ~# ^) t, f' J' l
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: Z5 Q- F- p! R1 O, @( Z. L) e - #else
1 f( _6 d3 g& v4 D' R( K - #define DMA_PRINTK( x... )% Y5 J/ Z4 d1 q# e4 S4 k$ x
- #define DMA_FN_IN u. x: j1 Y; B4 ~! L( t
- #define DMA_FN_OUT* v" @: f0 X! c) C6 W; V
- #endif) h! E0 C$ I" f, @5 q
' r/ G3 y' y5 x/ \, D6 `- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( i3 T7 A- m4 D1 m$ _
- #define STATIC_SHIFT 3
, L* x2 K% E6 ~, {/ b/ q) b; E% }% c - #define TCINTEN_SHIFT 20. Q0 v5 N$ f7 T/ t8 \' E
- #define ITCINTEN_SHIFT 21
9 ?) T. T! G4 i# k - #define TCCHEN_SHIFT 22
' F- z2 D K* ~5 Z! B - #define ITCCHEN_SHIFT 238 e9 ^2 Q- [1 z$ A7 U
- % c+ A0 C% M7 i0 g5 H% d
- static volatile int irqraised1 = 0;
7 C& x1 S J3 \$ T - static volatile int irqraised2 = 0;2 _# y3 A; a+ ~* q5 x1 w8 A
- 5 \) H) G* q1 k6 w! g; T. ?- L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& A, u5 Y1 ?- ~1 r' E5 h
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 E# W9 X( h1 A2 U+ F* Y0 M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 g- ?4 L4 E# t. U
% P0 | R% z+ V) X/ P* j- dma_addr_t dmaphyssrc1 = 0;) Y" k4 d' u( L, H" k, Z* ?
- dma_addr_t dmaphyssrc2 = 0; ]& G; ]7 h' B: Z4 b& G, F# E
- dma_addr_t dmaphysdest1 = 0;8 f& I/ p. x9 k- S1 J! m n
- dma_addr_t dmaphysdest2 = 0;
# f7 X- T" q4 y; t9 }9 m - 0 u$ w$ r5 z% q K4 ~$ h6 \
- char *dmabufsrc1 = NULL;5 `; d4 ^. m) A6 ]$ A( b
- char *dmabufsrc2 = NULL;6 x$ a0 O% B% r4 N$ a" A5 F- P3 I
- char *dmabufdest1 = NULL;
: W" @6 W, q/ `/ l - char *dmabufdest2 = NULL;
1 C/ x6 M9 N3 X+ E, N - # ^& P7 W7 c J/ E9 e
- static int acnt = 512;
* B T) C9 C1 p' U U- v ^ - static int bcnt = 8;
' B5 n; s' h, l, o! k. f! B - static int ccnt = 8;' _5 V4 X" w; N& S( o
- ' \! \0 H% y: g, C* e. G
- module_param(acnt, int, S_IRUGO);
+ Q4 O& u; o1 s7 s( o U8 M) y - module_param(bcnt, int, S_IRUGO);
7 _- x& k6 G! l; Y8 [( p - module_param(ccnt, int, S_IRUGO);
复制代码
3 n- L7 `# U+ g7 D0 ~
' @7 f' r' B2 c$ L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ X# T" @1 }1 a5 s; X' }4 T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: j Q. i j4 l4 z8 [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; Z3 F- C! g$ F5 Y
/ N l l$ X' a* m! U& x
3 S4 {" ?; w+ L9 Y5 T' o6 B2 |4 y |
|