|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" \# M- A( T+ Q% K$ F- [code]EDMA sample test application
6 M& C/ i2 ]0 E) v. v - /*
9 l% }0 M% _5 P+ P- L: t$ j5 v - * edma_test.c1 j Y- h2 m( e
- *
2 W' U" E. h3 A, X' i - * brief EDMA3 Test Application
2 S" K7 G' Y" ]3 _4 @, M0 q- A4 Q- b& s - *
0 V9 M0 J; O7 ?& O - * This file contains EDMA3 Test code.( {9 q* V, M d5 z( O8 M. B
- *, v% ?2 N7 V# ^: }0 l
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
x3 ?5 {, F5 |6 t ]# i5 Q5 q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( ` @0 {% A3 p0 L% g# {6 r - * TO CHANGE.
. ^1 _2 R: g1 G - *
2 U, Y, C0 G) d! K& B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 ^5 e# s7 {! A2 w- J - *9 b* Y0 L8 X" e) N% W
- * This program is free software; you can redistribute it and/or
: D) E5 `0 h0 ]. e+ S7 ` - * modify it under the terms of the GNU General Public License as5 z& D7 U* Q+ n' N1 Z; a8 ?; [9 ?( _
- * published by the Free Software Foundation version 2.
. \0 B% {* c9 ]4 I# z, m - *
. ^2 n5 r( s9 H8 n/ D9 K# T - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 u- f* ~: c, ?) R6 e, P
- * kind, whether express or implied; without even the implied warranty. b) {# J- R* Q+ M: {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- D2 p4 g4 b" ?, t
- * GNU General Public License for more details.7 m j6 n! ~ l9 C4 V; I
- */- W) b, z; i' i7 ?5 M8 w S
: D8 \9 j w# w4 O- #include <linux/module.h>" Q- U3 n, a0 E2 N& }" A' n1 J$ ]
- #include <linux/init.h>
. J9 m, U! J7 q0 `) A9 K - #include <linux/errno.h>
% j& c% A$ l/ ]* n5 ?. K - #include <linux/types.h>
7 ^6 A7 Z; C5 @0 d8 p - #include <linux/interrupt.h>
: T {$ z3 _# t- q) a' M* n - #include <asm/io.h>0 I4 a( B& ?7 I" ~3 @1 |
- #include <linux/moduleparam.h>
4 n0 l4 V3 C0 D! h7 M- m - #include <linux/sysctl.h>6 z# Y* t% u& h. }( u" O
- #include <linux/mm.h>% k& o; a7 ? T" S" L
- #include <linux/dma-mapping.h>* U @* D9 Y# r% q
- - q9 M3 j) l3 i0 M4 S) Q( K
- #include <mach/memory.h>
- x: p+ H. a9 Z# ~6 b( ~ - #include <mach/hardware.h>2 `0 q/ p$ |- V6 o
- #include <mach/irqs.h>" p/ I' \$ A: N \9 w3 i' X
- #include <asm/hardware/edma.h>1 r, V. f# c. ~, `
- % S2 d! P! k5 \6 z2 n) |( h' g
- #undef EDMA3_DEBUG2 e/ R% J6 X/ ^
- /*#define EDMA3_DEBUG*/# |) ? @5 }5 d/ E7 V5 `
( v" t8 O; b1 C2 b$ r- #ifdef EDMA3_DEBUG5 G* ^. E9 e9 ~% w
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( z! h! O$ B$ d" t7 f. C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) \2 ]: w" `$ M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ W" C3 J6 i2 t; J: J$ [ {2 k' w - #else
6 c% k6 w9 C( M1 I - #define DMA_PRINTK( x... )
2 ]7 ~+ f" t/ D7 x+ q8 c - #define DMA_FN_IN
8 r0 A# ]4 `- w) v) }' ^ - #define DMA_FN_OUT- T# Q; K& N/ r
- #endif
6 r s9 v5 T1 s* O+ x - 5 h3 N* X6 u' P$ C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) K/ s1 \. z8 \3 O
- #define STATIC_SHIFT 39 L( w! `* e) c; l. H8 |
- #define TCINTEN_SHIFT 20. }8 _6 m0 W: N( y3 D
- #define ITCINTEN_SHIFT 21
" c8 F# O2 Y- T( q - #define TCCHEN_SHIFT 22. M7 o6 Z+ p( J9 z$ z, V
- #define ITCCHEN_SHIFT 238 q/ _: t1 E% w# o
- : C0 ?; V7 w$ B4 Y4 a
- static volatile int irqraised1 = 0;
6 c1 W3 v: q, J& T1 U - static volatile int irqraised2 = 0;+ N i! Q' x6 j1 z) O% G
8 G5 H- u! K) X6 i+ c% d4 P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, [/ K; I+ T: G' X" D+ e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, R' b" T# Y" y% }
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ c9 ? h3 ?; p, @$ s
1 S i, r$ d" ^1 @# B8 Z$ C- dma_addr_t dmaphyssrc1 = 0;" T8 t# \& Y* _( I1 `; G
- dma_addr_t dmaphyssrc2 = 0;
, u3 ]! w$ t5 B7 l2 n - dma_addr_t dmaphysdest1 = 0;7 H! M/ f8 @. M' E2 l0 K6 o) s, R: [
- dma_addr_t dmaphysdest2 = 0;
$ \1 J9 t/ ~. ] i8 O. l
U2 G% {: E; j# G- char *dmabufsrc1 = NULL;
9 _( c+ ]/ P4 b. t+ Q - char *dmabufsrc2 = NULL;% m0 U, z$ e0 x! A; n7 i
- char *dmabufdest1 = NULL;
. e, q& y, i- S - char *dmabufdest2 = NULL;
0 o1 }" u; K& i8 y) J - 2 Q+ N1 Y' D1 H- }2 Y8 S( e K# K
- static int acnt = 512;
Q) Z0 V# j* Z8 m8 a4 J+ F - static int bcnt = 8;
, L7 e* B: B- K) Q4 b - static int ccnt = 8;1 R& I. C8 A, D; K+ M1 R
- ' |' q3 E- N( F- ]! m
- module_param(acnt, int, S_IRUGO);; _2 b3 m6 j- X) L
- module_param(bcnt, int, S_IRUGO);) K; r' x( o- m+ ]0 \) p$ `, K
- module_param(ccnt, int, S_IRUGO);
复制代码
l5 s' A, S/ h1 d0 e' j0 L# l0 a
% X/ E# w7 j$ ^: R" L. ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 K! S* J9 c: s6 Z, q3 garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ M1 O3 @; g/ K8 e4 k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 i8 O5 C& x5 Q3 _( w* w. N* V9 K' ]
# b: l8 y' q8 g3 h; w9 ]1 ^: h
& ?$ I/ s1 Y( u1 s0 w/ }/ c/ r |
|