|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 j9 _* b" B, {$ B0 H9 @$ p2 q
- [code]EDMA sample test application
9 G- U% S$ _2 F. P - /*# ^" w& k" ?" N+ p! }+ z- x B5 W
- * edma_test.c C9 L" d# V6 ^
- *
3 n! a/ \) d- B - * brief EDMA3 Test Application
& z" N8 L( g% U% p9 M; u - *% |4 i$ m! ? x. n! i1 Q$ k( t4 ?
- * This file contains EDMA3 Test code.
% h: f! a# e) m% a - *
, Z( a4 M, C3 q2 p3 `2 `' f( b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ p8 r w) ?. g) k; R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& G* W$ O" f* w9 V( o: k7 b$ @+ B
- * TO CHANGE.( V1 P6 e# ?9 G& r @
- *
, W; I% J. G; u' ~9 |9 _5 z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" _4 U/ r7 N0 _8 c# @& \
- *
/ d: _7 D. c" @; x - * This program is free software; you can redistribute it and/or% y8 F. s4 _! X" \: B, l5 }
- * modify it under the terms of the GNU General Public License as! }, R. v- Y5 P( P6 w- q
- * published by the Free Software Foundation version 2.
' d* z7 m0 `2 d3 z" C: \3 j. w - *
% A+ P: N3 ^2 @2 {5 W, ] - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
B) f& ?. Z1 v% c - * kind, whether express or implied; without even the implied warranty# g+ F' F/ t Z7 ?# I8 O
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 i8 j0 L* b: A1 R$ |
- * GNU General Public License for more details.
2 u& y4 X6 p c M( a' l - */: J0 P; b9 [7 R7 A
# @0 N9 g- y7 L4 T3 T( S- #include <linux/module.h>
' k" F; {, y {! X' K& T - #include <linux/init.h>
0 [6 c1 \* r1 f" s! F - #include <linux/errno.h>
* V, [! y6 ]" i4 }2 V' g( e - #include <linux/types.h>4 T) f% d8 A7 _+ s9 [* U' ~$ l
- #include <linux/interrupt.h>5 |2 W- ^: ?! v+ X
- #include <asm/io.h>% f7 ~- o7 L* B
- #include <linux/moduleparam.h>
5 d' [9 l% [# L5 S- F+ a* w - #include <linux/sysctl.h>
$ Q$ @6 g$ S6 T4 W$ B! u1 P8 y - #include <linux/mm.h>4 o5 f ^ f+ r+ t
- #include <linux/dma-mapping.h>0 d) A% {: g1 h: [
- y- Z/ n$ o+ }; Y3 B
- #include <mach/memory.h>
* |, O) S% R5 c N$ Q9 |9 G - #include <mach/hardware.h>
6 b) N2 O# u: v C6 ]3 t - #include <mach/irqs.h>2 t$ ^2 P k$ Z/ D% V/ |
- #include <asm/hardware/edma.h>
& ^3 }5 \1 x; s! a0 Y7 u - 7 D+ K* |9 t- g, o& \
- #undef EDMA3_DEBUG
' B: G; c& d0 V& w7 [8 Y, ] - /*#define EDMA3_DEBUG*/" F- ]! E/ [$ ?4 Q/ j
9 m$ ~( W: ?5 @( ?- #ifdef EDMA3_DEBUG
% T% e# ]+ O2 \' k5 s+ P# Z& r - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 I0 W$ O G/ Z% F! O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 S8 i+ p: C4 f8 t! c
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 @4 o s( }; B I8 X
- #else% E* E3 v+ g% c9 T
- #define DMA_PRINTK( x... )
/ A; A+ k, V( L6 ]; a$ V! X - #define DMA_FN_IN+ H0 o: L0 a3 Q: n' x" g
- #define DMA_FN_OUT
$ ~0 p, E Y/ @9 A - #endif
. V: U( k) p2 o5 v - : Q- R* p, g3 l
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, F* g' D( M; D- h3 g5 E - #define STATIC_SHIFT 3
) _- z( A V8 B. X( \ - #define TCINTEN_SHIFT 20
6 s6 \2 @) [# ?# X/ x j- E - #define ITCINTEN_SHIFT 218 ]" [, q0 Y. ~7 J; E' |. W( A
- #define TCCHEN_SHIFT 22" S* K+ T8 V: t" h3 F/ E: D
- #define ITCCHEN_SHIFT 23
$ z2 l, G; x2 U4 R' C5 | - * k: ]; X7 f9 A) O9 S4 O: ^
- static volatile int irqraised1 = 0;$ X$ L H' \ ?2 a6 e% s* M
- static volatile int irqraised2 = 0;
0 R. i) G7 g- Y - ) U- d8 g; G; W+ r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- z7 u0 h' j) _9 B+ V: e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: P- K) B2 q" n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 l" n) q3 E' b: @- [ - ; U/ \( [! P. V1 Y \1 ]3 c# _- V
- dma_addr_t dmaphyssrc1 = 0;
: { V. S! Q- { - dma_addr_t dmaphyssrc2 = 0;
1 @6 s2 H W3 g5 b - dma_addr_t dmaphysdest1 = 0;
4 T) @$ n9 {' q3 V# j - dma_addr_t dmaphysdest2 = 0;
* c% x- K- M: a7 j0 s- c& X - ; s! f" L+ B5 A5 f
- char *dmabufsrc1 = NULL;
; I1 B5 a* F0 K% C% I! G, f8 N - char *dmabufsrc2 = NULL;" m8 s: ?- L9 @' r9 M' v7 s
- char *dmabufdest1 = NULL;# r4 A. C1 P& w( _+ Z6 i
- char *dmabufdest2 = NULL;2 A* Z d! d* W9 d0 g
& t5 I4 M4 C) |$ r- static int acnt = 512;( T) I3 y1 Q0 j. a1 v8 K, a1 y
- static int bcnt = 8;0 h; Z% [" E1 o$ G# s
- static int ccnt = 8; X8 f& d0 Y% [3 y; l3 C* l
- 5 z0 w3 i& F- X( |
- module_param(acnt, int, S_IRUGO);& p: ^3 @: a% q" }
- module_param(bcnt, int, S_IRUGO);, O/ T* h- g- h! k' f$ Y$ F
- module_param(ccnt, int, S_IRUGO);
复制代码 5 e- c. a, ` T
8 y8 P( c% s. G: b' B, h1 k
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ s2 S! x, S) \2 F5 `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ F& S% a3 R3 q. ^1 B( k9 o3 `9 i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 A0 P$ R: J: ~7 e( q( e# j' o2 z
|( e. Q8 w" L6 I1 }. u! [0 B c# g5 q2 c! v0 A' S
|
|