|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 ]$ Y" {+ T. s! S8 t8 j! c3 I$ D- T
- [code]EDMA sample test application9 ?' ~# F5 J: l6 n A1 r! K' |& i6 _2 R
- /*
0 k. h3 ]: V( Y4 Y" k* h2 o - * edma_test.c/ m7 U; E4 i8 W% H3 S+ f
- *
8 G+ F% ^- x4 S! {5 e; y' g - * brief EDMA3 Test Application8 C3 \2 c! u. O: p- \" u. a; Y# e
- *
+ z Q# Q8 A( ~( Y4 s& n: B - * This file contains EDMA3 Test code.
- h0 T0 ~. n% h - *+ m! @+ b" m6 t& Z( ]7 E0 O. y o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. D$ ~: I: |4 z$ b- A' ]' J( l) ] - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& t6 I1 u9 [9 ^# _ - * TO CHANGE.& h. b; a3 I+ d- O+ ]9 u9 l* F
- *5 S5 X! w: F) M0 g9 w$ F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ R4 ~8 R; e I
- *
$ d, b' t; r5 J1 N' |* [7 Y; V - * This program is free software; you can redistribute it and/or! T' k$ Q4 d' z! O% Y$ a* z
- * modify it under the terms of the GNU General Public License as' o _' [6 c% M5 w9 \3 U9 L& \
- * published by the Free Software Foundation version 2.
+ p# x" G) k9 Q+ B - *6 J/ @% M( X( z/ C% c' u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any' H* g. k; N! S. n# i
- * kind, whether express or implied; without even the implied warranty- r! q+ }; F7 k- H8 \8 o5 T" i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% V4 [' T3 |( Y
- * GNU General Public License for more details.+ [& w; f$ L" W5 m1 m3 F4 B
- */1 i$ h9 f+ G7 G/ E# P
- ( k9 O$ s$ o, F. x6 A: l
- #include <linux/module.h>
( t; i6 ?! i( y8 f* I: b; ?1 X - #include <linux/init.h>
6 h+ B+ M; A8 u5 b% O% H% L: y - #include <linux/errno.h>1 _$ q4 y# [* w2 F9 c; W9 J S8 x
- #include <linux/types.h>, C M" F, g/ ?
- #include <linux/interrupt.h>0 n( q- A! m) i+ Y, o5 J
- #include <asm/io.h>
2 G2 A1 G0 ~8 ` u0 ?! w3 e - #include <linux/moduleparam.h>
5 I- d3 N8 k' d& E - #include <linux/sysctl.h>
1 ~, k0 l* Z% D7 u' A - #include <linux/mm.h>5 V7 E! _0 F' Q, h/ l; o
- #include <linux/dma-mapping.h>/ r8 S8 X/ G2 s: R4 Z
5 E/ P2 O, H- q/ d) b- #include <mach/memory.h>& P; j" p( j, i/ }( S: @
- #include <mach/hardware.h>- j/ g3 l7 j% T; \1 J* W8 H; s% ?
- #include <mach/irqs.h>
0 }, ?+ w3 o5 Y* m& V" I% @ - #include <asm/hardware/edma.h>. C, o3 N8 O; }/ |) H
, l" ~8 p2 m5 |( Z- #undef EDMA3_DEBUG2 I' e* ?2 C# c7 V# Q
- /*#define EDMA3_DEBUG*/
0 y# d6 n6 F# [: p
; S5 r! I0 D1 q! R; k, \ T- #ifdef EDMA3_DEBUG
) ]4 n8 H; J9 O- K1 k, K0 e6 {6 U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# j8 p9 }6 G( b, l7 E% a - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# n( P6 ~+ _$ E& ~8 G7 B! C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
X8 L3 j4 M8 C: K - #else9 ]; j* W" G9 R
- #define DMA_PRINTK( x... )& o* Y8 B8 c2 X
- #define DMA_FN_IN
) C+ ]) t' {" J+ f7 l1 X* { - #define DMA_FN_OUT8 [' ]5 e$ Y' m9 _9 m( k0 @5 v
- #endif/ G1 D) c# o! s6 T& r
- 6 M( T. o+ o1 J* Q, W x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 Y9 N$ n3 }( M4 M( L - #define STATIC_SHIFT 39 v$ O7 o8 u# V2 N2 q$ S
- #define TCINTEN_SHIFT 20/ }& R! e* u3 t9 L1 K% b/ A3 s! _
- #define ITCINTEN_SHIFT 21& A R7 Z2 H) D) X9 F$ S
- #define TCCHEN_SHIFT 22
. R% N4 I8 ^2 Z& [, U6 u( ~ - #define ITCCHEN_SHIFT 23" ?; Z2 _7 C$ K; f( |
- 1 a( F( O b3 c+ ~& V
- static volatile int irqraised1 = 0;, q0 X3 f# h8 V/ S7 ^
- static volatile int irqraised2 = 0;' _) f* h+ T+ B/ |) y5 }
/ i; i( c6 ^+ v' E4 a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! n2 @* V# W/ a* p7 E% c8 o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* a! C B( i1 J7 b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* q! ~4 ]2 e" m& i7 [
* x' d; i( D, g- dma_addr_t dmaphyssrc1 = 0;4 e$ {) ` _. ?. I
- dma_addr_t dmaphyssrc2 = 0;# q5 U) F/ E+ p2 p" X% H4 B9 [
- dma_addr_t dmaphysdest1 = 0;3 x9 F# _- H" b" W* c
- dma_addr_t dmaphysdest2 = 0;2 I9 J6 E8 W& t& d/ m( c5 Q: D
- 0 W5 l6 K' @; F
- char *dmabufsrc1 = NULL;
6 S: E+ W: c# s6 K( D# Z - char *dmabufsrc2 = NULL;# Y- ^; G" g2 [* B* u! U
- char *dmabufdest1 = NULL;6 T5 f- [" n% t9 a* D
- char *dmabufdest2 = NULL;
6 D& N2 b- [9 h& r2 c: k
% @. ^" e: P8 j" e3 M7 k" o _- static int acnt = 512;
2 u# }0 I3 d5 w8 J - static int bcnt = 8;3 O# M4 l2 ] h+ E7 N4 ]. j$ ]1 X
- static int ccnt = 8;
2 x6 @" ~4 w% R# D - 0 v0 I9 U9 W8 s1 m4 k: Y8 e
- module_param(acnt, int, S_IRUGO);/ I% A; L# K3 `" M# }; x6 ?/ {! |
- module_param(bcnt, int, S_IRUGO);$ a# T1 ]% B6 X6 G; R; \
- module_param(ccnt, int, S_IRUGO);
复制代码 : ?6 g- F# v1 M! x" h N1 r
6 ^7 {) a- q: ]: W* { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 ^) H. [4 t4 h; q2 Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) \) i& n1 `9 e 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. {3 g! J! z+ F$ u) `! }* B3 i2 ~
# o3 c# g4 C2 m% ^% c# ^ d) G) f/ Q7 o- f8 H! r. q! v
|
|