|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 A9 n. o% `& q2 n3 b8 T3 @" I- [code]EDMA sample test application% _2 i8 A( A! P
- /*
6 a N9 w3 \4 ? U; S - * edma_test.c
, H: u5 A1 q8 A" v: F: v6 v/ L - *
* R6 |9 A9 H$ }: [* D; ^) A" c - * brief EDMA3 Test Application
3 \& Q+ e/ t; F' @* I - *0 b# a8 ^4 I2 s* I* E
- * This file contains EDMA3 Test code.4 m* W1 k' }5 ]* n1 K4 h: @
- *& W: I" V2 Q: i3 @
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& L0 y$ Y1 d+ s- t0 `9 E - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# L1 b& W$ D# e4 U) E - * TO CHANGE.
4 c0 D" U9 I5 \; m( [+ v - *
8 B) ^) k# B# s3 v1 Y# j - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 M7 A8 l: a! t3 c+ Y' G+ |
- *
' M5 L7 p6 k { - * This program is free software; you can redistribute it and/or" j# v$ x" ?- G. g3 M
- * modify it under the terms of the GNU General Public License as1 }, Q% G) b5 n6 C- B
- * published by the Free Software Foundation version 2.! x7 y9 Z" A' p2 p# H7 J
- *1 B( S# C' y- |7 r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 l: @" e5 x1 L" J - * kind, whether express or implied; without even the implied warranty
: f2 z3 h8 w! | - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) i! O# i& f! o/ M - * GNU General Public License for more details.
, J$ M) W6 P" R7 \ - */3 x1 v) j( J" x1 c4 s7 M# X
- ' L' v" c& e u+ |2 G1 e- h
- #include <linux/module.h>% A6 q7 L+ ^. T" t( [) U. W
- #include <linux/init.h>
W+ O; q3 n( u7 _: n D( z% t - #include <linux/errno.h>% N, y, R' \2 T" @: d5 R. d6 F
- #include <linux/types.h>
4 m3 [8 }; j3 M; F& c - #include <linux/interrupt.h>- |9 B& X1 a1 P2 ^; M
- #include <asm/io.h>. M& i" s; P% V% m
- #include <linux/moduleparam.h>
+ b' S, C; G0 ]! O - #include <linux/sysctl.h>7 n8 m! v8 G* Z6 M
- #include <linux/mm.h>3 d2 A6 v0 H' `: K, u5 ^* K1 V* `% S
- #include <linux/dma-mapping.h>$ |/ V/ {5 ?8 V! K5 N ?! j# {! k
) `, S& j7 f4 [$ V2 Q- #include <mach/memory.h>" G2 x8 U/ e) w: E! S$ b" O! E
- #include <mach/hardware.h>
" z+ |& A) d& v& g - #include <mach/irqs.h>3 H I, [' ^ }& ?+ ]/ p) s
- #include <asm/hardware/edma.h>
- p- x: q% w9 Q1 M7 C& d
( V7 [9 k# B5 T0 n- #undef EDMA3_DEBUG
1 @* ~0 s) j/ {. k - /*#define EDMA3_DEBUG*/
) s7 p4 J3 ]1 D" U
! I- Y0 ?! |3 G* { a! m- y- #ifdef EDMA3_DEBUG
& r/ A) _# c4 [8 V4 \ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): w3 ~! L9 M2 v* C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 P& ]" @! J# c/ u& `) _
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) S: r/ X5 W/ R* Y+ F' V6 H$ P X
- #else
2 @% V0 \: G4 l; |. j! R( A - #define DMA_PRINTK( x... )
5 P, I$ x' ?8 T @# I! w! I - #define DMA_FN_IN
7 p, e% J7 p% J) i& y - #define DMA_FN_OUT
* C4 a8 t# O$ ]8 v) x - #endif
6 t7 R ]/ ?! x8 _( q, x - / W" f7 ]0 r! g; z! k
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! U$ J" k/ S2 t9 e2 t
- #define STATIC_SHIFT 39 v7 v v: ]6 ~0 j6 X$ Q
- #define TCINTEN_SHIFT 20
# t/ t& w# w/ U - #define ITCINTEN_SHIFT 21
* G0 r! C) j n - #define TCCHEN_SHIFT 22
( I2 |# Z# p# h& N - #define ITCCHEN_SHIFT 23& X, ^( M" K) e3 r# u* A7 [/ f5 i
# ]; U* s1 [' o/ ~/ g- l6 p, z* K- static volatile int irqraised1 = 0; ~6 X `2 K; W* f5 N1 t8 }/ w
- static volatile int irqraised2 = 0;
. L" e/ v+ W6 e' j: }
8 I: r; @+ m) Y4 j# C w0 y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ b6 T1 @. w( C A+ U4 @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ P# N+ F$ f/ J9 v& S; a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, z6 M% H' ~/ g, y7 ?" D
/ o: j4 S0 R. D0 u- dma_addr_t dmaphyssrc1 = 0;
' G$ k5 y9 {6 A. A - dma_addr_t dmaphyssrc2 = 0;0 v! N* v! D% A* ?2 T! _3 |3 T
- dma_addr_t dmaphysdest1 = 0;( Q. J2 w/ c" H( j/ \
- dma_addr_t dmaphysdest2 = 0;, Z; u, h8 x- M" i7 g/ H
- _+ A/ F/ l( i5 l
- char *dmabufsrc1 = NULL;
! a4 E% l3 J# {% ]6 R2 G! P7 W3 A - char *dmabufsrc2 = NULL;
1 Y, _+ g7 B* k7 c - char *dmabufdest1 = NULL;. r8 Y4 p( v1 l
- char *dmabufdest2 = NULL;4 z1 o2 i- F9 y2 p
- , i, y( h! T7 G8 r' [
- static int acnt = 512;
4 d* @9 J6 g/ b+ Y* K- y& L - static int bcnt = 8;# X4 p4 x) T; Z4 n2 F
- static int ccnt = 8;) X# v X3 K/ z6 X: J! [
6 c ] B0 N/ s* O0 Z0 t- module_param(acnt, int, S_IRUGO);
3 Y# h- H8 O0 X+ P% y7 o - module_param(bcnt, int, S_IRUGO);9 ?4 J0 }$ c% s- e" U
- module_param(ccnt, int, S_IRUGO);
复制代码
, a o1 P/ Z e7 M9 m; [9 ]" e( t2 d |4 I
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: L$ k/ E5 |& a. m1 {3 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# z0 j* [$ S( G; r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# e9 h- U" C: t! S4 C7 P! r' o' T* ~$ s' C% i& Z
+ s/ r1 l5 o+ v Z/ y' ]# q; _! d: S |
|