|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; s2 t5 a0 w; t0 L8 X' i1 G5 W8 Q- [code]EDMA sample test application
6 z( a) n1 u0 F/ ~' k2 N0 Y - /*! j1 v5 Q- e, d
- * edma_test.c
a) `- A; f' i - *
2 Z& Q; l0 {' }* h/ a2 f1 T5 o - * brief EDMA3 Test Application
2 s* M2 l! n) @( C" Y8 p - *+ g6 f6 q4 p! @. s8 q I
- * This file contains EDMA3 Test code.
" ]4 a0 H( M$ C$ H; N& @* |0 R( n - *
1 o( r, R& `8 Y; h0 E* U/ o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. h. A; P4 H3 N8 ?+ K. t, t
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& d: p$ A! S0 E2 k" T1 o
- * TO CHANGE." q n* U+ T }4 `0 z. o* B
- *3 n% \& r9 ]- p$ a0 H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 Y! \) P5 x9 ~1 `5 L, n4 y* V - *
5 j9 [& C. ?0 X; P2 t. n# Z: B - * This program is free software; you can redistribute it and/or
5 L% i7 B" m' b6 O. F) I0 O# N( N - * modify it under the terms of the GNU General Public License as
% O5 v4 D7 A- a5 S& g - * published by the Free Software Foundation version 2.
7 @2 V) [$ j- n! F - *
. N0 W. \5 [3 e4 U" S/ h' W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 n l$ {6 C$ T( g" j3 R* W - * kind, whether express or implied; without even the implied warranty( E4 m( g$ q$ ~3 P( B9 _$ u
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 F4 E/ Y8 N7 K( ]# Z* N
- * GNU General Public License for more details.; P- W A- ]8 ^: d8 p
- */
2 B2 S, B3 Z9 h5 N - ; e7 `6 x% }' _7 ~- r
- #include <linux/module.h>
) W8 I! ?. j1 a" A - #include <linux/init.h>
' l2 K; e5 N: S/ Z- @$ E% d, k! k - #include <linux/errno.h>3 p" I: ^; {6 \0 w% o/ F8 c
- #include <linux/types.h>
5 c! v, R( Z6 i( h - #include <linux/interrupt.h>" Y7 M l$ _# S2 L# D( I
- #include <asm/io.h>5 ~ U8 c. W; Q4 q! K
- #include <linux/moduleparam.h>+ r$ N' A8 l9 \& C% {9 E
- #include <linux/sysctl.h>
% i/ {. z2 K% o4 B - #include <linux/mm.h>+ x! n' x: U7 L4 z5 k
- #include <linux/dma-mapping.h>6 s9 Y, j5 I, L8 ~
- 7 q- |( S$ O- ]$ F
- #include <mach/memory.h>1 t4 S- Y1 |+ M
- #include <mach/hardware.h>
9 `2 g0 `; u7 f2 Q. g - #include <mach/irqs.h>
1 T1 d3 {' n4 }9 B8 e" Z" |- U6 d/ y - #include <asm/hardware/edma.h>
4 h8 a$ ], w- p- k3 G - 8 c }* ~2 e3 B* y) O% L: N/ v
- #undef EDMA3_DEBUG
5 R( ~. m [! T& s/ J - /*#define EDMA3_DEBUG*/
$ H/ t+ J: G2 L
" `( k' N6 A. Z8 g, ^- #ifdef EDMA3_DEBUG
: P! x; t, w5 `$ v$ \" D - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* [: r: B$ x9 Y( ?2 A) b/ v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( K: u/ H1 r- [3 J5 N
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) j+ V( G) z& P0 T" i$ t2 r2 F
- #else# J7 Y; c% k6 V7 N
- #define DMA_PRINTK( x... )
8 c2 q& D; O6 H" R - #define DMA_FN_IN
7 M4 v5 l1 d8 i0 }- I: ~ - #define DMA_FN_OUT5 G8 ?- F* o- K5 f f5 k+ w% d
- #endif$ ^" x H) S; T5 m8 _
- 5 b$ s; H) s' a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 ~, z. S& T4 z0 w. k: X' M! ?
- #define STATIC_SHIFT 3* c, P3 P: ?- e& Y& k& q
- #define TCINTEN_SHIFT 20
: Z/ d6 i/ c2 O8 B# F! Q, l. h6 ^ - #define ITCINTEN_SHIFT 211 v9 z" D7 O# I8 B
- #define TCCHEN_SHIFT 22
6 M4 p- z" E+ i; k - #define ITCCHEN_SHIFT 23: D% r5 A* O% ] X$ h b- p
+ i; E0 p& P5 a0 `% m- static volatile int irqraised1 = 0; s9 I: G6 u" D3 K# e, ]) H
- static volatile int irqraised2 = 0;7 Y! y% q) Y1 _4 A2 Y
- " U- V* _' Z* W, v& ~
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* {. B4 W7 M8 G: M6 n( z; o0 @# L - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 o. g: P9 M7 j: B" g
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); T% ~0 {# m7 R1 }9 n' E
, ?6 t* m0 \- e3 ^- dma_addr_t dmaphyssrc1 = 0;4 p5 g' ]/ b# w6 m2 [; V
- dma_addr_t dmaphyssrc2 = 0;
n T5 m; Y5 C7 q+ x$ B! C [ - dma_addr_t dmaphysdest1 = 0;
4 v* H! H f4 k0 _ - dma_addr_t dmaphysdest2 = 0;) F8 F" o0 ]2 {& S, d3 I4 @* Z. Y
- e5 }& E* O F3 A1 I' T- char *dmabufsrc1 = NULL;, [- X0 f b& c2 X# u) v
- char *dmabufsrc2 = NULL;' g) {3 o& M5 {/ d& J9 l$ I4 i- r
- char *dmabufdest1 = NULL;
- D3 O. H9 A. ~4 o$ X# l' i - char *dmabufdest2 = NULL;% a, D- Y; y+ W! E
' H8 P& j% \; U* X- static int acnt = 512;
' Z( ]) s( ]! V( k- B9 f8 a* H - static int bcnt = 8;' ~2 Y) ~% C% s& u& c
- static int ccnt = 8;
6 ~0 X- W. y a# Q9 D L) T - ; p; I' d9 q4 ]' h
- module_param(acnt, int, S_IRUGO);( ]6 \7 S) f* N# _
- module_param(bcnt, int, S_IRUGO);
9 x% M6 q- O. r; Z/ d - module_param(ccnt, int, S_IRUGO);
复制代码
+ @) z% W+ _+ h4 k. j, }- Z( O2 R# x
5 ]" J% O+ B0 O; W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( R2 ~4 ]7 h" p9 c/ z4 aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" u) t- z/ X4 {' T% w1 ?- i4 l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- Y7 I8 j m- ?
) q! G! r% e- @& D$ u1 P8 M s* _0 J/ M& a# i6 A: @" M
|
|