|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' ]' { R4 D: H; ~4 r
- [code]EDMA sample test application
) v0 ?3 C; E6 S: V8 J - /*# R3 i6 ^0 c- w1 `! J0 N5 `! d( V
- * edma_test.c
; N; @) y! p4 U/ y; `" p; B - *9 }9 K4 R8 S |: \% ?/ ?5 D
- * brief EDMA3 Test Application
1 [. k" b0 A9 C+ o5 K4 r" k - *
6 M. i8 T3 C6 D- X% T, W/ o - * This file contains EDMA3 Test code.5 o5 N. q' L* |# h8 l% v4 j
- *1 A J$ b. i% S, j! d7 z8 w. j( f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 i' s7 s! G! p0 g - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& U( L! R2 o3 A' O7 K - * TO CHANGE." {/ T( F. `, x0 W; J; B# [
- *3 ^% V$ i" X2 H# p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% j" E( z) ?- E - *
6 ~2 i6 ?: w ~( _ - * This program is free software; you can redistribute it and/or
! U+ P2 l& a5 E9 b" J - * modify it under the terms of the GNU General Public License as6 ]( \9 H$ m' q7 Y' B
- * published by the Free Software Foundation version 2.
: n4 b; C2 Z, H$ H6 q% {1 Y% W - *
. L$ Y0 S; {! @: I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! y. C. ]1 m; p3 b) y
- * kind, whether express or implied; without even the implied warranty
+ c. o/ k9 W8 ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, Y! U, P. N h, U3 y8 P7 l2 M% b& p+ l
- * GNU General Public License for more details.
% c, S0 ] h6 Z - */1 {" b0 Y8 n2 Y. a
2 v( P3 m& m" H2 u7 r8 n0 O- #include <linux/module.h>
, m; v4 ]& o: R( J! a - #include <linux/init.h># B$ ?: k2 Z; \3 R6 b5 ?
- #include <linux/errno.h>
/ _( K( F1 j9 e. J% s6 J - #include <linux/types.h>
6 v& t: k7 N; V' c - #include <linux/interrupt.h>
# S5 x, }6 P1 e5 | - #include <asm/io.h>+ t3 S# q) w& B, H
- #include <linux/moduleparam.h>. p4 L/ M" j6 J/ Z5 O8 T E
- #include <linux/sysctl.h>- _; X3 K1 D0 Q2 Y
- #include <linux/mm.h>
8 I3 p- ]8 Q, L: Q4 B3 P+ O; \3 ? - #include <linux/dma-mapping.h>) i4 j( r1 @7 y
' x5 f# C0 b6 E0 ^# |4 j& b- #include <mach/memory.h>
. a% e- x1 _3 a$ @8 w$ Z5 C" g - #include <mach/hardware.h>& h, m# b, {* a' ]! y. e4 l
- #include <mach/irqs.h>
( w3 d6 t/ d4 o! g - #include <asm/hardware/edma.h>2 h0 k+ r2 n7 L4 ^* O
- / i5 ^; X7 p; X: ~: m
- #undef EDMA3_DEBUG
; s6 M0 W4 N( M$ i9 b/ W G& a - /*#define EDMA3_DEBUG*/. ^" t8 A! v4 h Y& M+ P
5 S( c' Y6 Z% D, z7 ~' ?- #ifdef EDMA3_DEBUG
7 t) X8 U+ y) q7 ^" z, e0 |7 a, l - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). y# q' B0 m3 m
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% c* L' m0 M) p, h1 m. u9 J - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) Y# F. f2 z' A4 F0 Q+ b3 q
- #else
' i2 ~8 s) R) w l- @4 _" ^ - #define DMA_PRINTK( x... )
0 U6 v E- b8 v& }. M; P - #define DMA_FN_IN
" [" F. v+ v( b& _3 g - #define DMA_FN_OUT1 F4 H C% }& k+ i2 Z: J5 V5 _, p' y
- #endif
8 f6 V5 l6 s& \3 x
( j* a# E8 z& u% \, q: q' s- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 M. T4 Y0 O. i$ D( m# X
- #define STATIC_SHIFT 3 G9 t" u% ~: B: D* C3 M" e
- #define TCINTEN_SHIFT 206 X4 a! J# [0 L
- #define ITCINTEN_SHIFT 21
1 B& {" p* f& U0 L - #define TCCHEN_SHIFT 22
* R2 ~" ^/ T* `2 a6 B, O0 u" Y0 } - #define ITCCHEN_SHIFT 238 k+ ?7 z: v+ P; h
- N9 @' i, `! r5 `+ y6 Z
- static volatile int irqraised1 = 0;
; O" M. \" Z- R. K0 J( E2 r$ H - static volatile int irqraised2 = 0;
' C* J6 B9 V6 D8 z5 y
4 q( _/ `2 @) k8 x' G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" N$ F) m; n: i0 l- A7 n! N. t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 T ?' H1 d& c5 X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 Q0 t* H2 b' Q* I3 P/ f
& _6 Y, s! S, [, U# N1 `- dma_addr_t dmaphyssrc1 = 0;
3 y% u- ], G6 N$ t3 k - dma_addr_t dmaphyssrc2 = 0;
9 h. a% j( r6 z - dma_addr_t dmaphysdest1 = 0;6 j) n" \! g6 V: r4 A! a0 _3 ^' J7 r7 ?
- dma_addr_t dmaphysdest2 = 0; b0 f! y0 y) T a5 j
, { g5 s" [3 ]) e( F, [1 m# O- char *dmabufsrc1 = NULL;$ m0 X! O& E; q! \; i( W7 X. V
- char *dmabufsrc2 = NULL;6 a+ Z' r! R( e" E" H8 C
- char *dmabufdest1 = NULL;
! L8 n1 H4 |5 c6 ]2 |$ W - char *dmabufdest2 = NULL;
1 @& Y) }5 l0 E6 T3 n' G - + h0 c9 T" z6 T$ k& A
- static int acnt = 512;) k' v4 ~' A0 W5 T3 y1 a0 g) t
- static int bcnt = 8;
. N8 n" g- M, F% K - static int ccnt = 8;
c; N/ Q, I" m' j; G - / m1 L7 d( P1 f
- module_param(acnt, int, S_IRUGO);9 u3 K6 E: B5 U; C
- module_param(bcnt, int, S_IRUGO);
& T2 X- _3 s2 ?; K - module_param(ccnt, int, S_IRUGO);
复制代码 - w, R* k; y |7 Z
: F0 @4 r/ _, E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# S. m! n* _3 w/ `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 y6 Y/ l+ S. \" U* i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 T4 D; T) L) q8 A$ n1 `3 g3 v ]$ L: \" p. L0 O
0 B) A' _5 W. O# b& O; K2 e" O
|
|