|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * C; F/ z8 d- `. y
- [code]EDMA sample test application! E; d+ v' t, H" ^2 |, \
- /*, u" Z" Y3 l/ T2 Z; O, Y' b. x
- * edma_test.c K+ e1 K0 P+ ]) q
- *' c! v- L8 C, F* K( c- n8 W
- * brief EDMA3 Test Application, i- X3 S- Y( q- |
- *
6 E+ w/ f0 P; K% Z) A4 r, I - * This file contains EDMA3 Test code.
: c3 V& n2 ^5 H9 H1 h& p - *
: m9 r8 P. Q$ K# J2 v$ ]$ c @: K - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 n* Q3 b) l8 Q! u9 `3 K' V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 @7 a" L6 _- } F5 R1 d - * TO CHANGE.
- {# X$ M% g$ ?0 J( `7 x7 m - *
5 K, w) H6 R' u/ H( c( ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ ~# Z8 g: i0 v: {) E, l3 K# L - *
3 d3 V U2 K& U1 p - * This program is free software; you can redistribute it and/or0 H4 d+ y: i* \- u
- * modify it under the terms of the GNU General Public License as; E1 S" `8 A1 A6 j; S, L$ m2 {4 A
- * published by the Free Software Foundation version 2.4 N6 ]3 @* ^! L; q
- *
" A* J3 U* V3 K& n. { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ G8 W* S4 K6 _ - * kind, whether express or implied; without even the implied warranty1 U2 t( F$ ~7 }9 r. F8 |- ]
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. l( M# i& U- T5 C8 J1 t1 A3 J$ |8 @ - * GNU General Public License for more details.
6 b2 l: L: d+ g - */$ p ^6 O4 u* A1 ^
, D2 L# F& |/ D( p1 v4 m2 F- #include <linux/module.h>, a/ N7 P* v Z. B$ N8 g; ]
- #include <linux/init.h>& ^/ }7 P* H) r* ]7 }8 m
- #include <linux/errno.h>5 X: P, @6 b* ?% J9 w, c
- #include <linux/types.h>" R' v- U7 n% Y8 a1 O3 l5 r1 C
- #include <linux/interrupt.h>6 K; |/ B: y/ e7 [ a8 Q( Z5 D, g
- #include <asm/io.h>
8 ?, G8 G- N8 s0 u+ y: i - #include <linux/moduleparam.h>
/ c9 B! d4 y$ w4 I) ~- d - #include <linux/sysctl.h>
. R9 \ [1 @4 b4 ~+ r - #include <linux/mm.h>$ ~5 [6 }3 S/ G0 r
- #include <linux/dma-mapping.h>
d! B) k4 g- s2 v8 w8 O' L K l% `7 ?6 h
& f; Z# G) g/ s. S% Q- #include <mach/memory.h>( E% f5 u8 l" h
- #include <mach/hardware.h>
; v6 J- R4 i1 ? - #include <mach/irqs.h>0 ?& p) i4 A: Y) c
- #include <asm/hardware/edma.h>- h# M s( [0 |7 z
- ; s$ c* O+ P" p- r" j8 g
- #undef EDMA3_DEBUG
0 Y% M0 Y2 ?9 \8 d3 z4 H& a - /*#define EDMA3_DEBUG*/' N+ W: t5 F' S2 b/ ^4 E
; V: n$ g+ n0 p( C; ~! @2 i5 l( r, N- #ifdef EDMA3_DEBUG
1 T' E8 ?! x6 D/ v9 j2 n" ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" D4 E( S: ]5 f- H% N+ F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 Y/ ~$ E! o4 x0 ~8 l5 e' w7 T6 E( @
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, C; J1 h& f" ] - #else
0 i: O; {& Y) M, { e2 h$ a ? - #define DMA_PRINTK( x... )
: X/ A) U- M( z8 _8 r) D" R% C0 I - #define DMA_FN_IN3 a- x5 w5 U. C" p
- #define DMA_FN_OUT
" _$ N. N2 r6 k& q/ k, f - #endif# a/ f- z! n* E p; H
- 9 X- c. A+ j' I
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 K. Z" I5 |. U" R
- #define STATIC_SHIFT 36 @' \6 \2 v+ w( O
- #define TCINTEN_SHIFT 20
6 A) s" P# `, ` - #define ITCINTEN_SHIFT 21
' _" B! V$ q5 Y( e+ V9 S - #define TCCHEN_SHIFT 22& n' n: p. d# X5 G$ D' m8 H$ _
- #define ITCCHEN_SHIFT 238 O1 B3 \6 A4 Y2 Z9 l, P. @- @
@1 Q" C4 W' y: W9 Y9 u2 G- static volatile int irqraised1 = 0;+ a* X0 `2 d7 W# u" V) I
- static volatile int irqraised2 = 0;* q4 N" t# y' m) ]. ~+ x/ i) D; Z5 F
- 5 p0 E+ F! i0 _; R, B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: Q8 l- s5 K+ m) O' q8 ~$ w4 v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 L! {: A, H* @7 F, a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 C* g2 J* b( v, O5 Z
5 _$ e: f+ R% W1 g- dma_addr_t dmaphyssrc1 = 0;5 _) t7 w1 _) P: v3 ], K% E
- dma_addr_t dmaphyssrc2 = 0;$ i5 C: C! R: \( f: w. a; ~
- dma_addr_t dmaphysdest1 = 0;, j3 L+ r) A$ M5 c6 f* H$ j
- dma_addr_t dmaphysdest2 = 0;: t8 a" ^5 T" {$ q
C3 B. Y2 t+ k' I9 j) M' \( U% ~% }0 `- char *dmabufsrc1 = NULL;
6 P+ ? v. k, e' `: K. ?) v# X1 { - char *dmabufsrc2 = NULL;
: P, u# p$ Q: W0 Y - char *dmabufdest1 = NULL;: v. s, R {% `4 n4 N
- char *dmabufdest2 = NULL;! a* R0 \0 _5 t, }4 @
- ( ?5 A- u$ S+ M5 e3 i! @5 A, P8 ^
- static int acnt = 512;
, ]; I' n9 u$ Y8 F4 }# h - static int bcnt = 8;
u5 t8 U4 ?3 A1 ?+ L: ~6 I& F - static int ccnt = 8;
z0 a/ f: q: Q0 o( E - ( Q+ X9 ~. ?& f; t
- module_param(acnt, int, S_IRUGO); L' q7 I' p5 A5 k n2 H3 J1 C
- module_param(bcnt, int, S_IRUGO);
/ N! L K0 j6 k* ]' S9 { - module_param(ccnt, int, S_IRUGO);
复制代码 5 h M( h& Q; D% b \
& E7 h) f! ? j" z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. m X- K5 G* r9 K1 `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% g) d! T' K1 a4 T; ` 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# M- A6 M# o4 N4 g$ V& O# Q! \6 c0 m- v" H: B6 F# r" b# U3 @
* Z" E1 w$ p0 B$ L+ W; o: q |
|