|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 Y# V5 K6 X1 i# k* Y$ _; u- [code]EDMA sample test application
# i2 Q* _, d1 m* z/ G% C" [ - /*3 ]* o1 P2 t) d( ~! P
- * edma_test.c v$ X: Z: h4 f% j2 V) P& c8 K
- *
1 |0 g. A& r: P - * brief EDMA3 Test Application1 b' ` r0 E# s
- *
! |; q% P& e& t `$ `- e - * This file contains EDMA3 Test code.
3 w, X' F; Y' w) j - *% N, L$ K% X$ Y% N# D- u# }
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 @( d! `0 I. m2 W: @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ V* S+ H/ T: ~6 R; n1 V - * TO CHANGE.
: d2 A6 t+ @1 k9 H1 N - *
3 h- L* X% c' C, T4 E+ B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 n" x4 Q" c, y
- *
* v4 J" y# R& j+ v5 j - * This program is free software; you can redistribute it and/or
& n) h# f/ K& A- M - * modify it under the terms of the GNU General Public License as
1 Z' a0 r5 j% A1 { y - * published by the Free Software Foundation version 2.. E* R& n# L% ~/ j
- *' P1 D) I* o$ W# S% J9 k! y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& o- D( L$ K3 c1 p; j, @
- * kind, whether express or implied; without even the implied warranty
3 g+ e8 F8 o/ b/ H; D. f - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 |2 ?2 C1 x% ]+ a - * GNU General Public License for more details.
. W: B" Q0 K9 d: l - */% F! o: z8 l6 t q; ~& f/ v8 V
- ' I6 _1 D5 x# ~ k1 s$ y" v
- #include <linux/module.h>
6 R9 U5 q' f/ }2 i. g - #include <linux/init.h>
2 A; N' a( z5 L- F - #include <linux/errno.h>
. ^+ F' Y; G2 J4 L& H - #include <linux/types.h>' H2 |! L; L4 C& c
- #include <linux/interrupt.h>. b; n+ p2 s# y3 ~. Q
- #include <asm/io.h>
/ l* x5 ` A. j- J1 I9 P5 E - #include <linux/moduleparam.h>& ^& d( E9 k5 K
- #include <linux/sysctl.h>2 x. Z. \( l1 ]7 P9 w4 R
- #include <linux/mm.h>
q" Y& @; o& `6 f - #include <linux/dma-mapping.h>
+ w7 I) o+ H, q& t
5 |! _& O% g. q7 a2 n! i- #include <mach/memory.h>: r! @4 X$ x! D3 ]0 Y7 E7 l
- #include <mach/hardware.h>
( \. L1 ?$ [( p, w$ D - #include <mach/irqs.h> F+ s0 T+ Q9 R( S9 w3 d8 I
- #include <asm/hardware/edma.h>) z/ J$ a6 ?6 s, q& B
* U, Y9 v- E& W Y: m4 i- #undef EDMA3_DEBUG: i8 f* \5 y- E* Q' w( Y) s
- /*#define EDMA3_DEBUG*/
3 M) ^% ~- _3 D% l$ i6 v. L
: K8 a4 z6 o4 ?" ?) O- #ifdef EDMA3_DEBUG
. ?* l! {, e$ J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ ^0 G9 `1 `% Q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' K) q/ F5 Z0 G- U8 @. U0 S7 C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& K* z, N/ a$ w! P. w) U
- #else$ G- X u7 E g& I- z* ]
- #define DMA_PRINTK( x... )
* w2 G" @) E1 D/ b2 }/ i - #define DMA_FN_IN
+ T) G$ i" d! a6 ], r" l( i - #define DMA_FN_OUT
3 b( A& L) ^7 P8 {; \ - #endif
4 m5 o, b4 p! q* n' ~1 o n - 3 V+ Z3 y+ `) C" |! i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 @2 L4 `6 w5 r1 N- _
- #define STATIC_SHIFT 3& m$ }. y" B; K, k
- #define TCINTEN_SHIFT 20
8 ^6 _, Z8 m* o$ T7 J' R - #define ITCINTEN_SHIFT 21
P( T5 y. r' P - #define TCCHEN_SHIFT 22
! Z2 G7 ?0 M. X( t: I - #define ITCCHEN_SHIFT 23% Q P% [. ?2 ?3 l5 X0 Y
- % b2 z7 O5 P1 A, V) q; z* R& j
- static volatile int irqraised1 = 0;- B" X* b! K0 G/ H6 N: L6 j
- static volatile int irqraised2 = 0;
" g% f0 I/ L' @' k$ v1 M+ ` - $ Z2 p- X3 m# p- H' z( }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! H2 l" g% O2 f& O3 j
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" ^3 F6 f& ^+ `1 P - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! {' R. y' L; v" g0 h - 2 ~- d3 V: O& {5 x& I
- dma_addr_t dmaphyssrc1 = 0;) e3 Z; y1 |5 \; B/ u
- dma_addr_t dmaphyssrc2 = 0;* m8 Q7 N: i8 o l' J
- dma_addr_t dmaphysdest1 = 0;3 [+ [( P* I. c) S3 ^ `
- dma_addr_t dmaphysdest2 = 0; q9 ]/ j1 j o% l
]( A3 q g! ~- char *dmabufsrc1 = NULL;, G8 n, r4 P6 `
- char *dmabufsrc2 = NULL;
4 Q; L- U1 Z) t- w/ P- J7 r - char *dmabufdest1 = NULL;+ j) l) }+ r# W$ b( J2 E! w, I" N
- char *dmabufdest2 = NULL;7 I6 Q2 E: n: b* a
- . L4 i A) Q+ f9 \/ O" P6 q
- static int acnt = 512;
7 f6 ?. T1 {0 L& p - static int bcnt = 8; L B6 O. M/ u
- static int ccnt = 8;
+ q2 e; j, {2 O6 ^) p* T - $ q. E. K7 c+ L9 _" a
- module_param(acnt, int, S_IRUGO);
" ^2 i6 h" T! j# m3 ~6 z5 C - module_param(bcnt, int, S_IRUGO);( l, B3 R" _; L1 J
- module_param(ccnt, int, S_IRUGO);
复制代码 3 m! T; |- K0 N0 R1 C2 y! R! J
- ^2 {: ~+ V z: w& _9 w& [ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* R5 Z# H3 n" K+ M, P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; h' D [9 @8 z6 `3 C' J 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ E" e8 ]0 s, K! P
- s' Y) l4 p( a$ ]7 Y+ e0 s
1 T' v5 u2 E0 G" h" H" t' ^ |
|