|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 _- O5 y H3 H% c2 Y: {- [code]EDMA sample test application6 i- A; U6 H( K; O7 C# q p* g/ ^+ ?2 m
- /*% x7 l+ B% h0 x5 {! J, S6 J- Z, Y
- * edma_test.c) _. @2 v1 i$ j9 o/ @0 t
- *
8 v% ?% A+ ?: h4 x1 Z - * brief EDMA3 Test Application
! W( d! v5 W. s! P - *6 U4 J* z: w, u9 q, M6 A2 y# I
- * This file contains EDMA3 Test code.
: [8 J5 h" e2 V/ p5 ` - *
! b6 u' o2 U/ ?# w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
@. u/ |8 C/ v% _+ i% }, D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 M8 u8 t* Y, P" i% {
- * TO CHANGE.
$ C$ J6 j: U- h ^6 p0 E - *
' }1 L/ D6 a" Y4 j/ k - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ m, P4 R [5 Z3 O
- *
7 s) e/ R D6 V$ [ - * This program is free software; you can redistribute it and/or o2 O8 u2 C" X; L# M( F
- * modify it under the terms of the GNU General Public License as& \: H7 p# @/ i& b! F6 J- a' V
- * published by the Free Software Foundation version 2.$ O0 y$ Q1 h3 _5 ]" S6 C
- *
4 K, C7 O6 q3 F; R& T @7 x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any* k9 n3 n1 ]- o1 ]7 s# s- A
- * kind, whether express or implied; without even the implied warranty: i5 H5 x N( w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. ?# {) h4 p$ d0 J. X1 J1 F0 m9 U. | - * GNU General Public License for more details.( [. U2 N% q9 N. O$ v
- */
& u: c: v% Z( @, J - & a# W, k8 m8 r7 y
- #include <linux/module.h>5 W. Y2 W+ {, _
- #include <linux/init.h>
& }, A. z* w2 T; w - #include <linux/errno.h>
5 o1 z* u/ T; a8 C& _3 s - #include <linux/types.h>
3 u, n9 Z, Y# g1 j8 t - #include <linux/interrupt.h>& E! z: @$ d* v# m
- #include <asm/io.h>
7 |5 y# f1 v0 Z/ W1 S - #include <linux/moduleparam.h>) U6 e6 }' D8 H- g( U4 ]5 f/ E! q4 K
- #include <linux/sysctl.h>
' w1 L6 A# O( n+ w - #include <linux/mm.h># W [, z6 k# I! ]( h- n% A
- #include <linux/dma-mapping.h>8 C$ s, }# ^/ C8 \+ ^7 n
& O4 g8 z2 Y( }& u5 L- #include <mach/memory.h># w! v, Z. i. i. b
- #include <mach/hardware.h>
0 V- Z$ J, B5 E1 g1 a - #include <mach/irqs.h>
' R1 \, C7 y1 d/ i7 y4 C# Z - #include <asm/hardware/edma.h>
- L, s8 f( f4 X2 k. n1 U7 T9 \ - 5 g! p" G8 G6 ?- U
- #undef EDMA3_DEBUG
/ l5 |7 G; ?* x% C - /*#define EDMA3_DEBUG*/4 [2 o n& M' z3 r
- 0 E8 C) p( _- _; [
- #ifdef EDMA3_DEBUG, G! X( i7 V1 i2 _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% j: K- J4 W# s0 t% }# o+ r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 ~* R9 U/ v |% o% r5 h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" N! X2 W, o6 Y% a) F& j6 F - #else/ X' @' k! N9 D9 g4 [+ \+ \
- #define DMA_PRINTK( x... ). Z. h0 J* m( q O2 j; a* a
- #define DMA_FN_IN9 G( z# z+ c4 ], n6 S
- #define DMA_FN_OUT
# Q0 ]% z( h# d+ x8 D- e - #endif! e: ]; Z' A+ w/ j6 b0 D
1 A8 u/ D, a8 w& i- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 |, g# w5 f, P% T' j( F - #define STATIC_SHIFT 3
6 ]/ V, r1 v3 ]/ V1 y% I - #define TCINTEN_SHIFT 20' ?; x' s. O' {9 i
- #define ITCINTEN_SHIFT 21! g. b0 I4 i: h3 S, [2 a, @3 r
- #define TCCHEN_SHIFT 22
& A' Y) z! `8 i: e - #define ITCCHEN_SHIFT 23
" G4 p$ w+ t8 r! O8 b# @$ V
. e: r5 H8 f- S/ g- static volatile int irqraised1 = 0;7 b( ^; k# e4 B9 e. p
- static volatile int irqraised2 = 0;
: ^1 S4 f+ ~( u$ K - + A1 {$ `1 I8 \) P$ G! O7 b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" `' s6 C/ A- z& W, {+ a - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* Z5 J' G4 Q) h" N! E) m - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 {" q: Q( N4 \% d D - : k7 v R9 O0 H7 l% | k/ l+ j
- dma_addr_t dmaphyssrc1 = 0;
) I* j; g6 b) a - dma_addr_t dmaphyssrc2 = 0;
1 R. U0 _: s @ - dma_addr_t dmaphysdest1 = 0;
, F9 j% W( s, i% X, b - dma_addr_t dmaphysdest2 = 0;
9 R; Z/ h2 O* R, r. u6 @ - ) ?7 t) I' V y% T1 S
- char *dmabufsrc1 = NULL;: M$ Z" `5 n; y9 O) Z1 v9 E
- char *dmabufsrc2 = NULL;7 _- a7 j; a3 t& g/ F9 _
- char *dmabufdest1 = NULL;
8 K2 V a' Z6 z2 D8 Y; ^9 D$ ` - char *dmabufdest2 = NULL;
( F* X6 u6 h, u" Z0 _; w# N9 J - ' w5 @# w( a3 q6 K; R
- static int acnt = 512;
4 H. z3 r$ Q* Z) H - static int bcnt = 8;- S% C& M! \& o, S
- static int ccnt = 8;
# x/ u9 z, _7 N& `$ X. R" ]
; j2 I- P# t. T" j8 O4 g- module_param(acnt, int, S_IRUGO);
3 A1 A: O! d. |2 n6 s0 I - module_param(bcnt, int, S_IRUGO);
8 a A: x0 R% m6 I2 Q - module_param(ccnt, int, S_IRUGO);
复制代码 % g2 E6 k4 m; y3 f( j& x, `3 ~) C
/ a1 Z. D$ V; b# C5 t/ n& _( H5 ?
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; f+ V* S8 N7 H' ~: u+ @" `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 b, s4 b/ d- v( b& Z% X
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 ]' B# A7 B1 i
, w3 Z5 D3 \- u# J: `$ f1 o* _( D6 Y$ P) O4 t- U+ @
|
|