|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * T" s& t+ e4 a' q9 @& P% s
- [code]EDMA sample test application0 v) }$ g/ e' i y
- /*4 `0 K9 R) T, Y: G; }) V1 s* x
- * edma_test.c8 @6 P! \! K4 T) m; a0 w
- *' o3 ?" u2 G% \+ X5 I4 b& c
- * brief EDMA3 Test Application( l7 k# z8 k0 X* x# T2 b f
- *0 X; l& b1 U) y d) C0 n- T6 x8 p; H
- * This file contains EDMA3 Test code.
& d* Y8 I# X/ U* P0 i1 \* ^, U5 F4 c& q - *
4 `- I+ {6 h3 q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 ]6 w$ ~- g9 V% V0 X( \$ p
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT m! R* ~. f" X. t* ^0 H
- * TO CHANGE.
+ P& e6 D; z0 Y9 t1 } - *' E* ~# D9 X+ j* I g' z, ]9 B# S- k, ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ i4 V4 ?+ T ?
- *
- z. }9 N2 ]! _( j" I2 m - * This program is free software; you can redistribute it and/or0 H, h4 H8 X, _! m* f
- * modify it under the terms of the GNU General Public License as
6 S8 C5 w$ Y4 t! R* K - * published by the Free Software Foundation version 2.
( C7 s7 }" S' f( Z - *
/ e+ J2 W, }, L8 W+ t# M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 Y5 I. X( t1 t0 |: M
- * kind, whether express or implied; without even the implied warranty
7 g0 A3 a( I8 `8 L3 i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ c( g3 x) ]- Z T3 T - * GNU General Public License for more details.
" `! {3 j6 L4 S4 A7 ^8 a - */4 B: R" G* I7 f L4 ?' P( Y
- 4 S* o9 x) F* q, U) w
- #include <linux/module.h>
: t, G: b" r" t) v! u$ J - #include <linux/init.h>
0 G/ S7 r" f( \/ E5 h4 y - #include <linux/errno.h># D5 v$ T, g. Z1 `
- #include <linux/types.h>) R$ Z4 n! A! S
- #include <linux/interrupt.h>
" U$ L- s- N3 ^0 M4 [ - #include <asm/io.h>& E z, g5 q8 ~! U6 P
- #include <linux/moduleparam.h>: {( o0 Y( x1 ^1 }8 S
- #include <linux/sysctl.h>
' Q' G) P5 S3 q: q: `! k% t - #include <linux/mm.h>2 N6 a' x4 n- Z
- #include <linux/dma-mapping.h>
9 b+ J4 _: S/ a4 G, P
/ }9 ~) _$ [7 n. b1 h6 P- #include <mach/memory.h>& q! b- |' }+ d
- #include <mach/hardware.h>
; U% \/ |% N2 R% ~ - #include <mach/irqs.h>
) a! H% J* Z# {5 I9 h5 _ - #include <asm/hardware/edma.h>3 Y! i1 I! D5 K! E/ E: C
- , C+ h2 s, n3 u4 X1 n! |! P, ?. h
- #undef EDMA3_DEBUG
' W; k. g" U$ A* e* N+ C - /*#define EDMA3_DEBUG*/% I. ~1 I' Z; f5 M1 V" o
- 8 |- V1 ~# G* J% w" ^ c
- #ifdef EDMA3_DEBUG3 c4 c- Z1 r; _' Z' e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 |& j7 B3 Z: D- ]
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 \( U. ^, j/ o, _& W5 L" X - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 ^. F- j( Z8 x- {
- #else
1 \8 u+ R0 U2 Z: m. }+ q; K+ d" I - #define DMA_PRINTK( x... )
6 A) N! I; l( n9 ` J3 a2 K! [; Z ] - #define DMA_FN_IN0 N9 |' P# R0 a3 q4 q, h0 z& ~
- #define DMA_FN_OUT/ x, o- K' W" f# \
- #endif7 Q3 G" P/ J6 e# S% r; {! a4 Z
- # R3 Y5 g) p. J8 q1 p+ {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 c9 A2 S5 X: [7 l8 X b
- #define STATIC_SHIFT 3
/ e0 \1 w$ ~- o, S/ v% |& t - #define TCINTEN_SHIFT 20
6 s! ~6 X* D5 c4 y# Y - #define ITCINTEN_SHIFT 21
: _# Q$ A: |% P* Z9 w. n - #define TCCHEN_SHIFT 22
9 O4 l% ^: n2 }+ J - #define ITCCHEN_SHIFT 23& w) |! s) h9 p: ?& J# n+ J
- " H6 K9 X2 v: X% ?( @' A1 T! m
- static volatile int irqraised1 = 0;) |& P7 o& v- I: i
- static volatile int irqraised2 = 0;
. F+ y w+ y! w1 } q6 g' \2 W# M2 c
$ C# ?) l) x) r+ S- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 ^5 P- C6 Y) {4 ` O8 V
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; S4 k b* b5 g8 l! R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) i( T7 p1 ^, {5 s s2 K! t - , b6 W6 G: l, x6 k: E& J
- dma_addr_t dmaphyssrc1 = 0;
+ Z' _$ B0 J5 }! {, w1 y0 @( P' a - dma_addr_t dmaphyssrc2 = 0;
" C! d3 H3 i: C - dma_addr_t dmaphysdest1 = 0;) P- i3 Q/ O m n
- dma_addr_t dmaphysdest2 = 0;: ~+ G3 F1 ^) U
- 9 j2 Y- G0 m4 D" z& R
- char *dmabufsrc1 = NULL;5 x4 V6 y+ C. p/ m/ |& y
- char *dmabufsrc2 = NULL;
" o7 Q; _) E8 p( o2 [. ]5 L - char *dmabufdest1 = NULL;# F& e7 X/ I- X
- char *dmabufdest2 = NULL;& m2 m0 z3 s7 f8 e2 X, h/ x* g- w
, e1 E: I* c4 R8 Y& K& v- static int acnt = 512;2 V9 O8 j9 ^+ j! E
- static int bcnt = 8;7 h4 s. w& {, p
- static int ccnt = 8;
" Y3 N/ r( i' F
/ e% s* U7 ?, Q! L& U$ x- module_param(acnt, int, S_IRUGO);
3 e- D* g: j; y - module_param(bcnt, int, S_IRUGO);
! c/ I5 d$ l5 \9 v - module_param(ccnt, int, S_IRUGO);
复制代码 9 R/ ?/ J* H0 g3 x$ Y1 D/ B0 m
( y9 t: q' g$ Y8 h
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* C$ i5 ?" Y, 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ m$ d% j# ?6 e4 z* v2 T
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* F# s8 Y0 z! W4 e
( h' E& d7 s' X! E
+ [* ^# {" S) H
|
|