|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 L2 p7 }& a( Z8 I& X( m8 Q( G* N
- [code]EDMA sample test application# E1 d- n: l& |4 i9 Q2 ~% [% T. J+ e
- /*% l8 J2 q9 F1 p1 |3 \2 f5 g
- * edma_test.c; j; r5 M1 e+ z
- */ N! B) [9 ?5 l$ _9 Z
- * brief EDMA3 Test Application9 o% `' q! L: P0 B# z% V
- *
3 X0 i& R& N, I' ? - * This file contains EDMA3 Test code.
# C' L3 d0 c& y/ [- Q% W6 z - *
0 A/ v; h0 J: r' g' e& ]4 u! t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ c x9 H- ~- S9 p - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' }) F- W$ j f" M7 e i - * TO CHANGE.3 h- ^* p! ?3 P; m9 Y) \
- *( f5 C- w' j" R3 p; n, K1 p: `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 b4 C# b( |# l9 w b0 x( J
- *
7 ~, Z: x. {& p4 |% x: e - * This program is free software; you can redistribute it and/or8 t, H6 P6 l8 S5 x) D/ j& b L0 h
- * modify it under the terms of the GNU General Public License as( t* U7 ?# Q( ~* D! {5 q
- * published by the Free Software Foundation version 2.; `: p3 Z+ F) K1 q6 Q/ B9 ~
- *+ E3 G1 |, G' q- ~) n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ d# K L! q! F8 a
- * kind, whether express or implied; without even the implied warranty
! A4 H( u- T$ z) p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 ]5 s& j2 d3 Y# }' D
- * GNU General Public License for more details.
) V! x$ m- {5 V$ l7 R m( \( C - */; L/ e- g R" p0 G+ ~
" f+ p) Z. r, |- #include <linux/module.h>. C: u6 W% _; w
- #include <linux/init.h>
; m1 R8 G# I; u) K9 y0 _ - #include <linux/errno.h>
& a" |" k" e) L% X% _ - #include <linux/types.h>
% i& Q4 q! {; ` - #include <linux/interrupt.h>( D' M9 [; @ s* s
- #include <asm/io.h>0 o/ v9 Y" M( }- C2 r- @1 \
- #include <linux/moduleparam.h>0 C+ U0 h& N, ?' B. n( f# U
- #include <linux/sysctl.h>
; ?2 G' r& X$ j; P: `. O7 c0 P - #include <linux/mm.h>
0 c- J. t: F: G' i# {6 d - #include <linux/dma-mapping.h>. L; c. D* F; Z! R) j; d
3 D; Y9 ?/ r) l9 H" D- #include <mach/memory.h>& [4 z. V6 A& ]! }: C: r
- #include <mach/hardware.h>3 O! _" A/ i% x7 G3 e1 [
- #include <mach/irqs.h>; s* S7 E0 Z& A3 C7 o" W
- #include <asm/hardware/edma.h>
$ x1 E$ S8 G- n
- J9 K- \1 F5 A3 U+ I9 W- #undef EDMA3_DEBUG
; Q/ y) N: R3 _' w5 r0 N( H. b b# F - /*#define EDMA3_DEBUG*/
3 }4 k4 e6 ~$ v3 M- N" g* O - # x+ F3 u3 {# H* v# K
- #ifdef EDMA3_DEBUG+ S8 Y$ i" Y. F8 Y Y2 _7 d, t
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 l+ z: H. C" l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 d. S1 a# a' @! @1 m+ E) F
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 M S b& {. K- T - #else# d0 w: V! U4 X5 [6 @" U1 H8 e8 p
- #define DMA_PRINTK( x... )2 ~" S v9 B0 y/ L: c, f2 m
- #define DMA_FN_IN8 S( \, j) G" l7 p+ x
- #define DMA_FN_OUT, Y# I5 K( ^: m0 e# e
- #endif
. s( i0 e: {4 {- w" {( p
! d$ k7 \! f' T; S3 J) b) b- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% J* \& b. j, y* W& M W5 V
- #define STATIC_SHIFT 3
8 i- c+ v; A( P+ l% ] - #define TCINTEN_SHIFT 20& ^/ X; S! x/ \1 l7 i
- #define ITCINTEN_SHIFT 21
+ J+ o! O2 d9 D6 M( B1 c" u9 l. q - #define TCCHEN_SHIFT 22 \2 Q. z9 A0 H1 M+ {! ~0 m
- #define ITCCHEN_SHIFT 23# d! x' x0 q+ R5 C$ B( e' |& y
- ; }4 C( n1 F2 P8 Z; A: j% |6 ?5 e
- static volatile int irqraised1 = 0;1 o. @6 J; {3 A0 d2 G
- static volatile int irqraised2 = 0;7 C! g1 B" H% Z C. }& y! m
- % k" \4 Y5 G/ |# c( A" v0 n- Q$ t6 D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 ]1 g6 d3 q- ~ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, S& V F+ Z( i: A3 [. m - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- c2 g+ ?; o0 \: o2 I# @( K - ; K# s6 v5 ~$ i
- dma_addr_t dmaphyssrc1 = 0;- Y1 H) a) X# L5 Y) @- M. g/ Q( c
- dma_addr_t dmaphyssrc2 = 0;# ~1 w( s3 S+ i+ X$ u, F0 C; ~
- dma_addr_t dmaphysdest1 = 0;9 u0 ~2 Y! K3 ~) Q- D. Q: ?
- dma_addr_t dmaphysdest2 = 0;5 T5 d; C: B( }1 P4 V% _$ X
7 m* E6 q0 ^4 I# X) `" @7 U- char *dmabufsrc1 = NULL;/ G W$ D, `% Q: v: i
- char *dmabufsrc2 = NULL;
7 K+ f8 H# c0 Y+ d% N, c/ q - char *dmabufdest1 = NULL;
) B! X8 Y* d7 h - char *dmabufdest2 = NULL;
4 n _$ D# Q* c+ F - : j9 S9 D. b4 V5 g0 V# x8 v& t
- static int acnt = 512;9 t* @4 T c, ]) c& j3 M' I' ?
- static int bcnt = 8;6 Q3 p3 }9 V8 |" u1 s \7 j8 {* j
- static int ccnt = 8;
7 c; @# L( A4 N6 z9 S2 S
$ y) I6 n( |% Z: k2 r4 y& }: @. C8 Q- x- module_param(acnt, int, S_IRUGO);
7 v( z( a) {$ C - module_param(bcnt, int, S_IRUGO);
1 a. T3 \( I# R: ` - module_param(ccnt, int, S_IRUGO);
复制代码 " e: y3 J4 ]8 p1 w; v- b6 c! h
Z, V+ {7 |, Y4 k, j% _* w( L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! {! g' G; `$ `/ A+ Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 d" B" ~" {5 b: {4 A0 E' P, ~$ u. O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( W* D# x) s& \! c ^; h
& f, c1 R5 m6 S' J3 w! v- Q7 z0 \ ?! ]% M6 q$ R! r
|
|