|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / H" y0 D/ g/ j& h" k5 x
- [code]EDMA sample test application+ k) ^2 ^- V: o; P6 }
- /*- s: J$ F4 d2 T8 @
- * edma_test.c
$ r* C" Y* G$ `5 T8 z3 V - *
& I% Q! a1 `; a/ @5 I; C - * brief EDMA3 Test Application
0 p- _% o9 T$ L3 B9 L5 y; z - *& h7 f' ]+ Q& g/ G$ b6 E9 h+ F. }! C
- * This file contains EDMA3 Test code.) _6 x% M: R$ `- Z3 v
- *: G. S9 F+ ~: J; J$ T
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 D2 L, p+ q7 l6 Q( k/ e0 J ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; k5 D0 @" p3 J: d' ], F0 ^ - * TO CHANGE.
# F1 z' c- n% R0 W$ ? - *( |8 G' T. z. F. p. L7 V+ v! N( J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; c; v, ?5 B- N1 _. B6 P4 n - *
# R0 @0 D- H4 t% N" ?0 Z - * This program is free software; you can redistribute it and/or2 y- [) g/ L, \7 L
- * modify it under the terms of the GNU General Public License as" _$ h2 _+ v2 F* I6 E3 Q
- * published by the Free Software Foundation version 2.
: b* G0 D& O: S4 j9 m [ - *
: T" Q. @! s$ M7 u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- J1 d" f; e- k6 o" v0 q
- * kind, whether express or implied; without even the implied warranty
5 }; v' y% A) f" m5 M* e- } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( J$ ?# j; p: L: S: f
- * GNU General Public License for more details.
; ?5 H* W/ \% T - */$ ]( |, `0 J: L+ j
. b* c) @# H* N6 \- #include <linux/module.h>- H* o+ V' D2 Y
- #include <linux/init.h>
- q! K( y/ ? p: r, F9 f - #include <linux/errno.h>* W* m4 @2 A4 m. O
- #include <linux/types.h>5 w& r& \& h) H( }- |
- #include <linux/interrupt.h>
( \$ b2 n! O$ H* S: ^) c+ J( b - #include <asm/io.h> m$ B0 [4 x; Y2 @( h
- #include <linux/moduleparam.h>- l2 n# M1 J: c/ \& h
- #include <linux/sysctl.h>4 \( E. S; F0 L( g
- #include <linux/mm.h>2 K' |7 W9 A: F" N
- #include <linux/dma-mapping.h>2 V1 H9 c4 U/ }
) L6 ^5 t) l. M2 l- #include <mach/memory.h>8 U6 c8 g% v1 _
- #include <mach/hardware.h>- J, U" O4 [9 E; ~- H; I$ O
- #include <mach/irqs.h>* B) [' ] \+ l9 s1 }; ~) r
- #include <asm/hardware/edma.h> e1 v. O5 G) ]/ Y2 R3 o! L
a$ O! |* M, I; D: d- #undef EDMA3_DEBUG; Z8 d6 b( }9 k
- /*#define EDMA3_DEBUG*/
' I4 @# y0 q* T* B9 E& P
* t" a) |5 p; K, J! @- #ifdef EDMA3_DEBUG
& ~( W: W/ @' L0 j# c$ I2 y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- v2 I$ d. ~/ @+ [! i1 W - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) V! K" E2 n" L8 { h - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 N- G! Y) N8 F4 E' U
- #else% S" _+ A9 G& ?% m6 ^- O
- #define DMA_PRINTK( x... )
- j: w2 x+ L4 T9 g) z0 p3 g - #define DMA_FN_IN8 G& [+ J' l& W& h2 m9 T
- #define DMA_FN_OUT$ q. y: [5 X0 s# ~" W* V
- #endif( N! @3 m( }8 V4 U
- 1 c# w. s7 W2 ^6 @3 y8 U# F; K: K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 a; i8 P8 X" S. q$ \
- #define STATIC_SHIFT 3
! K. M5 |2 ]* c3 a6 a - #define TCINTEN_SHIFT 206 G( U9 h; S* m U5 i7 b
- #define ITCINTEN_SHIFT 21
# R- H! O9 m* S - #define TCCHEN_SHIFT 22
: R2 H6 a! W5 g) |6 k, W2 X9 u' _ - #define ITCCHEN_SHIFT 23
( J3 U9 a4 q$ S" C) R - 9 o! M% ~) s$ N0 x
- static volatile int irqraised1 = 0;
. c' J3 E' p1 ], S# L4 K - static volatile int irqraised2 = 0;2 _5 V! Z& q* Q Z L
. V: z( H0 H) j( C, g6 u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 f0 s w. R2 v- `: f - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* J" {. T: I6 p - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 r7 ?4 w+ ?8 Q0 H5 E2 N u# I" I
7 J! d. }* ^, N% V. U" _& s1 ^- dma_addr_t dmaphyssrc1 = 0;, v3 y3 q* L1 k; {+ v( e
- dma_addr_t dmaphyssrc2 = 0;
' ?1 s9 m" u( J J+ | - dma_addr_t dmaphysdest1 = 0;
9 h" p: P/ c9 a* `9 q; {! ` - dma_addr_t dmaphysdest2 = 0;
7 ?2 V4 `' F4 E+ W) d - 1 X/ G; ~+ R+ x% [4 X
- char *dmabufsrc1 = NULL;
8 A2 f" G' [( |+ u6 L - char *dmabufsrc2 = NULL;
* i0 E9 W& e$ |: T! Q - char *dmabufdest1 = NULL;
! n$ R' I# r7 O, m9 i9 n! y - char *dmabufdest2 = NULL;" r, K! k. b0 ~% Y6 e6 _! E
7 c; ]. A4 h, Q. j& H; _ N) K( p- q- static int acnt = 512;
. d) b* _% b. ?* L. Y! D1 o - static int bcnt = 8;8 Q8 L8 ^" c8 {6 `; z/ O
- static int ccnt = 8;
Y9 C( ]* C/ d$ M; @8 p0 F& W
7 M/ e8 T1 a( ?. {7 {& i5 u7 g1 U4 e- module_param(acnt, int, S_IRUGO);; ]" D2 a) {" D
- module_param(bcnt, int, S_IRUGO);, U, G+ a* r6 c/ b4 O, {
- module_param(ccnt, int, S_IRUGO);
复制代码
! I2 s8 y" D- f, a! B C. N; c9 ]" w% S1 E; ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' O1 y4 d2 H$ h, f0 W3 H+ v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& _) x0 r- \5 `" n' g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& B7 T& W6 d" v" D" B0 ]5 a: G% N
3 p; F3 m* _9 z9 a2 l" k9 T g2 W
) u. h; d/ \" c; t7 { |
|