|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 P0 g1 R/ K, ?- M2 k- [code]EDMA sample test application4 |$ N( g# [/ n: t$ h3 c- [8 [
- /*
' x: V: O& a/ ~* x - * edma_test.c
8 w s& K9 w! R8 r - *
: b8 M( o/ |# }" o# p - * brief EDMA3 Test Application4 q; a6 j* D2 q
- *
. [: y2 a& l5 ]0 a" `( [) q3 S - * This file contains EDMA3 Test code.* p+ ]; [/ \/ R: \6 a
- *
% r- `' r ^4 g3 A6 h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! e+ _3 b) c6 U$ E' U( O
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! F5 ]: ~, h9 n
- * TO CHANGE.
e0 C1 G6 j5 h$ V% m) ?: Y+ u* a- j - *
8 ~" k( j5 e# q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 |# [: O2 x Y# A( i
- *5 V2 O" d7 C8 d6 a
- * This program is free software; you can redistribute it and/or7 |2 @/ k5 i; N
- * modify it under the terms of the GNU General Public License as& \! R$ I# \$ I4 S- T
- * published by the Free Software Foundation version 2.
# P5 L; w: f/ i/ N - *
/ k2 w; U8 H2 w% D( Y! Q1 b7 o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" P. ?) B+ A; d& D- Z" y - * kind, whether express or implied; without even the implied warranty, [4 [& I( Q$ M& j9 E1 S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 J; r( K- T; P6 }( R3 Q5 f - * GNU General Public License for more details.9 |( j9 N# v ^& K9 d, _
- */) }5 U* y" s; t( S
C4 R1 s# Q! k% }+ z3 m# P( T- #include <linux/module.h>/ V( ^. `& C( z% h4 n/ D) U9 p
- #include <linux/init.h>+ ^4 ]6 M# ?% R
- #include <linux/errno.h>' t( n" B8 k: ]% }# G5 K. O5 P
- #include <linux/types.h>' M S; J" R; u9 g- K
- #include <linux/interrupt.h>4 p1 u3 `( C# E' H
- #include <asm/io.h>2 F* l: g0 n. ~. T" K- _- W7 b4 P
- #include <linux/moduleparam.h>
0 v$ X! @5 r* M- i" q. G - #include <linux/sysctl.h>; N$ A: c/ K5 A" g- |
- #include <linux/mm.h>
( G5 ^6 S+ `! O. M9 n ` - #include <linux/dma-mapping.h>
9 U+ N% j8 u! M+ q! `, V
/ ^5 s* t7 L5 V3 `: y- #include <mach/memory.h>( Y8 H/ h" x0 }/ @
- #include <mach/hardware.h>$ g! }0 v" j8 j; `; L8 O
- #include <mach/irqs.h>; |3 r6 v" f$ H6 q
- #include <asm/hardware/edma.h>! z0 k# E ^" k4 K6 ~/ I
- d: i; N% v# T. P+ L2 @+ a% s6 S- #undef EDMA3_DEBUG
2 K+ B; h: m6 S( D5 D - /*#define EDMA3_DEBUG*/0 K( J8 c% A7 C3 u' @
3 t/ \* f( a# G# T& Y% b- #ifdef EDMA3_DEBUG! x& L! f; ]7 E, s2 Z$ Z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 I0 Y) ~1 S- ~5 f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& B3 `" `, f8 q+ I# G+ q# y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 a& d' Y; @1 ^# p6 U( \+ P0 i5 d - #else. Y6 v& p+ z. F# h. k5 X! t
- #define DMA_PRINTK( x... )( y5 J( u1 ~" \% e3 p& e
- #define DMA_FN_IN2 h$ t+ t) Z8 ?" \% p% t9 D
- #define DMA_FN_OUT
' Q4 y+ ^6 W5 u; c - #endif
3 P( T% }# ]7 h1 L$ U8 C p9 G' D - ) c% }# g$ Q+ x% d0 r U
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* W* [! l% w' d* {( ^( F! r - #define STATIC_SHIFT 3
5 o' r8 ^2 h' b- E7 N8 |, k$ Y - #define TCINTEN_SHIFT 207 @$ T+ W, u4 c3 F3 y% J& ?
- #define ITCINTEN_SHIFT 21$ t+ a5 h& B) z7 _
- #define TCCHEN_SHIFT 22* J) s$ E( L. z x* G
- #define ITCCHEN_SHIFT 23
- }9 [3 y- c6 y
/ f, Y7 F( I) T/ N' j- static volatile int irqraised1 = 0;. ^. c2 N& `! u# b: o5 G% V) r
- static volatile int irqraised2 = 0;6 y; a2 u5 L- e' ^3 P( Z0 o
8 a: A1 c" g+ m' O- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 _7 E1 u! m0 {+ Y6 E - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& U9 s2 U5 U1 t! Z% } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# _/ x; }% |3 J! d9 k& o - " w0 C5 y' h R3 b/ i
- dma_addr_t dmaphyssrc1 = 0;- Z9 s9 w& z1 k0 l3 _
- dma_addr_t dmaphyssrc2 = 0;. H+ T+ G& |2 G/ n
- dma_addr_t dmaphysdest1 = 0;% `( z) v0 v! t' a2 b0 V5 A8 j
- dma_addr_t dmaphysdest2 = 0;; h3 e$ F3 i% f) P0 i. ?
5 m [ i/ h. L3 c! h: F* ^) _- char *dmabufsrc1 = NULL;! f3 s% y# u# E, s5 [4 Q; F7 |
- char *dmabufsrc2 = NULL;
2 ^" c4 u0 @5 v1 x: C1 ? - char *dmabufdest1 = NULL;; h# S. P4 y+ F" u0 q* t
- char *dmabufdest2 = NULL;2 {: ~0 m" h3 d) b5 P+ ~* v* K9 e- D
$ @0 i% {4 O4 Y2 g, X5 s) c- static int acnt = 512;
, V) {+ ~4 f8 w% V! m. \: \ [6 m - static int bcnt = 8;/ E X. n8 c. X2 ^
- static int ccnt = 8;1 E3 p. E* H: g5 p
# {! h; k ~8 ~/ j A- I. x$ g* ]- module_param(acnt, int, S_IRUGO);
) l3 |& t- r/ g& \/ o/ _7 m - module_param(bcnt, int, S_IRUGO);
3 j8 G. N! h) B# `* T8 F( e - module_param(ccnt, int, S_IRUGO);
复制代码 7 s6 N; g5 ]% J% c
' s) V1 v3 K( j9 E& f9 M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, Z& Q. g/ k- Q. F; G3 v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 g$ H! M, a' F8 ?- U( ~4 } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 `* `( _# T- D0 a& C
F8 Z/ ^8 ^: A1 A1 r. ^8 A/ ?$ E
I3 N6 g' p1 d# I: ]$ N; A6 D
|
|