|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 Y Z. s" }0 D4 P8 w1 s
- [code]EDMA sample test application
: S/ a' c5 v( J$ X - /*
0 W! z) ?. C: ?, F" F3 `: L7 u - * edma_test.c1 t3 v- G$ [) P$ D U* ~( G0 n
- *
+ l4 U, z. b9 Z: t8 `% G. w - * brief EDMA3 Test Application# ^2 X) Q, } W; M/ A8 S
- *
" G- N0 @* @) Q4 U, ^ - * This file contains EDMA3 Test code.
+ E, i0 s: o6 L4 s2 L# ? - *
: M, E+ x0 A1 L1 g7 t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ Q1 |- ~( z$ p# o( p4 h J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' E, H# D+ ]" ` h( G3 a - * TO CHANGE.8 M8 p2 c# w2 ~4 w5 N6 B0 {
- *
) ]/ w; O0 [; ^8 S8 d" ~. r) y; R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# D" r* k7 O7 d) D! a: ~ - *9 W P+ Z8 F, U
- * This program is free software; you can redistribute it and/or* _; m$ q M0 K
- * modify it under the terms of the GNU General Public License as
6 A6 n8 i0 I* T7 V1 u6 g% Q; y - * published by the Free Software Foundation version 2.2 f/ o y; H6 X
- *
9 Y- r) T p& F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" J r& I7 U' R) B3 x( R( E
- * kind, whether express or implied; without even the implied warranty
% q$ p- Z6 ~) Q3 d/ L& F @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ q3 y" u6 O$ {0 V) N6 a
- * GNU General Public License for more details.8 g" j% `4 Q: E4 N- Q B9 C
- */
8 ]$ V8 e u& K( q0 _! _
) }/ O8 e; V8 q- a- #include <linux/module.h>: Q+ X$ \% ]& l; ~. H% S
- #include <linux/init.h>0 [1 r: t# v5 q$ B
- #include <linux/errno.h>1 Z3 |. L8 _: {8 F9 h
- #include <linux/types.h>
. b; j' ?& K4 M! V9 A5 o t - #include <linux/interrupt.h>0 ^4 ~3 f4 S% {8 l% \7 ~) c" B2 Q6 _
- #include <asm/io.h>3 i( x% i" P, J0 E5 Y; Q
- #include <linux/moduleparam.h>
, g" n2 o3 o9 {( c+ y; M - #include <linux/sysctl.h>1 e9 E# n, `8 r1 |
- #include <linux/mm.h>
5 E, I+ b2 A+ W' D# q6 Y1 @& [2 I - #include <linux/dma-mapping.h>
0 u& j' A0 P( `5 \; A
! k! Q7 V9 c# v5 L- #include <mach/memory.h>
0 U, R4 {+ t9 D d* t9 X - #include <mach/hardware.h>
1 K( { m# j3 m4 t - #include <mach/irqs.h>$ ~: Y4 F) J! w" X) i8 s. n% o
- #include <asm/hardware/edma.h>
* _* O: _7 [- N U @
) ~* t5 ^. @4 c( l6 i% U- #undef EDMA3_DEBUG
+ I7 i, Y% T, x: J' T - /*#define EDMA3_DEBUG*/& k- d8 ]" g! B5 j6 K
- S* J* U o$ n' W( e
- #ifdef EDMA3_DEBUG
( ]; _# o4 c0 [4 B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# e1 D& k% Y$ q( P$ i7 j$ a3 u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). ~) y* y0 ~$ h, k+ K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 J _4 v/ c) B
- #else e" `" U+ u( v( W2 n5 k
- #define DMA_PRINTK( x... )
/ ^* ]! f* `' F9 B5 e" u. J - #define DMA_FN_IN5 ~( E& ]4 W" @ I7 `
- #define DMA_FN_OUT C3 r* A7 i( w- k' r; G
- #endif
( ?3 c6 J0 V* t) Z - ) ~3 E1 M+ n; a8 O2 s N
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 L3 \$ b/ K( b9 a/ D. K1 D3 e - #define STATIC_SHIFT 3# m5 G( r4 q3 `, ~6 D% t5 \
- #define TCINTEN_SHIFT 20
8 s* p4 A8 U! g u4 c - #define ITCINTEN_SHIFT 21
& g9 l! }3 ?# v$ k9 ^- i) g/ m - #define TCCHEN_SHIFT 22
& n2 _/ T- l O: D8 ?- f$ v - #define ITCCHEN_SHIFT 23
3 @: U' ]& t! s% N+ V, x7 x0 l - 4 [1 ^! u( t v8 b7 {8 J2 @
- static volatile int irqraised1 = 0;
" x! s2 ]0 d- O2 {0 A9 Y6 f. q - static volatile int irqraised2 = 0;
- s4 F4 r0 |% ~- q" T! C6 q3 f - 7 }" I- C% w' v: u8 s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" w( v! U# P( c' `( K. |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ q0 |) z3 Z; t* ~, { - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. C# u, Y0 E. y
9 N6 D h9 i* {' Y- dma_addr_t dmaphyssrc1 = 0;
2 D) b( P& Y6 T/ ~ - dma_addr_t dmaphyssrc2 = 0;
+ x& K* `3 n0 H - dma_addr_t dmaphysdest1 = 0;% A" ]" J1 I( t7 t+ j
- dma_addr_t dmaphysdest2 = 0;& s& R# E& D& J
- 7 U. M# T/ p" [+ L% I4 \ b
- char *dmabufsrc1 = NULL;
6 R% c; s: z7 V1 X5 ^$ e7 }# x - char *dmabufsrc2 = NULL;) p. ~* O7 D; u; k
- char *dmabufdest1 = NULL;- Y1 c7 x- O5 @) k# U. I' e# j& |
- char *dmabufdest2 = NULL;8 l. e* m) R5 A# m& K$ k! F
5 t6 v, o4 G2 m' H6 G2 x s; j- static int acnt = 512;
' k! N" q0 H4 l9 _* z( m - static int bcnt = 8;
2 t+ M1 j+ M1 @ - static int ccnt = 8;
" y$ a/ j; S7 P3 `% X7 z
1 n, t5 _1 M# I5 B0 i- module_param(acnt, int, S_IRUGO);
5 Y0 H; ` o/ v' s& N - module_param(bcnt, int, S_IRUGO);4 R: r0 y R, Z; D
- module_param(ccnt, int, S_IRUGO);
复制代码 ! {* O! h( m9 m, s. f; ?4 C$ v4 M
$ h$ K4 @# ?" s9 O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 [9 T7 X" Q4 c$ b7 Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# P' K: Z+ Q* X4 \4 n, C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* R4 H9 @* ^3 S" B6 S& y
8 N4 g6 E3 v- s3 S+ D1 [6 P8 b
/ J4 O# h8 ]# Z# Y* r% ]% D
|
|