|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 v( n$ K" d" p3 C- [code]EDMA sample test application' ?7 y9 h0 L4 S5 l2 N
- /*
0 J$ S |/ }- r. ]6 ^/ C. q. ? - * edma_test.c$ }4 Z- l! X" g2 G" k2 O Z
- *( O. G: T+ W2 R
- * brief EDMA3 Test Application0 u+ j7 `& X. N4 t4 ^) r
- *
& z; h# E" ^( [, G p - * This file contains EDMA3 Test code.# o S. ^0 N$ e8 L4 e4 \8 d3 ^( ]) z
- *; v; |& q* }% n- U8 f" s
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ X6 T3 T; C& ~2 z2 Q7 [- R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: h4 t+ Z) V6 g4 ~ - * TO CHANGE.2 p3 \( ~* ]0 Z. `: [
- *6 o' ~1 N8 X# A) @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ h# K5 m J9 D, G - *5 l! E7 C2 A0 ]; h
- * This program is free software; you can redistribute it and/or
& {1 r) X0 e/ g# r - * modify it under the terms of the GNU General Public License as
4 v( u7 m. W8 K' Z* J3 ` - * published by the Free Software Foundation version 2.( g* G$ J8 [& h7 T; ]( M
- * P; W F1 x+ h, m
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ G( k! E8 e5 x( f8 S - * kind, whether express or implied; without even the implied warranty; S: z4 w$ T' n' r1 }1 E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the I3 d7 ` D% l' k9 I! X; k
- * GNU General Public License for more details.
* R; F' }: h# F$ K/ L - */( a4 r! k# r3 \, [6 t4 e6 o
3 @0 j/ h/ @9 N( g$ q I( M- #include <linux/module.h>
+ @& a! B" w7 s5 {0 Y; x& J - #include <linux/init.h>
l1 f6 r( H9 W7 V - #include <linux/errno.h>
, s" q% g. N$ E" h2 g8 o3 c - #include <linux/types.h>( q' {( q: f/ ? B4 ]% P+ l
- #include <linux/interrupt.h>, H; s; D4 A# ?+ F
- #include <asm/io.h>
) H5 E9 l; d0 ^ - #include <linux/moduleparam.h>
' j# O7 u5 w% ^' y9 ^" F - #include <linux/sysctl.h>, ~2 q7 Z% e' \* w8 E
- #include <linux/mm.h>
! x* j5 O) X9 @: I2 a* Q4 i$ Q - #include <linux/dma-mapping.h>
% g' y* U0 r9 ^6 G1 j - ~ g; u2 _9 S
- #include <mach/memory.h>
7 l% m8 J% U; M# L7 h2 n - #include <mach/hardware.h>3 C2 A8 D1 ]8 m0 s3 q; n2 @
- #include <mach/irqs.h>
0 M" K1 Y. t% p( O# K - #include <asm/hardware/edma.h>5 }3 [/ R- ?! }7 p9 d4 O0 c3 {
- , M! N" h) o d% I. h5 S' U
- #undef EDMA3_DEBUG
1 n" D5 W) ^6 D0 F+ J - /*#define EDMA3_DEBUG*/
. V4 L1 y, q+ P R% }" S
8 @. I2 J2 r5 ^! e3 ^- #ifdef EDMA3_DEBUG1 F6 D* W$ p' {
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& V N1 H) D+ Q G$ ^8 i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 @4 K9 ?& D. c9 ^5 [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ |4 `; l0 g2 L, v+ x6 `
- #else
% H4 F& K+ K+ Y; V X/ S - #define DMA_PRINTK( x... )
. ^! X. C1 \5 \ - #define DMA_FN_IN$ b2 Q: a1 y8 g0 B$ R/ s" v) U
- #define DMA_FN_OUT
' ~0 @$ E+ F; }- I8 I - #endif3 F6 J3 v& m+ A% p* h9 ]$ o
9 X# s9 w2 T# m+ n: r- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- f$ F+ R& l& K' P/ ~) y) ^1 f
- #define STATIC_SHIFT 3
6 G/ H" w* |) y+ t0 { - #define TCINTEN_SHIFT 20
# t$ ?6 f3 O! F0 g' ^ G% N4 \ - #define ITCINTEN_SHIFT 21) f& C4 J+ N% o$ ~4 O j
- #define TCCHEN_SHIFT 22# X9 a& X* s( q) ~
- #define ITCCHEN_SHIFT 23
+ a9 Y- N7 h. | X
8 ~- y8 b# \$ n/ h$ W- static volatile int irqraised1 = 0;
% E3 P/ {+ L+ z" U2 b3 r2 X6 i( N/ E - static volatile int irqraised2 = 0;
N4 e6 V8 Z: @! T: l' O - ' ?2 ?; e! A2 y4 A, F3 M8 p9 m4 s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( I# J% X: I. m+ }1 f
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ f. p* ~" _1 K& N0 m - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, C: L9 k& a* Z( y% G# E
- " C( I) D$ o3 A2 q; E
- dma_addr_t dmaphyssrc1 = 0;% X% E$ B% H+ _
- dma_addr_t dmaphyssrc2 = 0;
" Q3 ~4 g1 _+ H0 j/ m3 j) C& p - dma_addr_t dmaphysdest1 = 0;
' D* H) u$ t: r3 b - dma_addr_t dmaphysdest2 = 0;
# A0 V. C0 G: @. a4 ?6 p6 u: H" F9 ]
( L) r5 K; X; P* Q( l- char *dmabufsrc1 = NULL;/ o9 e/ M+ y! d; D* D0 [6 k2 b
- char *dmabufsrc2 = NULL;
' _. ~' ^* D( W! G - char *dmabufdest1 = NULL;
# v% e4 {, X# o$ d0 Y - char *dmabufdest2 = NULL;
3 ]+ K6 L* ? K. o
/ @# B6 _/ M0 o! y6 W- static int acnt = 512;
' @9 B. a# b( n; P8 Z9 [" p - static int bcnt = 8;+ } q" T4 d6 @+ _3 V
- static int ccnt = 8;
1 O6 K5 x4 y: L2 V, J' m0 z - ( E, s* [9 S8 t' B* A
- module_param(acnt, int, S_IRUGO);, \6 T" A, Q2 I* k" ~1 s7 X; D& L
- module_param(bcnt, int, S_IRUGO);
4 a8 @( r! ]8 _0 U. i& O9 S3 [* G - module_param(ccnt, int, S_IRUGO);
复制代码
! b7 Z. x3 Z: W# c9 X7 Z) _6 c/ [! k9 F Z, `' q2 ?
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 y2 R7 {1 `* p& W6 \7 earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ x* J$ [6 U( e6 W/ T7 O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 w/ v! j8 k# ]; z" C" x9 O6 W: l2 o
0 m: [* D( s* V! j0 V( ~8 Y. h7 F3 I
. H% y2 J& n* [5 T |
|