|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . Q0 } W8 j ~1 j) j3 I+ R
- [code]EDMA sample test application
. |0 j: d0 s! v/ M. Y - /*
( h) z! [ z* m' N/ A - * edma_test.c- W2 o' Z7 f) u( }: g) ? d% V
- *: ^+ k/ ~& K/ D n" q
- * brief EDMA3 Test Application8 `; q6 G' C, H# g; q, W
- */ h% f- t) n% |1 `- r1 h4 B
- * This file contains EDMA3 Test code.
1 r, i4 X2 [6 P7 [& t ^# `0 P - *. N$ P' L, G6 F, B& n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 k" l2 E/ F C2 V" B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' f' O+ X; l% a; a) t- M# ^ - * TO CHANGE.
# `1 D' N& w' Z" ~; J - *; _5 V9 a% G% }+ L, U v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- s: x. V2 K: c" |6 v) P, U - *
2 h- k" l' {2 j: C$ U7 W. ^ - * This program is free software; you can redistribute it and/or
) \& A1 l+ [! v - * modify it under the terms of the GNU General Public License as
w+ S) k2 n4 U1 ]& W3 a* M2 M - * published by the Free Software Foundation version 2.3 v1 r: V# S% w. W7 l8 r
- *
' c2 ~3 {8 c9 E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! Q7 j0 }9 y! C# _8 { - * kind, whether express or implied; without even the implied warranty
" T( _; p. ~2 {/ `0 _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) @1 ], F3 ~3 ^: u8 M
- * GNU General Public License for more details.
- w9 ^# N6 T5 c( V+ |5 q - */
0 X. [! T, B( Z& p8 e9 u8 `
. ~5 j( w1 C2 q- #include <linux/module.h>! i& a' S8 S: S* F
- #include <linux/init.h>
* D" R6 y/ ^, {3 \6 h1 J - #include <linux/errno.h>
6 \- [/ |1 ?* W7 c( G- H8 C - #include <linux/types.h>0 p% G/ a2 c8 y; O) @. s
- #include <linux/interrupt.h>
! Q: ~/ P* \$ q9 V - #include <asm/io.h>
5 R+ F8 O$ w2 ] - #include <linux/moduleparam.h>
" H/ m9 r9 d9 q: k' q - #include <linux/sysctl.h>7 [7 J7 ~2 d! W& N6 Q& } L
- #include <linux/mm.h>
# R3 V6 N" x# {4 {+ M+ e - #include <linux/dma-mapping.h>
9 b6 W, d6 H; l/ j2 w: x - $ S0 p1 ~" D/ E
- #include <mach/memory.h>
) G' w4 U4 w) w! V; A7 o - #include <mach/hardware.h>
: O$ ~% X; o# v8 h, m - #include <mach/irqs.h>
# ~1 }; |- ~6 P% [ - #include <asm/hardware/edma.h>
. g4 C7 |- C9 x* E
2 S" C' x( u# [9 t1 V. p' z- #undef EDMA3_DEBUG
- z( s2 h a8 z+ u1 Y7 j. y - /*#define EDMA3_DEBUG*/
# h2 q) \# o! M: c6 w - # O& V5 {7 U6 `4 N
- #ifdef EDMA3_DEBUG* A" M+ a, J$ T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# Q! e' g1 L% u9 q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( n$ k& m! H* d4 i' O - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. m% N8 K% z$ P; ^7 Z+ U/ f" x$ C8 x& \ - #else. @6 r6 r. l) P/ n) U% _; s; c
- #define DMA_PRINTK( x... )
" Q6 Q$ }7 D ?- c& L" U5 e- i - #define DMA_FN_IN
/ O9 Y( k' x( L! Z* C( T, R' } - #define DMA_FN_OUT
: S) w$ v9 Y. T3 \# | - #endif# K' F! p+ r# V- j: P) p. X
- y' a( f; w0 Q& [% @5 f6 \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ k& @9 b5 f8 I/ \6 w$ B - #define STATIC_SHIFT 3. a+ U' Y, w% _# {' n6 H1 U
- #define TCINTEN_SHIFT 20& r" t7 @" b# K
- #define ITCINTEN_SHIFT 21
+ V4 o" D9 ]. n1 V - #define TCCHEN_SHIFT 22" Q$ c3 C* z& ]
- #define ITCCHEN_SHIFT 237 p$ Q8 [7 f2 u3 b
: h+ X+ @& `" q$ J* l# {0 M5 L- static volatile int irqraised1 = 0;
; c, B& B* i7 { - static volatile int irqraised2 = 0;
7 L% u" y: T& z7 w9 d+ C; G* x - / n4 a2 I9 \- l( z# c) e7 B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& c2 A" G0 {0 k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 C. i( v1 N8 X
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 d* H# g- _, v
- 2 L! E! F; L& e6 |
- dma_addr_t dmaphyssrc1 = 0;
; V e# H- n% Z6 f& r, ]( V - dma_addr_t dmaphyssrc2 = 0;
; `* x1 V2 G9 Q) l4 j) T/ p" \ - dma_addr_t dmaphysdest1 = 0;
2 Z# L7 r& d3 f0 q; V$ d3 a, J - dma_addr_t dmaphysdest2 = 0;
9 N6 {3 n" `: r8 e! ~( @
9 C/ _ P# ?: _7 F& r$ \- char *dmabufsrc1 = NULL;7 @4 \- I, T1 d! f
- char *dmabufsrc2 = NULL;0 m) f5 R7 a' T1 j
- char *dmabufdest1 = NULL;
8 C3 Z( @* p1 o2 A8 C( i2 y6 V9 w% j - char *dmabufdest2 = NULL;/ a+ e$ r$ P$ a5 ]- [; ^; q
; } ~# ~- F4 I/ r- static int acnt = 512;2 {2 c/ J5 l; V8 U8 w
- static int bcnt = 8;) u7 y F" ?- Q/ z9 ]# q: H
- static int ccnt = 8;% L, B% g; K2 O! |: b6 `
4 C/ y2 H- k3 m6 o4 @7 p5 l1 _- module_param(acnt, int, S_IRUGO);( B4 B5 @( l" k; K4 U0 ]& F' O
- module_param(bcnt, int, S_IRUGO);
7 x% ?+ w* P2 b - module_param(ccnt, int, S_IRUGO);
复制代码 ' c* p3 z' O: v3 M
& D- F: S d/ Z c2 R! }- H- w! g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 _8 f# q u) _, _2 }/ ]
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) }% A; Y# e& A- S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 h. r& F* a7 ~; S3 }# m( `: \ t: G
2 N' h$ g D' t8 a; c7 j |
|