|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ w d2 q! q, M, l2 M0 b" S& X0 [
- [code]EDMA sample test application! x6 x. l* l% E) o
- /*
* {0 m3 O% c- G3 Z; ] v - * edma_test.c8 r6 i* O/ E j' n. f5 `5 ?8 f0 y
- *
0 ]0 I- \1 V0 k - * brief EDMA3 Test Application r* ^* K u5 D0 l/ |5 @
- ** l) `! z% Y- M- y' Z1 W' f
- * This file contains EDMA3 Test code.. h5 |+ }7 u' o) z
- *
4 ]% G) }2 L3 N5 g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& p ^& c6 R. ]2 ]1 N: H- H1 h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 c9 Z. x/ n4 u2 g - * TO CHANGE., c" p* F; M8 H5 l: R
- *
. D; P: Y/ G- ]. K+ s$ d - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 W8 y6 m! U* E8 E- f5 M8 _. X - * p$ |& K; ?% j" E* r" g3 B B7 r3 ^2 l
- * This program is free software; you can redistribute it and/or
0 y( ]* F; l k- ~, m" T - * modify it under the terms of the GNU General Public License as
5 G! l/ h) N; `" I - * published by the Free Software Foundation version 2.
/ F- h) N q H& ? i# B - *
+ v0 H& j% A! D# t+ A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 y; d7 f5 e* a# q( S
- * kind, whether express or implied; without even the implied warranty: J( s* B, z% N4 q3 t" i4 d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; E3 U2 C6 ` O7 I; g2 P6 P4 ]
- * GNU General Public License for more details.1 g0 N' {& b; ?9 f
- */4 F' i A5 J" C+ @+ I
- ! r2 e' ?% Q' z m
- #include <linux/module.h>! H* A& ~' g7 T. p, q
- #include <linux/init.h>$ Z; i( S& X" N% Q" d! y
- #include <linux/errno.h>
& }: G8 V2 ?; @ - #include <linux/types.h>
5 f( ] e0 e$ U0 t - #include <linux/interrupt.h>
, }, p+ W4 k, i0 C3 }+ W. z' j - #include <asm/io.h>
0 H0 p: m% M( Z - #include <linux/moduleparam.h>
5 {2 q: A d" N1 \ - #include <linux/sysctl.h>
5 ?0 k0 V, j) ] - #include <linux/mm.h>
# ?4 |* o2 \) T! F - #include <linux/dma-mapping.h>" v2 I' d" v$ B) ^+ B: i
- % l* D3 d( U+ w# Y C% ?" V
- #include <mach/memory.h>4 \7 t) ]. C1 q+ M- Z+ f( s5 U
- #include <mach/hardware.h>
) E: u3 M( R: y/ V - #include <mach/irqs.h>8 B3 M4 ?, h+ h/ p8 }7 W
- #include <asm/hardware/edma.h>2 T/ m* W. j1 ]$ Q+ V- H5 v5 K5 N
- / y0 C( U# z. f3 z( c# A' d7 a7 \
- #undef EDMA3_DEBUG
; w/ c' d; K/ @ - /*#define EDMA3_DEBUG*/% r8 R8 ?) Y- f& X( Q
- , v' c9 v) \5 a9 [3 W5 d. a
- #ifdef EDMA3_DEBUG
5 n/ j( x3 ^; O2 g; z6 H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' W/ ^" [, x- H$ |1 \/ g; k
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ W, S6 W! K, b. q. \* z0 L9 U6 N3 ^
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' ?, J7 s3 |; @) {, A
- #else
) t1 W5 V3 l: }+ B/ P/ q - #define DMA_PRINTK( x... )
, N/ v+ `. c: } ?( J: W - #define DMA_FN_IN& f8 ?/ t0 C- R. J7 K
- #define DMA_FN_OUT/ p2 l% y }( R6 z+ _( o
- #endif
- O1 x' T) g# | - 3 Y8 N& e; e0 r" x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! u% ?5 F3 B: e - #define STATIC_SHIFT 3
; @3 R9 S9 v+ t - #define TCINTEN_SHIFT 20
0 Z6 y- m: |& p4 ? - #define ITCINTEN_SHIFT 21$ G7 p R' ? n
- #define TCCHEN_SHIFT 22
4 e2 w$ G* q/ x( Z% T& i - #define ITCCHEN_SHIFT 23; F; o" O* [8 R7 Y- w
- $ Q% O* C9 P; B- S
- static volatile int irqraised1 = 0;
! E, B9 j5 K( E* K) W3 S - static volatile int irqraised2 = 0; M+ N' B4 M' e( _
6 C: e0 H2 O9 o7 ]+ o# ?' q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 E( A; D0 Y4 p; ~ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 G3 @1 C: b' h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 P+ @) y9 T5 F! [: ^. e. r
- 8 s; O% _6 s( q8 @
- dma_addr_t dmaphyssrc1 = 0;/ p/ k. m" v3 Q* I0 D3 P8 m2 L6 N
- dma_addr_t dmaphyssrc2 = 0;
$ O3 Q# K9 R* W: B) b - dma_addr_t dmaphysdest1 = 0;
# a5 w3 \) c0 x) Q) W - dma_addr_t dmaphysdest2 = 0;
- f1 P7 @# v" M4 C; Y. Y$ A - : j7 N; o5 c# @* h5 D* E# I$ I
- char *dmabufsrc1 = NULL;% R% ^ [# H0 t* h) B
- char *dmabufsrc2 = NULL;& k4 C# H0 t- s/ ?
- char *dmabufdest1 = NULL;% }0 Z; Y6 t' _. _( ]* ]
- char *dmabufdest2 = NULL;
+ n* T, e% L' T1 }3 p V - & H7 T$ a5 M, ~/ D
- static int acnt = 512;
0 f3 N; c% \- k) _9 { - static int bcnt = 8;5 p4 A7 B8 u* o
- static int ccnt = 8;2 w( G0 y9 L7 [8 `8 w# I
- $ L W/ C2 Q, E/ O5 u
- module_param(acnt, int, S_IRUGO); Q+ u- y. g$ y; }; r+ b# K; U" X
- module_param(bcnt, int, S_IRUGO);
$ _5 y& T* D- Q' C$ ? - module_param(ccnt, int, S_IRUGO);
复制代码
/ j* R3 g. R# J* j9 u0 z& h6 Z- h" S
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" g6 ?, G$ p. D+ Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ c9 z W. i" i7 F1 m; d* I* H, \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 @% k# [3 n7 @7 P" P: J
# r5 U8 S: M+ f6 V" ]8 F8 \0 @ Z: Q
|
|