|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 z4 p" I5 H: L H" Y- [code]EDMA sample test application, E' w3 V) B. {' ^( k) p, @5 n Q
- /*5 v! @% m* \( ^6 z3 ?! n1 t l2 x
- * edma_test.c5 Y' |1 N. j V Y/ d6 R j1 \9 {
- *
/ A! j8 t5 z8 n9 E5 X+ R - * brief EDMA3 Test Application
1 H/ c6 x6 Z1 I9 {3 K) U% y - *
( X3 ^1 {5 A5 ]& Q+ @" v$ Z - * This file contains EDMA3 Test code.
j: k6 R4 F& i/ H4 w - *
5 @" v& x8 i! W2 ~* {7 I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ ]1 J9 u8 W1 z' V3 s5 F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 c1 \( \; w$ F2 p& m% {! X3 e
- * TO CHANGE.( ]* c) r, D( v
- * v0 n& m/ Y$ k4 Q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- e/ M3 t' V3 t* }* b9 u
- *
: m: h/ E9 C& r5 [* P - * This program is free software; you can redistribute it and/or' r' Q& }8 [, e# X5 ]
- * modify it under the terms of the GNU General Public License as5 T1 @5 R4 j8 N6 W1 g
- * published by the Free Software Foundation version 2.
) Q; T. a4 D; X% ] - *
0 u' q( w( k d$ ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 k8 e4 R* E' d9 C& @
- * kind, whether express or implied; without even the implied warranty
$ Y2 W3 d! ^( b. }8 a9 U/ i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the e1 E9 a# ?9 s/ P/ U2 X; U# L5 v% K
- * GNU General Public License for more details.
& k! g0 g8 O( g( |' f - */# y8 @6 o. O ]; [/ W, H6 _( D
- + e1 L* G8 ?% k8 D
- #include <linux/module.h>
. A+ l# y B) H" t1 l- F8 B - #include <linux/init.h>
! S: y p+ L8 s) j7 U - #include <linux/errno.h>* Y) s4 f U; q2 t: _2 s5 c
- #include <linux/types.h>
. \4 f$ h6 Y# H ~3 y3 @% x - #include <linux/interrupt.h>
! d! e+ q2 G+ r# w T- c - #include <asm/io.h>
, Z S8 s* I4 E' @5 }. u - #include <linux/moduleparam.h>5 r4 M* M5 A; z# h$ ^6 T5 f
- #include <linux/sysctl.h>
2 d# q! U7 H4 Y8 M - #include <linux/mm.h>
# d/ s! i X: I% a+ i - #include <linux/dma-mapping.h>
3 I+ t }# F" |$ x5 G
* m% [7 h* e& u9 G6 `' j O; ~! Z- #include <mach/memory.h>
5 E! s, ?" s/ D4 \ - #include <mach/hardware.h>
/ \0 k( `( d: E" p: _4 d - #include <mach/irqs.h>
, c- v# W& z# o) T4 G - #include <asm/hardware/edma.h>
( ~( A1 p+ w; Q5 k! ]0 L - * r# u8 o: m" w- S0 G
- #undef EDMA3_DEBUG2 X9 F7 h9 ]6 U" D
- /*#define EDMA3_DEBUG*/
0 u6 V: e4 A. V+ m; L$ h# [
! _' Y3 r3 c$ E: q0 F- #ifdef EDMA3_DEBUG% |& O! }- C+ N3 f, E) h$ ^ w
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& R: e" A( _3 Y2 W% r P' {
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) _2 \. s, g3 W6 ^" z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' _7 M% Y+ }) l+ a' y - #else% M- k. ?. r. v7 D# K
- #define DMA_PRINTK( x... )! s. u5 ~' j# R. w; e4 }, O
- #define DMA_FN_IN
u3 l; ?5 m" r0 N# e- ~2 p/ m% k - #define DMA_FN_OUT: @ c! i4 z8 [' Y
- #endif
P0 K4 H+ k k& p" b - 9 e2 y5 a1 J- f2 U; S. M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! n7 i4 u' H$ Z/ m( i
- #define STATIC_SHIFT 3
6 Y' {1 R7 ^; n' a+ V8 T8 s - #define TCINTEN_SHIFT 205 O; ?$ ~5 N7 Z: J+ z' w
- #define ITCINTEN_SHIFT 21
; T5 J& I6 ?, c. Y& Q% J% S - #define TCCHEN_SHIFT 22
q: U8 x6 ^+ r - #define ITCCHEN_SHIFT 23; p2 z$ _2 C" N8 _8 ~$ ^/ x6 [
- , M4 R* e1 I1 `% {( L
- static volatile int irqraised1 = 0;) a( [ H( o& K+ o
- static volatile int irqraised2 = 0;3 X7 P. k2 M" d& [8 b
7 C1 ` ?2 V: [+ t* C/ Q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) }+ A& o, c' F: l. N# d% I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: q! w; x1 H$ Z. ~' c8 h7 P I
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; l9 m, D6 [8 J' N2 U2 f: C
/ e' ~( @4 ]& G# o. i8 x1 N# U- dma_addr_t dmaphyssrc1 = 0;
5 H. F& \3 W% t2 R* `* @ - dma_addr_t dmaphyssrc2 = 0;
4 l. H( U6 X7 _$ b% l" h1 O - dma_addr_t dmaphysdest1 = 0;
# E h5 ~- A6 f) G+ o - dma_addr_t dmaphysdest2 = 0;
# x0 `* A8 ?* f6 }7 z |$ v
# g( G+ a. i& ?$ S- char *dmabufsrc1 = NULL;
3 ~. [+ k$ h* Y - char *dmabufsrc2 = NULL;
- f2 v% M. ]6 \! o$ j - char *dmabufdest1 = NULL;
) J( X# `. x# v. S! o - char *dmabufdest2 = NULL;
& N& W7 q" H/ C9 t+ S x% C6 ]1 h
u" m8 G: u% c- static int acnt = 512;
2 ?3 Q% R) v7 m# C$ N1 Y; F - static int bcnt = 8;
) n- N( U* A( R3 M7 c - static int ccnt = 8;
4 E ^# N) `' b$ l# t2 y
* j1 r3 O" G/ L1 A- module_param(acnt, int, S_IRUGO);
, h3 F7 ?, D% H" [, b8 A5 T1 { - module_param(bcnt, int, S_IRUGO);1 |# }2 Y E! u/ S* ~0 x
- module_param(ccnt, int, S_IRUGO);
复制代码 6 h. R9 c% `" F9 p
D0 Z8 n8 d8 v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 g* m Q2 Y$ V7 \7 `3 T; N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: C! o5 s: l P- h* ~) E# J" M8 ^8 k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 x( ]+ |6 f0 v' d9 R/ N( ]
# l7 A6 [- }7 a3 S3 C5 s) |0 Q
: Q* p' x& f% J* [9 h& D |
|