|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " C8 E7 K% B' g8 B; M7 m; q' M' e0 C
- [code]EDMA sample test application
& Y/ C' G ]- ?* D' Y - /*! ]# F. l( _' G5 N( N# Q6 y1 I
- * edma_test.c( `0 m& G3 K' \2 Z5 D/ {" l
- *# n) e9 A) G' l; j
- * brief EDMA3 Test Application0 G! F0 f, i( l, F" x: B2 r3 }
- *
- X- K* t7 j( f$ u - * This file contains EDMA3 Test code.
. F4 l. {0 H. W9 b b- d - *
1 b- m4 M7 o/ z& R4 C+ d% ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( F3 k) ]/ T* W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) d3 P9 E: t" h& H - * TO CHANGE.
3 M- q. ~& j( P; O2 _- R/ @2 Y9 F - *
0 v+ P$ P0 z( V; ~ a A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% k2 r1 U. D. E& e
- *
5 @8 B' ~& v6 ^, ]& g8 j - * This program is free software; you can redistribute it and/or
+ \$ H3 |' a; _' O( d: W7 w- `1 B - * modify it under the terms of the GNU General Public License as
; x: u% b" t! ~. W# k - * published by the Free Software Foundation version 2.8 G: x$ j9 ?1 i- C; L% g( l. c
- *0 z8 S5 ^ f$ N2 P1 W5 q% [% B( c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ o8 K$ T2 X0 f7 y# @ - * kind, whether express or implied; without even the implied warranty
3 l7 {! P; G( S; i# z1 M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- v- d1 `4 w4 x3 B7 I1 R/ w - * GNU General Public License for more details.
2 l2 ]& q; i2 {+ i$ B1 M - */
3 Z: ~/ H- \& c5 A) x - 3 u% a2 a( m2 \" p
- #include <linux/module.h>
5 w. l' w4 o h1 f - #include <linux/init.h>
$ N" I4 \% ]3 i; g9 Z& d& W - #include <linux/errno.h>
3 N( f" x* z- u& K$ {* B - #include <linux/types.h>: X8 K; T2 ^4 ]# L
- #include <linux/interrupt.h>9 `, H# m5 Q( ^+ P
- #include <asm/io.h>
: o2 I2 J* E6 q0 {, G - #include <linux/moduleparam.h>. b+ _' J4 U6 L4 c; D7 Z8 w1 @( ]2 ^: G
- #include <linux/sysctl.h>
3 ~4 v! K- Z: |" |9 G: _ - #include <linux/mm.h>
, O$ c1 P9 K: a7 {' [# j - #include <linux/dma-mapping.h>
9 R6 x2 `) ?; }9 Q9 a) l' n9 Z
5 o$ ~# b$ U( C+ f# b- #include <mach/memory.h>; i8 K& j& N o% ~8 ?2 G
- #include <mach/hardware.h>5 j$ K4 \; @) } M' i
- #include <mach/irqs.h>
9 B8 S* H! L- K2 t2 X - #include <asm/hardware/edma.h>; G9 [8 L4 r z L8 ]) h
- 1 Z7 z, P3 b/ F( Z2 E) ^# m
- #undef EDMA3_DEBUG
; u7 X% T" f8 l( q3 B# P3 ~ - /*#define EDMA3_DEBUG*/
* _7 Z2 _6 ~7 a% A
8 l% x2 q r3 ~; T2 {- #ifdef EDMA3_DEBUG
* _; [* E. S( p8 q8 d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): N2 A9 g7 @ i( Q$ d' o5 v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& Q3 E: X* \; Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% A9 K2 f4 p7 X1 W7 S0 t6 C - #else2 | X" ?. X, j4 S( G% ]4 c" p* @
- #define DMA_PRINTK( x... )6 w$ }" K7 y2 ]1 L% w* P
- #define DMA_FN_IN, t$ [8 _% r0 T
- #define DMA_FN_OUT
$ o& @4 q. T# B( N7 D6 z0 b - #endif+ m- |; V0 | ]$ m5 g6 k# s/ }
- $ I y7 t- `/ t w; _$ U3 s& u
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 j4 G# f6 O! }; U& h1 K - #define STATIC_SHIFT 3
% z5 X4 L9 b0 m ]0 w( h) F - #define TCINTEN_SHIFT 20
# B, x. @# m4 v7 f: O+ z - #define ITCINTEN_SHIFT 21
9 Y" t7 c$ T5 U/ \# U - #define TCCHEN_SHIFT 22
8 f5 j, a% E, m2 P. K - #define ITCCHEN_SHIFT 23
8 F Q' G! K0 g& p$ } - 7 W. N$ F0 R" X7 l, j1 R; Y
- static volatile int irqraised1 = 0;5 ?- v$ h2 |/ u6 j( l$ c
- static volatile int irqraised2 = 0;
/ U5 n' S9 ^' C2 u5 N3 W, _
* {# w% w. f" N& I5 Y) C7 v. y2 F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' a1 ~* g3 ^7 @& J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ C6 L# d& ~+ @+ l3 ^# ~) G1 G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 H. w" A( Q) {. I# j/ ~ - ) V8 z$ H/ j, q6 }: p2 t) i3 z
- dma_addr_t dmaphyssrc1 = 0;
4 Z1 b/ `$ a, T: a4 l - dma_addr_t dmaphyssrc2 = 0;
7 ]4 v* F# ^2 e1 z! \& I0 n, w- Y1 Z - dma_addr_t dmaphysdest1 = 0;
) y6 \& K4 X" H2 y - dma_addr_t dmaphysdest2 = 0;
) }) P% R. l0 e5 I
7 u) w! M! M8 y' C0 x- char *dmabufsrc1 = NULL;
# O6 x8 \7 L4 Z1 W+ v - char *dmabufsrc2 = NULL;1 E+ F. ]0 ^7 l' ]
- char *dmabufdest1 = NULL;
( R6 c# m! s( J9 \5 W: i) e - char *dmabufdest2 = NULL;
0 m5 X; t, Z7 f% T4 R - / H6 u- g$ K8 ~) }4 D: {2 X
- static int acnt = 512;2 n6 Y! b/ S7 M* z4 R
- static int bcnt = 8;
C) b& B) E9 n, ^* @+ s, h% T7 s6 \ - static int ccnt = 8;3 k' B& b7 [* L( v5 S& O
- ; N3 J- ] e3 Q" k
- module_param(acnt, int, S_IRUGO); [8 s$ l$ D7 Q+ |6 G) a
- module_param(bcnt, int, S_IRUGO);$ W- g7 l" T3 o; [
- module_param(ccnt, int, S_IRUGO);
复制代码
8 t8 p& k( z4 o5 |
- f$ B% `5 h- Q8 D3 s3 J1 A4 y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 m& o2 r% P K: N( {- ^$ N7 e. h/ iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* k& i( k5 l7 P9 _4 n5 D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: K c+ y( Q( p) a4 i- Q
1 t4 ~& T8 v& X3 _0 v _: ?5 F# n c0 H( h
|
|