|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! f1 w) W" o0 o( J
- [code]EDMA sample test application
3 i7 O! G F* @5 j5 i, v4 f - /*! |# c. V. R5 O: l
- * edma_test.c
u4 `- _7 B7 h6 h0 Z" a - *# C! a- @4 i9 v" g, v3 \
- * brief EDMA3 Test Application: l5 `+ A9 F* p, Y) m: F0 M) O
- *
8 f; W, i5 `0 B6 q9 W2 i, v7 t l - * This file contains EDMA3 Test code., X8 W9 u/ w* R
- *
. f6 N$ j+ S: D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" z; a# {6 y3 K# q4 b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% F) j, @! ~) |3 g7 J/ k% N
- * TO CHANGE.5 Z& j% o1 Y1 g2 f t3 D# J
- *
( j1 O9 ^4 s { - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ I$ B, ~$ f5 l, A. A2 _
- *
) f* l) p2 S5 e/ B$ A) R - * This program is free software; you can redistribute it and/or6 W9 U3 ]. o6 Y0 H
- * modify it under the terms of the GNU General Public License as
: ~" x7 X$ ]3 l; f! I/ O8 j - * published by the Free Software Foundation version 2.4 I" D) M4 m! |$ V) Y
- *
) _& d% N3 I8 V0 b& o4 s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 G2 e( z8 |8 v& J" D# b - * kind, whether express or implied; without even the implied warranty
9 `& s: c: i, N& O. z+ d& ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 ~2 } k3 x+ m- T! V - * GNU General Public License for more details.
) S& `# i. e! x. n - */
3 [# ~5 j6 n m2 E - [2 e6 r+ E% g6 C
- #include <linux/module.h>
& [: I* a" `$ H% p - #include <linux/init.h>$ |1 U; J9 f C3 G' @. S& C# ?
- #include <linux/errno.h>
' M |; T- G" W# A - #include <linux/types.h>
0 j4 u8 } l) T& B - #include <linux/interrupt.h>
" g, r+ Z3 f' P. [ - #include <asm/io.h>1 s6 u3 Z' I7 Y$ F5 z$ B
- #include <linux/moduleparam.h>
+ Y/ z% Z/ X! R3 G) E. M1 @. ^ - #include <linux/sysctl.h>
% a) @ w% a4 T9 m! g" m - #include <linux/mm.h>
! P9 q5 b( v @* o) ? - #include <linux/dma-mapping.h>
" W8 R. ?' z- K
0 |4 L) h4 }: n4 }- #include <mach/memory.h>) L l2 j+ M" Q5 C* x2 C5 X
- #include <mach/hardware.h>3 o" h) L7 Z! F4 h
- #include <mach/irqs.h>
5 \9 K. k4 o; J: v u3 S& m - #include <asm/hardware/edma.h>2 g4 M$ b8 K) W& r2 `
- ( a( B8 N( V, D4 [# \4 ?
- #undef EDMA3_DEBUG
6 v8 L$ X0 |% _1 t9 N/ P - /*#define EDMA3_DEBUG*/
) ~) E; l2 a1 ^6 w4 a - ! J9 e/ [0 V( `; J8 k( N
- #ifdef EDMA3_DEBUG& C$ x: l& K, n4 S
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 l ~& J6 n$ [; W# d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ u! ? @ k, A- g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 c) Q, w7 u5 t+ a/ S3 A$ U
- #else
" S/ A! H: P1 v( s# M - #define DMA_PRINTK( x... )
# W0 o6 J/ U1 y - #define DMA_FN_IN, l/ q' v4 n! R0 Y5 V
- #define DMA_FN_OUT4 ?+ Q) u, R; s5 X" S1 Q
- #endif7 ~* {$ b9 F" Y- `- k
- ! H. ?9 u' W7 \- b4 A' }4 n1 o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# I) j% {% c9 Q. o4 B
- #define STATIC_SHIFT 3. n9 a7 m0 }6 E8 d
- #define TCINTEN_SHIFT 20
+ F, ^7 g* x. \% {. m* E; t) B5 p1 q - #define ITCINTEN_SHIFT 21
( X5 N5 V' M `. w* ~ - #define TCCHEN_SHIFT 22$ ~8 r+ r' R- M& B/ P; G
- #define ITCCHEN_SHIFT 238 K; d$ \2 F/ _' W
- d7 L; B0 \5 y& Z2 w" O! `
- static volatile int irqraised1 = 0;
]; y0 M* y: ] _ - static volatile int irqraised2 = 0;; n4 [& O& Q Q( u( {2 h8 D
; ?: n- R1 Q1 O2 g1 H& T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& {5 P) C% U, Q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- E$ T" f2 [ z' i( _5 Q' m4 R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 X6 C# w3 \) S, t( [ - + Y5 z' | i6 o8 d- t
- dma_addr_t dmaphyssrc1 = 0;- C1 U Y" ~. m9 X3 Q
- dma_addr_t dmaphyssrc2 = 0;
) j5 f! e- r! v5 z3 r8 w' ~6 W - dma_addr_t dmaphysdest1 = 0;
5 y1 c) B$ X' R$ j9 N& Z - dma_addr_t dmaphysdest2 = 0;
9 t! [8 n% J3 m5 t; ]( T; u - / \7 J( z4 M3 \5 k9 m$ ~
- char *dmabufsrc1 = NULL;) `2 n5 d- y% ]% Q0 P
- char *dmabufsrc2 = NULL;0 x/ ^6 F* t, Q! t- m* G
- char *dmabufdest1 = NULL;$ S5 k( |/ v: Z
- char *dmabufdest2 = NULL;
4 o: E9 O7 y' o- c! y3 u5 N - + b# y r( S# X8 ~. Z. r. e' @
- static int acnt = 512;
5 I) E& k! X' }+ }- K - static int bcnt = 8;
0 _9 E2 g& T/ P: t- o - static int ccnt = 8;
" d M5 ~0 h d' _' n - 7 n, c! w" L5 T* s# c
- module_param(acnt, int, S_IRUGO);
) a3 K3 b) z0 ~3 \0 X9 Y - module_param(bcnt, int, S_IRUGO);
& u3 T9 S7 |% d2 `- g! H+ |; k7 c - module_param(ccnt, int, S_IRUGO);
复制代码
- x2 S3 j6 l4 d6 {, \
9 K/ Y! J4 G. k* x0 K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% m7 l/ d( V/ t% `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; U0 C; `) c$ Z: X L( s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* O6 v; l2 z9 }+ V- M/ X* l+ m! E
! \" ~" @$ P8 D5 {; a4 ~8 `8 O5 W/ D; o- B8 Y3 b
|
|