|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & b* Z9 M2 Q) g+ W
- [code]EDMA sample test application
4 [* H8 O5 f& n: F5 z; Z2 ~: Z - /* m" Y. P' @9 c& ^1 S- C
- * edma_test.c+ T( Y7 t6 H1 X+ q- X% \( b
- *
, ?( o% z* o- i! x3 |; c - * brief EDMA3 Test Application7 c, j' n9 f3 }( u! L+ m) j
- *
! ?$ Q* {- {1 C6 H7 B; e% j - * This file contains EDMA3 Test code.2 E- q8 Z6 |: z+ W! [& C, Y4 v
- *# ^+ _; b" e: R5 s5 z% z, ?
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* n) V/ G# s# S [2 v p1 J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 {; B. g+ j, t: E/ N
- * TO CHANGE.
; s' q9 V4 C0 G( @ - *
?" w0 U0 ?7 L4 M+ O1 L! ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 j3 V( B7 S: N2 E3 {( P
- *; m! p9 O) i( x t- k! m' D
- * This program is free software; you can redistribute it and/or
! w- U8 j5 Z. ]! g7 p( p - * modify it under the terms of the GNU General Public License as j+ ~4 o, [* m. [, G: ?
- * published by the Free Software Foundation version 2.8 i$ |1 C5 K1 D1 L/ U. x
- *' J& }, S! ?2 L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 z4 E. D2 u9 L4 y1 Q) R - * kind, whether express or implied; without even the implied warranty
8 u2 y$ o- [- j$ c- E' p ?' A - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& _" w/ n: v* R; E" P. i! \% Z( Q
- * GNU General Public License for more details.! w$ X7 a" A/ c; E7 b" f4 k8 c/ F
- */# p" q; c4 V4 ~# P. t
- ) K- t, F8 ]# ?0 V: M% r
- #include <linux/module.h>1 x |9 x/ m6 R
- #include <linux/init.h>
/ X# K% A: h f# Q3 Z - #include <linux/errno.h>
% M1 c& N: @! W: I& T9 X9 G7 j3 E$ ? - #include <linux/types.h>
2 l, w8 R$ @6 ~3 x! R; ^ - #include <linux/interrupt.h>
6 n6 l1 c( ]8 j, G( E2 G' i" d - #include <asm/io.h>( R# C* b. V+ O' H: N$ ^3 T- X
- #include <linux/moduleparam.h>
% T5 J! c' g+ U9 O - #include <linux/sysctl.h>( p* g4 z) O- d
- #include <linux/mm.h>
/ j q' m" R* ?. u% k - #include <linux/dma-mapping.h>
( f7 C$ J. j5 i5 J$ E" E" p& U
/ D9 P$ f. c I8 t- #include <mach/memory.h>7 a9 K, {* O! I/ ~% v
- #include <mach/hardware.h>
% q" c: ^5 R+ z- u1 O/ x* k- Q* Y! e& e - #include <mach/irqs.h>
. f! a* S- Y. i. H8 g. \; w+ G - #include <asm/hardware/edma.h>5 q8 @( I% c6 K3 D, o, [' {7 }
- I' w8 J9 U; \2 J! R+ h' ?2 c8 y- #undef EDMA3_DEBUG: _3 f3 E: q0 W' m' A E
- /*#define EDMA3_DEBUG*/
- F$ T) P' K. `" y
$ }5 M5 X7 d: o# F+ k* |1 W- #ifdef EDMA3_DEBUG
0 d- D$ R& [7 Q" f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; r) U& D! s* S+ y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 B7 f5 G* L' C$ ^! W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& z7 u1 w8 U* S3 L* O9 B% H5 O
- #else
/ V8 G6 T4 ~) h( |; Y: M - #define DMA_PRINTK( x... ): \) Z0 q- x% o& U6 o
- #define DMA_FN_IN
0 V% C/ T8 B K - #define DMA_FN_OUT
5 ?$ ]$ {# ]5 y4 `' E% q8 f - #endif
. O7 W# a3 E0 i' b& C0 H3 z# i - 6 c, K- {! \, ~% s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 s0 B+ \2 x. _% b u - #define STATIC_SHIFT 3, u2 _+ X5 c$ R C
- #define TCINTEN_SHIFT 20
( b# A6 \5 S% ^3 U$ k. I - #define ITCINTEN_SHIFT 21- f4 l9 N0 g; G1 Z: e. Q+ y# b
- #define TCCHEN_SHIFT 22+ C2 I5 Z" o' \: X7 ]% S7 A1 |
- #define ITCCHEN_SHIFT 23, Y. X9 |# R8 r# U$ \0 c5 \
8 H9 c9 k! k: s; }! f6 a- static volatile int irqraised1 = 0;5 _$ n# m. r, \# `- B
- static volatile int irqraised2 = 0;! e4 O' b3 e- c! v9 P5 L* t* K
2 l6 }! d9 ~1 L) |' ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" o& v r5 ~$ _ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( I0 ^. a5 ~% _6 @1 O( |3 n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 i6 {& e1 Y3 a5 v& b7 I! C- m
- 2 w2 U G1 L5 R2 W5 y3 i. v3 h" s
- dma_addr_t dmaphyssrc1 = 0;9 A* a) I* T* c, u4 E9 }* c
- dma_addr_t dmaphyssrc2 = 0; _7 {6 J+ B( K x. X% B2 v) \7 }
- dma_addr_t dmaphysdest1 = 0;
* L% w! I" f5 f8 G - dma_addr_t dmaphysdest2 = 0;
6 @% S8 y" D% a4 C. g
# A' j" s5 \2 T1 D7 V+ O. D- char *dmabufsrc1 = NULL;
& W" W% P0 q3 S; | - char *dmabufsrc2 = NULL;8 ?* k' v. o, m0 w* [* y
- char *dmabufdest1 = NULL;) N- Z4 r! y5 @( p- @4 b- M; b
- char *dmabufdest2 = NULL;" Y0 c: r! U' c4 E' k V
- % m- w6 i$ a- B
- static int acnt = 512;2 A% t0 j% @! f" M; q
- static int bcnt = 8;. g3 ]3 u% r) l$ {
- static int ccnt = 8;
5 H: N# e# a" k3 \ - 1 i$ o/ h0 e, i4 k0 a; R
- module_param(acnt, int, S_IRUGO);
' K! N7 E1 I- j. r* W5 k# v - module_param(bcnt, int, S_IRUGO);8 j, ~. A6 y/ d) j6 M& R9 R, C
- module_param(ccnt, int, S_IRUGO);
复制代码 5 J8 N, O/ {7 x( l
+ C* z3 }. y$ P* f# F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 `: C6 W0 ?- [& u* E& ]. }- a3 t v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' [( U+ T# z- ` _" E7 n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- |/ k5 K7 u& B4 h, b; m
) t$ T; o1 k% w# R B, H: o# ^
: q9 B4 g( W7 z1 D" D$ d( S% f+ ^ |
|