|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; ` o9 }. X3 ^" A6 G9 L
- [code]EDMA sample test application- v1 x; l9 ^- M- Q" ~
- /*; v7 n' {7 s2 Q( v4 [3 V
- * edma_test.c
) c0 [" E9 H0 g( O" w0 N - *6 Q: p. Q# w6 E+ w" Y4 A# {# i
- * brief EDMA3 Test Application, @% k- [& @- e9 @: R
- *
, c' m/ g3 @% T - * This file contains EDMA3 Test code.1 U; W9 Y. |) X3 ?8 w: j
- *
% Q2 X, c3 R. r$ {( G - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! ?# t* ]0 w6 I E9 }
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 {( y6 C/ N; S, |) w. I
- * TO CHANGE.
- p' k4 u0 i& K" F- O - *
$ h ~/ n" S, y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 K; t3 ?3 Y/ Z5 h4 |5 D
- *% E8 J; B) S5 V! _9 }- L8 T
- * This program is free software; you can redistribute it and/or
. C8 z8 \4 i C) A% {( | - * modify it under the terms of the GNU General Public License as
$ X. c; p' ~, u% c: ]. ]. ` - * published by the Free Software Foundation version 2.
, G, a; X. t# i - *6 `4 `7 {( H8 Q5 _6 [
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ D$ q7 Q& ]- I* b - * kind, whether express or implied; without even the implied warranty4 V/ U+ O) m1 J% j- X
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, k$ j2 O2 I5 A& q5 V9 o& N
- * GNU General Public License for more details. u- {) r# v) B( ^5 p7 k
- */' b, `2 B2 N( X/ b
' {) i5 ?" F% Y/ L$ F$ m6 P! i- #include <linux/module.h>
0 L0 X' p M1 A d8 q - #include <linux/init.h>
8 u# Y( Q# t7 A3 f; w9 V; b8 h - #include <linux/errno.h>$ F, ^. d2 g7 y0 P( W) A) \
- #include <linux/types.h>
1 l" ~! T9 O) Y/ @% N - #include <linux/interrupt.h>
3 v4 ^+ L8 i' d) H# C% m - #include <asm/io.h>
* \' Q4 i' J. ^3 c, H' T - #include <linux/moduleparam.h>
0 Q( g' h8 q* Q) U5 Y - #include <linux/sysctl.h>$ y. u2 f: ], M2 e
- #include <linux/mm.h>2 ]! B* Q% P h* U6 N3 E
- #include <linux/dma-mapping.h>
( o" `4 m! u4 g. r7 b# @
1 n- |. U# j% E1 E- #include <mach/memory.h>5 l& h$ _! Q/ o) }6 ]) Y7 x$ @& x5 `/ {
- #include <mach/hardware.h>+ t0 V& ? o1 \( Y) h& F7 a
- #include <mach/irqs.h>
! _2 j0 j* _8 ^: u! c - #include <asm/hardware/edma.h>/ M+ g# }4 r; b$ a5 Y( p% o
- ; B* B# L* i, T2 h1 I4 B7 f
- #undef EDMA3_DEBUG
. B5 T) J4 W6 D u, g! F - /*#define EDMA3_DEBUG*/
9 R2 x/ t3 {" g; n4 }& `* e7 A, B
; C7 \ M& X2 b/ q0 ?7 @- #ifdef EDMA3_DEBUG" q. b8 ?$ ?' U# ^6 ^5 q3 q. i
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& ^) }7 V& r3 ^# g3 L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- D$ Q1 ?# ^6 K. v5 G* V& B3 f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 [# n7 G% H4 ]/ R+ p. M - #else
4 q! C4 M9 D' k - #define DMA_PRINTK( x... )
4 [8 S" b4 E% h' X$ _8 s6 L - #define DMA_FN_IN. i% O4 f: _8 w; q: O
- #define DMA_FN_OUT
" E; |# v: f9 {* `# H) i - #endif: S! I w: v4 g) ?
( z7 \5 |" v3 h7 z5 _, l- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 e1 d9 V4 ] w' e+ J - #define STATIC_SHIFT 3
( [ N5 e* _* ]% q" j0 g - #define TCINTEN_SHIFT 20, e- N$ n4 g' x8 j+ r
- #define ITCINTEN_SHIFT 21! D8 b! F/ p+ I& I3 @
- #define TCCHEN_SHIFT 226 J( p/ h* A4 }2 C2 j) Q% P4 r
- #define ITCCHEN_SHIFT 23+ E0 w3 B( S: v. K" M2 X
0 |* O( T' {: R5 W- static volatile int irqraised1 = 0;
7 Y5 v6 g V% T- B2 @3 N - static volatile int irqraised2 = 0;2 }' J; h" {0 _% {3 K2 X/ W
- - `3 c6 f' n3 _: {2 I
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& m# i- U6 F+ R; K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- G @8 ]% G7 Y1 O, h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( f/ I* T! h5 b. [1 x - % x8 d }* C3 f3 p3 [( x( r8 o
- dma_addr_t dmaphyssrc1 = 0;! {9 t8 g5 @! u/ X
- dma_addr_t dmaphyssrc2 = 0;
: S5 l1 O4 M' ` - dma_addr_t dmaphysdest1 = 0;
/ P, K3 L a9 b1 F - dma_addr_t dmaphysdest2 = 0;* n( e$ Q9 i1 b; R, r
- ; Q5 Q5 Q) [* v
- char *dmabufsrc1 = NULL;! x: v% j2 K) ~5 k$ H
- char *dmabufsrc2 = NULL;
- Z5 z7 E: r B; k/ X- o, { - char *dmabufdest1 = NULL;. W3 ^6 Y: Z: V- U# {: V
- char *dmabufdest2 = NULL;
3 `) v [9 Z, t
+ a) h' D9 n( S- R) c' z. I ?6 P. O- static int acnt = 512;
: [" f7 s5 b7 i# j- X - static int bcnt = 8;
/ [* t. _; J0 w - static int ccnt = 8; u% m/ Q- Z' s
- 0 x1 X. m/ D$ C# x9 m
- module_param(acnt, int, S_IRUGO);
$ ^9 ]" t V. F6 P8 C- _3 a - module_param(bcnt, int, S_IRUGO);. S+ U- n2 w- g/ j- X2 T; d
- module_param(ccnt, int, S_IRUGO);
复制代码 7 ? N& L1 J9 h6 q: e8 b2 _
3 m j8 \+ B( k$ m/ z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 x' a. b2 I( q5 _7 barm-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# U0 {7 x! i
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 m2 }/ ~. T; Y) O
5 O, T3 }5 Z6 u
: ^) b) O6 H$ _; N1 F; P |
|