|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ P4 _) L* Z+ k( U* k. W- [code]EDMA sample test application& f' ?" f* _3 b1 T0 d* w3 ~6 {* I
- /*
- g8 d$ n' L) P( Z! S: i) B4 K - * edma_test.c) F( V$ R2 l. Y* h
- *
) [7 K5 T1 x6 U5 ?' K, t - * brief EDMA3 Test Application' @6 V" x6 G1 d# y* L
- *
) k2 b# ?2 |) `( i5 n2 o - * This file contains EDMA3 Test code.4 W! M. Y c+ T- p+ b
- *
& L: C6 i; ^( F3 F: |$ d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 X5 E8 N8 z+ K0 |7 u6 Q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( W* ]. o2 h% M2 I3 v
- * TO CHANGE.! F8 _/ l( ]+ i; B9 K% W
- *
; I' Y$ L4 X" X7 @8 s3 U; p+ y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 W! m; ]( V5 Q+ k
- *! S# Y8 e( @& D
- * This program is free software; you can redistribute it and/or
; E( J) Y1 i) |+ m: c - * modify it under the terms of the GNU General Public License as m" T/ G1 }4 x' h5 s$ d7 X
- * published by the Free Software Foundation version 2.; ~6 Q+ G2 L6 o& m! H& m Z
- *
0 a! w4 N6 S6 R B/ H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any ?* ]/ ?: y) J! M& {8 I5 v/ l1 T
- * kind, whether express or implied; without even the implied warranty7 A/ ?% m6 _- y* n% @0 j( r# Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 U3 n5 h. y! l. a C$ q
- * GNU General Public License for more details.- C, w- h# @. c
- */1 q0 o/ D$ }$ `! i
- " k# @+ y& u6 T% s& z8 P, B
- #include <linux/module.h>: G. O3 w: t! {
- #include <linux/init.h>! x5 W0 I% P V7 |
- #include <linux/errno.h>
$ p2 B" W$ G' t# @3 J9 k! C - #include <linux/types.h>
' [& X+ f9 P# Z2 V0 j/ @ - #include <linux/interrupt.h>+ G b( Y; q& N1 Y
- #include <asm/io.h>' g& ]( R& W+ c% n' S* s9 p
- #include <linux/moduleparam.h>8 y0 Q/ A5 ~- P
- #include <linux/sysctl.h>
; T- Y, |2 o! K - #include <linux/mm.h>1 e/ p) _6 u+ s& y, w
- #include <linux/dma-mapping.h>6 }/ A2 O& w1 ]8 i' d3 A- f/ H" Q
5 i. M: j2 f5 N3 ~% w9 D6 J- #include <mach/memory.h>5 b$ w% X* I: r* Y* C5 b" |5 p* Z
- #include <mach/hardware.h>8 e. ]. T/ k" A5 f B
- #include <mach/irqs.h>+ r9 O8 K6 z$ ?: y9 W/ L0 q: K( C
- #include <asm/hardware/edma.h>4 y+ m3 h# H- F) h- D
- 8 P! h6 e/ t- Q. Y+ G" J
- #undef EDMA3_DEBUG
# T8 v4 O% W9 K; y - /*#define EDMA3_DEBUG*/
- @! C7 D/ P' d! i8 t/ l* [8 ]9 W
6 l& e9 j" r; i+ R! P% |# N- #ifdef EDMA3_DEBUG' K- Q* K: b% _7 ]7 w! ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" o! w( k* t9 ]- H8 A0 y8 F5 P - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- \4 J% }: t& m' A1 s, l8 o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- G# k& K' e% V5 \/ f - #else
* f5 H6 X) B2 Z1 q8 A; f - #define DMA_PRINTK( x... )
* E+ P* ~8 ]3 l% I; |( O; B. G - #define DMA_FN_IN( p' c1 Y4 t& U4 n6 H( l3 P2 k
- #define DMA_FN_OUT
/ {( K, f( V/ t* x/ {7 ~ - #endif
+ `- z( z3 Q4 [$ k7 A( m) Y* _% X- V
6 W9 u- j# U% S: o. W- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 w: M7 r; ]! u6 p, a
- #define STATIC_SHIFT 3& v5 L: f* O6 ^% w: s$ a
- #define TCINTEN_SHIFT 20
$ n, F: I3 k1 T - #define ITCINTEN_SHIFT 21
; n0 q2 V; V! w - #define TCCHEN_SHIFT 22" ]+ {8 v6 a- F/ g" o+ t. d" Y, l
- #define ITCCHEN_SHIFT 23
/ ]. p* ^& J" v2 z8 v, Q9 Z1 D - 2 i1 I8 y0 o# G" u# T$ W
- static volatile int irqraised1 = 0;2 M6 T# {6 ~$ T4 s% M' R9 ^' T
- static volatile int irqraised2 = 0;$ p" w" c1 D) Y- L g; L' h
- z0 g1 z. S$ J6 ?6 \, B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 {' F F" W5 d5 C) W1 p; X/ W9 d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 F4 w5 u$ O* a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); g$ B/ d. N9 N& Z5 ]
- 9 C/ u8 i4 t R1 i) d! C
- dma_addr_t dmaphyssrc1 = 0;
; T& U+ v% ]9 {% t, g. F1 T& e - dma_addr_t dmaphyssrc2 = 0;
2 J. O+ `4 C h - dma_addr_t dmaphysdest1 = 0;$ n: c4 l, G( x% Q0 t) n+ i
- dma_addr_t dmaphysdest2 = 0;0 `1 v$ [! }0 l( I$ P
3 m( ?# Z; T' J+ [- char *dmabufsrc1 = NULL;' d: R- {: O% { g+ ^
- char *dmabufsrc2 = NULL;; v, \* `8 x; g4 p% {- R7 ^) p
- char *dmabufdest1 = NULL;" g2 i. h' W8 i) ]3 U2 D7 B1 @
- char *dmabufdest2 = NULL;
- w, R- G% K# t2 j* ~
* f- g: S, x1 y! f. ]# Z- static int acnt = 512;: M6 V5 v% s. J" [
- static int bcnt = 8;
7 j" N0 d+ @: w& J, [ - static int ccnt = 8;
$ k, `3 o6 j6 n3 x' k' R - ; G; B/ O- e* N$ x: o0 s
- module_param(acnt, int, S_IRUGO);
) h# a% v+ _0 K) j# j- r P8 h - module_param(bcnt, int, S_IRUGO);* i7 ]$ d* u7 b1 l" c- `8 f
- module_param(ccnt, int, S_IRUGO);
复制代码 ) J$ }" `) H* O
; N: k# W) A4 L! S7 j
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" A/ ~7 n8 S/ oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" q$ q- i4 L! ~" v. T; J+ z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; l' v+ e2 z/ q) e# z
2 P3 p# r" B; c0 p3 C! x6 |/ h7 J" G8 {/ T
|
|