|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 E) n6 S+ y H# K- [code]EDMA sample test application( O" S4 n1 ]5 U& F
- /*4 R6 O% b: I5 |& [- r: i! B
- * edma_test.c
/ ^* h& l* ~1 P1 f. @ - *
) n- L1 f6 Z4 f6 C1 A/ y5 s - * brief EDMA3 Test Application; C. _# q, k) R! D) |# o# X+ a Z
- *
8 C' {9 a7 g" ?; U - * This file contains EDMA3 Test code.% J5 j) f8 |7 x4 r, r
- *
" e" }/ ]: n7 H" H- c- C - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 f( h$ s1 {0 |5 `% z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% _+ r* n0 r# o$ W9 Q
- * TO CHANGE. e( T7 O3 ]+ k! o; s5 {' y# y# C" r# }
- *: h4 Q$ K/ ?, X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' u% c. Q3 |, a8 ? - *
$ R9 }; f* _9 Z: x& M - * This program is free software; you can redistribute it and/or
! H i9 a& s1 i4 Z' q$ b4 U) o+ H3 m - * modify it under the terms of the GNU General Public License as6 X1 k) h6 x8 k" n
- * published by the Free Software Foundation version 2.
+ w$ {7 v5 n; p P6 \ - *: \: H7 z: d' G+ f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: X* T3 g: W, q3 v. y
- * kind, whether express or implied; without even the implied warranty2 s" A1 p w6 N* h, L: @5 w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ G7 |$ x) Y! a3 M' \) q: v/ g - * GNU General Public License for more details.
e8 |5 S) W3 [: L - */ Q/ f8 X+ Z: a! w# }
- ' I. V0 X$ }, P
- #include <linux/module.h>4 A4 _* B& X. ?
- #include <linux/init.h>) J' O/ i5 P% {3 w1 S$ L
- #include <linux/errno.h>6 G/ Z: v( N# v, K
- #include <linux/types.h> C5 M- U' E+ B8 n$ y. a
- #include <linux/interrupt.h>/ f5 h2 x. T8 E7 k
- #include <asm/io.h>
/ t m& {* T( c/ m7 t& M - #include <linux/moduleparam.h>
, e0 m$ f! H5 N6 ] - #include <linux/sysctl.h>+ e& s+ A' @9 G3 f% v
- #include <linux/mm.h>
! h. e1 O; ~0 q, h - #include <linux/dma-mapping.h>
# G5 B3 N' o% Y! Z3 J - 6 g/ |; h2 c4 J4 M1 K. n9 ]& S. @
- #include <mach/memory.h>
_ `8 P( d% i4 `5 j9 [ - #include <mach/hardware.h>
! j2 U1 C9 F$ m - #include <mach/irqs.h>
) a, d4 E" [- d) G& K1 d+ h- \ - #include <asm/hardware/edma.h>2 b ]8 E' j3 a- z" G; O
- . O; W1 o$ ?$ y |
- #undef EDMA3_DEBUG
3 a5 @1 _$ `8 ?( G+ e) a$ s - /*#define EDMA3_DEBUG*/
# J2 S0 V8 @- Q
( B' T5 l9 Y! n1 L' W- o8 P3 B, B! H6 L- #ifdef EDMA3_DEBUG
- @+ F8 B; ?) ?" b4 _# U3 y& ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) `6 b$ f" l' p - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% ?. k; b8 T: K: j4 J - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ ?$ c/ b; s8 g0 T2 X: }8 B. y
- #else
9 Z. P$ v1 `7 A9 _: h - #define DMA_PRINTK( x... )4 a# Q* X. {) V) o
- #define DMA_FN_IN. ^# t2 f4 ?; x9 i& d) I& n
- #define DMA_FN_OUT/ d" Z, D) B v) j& H2 `
- #endif2 Y/ W. O. H2 r @
) a9 {! w1 m6 A0 |6 G2 z) l- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 I8 ~* o4 L) W: V - #define STATIC_SHIFT 35 w. i7 o) m* Z, a
- #define TCINTEN_SHIFT 20/ z% w& O, X4 H2 Q
- #define ITCINTEN_SHIFT 21( \. A& ]: j# {
- #define TCCHEN_SHIFT 22* f. J9 H; h$ [$ o4 Z
- #define ITCCHEN_SHIFT 23
6 c8 W) U0 j6 H5 b* J - 6 n# y1 |# ^' A* u2 C; {
- static volatile int irqraised1 = 0;
6 i' S$ A6 \6 ?/ p, R9 D' y - static volatile int irqraised2 = 0;
6 p3 ?' b$ R3 } - - r$ X2 B( F* {: w0 h! T0 F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ @0 D9 w8 K0 ?; H4 b% F - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 P2 D# p: v- A - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 W; x3 C5 A, ?. c2 p - ( O$ C c5 j9 \& e. Z9 s0 I2 W- F
- dma_addr_t dmaphyssrc1 = 0;' M+ }, h) n6 s8 u+ u* z6 Z7 Y
- dma_addr_t dmaphyssrc2 = 0;
/ z, V# V3 {$ R- ?' c1 K! s+ r5 D - dma_addr_t dmaphysdest1 = 0;
+ f6 s6 S* M5 j5 p - dma_addr_t dmaphysdest2 = 0;
6 `) i- ^7 ]+ b |6 p
7 a' B/ K6 ^4 H/ u- char *dmabufsrc1 = NULL;
6 a: ]+ h$ V$ W o0 _% ?( p* Q - char *dmabufsrc2 = NULL;+ `' D% V9 Z8 B* Y
- char *dmabufdest1 = NULL;4 `6 }5 A9 F' J7 j+ Z5 C
- char *dmabufdest2 = NULL;: R3 Y; ]3 W8 J0 @+ v
" y% Y" {: {6 Q5 i# u9 A- static int acnt = 512;; ?7 Q( x) K6 n& R
- static int bcnt = 8;
. x: C, n) y1 |! B - static int ccnt = 8;6 v9 J) |" b0 U5 q
- ! ~2 G3 H, ~( F7 G+ ]) i2 i8 r
- module_param(acnt, int, S_IRUGO);" a7 k) G) H' f, v) L
- module_param(bcnt, int, S_IRUGO);
$ I9 L5 S0 f4 W% J" _% B1 h - module_param(ccnt, int, S_IRUGO);
复制代码
2 H: T1 m* X3 T
- \! Z- Q0 |! b) u3 w& s: H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 j5 V+ a) T# f: d) b' Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% @6 R$ U. j8 Y' T! \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( Y# U" y! K i# v" E( ^
" E, M2 C- S/ C1 j; |( L
+ S7 g$ y# R4 w5 }& ` |
|