|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 ~; d" _" l( V$ _0 W5 S2 d- [code]EDMA sample test application
# C, e/ x, A1 U2 J. u; [ - /*5 ^, y# ]0 Z* M2 i! U6 ?' U7 a
- * edma_test.c4 u5 j- F& k, x5 K6 I+ D
- *7 q" R* t* l* h
- * brief EDMA3 Test Application
& P5 x# ^# h' O y6 O$ X" P8 ~5 ^; G - *
/ R( @9 I1 a/ B - * This file contains EDMA3 Test code./ ^: k0 Y' _# P
- *
* }. `0 S; R& c i - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ V9 ^7 |2 q2 E. t0 z2 G$ _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( t9 q# C0 ]8 \
- * TO CHANGE.: _$ I, m- Z" A+ E3 \1 X
- *2 I1 m8 B( e+ J( M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 z1 I1 p: o& [' z7 X r - *3 E- K) D# F, n7 z
- * This program is free software; you can redistribute it and/or
0 i Y5 F8 b* k/ p- W N; ~* P - * modify it under the terms of the GNU General Public License as
5 _ C# m5 y( t. y - * published by the Free Software Foundation version 2.- q1 h! B$ h1 |/ A1 P
- *' G9 O* k2 a0 N1 M' F. T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, w) f7 e: i8 n8 G# J
- * kind, whether express or implied; without even the implied warranty6 t* p7 |1 i+ r2 N. K
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ h+ B+ X- c( _& b1 G! g$ c% W: M
- * GNU General Public License for more details.) a7 C, v' k# b7 ~! s1 K. e
- */7 L& J \8 v; n& t% K- c% T8 h
" m& r% f, X8 ^- #include <linux/module.h>
* P' `0 c* w& P: \; l - #include <linux/init.h>9 x8 p3 V9 K* R) D0 [6 G% N4 ^
- #include <linux/errno.h>
1 T1 G1 t2 G. w& i! }. ^. j - #include <linux/types.h>
$ p" a; i# h L' `" D0 R/ x3 U( B - #include <linux/interrupt.h>+ Q6 Q# @" ]9 f# f5 g0 n
- #include <asm/io.h>6 b' X9 o$ a+ i5 g
- #include <linux/moduleparam.h>% P, x+ D" r4 }+ F3 O
- #include <linux/sysctl.h>$ F' J3 K- a% m+ B, p1 a# d7 Y
- #include <linux/mm.h>
0 i5 a6 j, M3 G8 h - #include <linux/dma-mapping.h>
5 n3 p: Q0 \$ m1 i: E - 6 M" u h, y2 j1 M7 e
- #include <mach/memory.h>& D5 f3 ?+ [9 I
- #include <mach/hardware.h>
; F4 C0 v1 t. Y, s! d; ] - #include <mach/irqs.h>6 [: s, I$ R% Z& z
- #include <asm/hardware/edma.h>' G; ? D p3 B* f( |
- K/ ^" W2 ~5 J1 y
- #undef EDMA3_DEBUG
) H% C9 S( I) x - /*#define EDMA3_DEBUG*/
5 A% q- a: p9 m7 G! ~
R" L$ M3 }9 d% q! I- #ifdef EDMA3_DEBUG
6 f7 x- }' Z" A1 G6 m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), B8 }2 t ]7 T5 ^" V4 q. o; U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& a- q5 L) O& V/ R( P Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- k1 l! d: }+ K+ ?! g; G E
- #else9 S+ D8 f$ U( R8 ^# H
- #define DMA_PRINTK( x... )
; \2 w$ G3 f% b( z K# x" C# | - #define DMA_FN_IN2 G2 F- a: b. | S Q) \
- #define DMA_FN_OUT5 }% Z, K& ^5 l! S
- #endif' R# D1 B* ^( Z" j' @
' n9 S; b, }2 d! o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# }% \. X! {3 J3 r1 ]5 a( I6 N - #define STATIC_SHIFT 3
% z) O# I" k1 j8 E/ b - #define TCINTEN_SHIFT 20$ n# t* O4 g' H. v- S7 p. s+ S
- #define ITCINTEN_SHIFT 21
- s6 z8 s0 F+ [. ~ - #define TCCHEN_SHIFT 227 t# K( O5 o$ s+ o) \1 K! h
- #define ITCCHEN_SHIFT 23 n4 M3 D8 v& [ c$ E
H# a- Q# [ y" j7 |+ m, m' C- static volatile int irqraised1 = 0;
( r: P' N0 E( R- C - static volatile int irqraised2 = 0;
% D2 n+ a, Q5 Z% M" g. N
i7 U' ?, y% z. h8 p( P! j- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# s1 ^# D4 E6 {8 u, u6 ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 a4 V" E( `) a% `! x5 o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; Q3 o/ B+ p! b. i" L
7 M$ P( n. [1 F2 P- dma_addr_t dmaphyssrc1 = 0;7 `5 f# e7 G# D9 K1 G
- dma_addr_t dmaphyssrc2 = 0;
0 s$ t: _. Q1 q2 k3 T) m% p - dma_addr_t dmaphysdest1 = 0;
% K7 k1 f3 |* |) ` - dma_addr_t dmaphysdest2 = 0;
8 A6 C6 u& `) g4 y
" a7 ]( X0 n' c8 ?1 m% C+ b- char *dmabufsrc1 = NULL;/ T$ z/ Q+ ~; X0 m; o) J/ O6 [
- char *dmabufsrc2 = NULL;
& a+ V k: G+ m& S( I" { - char *dmabufdest1 = NULL;
& [6 }% `& C( k8 z3 t$ x5 | - char *dmabufdest2 = NULL;
$ i. b; L1 p+ @% A - 6 Z+ [, l/ o7 f( i5 I
- static int acnt = 512;& c& p5 C- {5 ?! E, B& h2 w, N6 U, e
- static int bcnt = 8;
: n3 O" U8 S! `9 \ - static int ccnt = 8;8 c p+ Z: @4 G9 H8 v2 q: J8 _
- 4 H: a7 B3 B! b# r% K
- module_param(acnt, int, S_IRUGO);7 B* O& ?7 \# }, e4 ^- E, D
- module_param(bcnt, int, S_IRUGO);
m! d9 B' M9 Z% J - module_param(ccnt, int, S_IRUGO);
复制代码 & A# `: d6 c0 ^; v9 G
0 V9 H# ~7 ?0 e8 A f- q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ ~( m0 W+ M$ [1 Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, Y/ i9 U& B: V$ x' U2 Y+ d 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 e, \6 o7 J+ c$ Z$ b7 F9 u; J
# i! `% d, T n( A: L( P$ w5 Z. r ~1 Z ~ s( f
|
|