|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" ]: K4 r8 C- j1 y% g0 d y- [code]EDMA sample test application+ _+ ~3 f' E* t$ `1 y7 t. {
- /*& n0 s$ h" X& W- w. B9 c/ F
- * edma_test.c
& X( M% G) Q% D3 F7 ` { - *( p0 y; j9 e) E/ P3 e
- * brief EDMA3 Test Application; y# h. n0 y: u9 l
- *+ m+ a- [2 F, F$ J& K9 E
- * This file contains EDMA3 Test code.! l+ G0 ^; G1 V8 g7 }' I
- *: Z9 f4 B0 C& j$ l8 X$ ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- y B) Q& k$ k- Q- u: [) _( n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ @0 p/ N' n8 v! q; W6 y
- * TO CHANGE.; l7 u) b3 Y" \9 v# O* Q5 a
- ** H) h1 W" N7 x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" ?6 j$ A2 i5 u( [, d' }2 x0 y% g
- *. x& l5 R5 o+ s+ y
- * This program is free software; you can redistribute it and/or/ u- D: u' b4 C+ K2 r' Y+ ^% h
- * modify it under the terms of the GNU General Public License as
- M" {( D6 C" Y9 B; I - * published by the Free Software Foundation version 2.
8 H5 i' M: E1 q8 ]: s" y0 e - *
( K5 X& y/ s% y* O f/ i+ i9 k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ H* d, w2 Z/ ]8 V - * kind, whether express or implied; without even the implied warranty
; S& o3 Z4 d0 @/ S0 F4 k4 @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& E+ L2 t# {9 b. j3 U - * GNU General Public License for more details./ j) i$ c9 [3 z+ G7 H6 R5 z
- */+ s! ^/ P: [1 e& w
8 X& d1 d1 \% q- #include <linux/module.h>
6 x: E: P |% \ ]0 a& h+ o - #include <linux/init.h>& s* c3 U& J' E) K$ a# a& P
- #include <linux/errno.h>, h. M* n9 T7 s# Z0 |' n
- #include <linux/types.h> e( j. c; G B7 l+ q
- #include <linux/interrupt.h>$ W% S7 v6 ~$ |7 y3 X
- #include <asm/io.h>+ e- q% w7 j! r$ T+ k
- #include <linux/moduleparam.h>1 S7 t7 d; L; ?4 i$ Q/ H5 S
- #include <linux/sysctl.h>
. G: O- ?- ^4 X( p - #include <linux/mm.h>) z4 S3 Y' F+ [2 m Y
- #include <linux/dma-mapping.h>
0 f ]' [' O$ x - 5 S) ?' r$ V; _0 z# V" e+ Q0 K" }: }
- #include <mach/memory.h>$ | e7 W- K: b% c; t& l
- #include <mach/hardware.h>6 K4 v* ^ n( r
- #include <mach/irqs.h>4 b* Y0 Z) j5 ~! L6 S0 S6 C
- #include <asm/hardware/edma.h>7 z& P% j D2 G- e3 R( o
/ w4 s" G6 Z5 N' O* d- #undef EDMA3_DEBUG8 e) G0 B' k1 v& `% }9 d
- /*#define EDMA3_DEBUG*/# M* R$ i) r* I9 I
9 K4 n/ k! ?! Y! y6 ~) R+ d. R- #ifdef EDMA3_DEBUG( P. l+ M5 b; s. ~: n
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 W6 w: E; |; F8 i! ?
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): D, p9 R: Y/ r5 F A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# n* Z. a7 i! E' J* \! ~ - #else0 E8 }+ c' H- G) r# L0 n* A
- #define DMA_PRINTK( x... )
* R# a: Y! I& G2 T) y7 Y - #define DMA_FN_IN0 e! @8 h1 A4 ^3 m- l6 \- e
- #define DMA_FN_OUT
5 \4 W7 I1 }5 v9 G( P$ v( t - #endif
7 }5 O0 Y; \, p - * W4 @3 W3 J# L. e1 O+ ^& \" m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. t2 t( a& B! \3 ?" T, r - #define STATIC_SHIFT 3
$ L" E; y [$ o+ d - #define TCINTEN_SHIFT 207 W# u1 j# i$ y# }2 N" S
- #define ITCINTEN_SHIFT 21
5 a( e! m8 W) d - #define TCCHEN_SHIFT 22
* {2 `- k# Z3 F! ?) `' d/ E - #define ITCCHEN_SHIFT 23
2 L: _4 h5 y' c% |" [& [* W+ c - . O& K0 V" _3 i# C, @
- static volatile int irqraised1 = 0;
: R- B# n' \" t! _ - static volatile int irqraised2 = 0;
2 g( H; L4 Q) u- X3 o O6 C
$ L5 R8 Y7 j4 ]3 d' X- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 Y3 [$ X- |' W0 r
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' F9 V& B# h7 h! ~$ B1 x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, p) x7 r" M! J; A; y {: [7 H
- 5 W4 A3 O6 b2 k0 Y3 P2 I
- dma_addr_t dmaphyssrc1 = 0;$ O% U" H" ]5 L$ [. I
- dma_addr_t dmaphyssrc2 = 0;$ ?. k9 V; z0 B; ^: J! ^* W
- dma_addr_t dmaphysdest1 = 0;
6 ]& z5 k( ~0 d - dma_addr_t dmaphysdest2 = 0;
# t+ X0 |0 P5 G$ D/ a+ V4 D - w/ L7 E* S& E* e2 M+ q/ C' T
- char *dmabufsrc1 = NULL;& T1 i; a# `1 ]% G# ?6 Q. X, l
- char *dmabufsrc2 = NULL;
, ]/ m3 O4 M% G5 d - char *dmabufdest1 = NULL;5 t8 A9 `& r4 q5 s' y3 |
- char *dmabufdest2 = NULL;6 \) D8 M0 ^: V' K4 v% z8 [
- 6 ^7 r! W, g7 {5 C& t
- static int acnt = 512;" }# p/ h3 ^( x# s( J( p
- static int bcnt = 8;" t6 K. W S" t6 Y/ }8 `7 z! x/ F
- static int ccnt = 8;. J5 J! P( H% J4 b5 [' ?
' @, Q* B9 ^2 _- module_param(acnt, int, S_IRUGO);
# V- B* c# t" i* w' u - module_param(bcnt, int, S_IRUGO);
( c( X9 f9 z# a, {* w4 u - module_param(ccnt, int, S_IRUGO);
复制代码
. ]% l$ x* Q6 |+ U
+ ]0 ~5 e2 o- U% d& Q A 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
\; s9 [ r9 L0 ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. l- n+ Y: p& L k. n2 E" O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 L: j$ R) O7 ^' q. p% o6 m9 S! p
4 P$ n2 _8 l) E- ]- S" F& b M$ p# J
|
|