|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 S* R. @, d/ G. |7 R8 J3 C- [code]EDMA sample test application
/ u1 {7 A$ }, r4 E - /*/ ]1 V2 s( D1 m4 v4 w
- * edma_test.c
$ b# c3 _9 @1 q# E4 e - *; y% ]. L+ w3 y
- * brief EDMA3 Test Application
! F5 \* w/ p) O3 a: U - *
/ v+ c) N' v5 b8 ^) }0 c( J& C0 b - * This file contains EDMA3 Test code.
! u+ W* a9 `1 h) x - *4 Q) k: G; g# `- w9 T" H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* T7 U5 `7 l6 N4 X# O- M! f9 j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 k6 C% | Y: } ~ - * TO CHANGE.
7 s/ q& s0 s8 ?: m. [2 Y - *" o, f1 Z7 S2 |8 E# j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 j t j0 Y6 |6 A( j. y- g O/ j
- *
) m7 W1 n& o7 S8 ^: i7 A; { - * This program is free software; you can redistribute it and/or% K% ?* o) F+ U
- * modify it under the terms of the GNU General Public License as
' v3 a. b9 v/ p - * published by the Free Software Foundation version 2.
# T+ E* k, o' O1 c: W, G - *: g( J; b+ z) h# t! _% z* Q8 \$ `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- ?: w2 y! B! x! c) G8 i - * kind, whether express or implied; without even the implied warranty7 z1 [8 a5 C7 E4 `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! ^. L0 B7 c, ~$ ` C - * GNU General Public License for more details.
6 f, q6 F, t" Q e. H; z4 P) A - */! o: p8 F9 H2 M; }. K0 p
- - |! f2 M0 }+ P5 l, Q( H8 g- z
- #include <linux/module.h>
3 Q0 u! ^8 V0 ~7 ]' k$ @+ P - #include <linux/init.h>" C: I7 p$ [$ n( S. m: X
- #include <linux/errno.h>
& K, P) ?: M4 } Z' C; [ - #include <linux/types.h>
. `$ |6 f( O5 E# i7 b - #include <linux/interrupt.h>' Y& i M/ \* R% V
- #include <asm/io.h>* ^) F1 K4 D8 q
- #include <linux/moduleparam.h>
' q2 v& L" \# {5 i: N - #include <linux/sysctl.h>: P, O" d2 J! a* ^
- #include <linux/mm.h>/ f8 g7 N4 O+ J; d
- #include <linux/dma-mapping.h>- Z2 D8 I* d0 h$ i6 z" j) D
- ( T0 h8 ]8 e1 `3 p W
- #include <mach/memory.h>/ U. P8 F) B) m& D- m% e
- #include <mach/hardware.h>
( m. v$ R% g$ k Z( A/ ]1 B2 w - #include <mach/irqs.h>
1 k: U3 w3 N/ f# z - #include <asm/hardware/edma.h>3 j" q( a3 w4 k4 T0 s; C( J
, `$ ], J* f& N6 u7 x; e6 j/ k5 _- #undef EDMA3_DEBUG8 o! Z. f% @" c: \$ K E
- /*#define EDMA3_DEBUG*/ e( U' m5 u& s6 j+ g
/ J' x0 D5 j9 e% u) h- #ifdef EDMA3_DEBUG
7 N! x- j3 s5 w" _ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 T T4 U" B# j3 V) b9 O7 J - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- @, m. K* Q, K7 N6 j. H" q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ i/ |4 {& Y. \ - #else
- ?" K7 M+ B* q' c3 W, |7 n: @ - #define DMA_PRINTK( x... )
3 @! d! z/ J4 b V5 f - #define DMA_FN_IN, e: J+ w% h, Z
- #define DMA_FN_OUT
) S* M0 E: W5 l - #endif
, m# O. @% k- m: z
; K; \, w4 R. h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 w* q8 L0 ?$ \* N5 h: e - #define STATIC_SHIFT 3% D& {0 F/ N+ ]( v" S, a" x/ f
- #define TCINTEN_SHIFT 20$ e$ k9 C8 t1 W' p, v, A) m/ j# x
- #define ITCINTEN_SHIFT 21( ?% i: p; H7 q# e8 Z6 R0 Z
- #define TCCHEN_SHIFT 225 B, f( L: d5 d" T2 c
- #define ITCCHEN_SHIFT 23- A* A, S/ y( w5 f( ~# l) q
- " [ d5 c" s0 Z$ t$ i
- static volatile int irqraised1 = 0;
7 e# [. Q" U, q( Y6 E - static volatile int irqraised2 = 0;+ Q5 M; F# M$ a' O/ s5 Z
" E1 r* W1 S7 u4 @, l6 A) A* i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 g" ?+ W0 l& F. J0 d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% m! p0 _2 |/ F$ b/ L- R3 i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ _; K/ x! m0 p2 q. Y
/ C$ x8 S9 m0 Z+ I6 Z3 z" ^- dma_addr_t dmaphyssrc1 = 0;1 O6 v1 v# I& |6 a" V. [
- dma_addr_t dmaphyssrc2 = 0;' [7 Q# T3 |2 V1 _3 z& \2 R1 ^
- dma_addr_t dmaphysdest1 = 0;4 W" t( G k& ~5 X3 L3 g. x
- dma_addr_t dmaphysdest2 = 0;
, t+ n$ @& K9 `
4 |/ T5 p# N0 i* G8 S! n8 E- char *dmabufsrc1 = NULL;
$ S5 Q6 Z* d1 x: n: b; M5 `& E - char *dmabufsrc2 = NULL;' K9 V# N2 B5 w( s
- char *dmabufdest1 = NULL;( o! F4 v1 A a3 ?8 C% ~! T
- char *dmabufdest2 = NULL;
u9 W+ ~9 l, e2 a% \6 d; v
. s) C' e2 n o, T. @$ }/ d ~- static int acnt = 512;( d0 L8 E. v3 Q- m' j/ J# A5 |
- static int bcnt = 8;
, s' t3 d- d h" l: ^8 u* a) g5 _ - static int ccnt = 8;$ \# A# J( r9 c) A4 n0 R
6 `5 ~; Z) n: a( S6 r; Y5 i G6 \- module_param(acnt, int, S_IRUGO);
5 k7 h* ?3 S2 h* {& |' U! u - module_param(bcnt, int, S_IRUGO);+ d+ {* z L" n3 q) ?9 P! K
- module_param(ccnt, int, S_IRUGO);
复制代码
6 N0 w5 [' E1 f8 {( H. N" O, [' U D7 e m; r8 N5 ?! x
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& y3 B: B# ^& }" K1 d4 D1 ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 ]" }2 X% F* s3 M: j2 y' S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. B: y9 ]( ?2 m6 ^; c7 |) B# ~7 `4 R" C- F7 F
; t* k# _! j' j; K2 Y# O3 e: e _
|
|