|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 ?/ y5 g8 E4 J) B3 B* N+ y7 Z- [code]EDMA sample test application j1 i% Z5 z3 w$ ~
- /*4 X9 g$ {. x+ y# h) P9 e J* B4 K
- * edma_test.c' G9 _0 m1 D" F+ [+ l9 C
- *
$ u) _( V2 Y! K0 K - * brief EDMA3 Test Application5 H# e$ e- A1 h5 k
- *0 F+ D" x4 M$ q6 v( |
- * This file contains EDMA3 Test code.
: R, Z/ |0 u( S6 Z - *
- y' T, Q- ` E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 U! C& B* E9 h8 R! k5 H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 @8 T( D2 K8 j3 J- o5 o
- * TO CHANGE.2 p4 y* m& ^0 @% w
- *0 v I, j0 ~, Q, p% z1 M1 v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 }9 B! W8 O6 [+ w' W, X7 \8 S
- *
. s$ ~5 w+ E6 O$ ~: J% [5 ~ - * This program is free software; you can redistribute it and/or
_ R1 x' ? m0 ?7 l* W - * modify it under the terms of the GNU General Public License as
3 z% ~9 ?0 F" {/ B - * published by the Free Software Foundation version 2.
$ r/ i4 j) \' q8 h x: f' T/ D. G - *
0 F2 X6 ~* e/ _4 h& C* E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# J3 O, x- r2 E! { - * kind, whether express or implied; without even the implied warranty% F3 k. p& l, [5 ]7 L/ s, d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' |8 C. a! y# B0 ?7 U# t
- * GNU General Public License for more details.
6 o" K7 M' L# V7 Z7 l$ Y% r1 @1 ^ - */* Z$ G5 E' W% @& a" m' |0 s# w
- - J! @+ W" U- v) D' }/ l
- #include <linux/module.h>
+ T& N) v4 L0 J+ k1 s - #include <linux/init.h>1 D3 T" ]' v# e$ S3 N6 \9 R, ^8 M
- #include <linux/errno.h>" O( E1 X8 O5 d: Y( F
- #include <linux/types.h>
) k0 H# h& l9 D k5 ]! K - #include <linux/interrupt.h>
: h6 l% V5 s! Z, U1 J$ f, H - #include <asm/io.h>; X9 F- [ v' M# `
- #include <linux/moduleparam.h>( Z3 D- c$ }1 u( d2 ?# F
- #include <linux/sysctl.h>
0 d8 ]! }0 w( p, u; `9 H& c - #include <linux/mm.h>
- d ^) P4 w8 w - #include <linux/dma-mapping.h>( C6 w4 u3 [3 ?4 x W
- . n' ~0 D& D W$ Q
- #include <mach/memory.h>7 o* k0 m% m/ k1 X! z3 `
- #include <mach/hardware.h>- b/ W+ m2 y* K" u( A
- #include <mach/irqs.h>1 M0 O% o5 ^' D1 k; O* H9 t2 e
- #include <asm/hardware/edma.h>2 l: m% B% `- X! S9 Z: T
- . B7 O; C, L2 v+ c
- #undef EDMA3_DEBUG
( E1 r" _' c6 h! {. m4 M* e - /*#define EDMA3_DEBUG*/6 N" l# y5 @# X- i9 m; t( m* }
\9 ~! E! |# M2 v1 a+ E0 K- #ifdef EDMA3_DEBUG8 `' l# @* {+ ~% M$ ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 b/ r* C; G4 B+ `3 l, l. g Q( S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
v2 E9 B# u* T A/ C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! M9 M; q# \6 ^8 P, ? - #else
+ A; u: B2 [0 w4 z+ A. m2 ~ - #define DMA_PRINTK( x... )+ u* {2 C2 O2 r
- #define DMA_FN_IN
9 l2 Y2 O, U3 j, J$ ?4 L; N; g5 d - #define DMA_FN_OUT: l4 {0 w' G8 t$ F8 J
- #endif: _/ r1 @" U" A9 d" q
& c& W! a n2 x$ t4 h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 J+ j2 C( ?; @5 o - #define STATIC_SHIFT 3
- |4 x7 n1 A& ?4 A9 R - #define TCINTEN_SHIFT 20# k2 S/ y- R' T I+ r" m1 A
- #define ITCINTEN_SHIFT 21* O4 n8 U& h- b, [
- #define TCCHEN_SHIFT 22
. F3 k/ n- H( `7 B T2 {+ F5 ? - #define ITCCHEN_SHIFT 23% ~8 o1 e/ e) G2 b( a. o& w1 H4 y5 ]* P
/ F S3 m9 t6 L5 @% {* `. x- static volatile int irqraised1 = 0;7 ~) W+ b* Z7 ? @ G; o) G
- static volatile int irqraised2 = 0;
' o5 S' b7 c; r- x1 {# v
0 y$ O8 W# b8 N# @1 p6 t- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% Z( f" V* p5 N. D; j
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% v6 B) k; o1 o" M% z) i5 w! h3 I
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& o9 x9 X% w! D* e0 c
- 8 Z4 x) u( `& U. D" I
- dma_addr_t dmaphyssrc1 = 0;
. x2 l* Y' v& _- ` - dma_addr_t dmaphyssrc2 = 0;' q" R" z9 c5 h) a0 r. T
- dma_addr_t dmaphysdest1 = 0;, d+ p' o5 c N9 y1 D
- dma_addr_t dmaphysdest2 = 0;
5 c+ u/ k2 x9 q% y1 h# E - 0 D5 n" Y; S$ O: K9 H
- char *dmabufsrc1 = NULL;4 S. _- |, l2 U, \
- char *dmabufsrc2 = NULL;! @5 P0 L: p; M, `9 O' d
- char *dmabufdest1 = NULL;2 ?* e0 k/ ]; i1 k
- char *dmabufdest2 = NULL;
6 w7 S& C3 W: |5 A - . ^0 |7 _3 { b% G: ]
- static int acnt = 512;& R' V3 j0 _7 u7 W! f
- static int bcnt = 8;
7 j/ A7 i+ P. U9 V' P" T6 J - static int ccnt = 8;- |- z- Q6 y3 [5 n! W z
. s3 ]; j" k+ g. c1 @; ^- module_param(acnt, int, S_IRUGO);4 _6 R+ _9 z8 Y
- module_param(bcnt, int, S_IRUGO);; ?! x) w. P. I% r4 |
- module_param(ccnt, int, S_IRUGO);
复制代码 , S# |0 i8 m6 J1 ]8 f& ?% n
4 s1 V) k/ S* Q+ }% U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 e2 y$ k+ R# s1 y4 X% C! U3 g) varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 g( q+ q0 t3 [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 @$ i" Z* h$ m# O- {
9 k& ?& H+ ?) Z3 X6 R
; S) y* i3 I0 r6 R5 Y |
|