|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 b1 F! l% [: _0 o& f1 g1 S; o; P
- [code]EDMA sample test application! U1 a! g+ @/ Z6 n$ ]8 ]
- /*- S* b5 M) C9 G+ j: P. J
- * edma_test.c9 c; ]/ _' D9 J
- *
5 Z3 l2 s, {7 Z& h; r! y - * brief EDMA3 Test Application1 f% R. `3 K& a5 y5 H, R. B
- *
6 @' q4 u. @6 a$ \1 B4 i0 I' Y7 @ - * This file contains EDMA3 Test code., a+ A9 {" I- T7 }1 V
- *7 J9 ~ l9 N# h. x# z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 s# R4 g' ~+ e/ V+ ^, M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# o/ {+ t0 K* W$ ^, U3 l - * TO CHANGE.$ d& b' a4 p; Y2 B, F; Y( g
- *( \' R- V, D* P' O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 \- }0 U. _; a; r - *
: F* ]- A) h# f - * This program is free software; you can redistribute it and/or9 n" [5 X. f1 |; E% f+ Y
- * modify it under the terms of the GNU General Public License as
5 [3 o; A7 e+ D k - * published by the Free Software Foundation version 2.7 O* ^" e& J" p& c7 Z
- *
7 L0 D& d$ `2 I9 g/ N9 r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- Z, O& i3 W' v
- * kind, whether express or implied; without even the implied warranty2 `6 s9 [ ^: u1 U# q& L8 _* \
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& {8 O* ?% u3 A4 y - * GNU General Public License for more details.
. `' [& [) Y* Y% o8 v - */0 M( @ p" {* c1 q' K
5 L1 K f3 y2 H7 k2 P6 h# S. D% p* @- #include <linux/module.h>
: E' W# U. h+ B; L7 l. l1 y - #include <linux/init.h>
9 P. Z; T7 U+ ~. l/ D: L7 } - #include <linux/errno.h>! M; p1 x+ |8 Q, N6 K
- #include <linux/types.h>
3 P; h% ?- k4 ?6 m - #include <linux/interrupt.h>5 F5 _ j% P; N+ ?+ @
- #include <asm/io.h>" s1 s7 o. J; }- L+ j8 h' V
- #include <linux/moduleparam.h>
; k, t& z0 P- S5 {! U - #include <linux/sysctl.h>
/ i4 z% ^1 H6 y# m7 m- ~. ` - #include <linux/mm.h> q0 x& ^3 W$ H2 u2 m
- #include <linux/dma-mapping.h>
; i8 v* L5 v! y/ W0 `- N5 R0 H. i
2 `0 o2 k$ u% x0 e; O. X- #include <mach/memory.h>5 r% ~, T, c. @) c* L: Q* |9 L4 \
- #include <mach/hardware.h>
/ j0 q. I& U3 F% ~ - #include <mach/irqs.h>
" ~ u/ F8 ~3 V2 K6 {0 A - #include <asm/hardware/edma.h>6 @; T( q6 `. R+ B# h% Y& K- b
- # `6 w8 ~3 G, q/ R5 {
- #undef EDMA3_DEBUG( n$ x/ h# z8 `2 c9 J
- /*#define EDMA3_DEBUG*/+ W/ V1 q$ U7 K$ z4 q$ y$ p7 T
: c( O7 E$ I5 `& I, M- #ifdef EDMA3_DEBUG
4 j" n. N2 t6 Q( P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) J; ?2 v* M I2 _9 q5 Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ p2 L; X, Z* N' h8 f# |/ E
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) l- e: {5 b0 l) r1 J$ Y4 ]4 w1 K- o - #else
" A0 X) c" _, n2 C1 c6 g/ D - #define DMA_PRINTK( x... )
7 @4 \* n K x - #define DMA_FN_IN- J" ?% ]/ L0 j @/ O' A6 m
- #define DMA_FN_OUT
& D+ |6 \% g2 C+ [, z - #endif
6 j5 _8 M' h; v6 i% f7 L) z - 3 a E+ J( Q0 G v i, t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* N! \2 w/ w- n& V9 l - #define STATIC_SHIFT 3
7 [1 f# l, a3 z4 s; A, i - #define TCINTEN_SHIFT 203 Z O9 \1 m: z0 |# H: B- A' c9 ]
- #define ITCINTEN_SHIFT 21
$ E% [& j$ {/ J0 u5 d4 A - #define TCCHEN_SHIFT 22; _- q; h v4 H1 i }
- #define ITCCHEN_SHIFT 23% ~ D7 r& f/ B Q7 \% V; z
- 1 V8 X$ U, [& s
- static volatile int irqraised1 = 0;
' O" y# U8 b" ]/ ?( Z9 l - static volatile int irqraised2 = 0;
# ?6 k0 \( k0 a2 i* O7 p: \: W
0 t; |, K- T' f Y6 E/ N% @) @1 t- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) p! t; ?1 ` R1 ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ V3 s. c9 e/ k+ O$ z6 X, K% M2 o3 ?, t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% d) o: k$ S9 O4 I" C# R; ? - + Q6 Z$ |" g8 I' X3 \, [$ N
- dma_addr_t dmaphyssrc1 = 0;
: @/ _. }5 O1 Z! o: | - dma_addr_t dmaphyssrc2 = 0;9 a" C5 g; u) w6 c- r
- dma_addr_t dmaphysdest1 = 0;+ l E3 n/ A0 Y6 a% k' X
- dma_addr_t dmaphysdest2 = 0;
$ X O9 P2 `9 ]3 X G# _( u; P: f/ _
) w; N, J6 d* W8 j0 U& C. ~) H# ?1 l- char *dmabufsrc1 = NULL;
) F6 ?% ^0 X% s, k+ S2 c/ B% W' T - char *dmabufsrc2 = NULL;: _( J7 ~# F& P$ L2 _1 Y
- char *dmabufdest1 = NULL;6 J1 ?7 D o; y# C
- char *dmabufdest2 = NULL;
7 {2 c) A: X8 ]
- P$ x0 W5 U5 s. \' b% J- static int acnt = 512;# W! `' C! X* l
- static int bcnt = 8;' f K5 x) g8 Q9 R, }
- static int ccnt = 8;5 K) ]8 I, q; t8 q
7 {/ t: i9 {% o- module_param(acnt, int, S_IRUGO);. [( f, e" I$ J" H1 w0 _
- module_param(bcnt, int, S_IRUGO);* _1 n* u* D$ E
- module_param(ccnt, int, S_IRUGO);
复制代码
5 N, m; _* g q: o
: m+ D! d1 u0 f 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 Z/ \" V) V: L; e( h9 {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 D# Z$ h) j, T8 Z4 C. q- d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 C2 t' S' e& B$ |
" g f' ~7 R0 O7 ~- R6 `) d7 Q7 B3 Y; v% T; \6 Y! O
|
|