|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 R- X# `" n u3 r2 x
- [code]EDMA sample test application9 Z) L$ V& V7 S- m+ n
- /*
# w# n1 q6 |- u+ N3 Q( p0 w+ u - * edma_test.c; s9 m& m1 l5 t' ~/ z2 i
- * w* [ [7 f8 B1 t, G& J5 I% U
- * brief EDMA3 Test Application: c5 ?: x+ e( k2 h
- * g0 {& n1 o- `& X1 R+ O6 [
- * This file contains EDMA3 Test code.# u0 z2 C$ e% ~) o y* D
- *
, ~6 ?1 K2 _* v$ Y' | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) @# X6 \- E# V. ?8 L - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 s9 X" V3 ~" R. D0 T - * TO CHANGE.
0 ^3 X4 N5 [' i% @. \# u' h: i4 J - *
/ i, ~6 j7 U9 {0 e. ?! S - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// w, b, k* U0 K4 U) e
- *- N$ ?& y( a3 ^3 t
- * This program is free software; you can redistribute it and/or% a( r3 e# C( }8 V( k4 ~0 c
- * modify it under the terms of the GNU General Public License as9 z$ Q- i. {7 A& V
- * published by the Free Software Foundation version 2.: V5 O: J! e, J7 l' W' |! M, ?& k/ a
- *; G# K7 L. i5 u$ ]
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; h: l7 ^/ c9 m( b# i4 X - * kind, whether express or implied; without even the implied warranty ~+ u1 M' u' t- X4 @! V V, B9 s3 a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 b0 ?- R0 j6 `9 l5 q0 t
- * GNU General Public License for more details.
% i4 C0 m+ D" H% V. B - */
+ v W+ y+ T1 u* y5 f
9 t' ~& w8 m. ^/ e- #include <linux/module.h>5 G, G- U ~& F. [/ r! K
- #include <linux/init.h>
/ o: v! I( D B7 @. _& p; h - #include <linux/errno.h>% P0 J+ l U, R; `
- #include <linux/types.h>% i# Q" k) a2 u
- #include <linux/interrupt.h>5 @" L/ D9 u0 H
- #include <asm/io.h>
) f/ s, }1 S1 v" |4 u - #include <linux/moduleparam.h>
" [8 A- b4 I6 ^1 k# C1 o - #include <linux/sysctl.h>
/ N% M; ?( n4 }; i) r - #include <linux/mm.h># A. E6 c6 s5 `6 E) ~5 u8 Q
- #include <linux/dma-mapping.h>& C' N. A+ L' C' ?) \
- ( d* z% l! t1 F4 _
- #include <mach/memory.h>
2 g" I9 a6 {+ e - #include <mach/hardware.h>
1 m. V0 x+ z) a0 Q- u - #include <mach/irqs.h>4 x; q4 {/ n U
- #include <asm/hardware/edma.h>5 F4 m" o1 y! \
- $ \8 A5 U% ?- C, e: h% U
- #undef EDMA3_DEBUG
* O X9 E$ d% a u2 d - /*#define EDMA3_DEBUG*/
' T! }$ h; N" b: P" ^
: Y. {# S) L8 g& k- #ifdef EDMA3_DEBUG0 y! Z2 s5 Z w3 H+ Y! m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 l: [( R# V* R* v5 D. v% p: G& C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 v3 v' O+ s$ l+ l; S0 ? - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 j" }# R# S' W- B0 U7 w
- #else5 I0 J N! z4 G- Q
- #define DMA_PRINTK( x... )
- Z( B: k5 w4 b+ f0 S - #define DMA_FN_IN
4 S* A/ F- Y. N0 q - #define DMA_FN_OUT% e: d- Q- P+ R" r( M! \( N
- #endif$ K' z, g: C5 a
5 k3 i$ n3 Y# J2 H- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* j. h& N0 Z m- R5 ? - #define STATIC_SHIFT 3% j$ s! y0 `0 ~! @- r: I
- #define TCINTEN_SHIFT 204 Q* k1 `3 A0 f/ h
- #define ITCINTEN_SHIFT 21" |* W4 A, l+ t% c
- #define TCCHEN_SHIFT 22
; W+ I; x) M O' N P5 A - #define ITCCHEN_SHIFT 23, j- {1 y$ |1 E0 i) h
) U: k& e6 W/ \ k- static volatile int irqraised1 = 0;
2 ^2 q/ |, C, G* C0 w - static volatile int irqraised2 = 0;& W6 i# V: h% {7 I+ s
) j7 \3 w! S7 T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! y Y! y, [1 Z6 q4 O/ D$ Z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 d9 B+ D+ a4 @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) N6 s6 C1 r; j4 y( d6 k
6 [/ o3 I4 W% q+ k- dma_addr_t dmaphyssrc1 = 0;
5 F# o3 x7 E$ O/ ^" F$ s" E" m, B - dma_addr_t dmaphyssrc2 = 0;$ |' Q8 |8 a8 w2 g, G2 |: g
- dma_addr_t dmaphysdest1 = 0;4 u q1 |, W4 l; t& t- j
- dma_addr_t dmaphysdest2 = 0;
$ N5 h9 r3 u5 P/ X3 C+ \, k
: M# o( i/ M" _5 O9 I. L- char *dmabufsrc1 = NULL;
, D+ _" B) F+ n, } - char *dmabufsrc2 = NULL;
, K9 t" M6 w" K8 @; s6 d1 d4 v - char *dmabufdest1 = NULL;, _, P, x" Y6 o0 Q1 Z) a6 d1 J9 e; `2 W
- char *dmabufdest2 = NULL;- z0 g! {+ r! u
c# M- W) B! f% M- static int acnt = 512;
6 E4 J% Z* `) r5 u0 q- j0 R% Q - static int bcnt = 8;
8 C! E, ^1 [* u; p. q9 k$ l/ x - static int ccnt = 8;
# q& w# v3 L1 P$ E3 l: h
, h/ |# N5 J% S" M7 f. w! Y" N% \- module_param(acnt, int, S_IRUGO);3 U) c, `, ?% N, R
- module_param(bcnt, int, S_IRUGO);( G, e- q- n$ A8 O9 L( s
- module_param(ccnt, int, S_IRUGO);
复制代码 * v2 S2 O# `$ h Z% I' E
2 l; k6 A8 D9 k; _5 o: P' P- c# U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
g6 x: e+ G9 g1 j% ]arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 Z7 W' Y4 H( [$ c$ ^" K4 H$ Q T
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. ]/ r4 f! X/ r- c7 q0 l/ [( ?7 c" ^
# l& t6 e3 x$ x( d% | |
|