|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 R ~% ?, D0 {) p
- [code]EDMA sample test application
: d3 i8 m% u' n5 Q - /*4 X; P6 B6 c( K; s0 k) r8 s
- * edma_test.c# t" ?# l- b6 m8 J$ a$ h& X+ W
- * m, c& [" n6 T7 w( H% P# }
- * brief EDMA3 Test Application
0 q) p; e' _5 `+ J. @9 e - *
1 P. J0 m1 A( C1 \8 } - * This file contains EDMA3 Test code.
, a) R4 [7 G5 a; B* S - *. \7 B1 [& F0 u1 x- y1 i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( s/ k; T+ A: e9 u
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: g7 c& s+ X& j4 r# Q) l - * TO CHANGE.: b! H( l4 u' Q+ G% A+ v& ^
- *" I! e. J6 x1 F! u
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 A) B( ~/ _2 V1 `% Z2 y' [" N - *+ z. H6 x* `0 @; r- b' m0 o# b
- * This program is free software; you can redistribute it and/or
! z3 l3 m1 v5 H. ?0 V7 ` - * modify it under the terms of the GNU General Public License as* R* _/ T, b7 x6 f3 I: f" N; ~+ z
- * published by the Free Software Foundation version 2.
/ v( N$ L' B" H6 ]4 {: O9 G - *# R- d6 l! @" W4 y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ x* V# E0 E" z" C! c: s - * kind, whether express or implied; without even the implied warranty
$ B" t4 o% y, G' p! b8 S5 f - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" n9 A0 H+ {6 y4 s( G Y& T
- * GNU General Public License for more details.; s( Y! ~4 I' a8 s" z# w6 T
- */. b' k$ o6 k7 ]8 y( C$ K
- ' n+ E g, S$ v0 G9 m3 T5 g
- #include <linux/module.h>
2 B: ~; K C$ Q0 A3 G# y5 l - #include <linux/init.h>) S0 [" \! K1 v! a, D( Z
- #include <linux/errno.h>
$ Y: ?! P o& i# F) p- W9 M3 v5 Y - #include <linux/types.h> t- l, m% v5 i4 Z3 a0 T
- #include <linux/interrupt.h>% @2 R0 Z, {/ L T
- #include <asm/io.h>
4 B, B) A% ]4 ?) Z+ }, @. n x - #include <linux/moduleparam.h>3 C- l# c% M: F; ]' T8 F6 _' l
- #include <linux/sysctl.h>6 e o! ^+ D8 Q' p8 G4 G- k( e ?
- #include <linux/mm.h>
* U: B! y" F- L v" o' X1 s) @ - #include <linux/dma-mapping.h>- I# ?$ N6 A- G2 {. J
- , a" }: U8 f* B$ J* q
- #include <mach/memory.h>
' c6 o J: X( Y - #include <mach/hardware.h>
# b/ J, R; Z: I$ g, U* {# y$ B: x - #include <mach/irqs.h>2 v3 a4 V" q5 X, U9 s7 F1 Q
- #include <asm/hardware/edma.h>
$ t/ b' K. D# |7 E
; x, \* l$ _3 q+ }& x* b- #undef EDMA3_DEBUG
8 j* ^/ q+ N$ x$ o. } x - /*#define EDMA3_DEBUG*/5 ~. ~/ _0 `3 L4 i- }. f" E
- 1 ~% ]. R. f% I( `2 F/ P% _
- #ifdef EDMA3_DEBUG" u7 Q5 Q+ _8 r0 C0 b
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. Q5 q/ L/ O# ^8 k& K* p/ C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 H# f" t! \1 g; ~+ S
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 `# d; R8 c/ T2 \% B( h" q5 N
- #else
5 d% ?0 Q4 d1 P - #define DMA_PRINTK( x... )
* p$ M, }. u) H3 B a ^. c. u - #define DMA_FN_IN
6 h! @. c- w1 A. S0 s6 C q - #define DMA_FN_OUT
$ a# o5 h/ u. f1 R1 e" I - #endif; i& g5 G0 z% V2 Y
- 7 ~# s$ T( x$ ~ B$ d% B3 K; `1 w7 q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! l8 ?+ o# a9 ~0 A) W - #define STATIC_SHIFT 3- g& w' v- k& C( \
- #define TCINTEN_SHIFT 207 A2 i l' W9 b) B4 K5 z8 z
- #define ITCINTEN_SHIFT 21. c+ h ?* Y, X
- #define TCCHEN_SHIFT 22, n* o0 x7 m3 O. V( F
- #define ITCCHEN_SHIFT 23" i* Y6 l$ N% n6 Q, N8 I
- ( J$ q9 p9 ^% y
- static volatile int irqraised1 = 0;/ Q4 A4 Y$ J2 k! B8 l% H
- static volatile int irqraised2 = 0;
/ J; d! {3 G. e3 _ - : v7 E" T* b, { R
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: o1 u2 L% [: T1 V! l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, F8 u+ _6 C' k: O3 i; X
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, T7 S6 \8 a e% ~' I
/ i" P% j4 @4 w- `5 x- dma_addr_t dmaphyssrc1 = 0;
7 ~, X# E, _, n% u! X: Q2 b( X - dma_addr_t dmaphyssrc2 = 0;
7 ~: C( T2 C. |2 e. z' o - dma_addr_t dmaphysdest1 = 0;
# s5 X0 e: p# d! Y - dma_addr_t dmaphysdest2 = 0;
. ~7 X) d2 C8 } - 7 h. A0 N$ Z1 v$ ~2 n% P" G
- char *dmabufsrc1 = NULL;( d# j& k* l) a! V" m
- char *dmabufsrc2 = NULL;
! a/ b" V0 @5 X& c4 ]9 d6 E - char *dmabufdest1 = NULL;
! c9 O1 M9 y8 y5 N! O - char *dmabufdest2 = NULL;
) ?. u8 H2 l! S" u g - ( H" O7 R. ]: `
- static int acnt = 512;
0 O2 d1 q: O6 L J* ?3 q - static int bcnt = 8;! t3 ]3 F% M0 W% U! q3 N, W
- static int ccnt = 8;5 E. V* J- b! ~5 v$ ?* z% K# K1 ~
5 D, z2 v* b9 L6 ^- module_param(acnt, int, S_IRUGO);* o+ ?) e) f2 m" t
- module_param(bcnt, int, S_IRUGO); a8 O/ f! w. W/ i
- module_param(ccnt, int, S_IRUGO);
复制代码
- `2 A" l+ U8 K
# D7 |3 c6 X: }6 u% J/ J, P) ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 h& K+ Q3 l- K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- l( ^8 v& P" u9 G. P$ i- ^! w
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. M6 ]4 E, w; t' @) H5 N
& y- J* v8 T4 @8 ]; c5 B# A$ s6 V3 |0 |" h- U& y. v
|
|