|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 `7 R2 N& H J1 A' u9 }4 W2 t3 i
- [code]EDMA sample test application: T& J5 n: {( s/ C
- /*
2 x# C3 ]( r) v4 z; F2 g2 b A - * edma_test.c: D: c* W7 x. i R! ]1 Z
- *
8 e: h$ Y. ?: d. J8 s( B; t - * brief EDMA3 Test Application
, o/ C2 f) Z+ P5 |7 W5 ^ - *
0 N3 V B1 z& z! s( X% [ - * This file contains EDMA3 Test code.
7 z$ O7 j! m. Z5 b: t - *8 c1 o* l3 T# s, O) D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ |/ D5 E0 f% H- H8 j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 v1 I+ H, T4 ]. C5 s. @% c5 d; O; K1 D
- * TO CHANGE.& w0 a0 C) n5 r" F
- *
' o% r. n+ x# H4 F: P - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 w: v3 A9 t1 W/ z) Y( L - *
+ L# Q% f4 m/ _( k) T; S2 v8 T. {6 ]+ { - * This program is free software; you can redistribute it and/or
$ i0 V6 u- f2 {7 k4 d5 C( p" I - * modify it under the terms of the GNU General Public License as. T3 z# ~7 ^1 N# @9 j/ n$ R
- * published by the Free Software Foundation version 2.
. w4 Z% p# d" o8 C+ S/ G - *7 L1 S" ~6 V$ f+ o. x2 E4 G) E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: N! {# f( S& h D
- * kind, whether express or implied; without even the implied warranty
% H, C% @& V7 o: i6 c! j8 A - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 x0 s- G3 c Z3 k; m$ W, O5 E( |
- * GNU General Public License for more details.5 Q+ ~, x8 K6 }8 t
- */* C# N0 ]! R4 [6 y# Z
5 V$ B! Y% d7 I2 N- #include <linux/module.h>+ H8 [; Z: k: b2 a! Y/ @& q
- #include <linux/init.h>7 F) f) }9 l( b( y5 C+ z# g
- #include <linux/errno.h>
) z4 Y6 h' y) Z& ^, I/ N3 X* C - #include <linux/types.h>: A" q4 i( @# {6 {6 P+ r1 t8 S
- #include <linux/interrupt.h>( @' \# I6 ^. N- b, z- }9 w
- #include <asm/io.h>
% h% B7 ?1 \/ P/ K5 d - #include <linux/moduleparam.h>
$ S8 G' R1 h2 } - #include <linux/sysctl.h>1 n6 L* m8 d+ q1 s: T4 K8 n* i5 I
- #include <linux/mm.h>
$ [ p j+ w& _' U, y - #include <linux/dma-mapping.h>
* D V3 N1 E& @! w9 a9 o - n0 J2 G3 y; T$ A" E# f' H
- #include <mach/memory.h>3 g4 S- Q6 ]2 D! x& p4 \
- #include <mach/hardware.h>
! Y" i$ G2 C, W/ g, L" C5 \& m# X - #include <mach/irqs.h>4 z, M6 T8 b7 C1 E" W
- #include <asm/hardware/edma.h>
8 `+ |9 |& i- w2 A, x+ l4 L
* m5 H& y! R: |- b5 h. o j- #undef EDMA3_DEBUG
4 Z3 h8 I" _+ l# k9 Q: x& H - /*#define EDMA3_DEBUG*/
0 D0 l0 q s8 `, q+ O
0 n# R/ @9 Q3 G! v2 U- #ifdef EDMA3_DEBUG
' O8 |! Q$ M. `6 ?8 W: s, g8 A, c - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 f) e/ T; ~7 I4 B. _* I6 w0 J* l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 x' k( \2 o' w* b7 m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" Y) b) L9 o. ]: C+ l# D. i; ? - #else
" Y+ U: b) l: ?. D+ x - #define DMA_PRINTK( x... )+ `, _: K4 x9 o4 j
- #define DMA_FN_IN
) M* O9 e$ Y2 B& G: { S1 M - #define DMA_FN_OUT
0 P, q( q3 _, O4 @. X - #endif
( z* W$ c3 p7 y4 ?! }" | s2 w - , J! d( ?" Y7 t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. c, ~' v" C" @ W; i - #define STATIC_SHIFT 3
, w2 x% @( j& Z6 e3 [5 U1 d - #define TCINTEN_SHIFT 20
6 z- R0 J, j& x - #define ITCINTEN_SHIFT 21
& e. S$ S1 k5 ^, ^* W7 A - #define TCCHEN_SHIFT 22' y7 p, ?% Z u" H( E0 C* E1 I
- #define ITCCHEN_SHIFT 23
" P9 I9 K2 i/ P h9 w - % s9 u$ z3 b& Q K/ B) \; K
- static volatile int irqraised1 = 0;
" @9 |% t+ l" K1 t - static volatile int irqraised2 = 0;
$ N9 b$ J6 A8 i: d: M* S% h - / T6 y1 k5 ^! J0 H
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# [6 ~% j- Y/ {9 j6 y1 g - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% Q- ~* L: h0 ^' H' u! ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: ^: d9 ]) ^& ]; K2 s1 Z& |
# r; d3 X/ A- Y1 e- dma_addr_t dmaphyssrc1 = 0; @3 `- P1 @/ T6 l6 ~6 C3 W
- dma_addr_t dmaphyssrc2 = 0;
! A& |( X$ d% w7 F; z) o0 n - dma_addr_t dmaphysdest1 = 0;" T" B3 G4 E* H) L. D6 X' E
- dma_addr_t dmaphysdest2 = 0;+ u4 ~, S/ i$ W
- 0 g4 h# B' C$ I# Q/ T
- char *dmabufsrc1 = NULL;
* I/ V4 |# J- q* u8 v% f; A3 R - char *dmabufsrc2 = NULL;
! N L0 ?( W O - char *dmabufdest1 = NULL;
7 @# { p& [9 h; K# `+ N5 I - char *dmabufdest2 = NULL;
5 Z- g9 Q: ^$ |8 U+ C
8 m$ D# Z$ y* T5 z& ?. _! q- static int acnt = 512;8 E, J0 r+ n! m; c2 B) R
- static int bcnt = 8;2 U( a" ~- A$ n9 g& @& [
- static int ccnt = 8;
+ u+ |+ c( w6 @( O5 b
7 q& [4 P% o0 _2 z4 S- module_param(acnt, int, S_IRUGO);
' y9 @/ E( K, _& P( v1 J/ P - module_param(bcnt, int, S_IRUGO);6 f! J. R h7 z' j
- module_param(ccnt, int, S_IRUGO);
复制代码 9 R: m! m4 c+ C9 l2 f# P1 V
+ I6 i1 k: }, ^1 V$ h3 x- ^! K- e; _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 I* c. M! Q1 `4 N! K0 R5 {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 P- L0 h [: A" y: F* C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 b& |* t2 O J9 ]) H' s
4 u: m' K2 u* H! c/ H& `) s) I
: j* K2 J3 G" o& u+ h) o! Y+ \ ` |
|