|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) |( h& ?( B# B
- [code]EDMA sample test application+ G1 e, \1 e" s0 S5 _' ^
- /*
2 L2 X- K0 L# k% L5 n5 U( j - * edma_test.c
7 h: S6 X* M- T; |: ~ - *
; c% ? p. v! |! i5 U' T - * brief EDMA3 Test Application
" H$ c9 k6 n: k - *1 t$ y8 L7 w& n4 m) p! b0 x. [
- * This file contains EDMA3 Test code./ S' t- X: r5 t V8 P
- *5 X6 ^6 D8 h7 b( i# e! v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ U% Q$ {9 P" W5 f, L9 o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) N5 L' |6 B% }3 d% d8 p8 ? - * TO CHANGE.
E9 g3 r5 `; _ - ** \. |# t4 M7 h; {+ O/ @* E0 x2 E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! i& c- X9 Z. |: |3 B
- *
& m1 n$ B" i- N( b. c/ b( s - * This program is free software; you can redistribute it and/or4 x' E. ?# A# G5 @% k, d
- * modify it under the terms of the GNU General Public License as5 s) D5 h- l" N4 ?/ k, O
- * published by the Free Software Foundation version 2.
8 E* B+ f- B. D( u. F# j - *
2 z/ N! q$ M' ]9 s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- F1 K% }; k% X6 l& b# B" S! }
- * kind, whether express or implied; without even the implied warranty
: x+ Y3 i) P- i! s$ Z, h* U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* d i, [6 R4 }# T5 h/ c7 j - * GNU General Public License for more details.9 ~# ^) [" i( U2 G
- */
8 K1 S! r" Q0 [ \
! m5 y5 H3 S3 r: v8 i* U/ |! b) D- #include <linux/module.h>% p w5 R9 Z A% U* N2 v6 K
- #include <linux/init.h>: [+ j% w1 H* s [9 p+ \, H" z
- #include <linux/errno.h>" q r. v- x* }8 _/ B, p( |4 Q
- #include <linux/types.h> m) c3 ]1 T9 W9 L2 l- Y
- #include <linux/interrupt.h>( E2 I `( [2 Y2 }
- #include <asm/io.h>/ R; _4 X, b; x# F7 `, Q" U
- #include <linux/moduleparam.h>
9 p6 C$ K$ ]( J/ S* e- [ - #include <linux/sysctl.h>0 `( c; x. N& @* z# g" f1 D
- #include <linux/mm.h>
) Z2 I7 b/ n/ X" [7 P. v - #include <linux/dma-mapping.h>6 i. X6 u' n# Y7 n( @; I
0 R! I' H9 O' M: v& [$ W- #include <mach/memory.h>
4 l1 l2 r. U: k5 ^! m - #include <mach/hardware.h>; n7 p' l( D. K
- #include <mach/irqs.h>
3 V3 Q, B' @9 |5 N! t - #include <asm/hardware/edma.h>
" I d9 S& D" G
) ?& I- g1 f1 P9 i) v1 y0 \- #undef EDMA3_DEBUG! V' ~; }- z; L1 i( Z
- /*#define EDMA3_DEBUG*/
! X9 i- Z( X6 z4 ]8 A; A2 W - 1 g9 x# U0 H7 M) x$ S5 `
- #ifdef EDMA3_DEBUG
; ]- s: k" Q6 Q; G( [2 {# f0 V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ l0 t* B* m$ q% r$ d" p* d- p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) U1 |8 E9 C4 L" L7 e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ g: _! \5 c2 E: x" o L" F' F: m - #else( O! h6 X, s" T5 S/ q! ^
- #define DMA_PRINTK( x... )
; C" w. y1 J6 M - #define DMA_FN_IN- w; J$ d2 k' ?! u. c/ K: r
- #define DMA_FN_OUT
$ G/ h1 ~, |8 b8 m3 l! h - #endif n' c# V0 j. O- S# y4 _( z
- . D4 N+ n5 N* k s/ w" h3 i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( l y, Z- M& k0 ~0 @ - #define STATIC_SHIFT 3
, V3 ^8 S+ t/ f - #define TCINTEN_SHIFT 20
; C( P8 \( w$ A3 g - #define ITCINTEN_SHIFT 21! e& n4 J1 u& V/ b9 N1 `5 I& }5 f
- #define TCCHEN_SHIFT 22
' a' V. Z' W) ~( a/ j$ U - #define ITCCHEN_SHIFT 23( B8 k" b3 a3 H; K2 u. Y f
+ C5 f- x' W G7 m- static volatile int irqraised1 = 0;8 U0 c7 b2 C% ^# h
- static volatile int irqraised2 = 0;3 @* g& K) h1 L. u, X5 H
- ' }9 l' M f: e, R! I( ?+ b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* P+ S& z* @$ V/ F4 W) c* K; l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& y% u8 f& |9 {- D/ K - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 g6 H, Y) _0 g# w0 E - 2 ^4 d) j2 n ?' U* [. u
- dma_addr_t dmaphyssrc1 = 0;: c5 u3 j! G. l
- dma_addr_t dmaphyssrc2 = 0;
9 i0 C, F/ R. Q7 \- U5 r1 I9 J - dma_addr_t dmaphysdest1 = 0;
- w1 T3 P ?( g4 D$ f* p6 ?. V - dma_addr_t dmaphysdest2 = 0;
5 X- w6 T1 W( d8 B- [4 n V - 3 `; c/ `* i& d' ?' n6 |! i4 P
- char *dmabufsrc1 = NULL;* {. ?. ]% G, G) v" A: f7 N$ O
- char *dmabufsrc2 = NULL;
3 I; d" ]. R8 c6 j# {6 B) S - char *dmabufdest1 = NULL;. k! j3 Y. @' j8 l2 _
- char *dmabufdest2 = NULL;$ e" a+ e: D- G+ g
- ) E' V- A$ \) J" w! j; h: p, P2 f
- static int acnt = 512;# G8 e' x7 N/ j3 y w
- static int bcnt = 8;: i4 L H' R3 b
- static int ccnt = 8;
5 Y+ q! v3 u; Z3 W( h' k - $ [; ~4 G& E+ A+ f- B# A
- module_param(acnt, int, S_IRUGO);2 R# T( O2 L X5 N& j8 e6 h
- module_param(bcnt, int, S_IRUGO);* v5 u! `7 V3 p T: Y1 V
- module_param(ccnt, int, S_IRUGO);
复制代码 * x. t: }# \7 h0 B( {& N
( S- C1 U' \. D7 N* m2 g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( `' L% y; p$ ?/ [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 ]- E0 i/ Q% u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, ]! `5 D, L4 w* s4 N
; ~, Q; ^& u# L; e% Z
! | V& j! j0 {0 B( M |
|