|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & z, q# w1 ]* u8 `8 [6 F
- [code]EDMA sample test application, x$ l7 l5 S; f1 E/ X4 D" w. V' I
- /*
% b, {6 S9 j8 v" Z. n- h3 A - * edma_test.c
; `0 @- U+ n8 _1 x9 G" G: o - *
7 B; k0 d: l+ S# P - * brief EDMA3 Test Application) F7 c3 d Y2 i7 e
- *4 {( c9 P: M5 Q2 r: I* H" X% L" U
- * This file contains EDMA3 Test code.5 R0 }4 j: Y. W8 x8 {/ S
- *
6 z+ [7 b( E3 L% h" \$ Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ u# ^3 q4 J+ c' _0 X( w" }
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 d) }3 v, s3 M' N" @
- * TO CHANGE.
% [4 M) r6 A# ^; O5 { - *- }6 ~9 a' c4 d: ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ s/ ^! R1 |! e$ T - *; A( U9 W. V' U0 N) y. C
- * This program is free software; you can redistribute it and/or( Q) n% T' Z( @
- * modify it under the terms of the GNU General Public License as- E/ R. g: h* G
- * published by the Free Software Foundation version 2.
) i7 K t. E& ]' R" L$ D2 s - *
8 z1 a/ j( {( `4 v$ d - * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 p1 }- e* f( K5 n
- * kind, whether express or implied; without even the implied warranty$ y+ {6 O% X' @+ E1 ~! C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
P/ K9 x; E8 z! \; }# Z% D - * GNU General Public License for more details.# J+ c$ k V( ^/ S7 @9 Q+ H7 s, D
- */% S3 b* H j" A$ n% k8 w" N
- " A. X3 D& D# m6 {
- #include <linux/module.h>1 e& V) B I0 {+ n( o" N6 @
- #include <linux/init.h>
3 h; U/ L5 |- |" Z - #include <linux/errno.h>
1 c% d. s1 ?2 H5 S& b - #include <linux/types.h>4 x( s H! n% G! i4 }
- #include <linux/interrupt.h>: c R4 Y5 N& n& s3 D0 E8 n# R5 ]
- #include <asm/io.h>1 X1 ], A8 {2 x* q
- #include <linux/moduleparam.h>. c: z) U7 `$ s1 M4 N
- #include <linux/sysctl.h>7 M$ u8 o+ h! T6 a- W
- #include <linux/mm.h>
2 D! Z5 X: s6 h% q8 d4 d - #include <linux/dma-mapping.h>' D6 b, @% i k& l$ X, p( o" Z
. `. S0 ]0 Q% w- #include <mach/memory.h>
9 _' t8 B/ |: Z - #include <mach/hardware.h>& n5 U8 |0 f" `$ D5 \
- #include <mach/irqs.h>. ~' E( l8 I7 d& c
- #include <asm/hardware/edma.h>" j2 i7 D! m8 s! B9 m# J
- % c% n9 W; d7 @! j2 N
- #undef EDMA3_DEBUG5 V' o" K$ T5 Z8 m+ Y
- /*#define EDMA3_DEBUG*/& F4 e. f3 i& {% H. U/ A
- % A# B; l( X9 M5 P+ A- }& k& h4 z
- #ifdef EDMA3_DEBUG
% N4 p: b5 a* U7 W8 u; S* O% j, } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ `7 M8 x+ s' x* w7 o: v+ q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 Q+ F# X4 q, Q1 D8 _# }$ W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# I6 S5 h" J3 [: j6 S; L - #else1 a l6 [. S/ A9 z5 R: d% n" T, j- N! {
- #define DMA_PRINTK( x... ): y8 ]; o0 C- `. ]- n4 b4 R3 u$ V: |
- #define DMA_FN_IN
! \: `/ {7 ^, I% [ - #define DMA_FN_OUT
" k. F3 ~4 H3 J2 G - #endif. t7 a; i! G# F" ?; T
- ; R; y1 I7 @6 c& } s$ D6 s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* T1 e& i4 U: R; ]
- #define STATIC_SHIFT 3
: ]; ~; x$ ~4 ]6 T - #define TCINTEN_SHIFT 20/ I: k$ z" m6 p C" ~4 e- v+ x
- #define ITCINTEN_SHIFT 21
F: f. t% \& y8 k - #define TCCHEN_SHIFT 22
, R; p& q! I" | - #define ITCCHEN_SHIFT 23( a1 K9 H u2 M6 {+ a
- 4 @; T- \* c( {, B: a* v. }- \% M5 N
- static volatile int irqraised1 = 0;8 q% K, ^- Z4 h# O
- static volatile int irqraised2 = 0;# m4 i9 A; u7 P* K. Z) L/ K) Y
) x% q, t. u0 i% A- u3 I/ ]/ Y b- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. a9 p2 Q& n6 M" z; ? - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ F* ]6 s2 \! o) T: i2 `$ \2 P - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); }3 n+ w1 I# G% p4 q
# {) R* W; \; X" u. t. }4 S# H- dma_addr_t dmaphyssrc1 = 0;
/ [) r, Q) }0 G# I/ D) _: j3 c! E - dma_addr_t dmaphyssrc2 = 0;
/ V/ m; w9 V% g$ N5 U; M - dma_addr_t dmaphysdest1 = 0;1 X8 q! m9 F4 D0 b& Q' _
- dma_addr_t dmaphysdest2 = 0;' b7 U6 A8 G. z4 A. q
) r6 q% H+ g3 ?! X6 _8 S5 G- char *dmabufsrc1 = NULL;
# ]5 b5 e! f5 a D- I - char *dmabufsrc2 = NULL;
* p6 ~* m+ Z8 K* f3 C( q - char *dmabufdest1 = NULL;; m6 Z: Y( I( b- m3 d* x( \
- char *dmabufdest2 = NULL;5 R' O3 }4 z" n) x# ?/ J) g
4 O/ e5 I# p1 q7 f8 W) e, `- static int acnt = 512;, T8 r% v% l; |/ S5 k( Z
- static int bcnt = 8;
# x' Q4 k0 }, C - static int ccnt = 8;$ s' T" m" `% _5 U$ M" f9 C
; F9 x* g J! P' Z! L9 M+ ^# Z- module_param(acnt, int, S_IRUGO);5 M n3 Q) h$ n+ d8 E: o: D! Q
- module_param(bcnt, int, S_IRUGO);
. Y$ H. W, P3 ~" g' K# W0 V# w - module_param(ccnt, int, S_IRUGO);
复制代码 5 h% D4 N! _3 z) ]
2 Z. Z: y/ f* O# w, Y1 ?# T k: |
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 i* E8 b" Z- u; d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. I9 f" O; `, G$ ]9 E! B- @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 r5 ^" q/ l: p. n) s2 a
. t/ j5 p# J4 N' a1 J. F3 ~$ ?; }, X5 g& u% [( a4 O5 q. b
|
|