|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 s' G' v7 k# |9 I
- [code]EDMA sample test application# K$ V4 \# _6 p% o
- /*( ~! H" z# G8 [, S2 S4 L
- * edma_test.c
4 r; r% f# e0 d! P8 b; A, a0 a5 |5 c - *7 {0 S$ v4 @( d* }( r z7 m' D9 [" j
- * brief EDMA3 Test Application
4 Q6 z: T6 D g9 b9 ]5 i+ I$ l2 K - *7 h6 k0 m3 W7 ~/ S- |
- * This file contains EDMA3 Test code.
3 @ V; ~) B# }! }* a - *4 ]) `! }* J# J0 K5 U" x
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' f2 G# H% i$ W6 ` ]
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, H$ H1 D4 c' U$ r; e2 Q
- * TO CHANGE.( Z' v8 @/ U) z, G! B- h8 C
- *; R; [% S% x" I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 E" L9 n# W. k( Z) R3 j9 w
- *
- e% U/ a) S- U# q/ | - * This program is free software; you can redistribute it and/or& p* y) S7 F% O5 Y
- * modify it under the terms of the GNU General Public License as5 b8 i. o* S$ Y" \# G
- * published by the Free Software Foundation version 2.
* J9 `" U$ S( M/ y( w - *5 l% |8 n( N4 W( O- ^* a( f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ v' b* U9 L& X4 `
- * kind, whether express or implied; without even the implied warranty
' H; v% A; w8 Y+ _' P. M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ O, X. k5 \& v q( I" h
- * GNU General Public License for more details. S, n. T& h5 W$ T
- */
& b2 g% c; i, J+ ^ - 0 S6 ^9 U4 i+ N Y0 H2 X
- #include <linux/module.h>
3 r, a0 C% O R9 n* l- T& o( N# R - #include <linux/init.h>
; i4 s3 g8 L, w) T$ P* q9 L7 H - #include <linux/errno.h>
- Q/ r) G% F* @8 `, W4 p, w- g - #include <linux/types.h>
' S% G# t$ [$ s# B( F; b - #include <linux/interrupt.h>
% V. i) P$ ]. G7 x4 c8 O. z& `9 i - #include <asm/io.h>' W' p0 ] f* N0 d, ^ {# [
- #include <linux/moduleparam.h>
& h2 N' B/ `1 T$ |2 `6 ?0 G - #include <linux/sysctl.h>. z2 J1 k C- U4 n- L4 W4 n5 @
- #include <linux/mm.h>( J+ Y4 P# _7 K, W: Z4 _
- #include <linux/dma-mapping.h>" d: M. f+ v4 X( m5 K
" B) d; U- ^- B- #include <mach/memory.h>
/ w$ h2 A; Y% l+ O - #include <mach/hardware.h>
! D& c( g- C2 v D2 _7 ~- H - #include <mach/irqs.h>
! L# _- ~0 _; f0 o, A - #include <asm/hardware/edma.h>* q# P9 E6 z* }1 N; @4 }, h( L
" d! k/ b ^6 K* M% q L- #undef EDMA3_DEBUG5 F* g ?7 ~2 ?8 u) I0 m' I8 ?
- /*#define EDMA3_DEBUG*/
- l) ~8 y* g5 N4 o, x& K# Z/ y
5 ~9 n. a6 Q. j- P5 u2 I" q- #ifdef EDMA3_DEBUG
" b8 i; [" l9 } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 G. x7 l3 C7 T3 d) X* P' k - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) y8 H- ?- Y$ v1 f% |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" \* g4 ]0 N1 Q& h( B% a" t/ w2 K
- #else. [- Q e$ p$ Q
- #define DMA_PRINTK( x... )
3 I, q0 Y/ k4 J! b4 S; u - #define DMA_FN_IN
- z2 g' I6 ?5 x' {. F: X, f - #define DMA_FN_OUT* j" H; h7 _6 B: @) h
- #endif+ B9 R; r- U% d. t V8 U
- - B3 ~6 Z) N% X" f2 T5 Z% v, K. L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' B2 d7 I. e1 n- N. _" m
- #define STATIC_SHIFT 3/ ]5 `; S4 B( Q. r* g
- #define TCINTEN_SHIFT 20
* z+ j1 e: y) D9 i+ g* f% n - #define ITCINTEN_SHIFT 21
7 x! |3 l6 ]% }6 Q* ^ - #define TCCHEN_SHIFT 22
f2 g4 p$ R8 [3 u- G5 S. h/ @ - #define ITCCHEN_SHIFT 23
; y7 i. O# [, a3 P - G5 q- K; O5 W% i& z/ _
- static volatile int irqraised1 = 0;) i! A7 _$ e1 `5 A3 K! w
- static volatile int irqraised2 = 0;
/ x" A( | V: n$ G - 3 e; @4 f: e8 |' ~2 ?% u7 _
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: |4 z& Y3 K! \- A- x N
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! F! j' F- h. A% Z0 g; i" D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ P! p3 A! ?- h6 v6 q) {; N
& K' B* m# [1 a( _+ Q9 V- dma_addr_t dmaphyssrc1 = 0;! V$ s% I6 t y! D5 X& |# Z4 @5 p
- dma_addr_t dmaphyssrc2 = 0;
% k w" R7 F R! p, ?* U - dma_addr_t dmaphysdest1 = 0;4 R M/ R; p6 o
- dma_addr_t dmaphysdest2 = 0;" a# v! @* f K( M/ e
( h. i2 D# \) B2 L! _- char *dmabufsrc1 = NULL;
1 i9 Q0 `: @* h4 ~/ y9 s - char *dmabufsrc2 = NULL;
- C: M$ R/ |" `) F - char *dmabufdest1 = NULL;
" |- e. I4 V! y9 w6 r- D - char *dmabufdest2 = NULL;
' n" E+ I' g, \) @+ `# G- u
8 U- d% U }" B. {- static int acnt = 512;+ _' J' b c; |$ r. T6 ?4 l
- static int bcnt = 8;7 W+ |5 u, T3 ~" O7 R0 J
- static int ccnt = 8;7 {7 v# } }* o* V: _; ]4 V7 T
& t) K* h) v7 o$ v7 @- module_param(acnt, int, S_IRUGO);5 @) Y1 _- Q/ k0 s( J' H
- module_param(bcnt, int, S_IRUGO);" Y% m4 c, k: T) q3 ]' |' N
- module_param(ccnt, int, S_IRUGO);
复制代码 ) x5 l0 Y; m: M
, u" T, Q" i; l6 d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) L1 }; |4 }" f! _9 larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 Q# Z9 ]* H0 R& B O( O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 ~9 V3 l6 ^# \9 m4 F/ v! S/ K$ K# w8 ^4 y
% {$ u5 p+ R0 i) h% C
|
|