|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 N" h1 @; t) ^8 U- [code]EDMA sample test application; }. F. s) ?# f
- /*
6 N$ @" q: {! E8 o, ]1 Y - * edma_test.c
6 r) a/ j) b8 e+ V# w - *
9 P0 y! Y9 M3 `: X! u - * brief EDMA3 Test Application
' }. N8 C! I" h+ q - *9 c* D5 x+ E4 q$ D- i
- * This file contains EDMA3 Test code.4 D2 X- w$ G: e( ~# S0 g
- *5 ?! v. H; V. `" w# F8 P8 }% H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) I/ V- E9 u" E8 | - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: @6 ^8 G# I+ w! C6 r; X+ x - * TO CHANGE.
1 U. A; i" h7 ?. ~$ u7 `+ A - *5 k( K d9 v7 }7 ^8 _& U Q7 |( L( w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* V& `3 k2 j* ^ - *
4 h5 E* x) p. S: [* | - * This program is free software; you can redistribute it and/or ~' w7 l( P* \) o8 I* P( m/ Y
- * modify it under the terms of the GNU General Public License as* }7 x! t2 u2 S8 Y( T
- * published by the Free Software Foundation version 2.* r A" C3 f; F: v. r
- *
s) {* X4 B8 ?" u9 _5 _ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( \$ f$ [* [6 _9 f$ [ - * kind, whether express or implied; without even the implied warranty" e; x4 f* B2 c( O( z% k; B( n( u
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ m/ D+ s8 F+ x2 n" a. W3 x. Y: Q x - * GNU General Public License for more details.0 b* {; C: k5 l6 B: t, P) N
- */+ i/ E8 b- ^6 b- q* R
- $ ~+ }, M) D: V! f
- #include <linux/module.h>+ q/ V9 u/ H R! |+ g
- #include <linux/init.h>
" W- z6 ^% L0 i6 E, X. c8 M - #include <linux/errno.h>
9 o- }& a. Q7 X1 K$ k: M0 P - #include <linux/types.h>
# _; `9 y( c+ F4 M - #include <linux/interrupt.h>! j( i5 ?6 ~. U
- #include <asm/io.h>
1 v1 G$ T! r- v& p7 _/ I2 ~. z - #include <linux/moduleparam.h>5 K/ y. Z' q: Y1 A4 s' ~) Z0 q. y
- #include <linux/sysctl.h>
' H; E3 c+ C5 ?9 s6 v& N6 _! A* ~' Z - #include <linux/mm.h>% R( U H9 M- }
- #include <linux/dma-mapping.h>2 H0 b5 D! n" C
2 _0 p. a9 _, \- #include <mach/memory.h>/ ~% E% f( s" M3 G4 ?* Y
- #include <mach/hardware.h>
8 `9 R0 c& P0 c7 k - #include <mach/irqs.h>
4 A6 N) _1 W! d0 k, ?! Q0 L$ J, p - #include <asm/hardware/edma.h>
+ {; G9 K' c# |, D- l8 ?
: n/ U9 J* [0 y2 d5 j* z7 v- #undef EDMA3_DEBUG! F( e6 U/ \) D- t) P3 w) I
- /*#define EDMA3_DEBUG*/
) ]" [% c; q) L* ^1 x; Q& Q. K
/ h- g; x4 y) F- #ifdef EDMA3_DEBUG W8 E- X `' ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- P. S M9 U) ~& c5 x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ Q% I) j6 Z: N: Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 [$ {) z2 U7 w; n1 E: q: C" i O
- #else
' K. J- c( h+ ?7 y) z' I - #define DMA_PRINTK( x... ), H6 Z& ]% H0 j9 b8 [* l# T( @
- #define DMA_FN_IN% o7 \& n; k( {( O- T" B- D% [3 n3 V( e
- #define DMA_FN_OUT6 z( T% o4 P: P0 A& B! Q# r
- #endif- h/ i- ~( T1 w: }
- ; V: Q+ }4 X" D* b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- _) J* N7 z+ A4 b
- #define STATIC_SHIFT 3
]- T( m, i6 T2 a9 c5 F. |% u - #define TCINTEN_SHIFT 208 a, n4 |! t0 D ^" A
- #define ITCINTEN_SHIFT 21. a% r' y1 F6 C- @8 `
- #define TCCHEN_SHIFT 22
- \: U6 h( H2 z1 X& o - #define ITCCHEN_SHIFT 230 k/ X3 Z: A- a3 Z ^. X
, ^& B8 W% k. u4 E1 P' T- static volatile int irqraised1 = 0;
" G) ]( R1 W/ H, F$ j! i: B - static volatile int irqraised2 = 0;
/ O2 Y* L) T- b# w3 i
1 t" Z$ W: M/ X2 j7 z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 ~$ e/ d5 R9 O7 F: @' \4 ?$ ]# F' c! ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' a/ y( Z/ f, a2 i$ p% _
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 v' I* Y7 L9 I5 c- B# s$ T- d
- + P) \0 N3 ^3 A w% X
- dma_addr_t dmaphyssrc1 = 0;
) }: t, ?( s# B0 m - dma_addr_t dmaphyssrc2 = 0;' V! d9 w' j% b9 q) V) n
- dma_addr_t dmaphysdest1 = 0;
/ r- e8 X6 `. x2 H' Q v/ F8 D - dma_addr_t dmaphysdest2 = 0;: Z6 O+ n+ d2 Z8 X) e# v
- 0 S- Z6 @7 ?3 _3 _1 o
- char *dmabufsrc1 = NULL;9 Q o2 g7 v& {" g1 q
- char *dmabufsrc2 = NULL;
. J' a! H7 O! i6 N2 g/ N, J - char *dmabufdest1 = NULL;
% p" n0 q4 b- f7 G; L7 \ - char *dmabufdest2 = NULL;8 O: O K" A) t% \0 Z8 }! C" k/ U0 o
. S: T$ G* W! m* B- static int acnt = 512;* c* x x4 e1 i. S, B. e
- static int bcnt = 8;
, o7 |& H) k f4 o9 L8 l - static int ccnt = 8;
5 ~; \1 d0 P, e, _/ u M, M5 ~
; X9 b" B6 X% y5 r/ `. S2 _5 r- module_param(acnt, int, S_IRUGO);1 W( ]; C+ w/ p9 q
- module_param(bcnt, int, S_IRUGO);
, x }" K+ t' Q1 @5 s - module_param(ccnt, int, S_IRUGO);
复制代码
! o- x1 N: F, }/ W/ q- r; I. k& o( s3 b' m5 I
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. P! ?4 e+ n; d/ d4 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! @0 P) w) _/ ]& P7 X k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 U6 m1 R2 Z* t3 v9 @2 t
! R$ y. w6 V: x% |1 f/ `7 _. o( W L
: p$ t D3 T0 ~4 ?, S |
|