|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- a( I M) \2 _( e- B1 A; f- [code]EDMA sample test application
3 B0 h+ a8 m# ~, b - /*
/ ?0 H% R8 p0 l5 I, L2 D - * edma_test.c% c7 l! J7 B: I
- *: D- j I$ }! F( ^6 I B e
- * brief EDMA3 Test Application
; t1 Y1 E' j! p8 G: e% n% ` - *
; G, d" y1 _- b4 z( Q& Q1 B, I* S - * This file contains EDMA3 Test code.
7 ~/ v5 A! B$ e f& @1 w1 p' J - *
/ _* B9 ?8 }& O8 W0 z$ N% k; J - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, A% ~, u7 w1 O+ }5 T* h$ d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* h+ T1 s2 v3 v/ {) @ - * TO CHANGE.
8 X% [: O1 D1 [& C - *1 p- q3 \4 j6 O0 P, Y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- z$ |3 F" w |+ v1 G; ` - *2 D9 Y8 `8 z. m
- * This program is free software; you can redistribute it and/or' l' k2 {7 }; Z% H% p6 o
- * modify it under the terms of the GNU General Public License as% X2 ?8 J; y& u; n
- * published by the Free Software Foundation version 2.- f9 F+ z) o8 V( d. L, t$ k
- *- u% j7 k" a+ r. n4 i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 H; n; a! i) v# I& y - * kind, whether express or implied; without even the implied warranty
% H0 H' g8 T: T _% T# a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 L9 o% l% x: t$ x+ K" [6 Q# B - * GNU General Public License for more details.* v% T5 G$ o9 A* ^
- */
: N* k+ \' n: X' h2 W8 A - # F) c9 h& d6 ? y
- #include <linux/module.h>
- y; o. u( G9 c& O! y - #include <linux/init.h>
5 ?, q6 s! x* i- L - #include <linux/errno.h>
z& y' @, F9 G( t2 }4 \ - #include <linux/types.h>" Y9 v8 V+ O8 r
- #include <linux/interrupt.h>9 l: K3 a% p* k# }( r2 _2 D2 _; e% `
- #include <asm/io.h>
: Q6 \2 v$ D, q3 q9 X* d0 w1 I - #include <linux/moduleparam.h>8 L, k* s8 J7 a9 B( C9 V: b* b3 G+ w6 Y) b
- #include <linux/sysctl.h>1 I. ]0 }+ r6 X+ c) r
- #include <linux/mm.h>6 V0 y% S# f& l8 V7 [2 g+ e
- #include <linux/dma-mapping.h>
7 f' s/ `5 L, o) k4 I: M) Q) n: w. ?
& Y. k. w5 L& s! Z6 b- #include <mach/memory.h>9 X8 P9 [0 Q, C1 ~* y+ g$ v4 @4 Q
- #include <mach/hardware.h>
* m+ W+ A( {4 U) d7 ]/ a8 _ - #include <mach/irqs.h>
& e4 G0 @! ^7 d; L' c; K - #include <asm/hardware/edma.h>
2 \ m) u8 Q4 O( ?7 ]2 c
4 F/ W! i& }9 S- #undef EDMA3_DEBUG
& l e; [8 U1 h$ d, h: d - /*#define EDMA3_DEBUG*/
' S7 L) Q+ N# a3 H+ F) d( a - ! ]9 I/ Y( [. T5 Q; W' Z) _$ m/ u, d
- #ifdef EDMA3_DEBUG
* f( Z( |! V8 d# o8 ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 z' R& f& h8 M- d4 K - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). Y; Q+ s& |+ X F9 H9 e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) o% M+ L d) S - #else$ D8 t9 w- o; [1 g- \- z
- #define DMA_PRINTK( x... )
9 o2 k4 c5 L, e - #define DMA_FN_IN+ R% c, z8 q+ k2 S0 V& g* }( F. r8 Q4 D
- #define DMA_FN_OUT
! U& I3 E; T M% s - #endif
* C& h2 W% g$ S
0 w8 r1 w8 f3 F: r7 N5 y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 F7 u3 Y' J" t) f9 G
- #define STATIC_SHIFT 3
) @, o. l+ f6 ?' Q2 g3 i- }! m - #define TCINTEN_SHIFT 20& Z/ ^; d5 P* d, w% o
- #define ITCINTEN_SHIFT 21 F: T4 W+ ? [
- #define TCCHEN_SHIFT 22
9 r" B" I. q+ p/ l - #define ITCCHEN_SHIFT 23' S) L: y2 |$ C
7 c9 S( ?, Y1 Y* P: z5 C1 e- static volatile int irqraised1 = 0;! l0 X: W7 g; K, a# K+ g
- static volatile int irqraised2 = 0;
* U3 b+ b" z1 D% K' d - 1 X, M2 q B- J) Z+ j& _
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 E Z0 a/ |1 U8 l- w' B" g - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 t+ g) }1 g3 s5 t' A) K& { W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) m0 a: F0 F- H - - t- [3 w2 V# v- _, i
- dma_addr_t dmaphyssrc1 = 0;
# h b$ s) O1 [8 e - dma_addr_t dmaphyssrc2 = 0;: D9 k8 j5 X0 h: y: _9 E
- dma_addr_t dmaphysdest1 = 0;7 N7 e8 ~$ n# t* n& ~
- dma_addr_t dmaphysdest2 = 0;
) b6 Y: `& H) Y1 O/ L/ w( D - 8 B5 d) g' L- g4 B1 c7 W
- char *dmabufsrc1 = NULL;
. G! e0 e- a# }( S9 g) \) }3 S - char *dmabufsrc2 = NULL;- G: }) C p% r: v
- char *dmabufdest1 = NULL;1 s1 J6 |5 s+ t7 K: Y
- char *dmabufdest2 = NULL;# K# u' ~5 H; Y3 D8 T* c
- 0 Q) g* K( S1 U h2 K+ |) B6 J
- static int acnt = 512;: D0 D% d' e% t9 Z$ A
- static int bcnt = 8;
+ D) U% t6 ]& j6 a, f2 Z - static int ccnt = 8;
, }- F- H' u$ k2 p# w - " z1 L+ C, u4 C# G* h1 d
- module_param(acnt, int, S_IRUGO);* p: q. r, A& L& x1 x. j0 b
- module_param(bcnt, int, S_IRUGO);
4 G1 t: T6 f) c0 s5 q! I; e" Z - module_param(ccnt, int, S_IRUGO);
复制代码
# h/ r; g }" A
5 g8 z2 ^% J9 Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 a# T2 O- S+ J; R o1 [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 s! P0 Y. \3 Y m7 [- M* M; ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 M- B4 _! T/ B& k+ i8 y8 r
; v* k& e( r! Q Q* W" t
0 y) @) } i8 } |
|