|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % n+ c# t. U7 ? B6 l, f
- [code]EDMA sample test application
* M2 d+ K3 N1 `8 Q" ?9 y9 C# Y5 n - /*
4 ~/ {6 D$ W( Q - * edma_test.c$ d2 u8 k O- E! }& h* W
- *! `8 u' r4 e W7 ~0 S- i3 V% v- C U
- * brief EDMA3 Test Application, \9 `6 ?) N. ?" c3 b
- *
' v. f- D& ^, j7 R6 Z - * This file contains EDMA3 Test code., d b6 w) [% Z: ^6 z' p/ x
- *- _! W* k( ` @. f! @
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 Y% V; G4 _' o0 z- B
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* d% q w, _2 E2 i6 u) B: D( F3 C2 M
- * TO CHANGE.
( N. q( S6 j4 Q6 u% H - *( Y. R% [3 g7 U, k! {" T0 y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ A9 z1 h$ ~5 a- P. b1 W
- *$ R! V5 Q. l, `4 n; g6 }: u
- * This program is free software; you can redistribute it and/or- H! ~2 s: D5 F E
- * modify it under the terms of the GNU General Public License as
* J$ s# b3 I. T - * published by the Free Software Foundation version 2.
$ q: N3 v. W- X" f9 P0 G - *
) u- ^0 w' t& l+ y* e5 V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ @6 P' Y# I1 w/ A$ M) i7 B; T& u - * kind, whether express or implied; without even the implied warranty" z f1 n. l% j; M0 i3 _
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 b& T3 d% C0 @# ?: C5 v - * GNU General Public License for more details./ E! a. X5 D, E. P, y P4 j
- */
7 G' a) ~' W7 y `) L. r* @
4 o! C$ z0 c& d# F& Q9 q- #include <linux/module.h>8 x ?: [' s/ u3 P
- #include <linux/init.h>, w/ R1 D: { j' ]
- #include <linux/errno.h>
4 V. V* [, w$ T, }! h; _+ f - #include <linux/types.h>
1 H- M. K8 C; Q - #include <linux/interrupt.h>
; {* ~) l' E9 O - #include <asm/io.h>+ |0 I8 x. ^2 I0 B
- #include <linux/moduleparam.h>+ P# q$ C- q7 m
- #include <linux/sysctl.h>$ y) J# T0 N" ^2 I
- #include <linux/mm.h>
/ b" b4 P; R% T4 f+ f - #include <linux/dma-mapping.h>
9 w! G6 X7 U7 s$ m! B, V% m2 J3 ] - / x, _9 F5 k: |$ [' G4 ~" I
- #include <mach/memory.h>
6 s5 P0 x: D# M* J+ O, Y' i6 X - #include <mach/hardware.h>
7 k/ m& J0 w+ f! M - #include <mach/irqs.h>
4 Z1 C/ H! | Z1 H1 M- d - #include <asm/hardware/edma.h>+ {, b* s0 p, g5 F0 M$ g6 C
4 d+ O( @' w7 Z$ Z- #undef EDMA3_DEBUG
) f9 S( I# \" [ ] - /*#define EDMA3_DEBUG*/
7 j& V0 P$ T q+ f/ e - - p7 p) |& p7 l, e& A; Z
- #ifdef EDMA3_DEBUG( q; g$ a: m+ s0 x1 r; b7 s' v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 F$ a& F* C N - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 s; A- S7 Q6 j9 j0 i! | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ `4 O% @: r6 p/ k5 ~2 g( T$ O, ]
- #else
& A4 f) U( b: B8 N - #define DMA_PRINTK( x... )
" K8 C% ~( d. {; O - #define DMA_FN_IN
; y9 O6 `5 Y k - #define DMA_FN_OUT
, J4 }9 `7 R3 O& T - #endif
; u" O. G, a8 c2 N$ u - * Z, o h% l8 R
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; b1 y: J$ x% X/ e - #define STATIC_SHIFT 3
9 g6 z+ M& A. a m" ` - #define TCINTEN_SHIFT 20
9 ]) k0 ^% a# `9 W - #define ITCINTEN_SHIFT 21
$ E( d5 } Q3 ^3 t - #define TCCHEN_SHIFT 22' I) i _2 q' r/ e- h
- #define ITCCHEN_SHIFT 23
$ D. V- `4 } `$ s4 g
& d3 y) \6 T; X- static volatile int irqraised1 = 0;
5 I* L3 [" P' Y V$ E - static volatile int irqraised2 = 0;
% h7 b' K( @( @2 p; u, c1 ? O# R - # P3 Z1 U' }4 s, ^
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 A* o% B& j. y2 N2 j9 J' l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ G* c5 V. b% y* u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& R8 o) O- E6 n+ C5 Y1 _
- * X" p8 j! _) r: r3 }& `6 w
- dma_addr_t dmaphyssrc1 = 0;
/ s. m# p+ y% j - dma_addr_t dmaphyssrc2 = 0;# ~- D: l$ _/ w( j8 G, N
- dma_addr_t dmaphysdest1 = 0;, B5 I T# u1 m7 z# o/ c
- dma_addr_t dmaphysdest2 = 0;
1 w! Z6 d1 z0 [# `: j& N9 j
' _0 L7 G; y8 j* d5 g) M- char *dmabufsrc1 = NULL;2 r" D5 s$ O E v0 ^2 i) E
- char *dmabufsrc2 = NULL;+ B0 h+ G( U/ u' `% K) h
- char *dmabufdest1 = NULL;) w8 U) A; L) T8 r: X" L
- char *dmabufdest2 = NULL;
3 m5 M9 T5 ]4 F# r5 j- M2 ]* X
- ~% R9 ^; m% O, F8 { j, `! x- static int acnt = 512;' V8 [" ^$ e: D! I& U
- static int bcnt = 8;
. c# }. o0 r. K4 X; Z - static int ccnt = 8;: j) e7 w% D# a6 k2 ^) X
- " ~: ?1 r- a. S, N
- module_param(acnt, int, S_IRUGO);
( d$ g b6 c& b/ s8 B - module_param(bcnt, int, S_IRUGO);1 N5 {; y9 }9 [* r" j+ m6 i( Z9 l
- module_param(ccnt, int, S_IRUGO);
复制代码 1 B$ Z2 d* m0 {3 @8 @: Y
* {% P& X0 P9 ?9 e" Y* W2 O
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 f+ b6 i& L+ Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) [5 l. U5 T Y* R( |& ~. F
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 C' n5 C9 [) A* K8 f5 ?; ~
5 ~4 b1 K! R3 Q# a+ t8 m
& w9 R" q! x& U6 Q7 [/ Y5 m& f |
|