|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) M' R" m. f; o6 a' X1 f6 r$ `# H
- [code]EDMA sample test application) L, A7 v4 u& N
- /*
0 B, ]+ q6 j; x* `) r+ _; j P* K& m, { - * edma_test.c
2 E" H; X; m$ X1 i/ B# ^ - *' U+ l& e, J+ O0 U3 H
- * brief EDMA3 Test Application8 Q7 L" E" m" H+ K+ x
- *7 Y5 d" S* d" b+ T, a/ C
- * This file contains EDMA3 Test code.
' y+ `4 O1 m* [4 z - *1 L# n1 u- A. \% l- B6 D, Z4 R
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 S, a, N, A: K' S
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 u2 z% t# e0 A [3 @
- * TO CHANGE.
5 p. c8 ]8 |) ^) T5 c( {: Y( g - *3 q" Z0 b9 ^6 ?8 u. C6 t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 }; V- q* y7 i - *
" A1 h( C; F* X4 P4 C" w" V - * This program is free software; you can redistribute it and/or3 M0 |+ U- T6 ~- Y! F1 g
- * modify it under the terms of the GNU General Public License as
. c0 R0 i6 m4 M - * published by the Free Software Foundation version 2.' L3 _* Y$ [# \: S1 U- e1 E+ z
- *- y- h8 r, I; }6 }& T- Q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 \2 p: D8 ]5 \ - * kind, whether express or implied; without even the implied warranty; T2 ^$ p" V2 }6 L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( b t& q2 _. S) R
- * GNU General Public License for more details.2 u2 [+ P! ^' D) e* X+ ]1 q4 X. A
- */
$ I, M7 J8 Z) | - ) ~) A' l$ \' \
- #include <linux/module.h>
% u! t) E7 e, z' N - #include <linux/init.h>
: F- t+ d* X5 s0 s' i! ]4 a }! w - #include <linux/errno.h>8 Q. o8 D$ S. K. N
- #include <linux/types.h>0 I- }3 H* v6 V5 U8 ]8 m7 n
- #include <linux/interrupt.h>
8 ~. f0 `* }& t+ L - #include <asm/io.h>0 z, }+ t# b$ C' O/ b1 s. R' I6 `
- #include <linux/moduleparam.h>4 z; V3 Q' C y& N$ N
- #include <linux/sysctl.h>! a- v) B* C: i& v$ R
- #include <linux/mm.h>
1 Q6 Q# N7 D# W5 | - #include <linux/dma-mapping.h>
( N5 i6 V8 _, e - 5 E2 B+ t4 ]% R+ N' l4 H
- #include <mach/memory.h>9 K& G$ }* `2 w4 ~
- #include <mach/hardware.h>7 o ~/ D- H/ p, D# L# U
- #include <mach/irqs.h>4 _: c& F. ~8 X5 M! M) |
- #include <asm/hardware/edma.h>, v% r7 V' e! s+ ]/ G
- ! ]4 v' W: G: k, b/ K
- #undef EDMA3_DEBUG* T. l0 s3 D) y: l3 o
- /*#define EDMA3_DEBUG*/5 e) E$ ~* Y5 r: \% X
1 e( _+ Y0 g1 f$ j$ }1 F- #ifdef EDMA3_DEBUG
R" G8 _% [- F5 T - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ Y+ [7 T8 p+ n) ^' ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); N% B* y2 V1 q5 T) l
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. ~4 m! B4 `: I- W+ Y1 h - #else
N4 j6 h2 ?+ Q0 Q - #define DMA_PRINTK( x... )
2 w8 c# o* }4 f6 S; ?* W" J - #define DMA_FN_IN* X9 F* [+ ~; U6 E$ S
- #define DMA_FN_OUT- D; n, F8 X( |$ a9 h
- #endif
$ v' n) g! D; V - . r6 U0 K5 ~- T' _( v; G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ R' @' D, M: p7 D
- #define STATIC_SHIFT 3! V, D) p1 |9 ^3 ]1 @* v! l+ K" o
- #define TCINTEN_SHIFT 20
. C7 w" s5 _( K( s2 z% T - #define ITCINTEN_SHIFT 21
# L' ?6 V' J6 n- m- l' M - #define TCCHEN_SHIFT 22( ~; ~; i' ^0 w! L, P0 @
- #define ITCCHEN_SHIFT 237 ?8 Z6 n4 F2 l ?, @! \5 |7 ?
$ R+ N J: t! {5 |! ^# P" t- static volatile int irqraised1 = 0;# F' p; a. y! z# ]
- static volatile int irqraised2 = 0;+ f" A) `) `3 Z$ v
- 6 _3 K; i3 [- m% }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 A- \- r$ L$ ]+ M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, @% m- A R% X) i: S, A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 |' E* y+ r# O; f. t* U# s
! Q$ A- Z' H6 Q$ W5 U t9 d- dma_addr_t dmaphyssrc1 = 0;
1 g: _. J, @: N - dma_addr_t dmaphyssrc2 = 0;
9 Z |! b3 p0 b1 Y2 s - dma_addr_t dmaphysdest1 = 0;
9 r1 U P$ F6 u5 T3 y - dma_addr_t dmaphysdest2 = 0;( U& O5 u- r8 ?( ~1 H
{- Y) c' M( g8 ^/ p2 R- char *dmabufsrc1 = NULL;9 k/ B: ?7 K7 d
- char *dmabufsrc2 = NULL;
1 v4 s: x, g& c$ T3 ^% c - char *dmabufdest1 = NULL;& C) l5 r1 A! [( n! z) V
- char *dmabufdest2 = NULL;% ^5 D8 M# x5 o
9 L3 W9 H: n9 U/ c; P# A- static int acnt = 512;
% _) T) w8 S. M/ I- x - static int bcnt = 8;( K( E4 ^. ~' w
- static int ccnt = 8;0 } p2 ?) Q# b
1 n( g9 ]4 \/ A0 _7 i9 Y" ]- module_param(acnt, int, S_IRUGO);
, \) _ n& D8 D& \8 g - module_param(bcnt, int, S_IRUGO);6 ?# \8 W \: E! ^$ [! M& G
- module_param(ccnt, int, S_IRUGO);
复制代码
" r2 W3 [" w: o8 o; h6 _
, b9 ]' E: m4 @& C/ n. c 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ A/ ]( ^7 E Y6 S/ X& b, garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 S8 J# K! D* @! T* X/ Z2 L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* _9 y5 {. U/ B- b d
) k7 q* K$ q9 o. c
, V O5 v; C! o( t7 b1 b. ? |
|