|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / S, `1 v9 i7 q2 ^! I
- [code]EDMA sample test application- i1 n: p- A% c
- /*
6 _6 E, R$ [. l3 b2 k* D( Y - * edma_test.c
; E0 ^" p/ B" P! j/ T8 v8 r' f! e - *2 |" n. W+ s+ r/ P
- * brief EDMA3 Test Application
) z! o$ {0 a9 i; F% ] - *; @& c& e' l% m6 y2 T; m7 l
- * This file contains EDMA3 Test code.
; \3 a1 Z: w" ?4 ]" }/ @8 N - *) q2 W' j' ?% d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 q- Q, H$ {6 r1 z9 |5 Q S - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. S# {! A9 l: Z- e' I& j3 V - * TO CHANGE.
, |# E. B9 ~4 ?0 X- N0 } - *. B" a u3 e: I9 g6 a
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 u0 e7 k* [! U* |. K; l- A - *; k; Q- B4 G" v. r: U$ p
- * This program is free software; you can redistribute it and/or
* V8 `- V) R- M! `" Q d - * modify it under the terms of the GNU General Public License as
5 r7 @4 ]$ @: `) M/ |3 R - * published by the Free Software Foundation version 2.
8 \4 H' F% r1 s; B8 W. S5 O. F - *3 N! v5 y) ]5 |& c" A8 E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 W5 Q5 |5 ]4 @4 I0 A8 w
- * kind, whether express or implied; without even the implied warranty
4 G+ p/ z+ x8 p( b; O$ g$ z/ y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 Z2 S. L! `% X3 d9 t& n% G2 E - * GNU General Public License for more details.* y5 S* k' ^8 @( E" \ F" ~
- */
3 \: b4 g0 g X4 [
5 s. A7 m# d5 ?, o- #include <linux/module.h>
1 y- e. S2 F1 k$ l - #include <linux/init.h>
0 V6 @" X6 j5 }" @5 |) o# H* N+ b9 y - #include <linux/errno.h>* S- \/ z: c! [& Z
- #include <linux/types.h>0 W) w3 [' W: {- m8 P( y
- #include <linux/interrupt.h>
) }, k F9 Y% L3 o - #include <asm/io.h>
& o1 p7 f1 A6 A: y - #include <linux/moduleparam.h>: t$ d! W3 s" B4 C6 i7 n0 g
- #include <linux/sysctl.h>
8 k& F& D4 n# G& o& t# T8 R5 w - #include <linux/mm.h>
! F- M5 @2 S0 Y. _: w1 b - #include <linux/dma-mapping.h>) e& O8 a8 Q4 M, K# C9 F( k
- * {2 N/ x0 W) D' z$ s6 v
- #include <mach/memory.h> u& R5 \8 F" v% j2 A7 b
- #include <mach/hardware.h>
) q" D& z% A3 k: k) ~ - #include <mach/irqs.h>
: I: v( C9 |& w- o3 x9 o - #include <asm/hardware/edma.h>
1 ]& y" U4 A' q0 h5 N; t$ w5 k - - g, ]! ]$ m+ b9 \
- #undef EDMA3_DEBUG; y; S1 h4 R" l, i6 |* A6 `, p
- /*#define EDMA3_DEBUG*/
( o; f. L! Y' v9 {, c4 _( ]1 J - ) y) o+ B9 _- u& }$ D& e
- #ifdef EDMA3_DEBUG6 b1 k5 t7 a. h* w- v5 W& H
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& ?6 q2 \2 Z) K* ?$ E
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 U& `/ F' S/ }! ^8 k
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 _1 s- }8 ]4 P
- #else
$ H" j! S6 t: w& N - #define DMA_PRINTK( x... )
3 f0 [/ I1 L7 S6 q - #define DMA_FN_IN1 x4 e, l' P, w! Q! Y# @
- #define DMA_FN_OUT* c* |; c j2 h. R/ V+ o
- #endif
3 a. [3 Y' o( I/ i, G" E - 8 L6 n+ u2 ]2 U
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ y- y0 e6 B$ |1 d
- #define STATIC_SHIFT 3* c4 w7 j. e7 N# B" P
- #define TCINTEN_SHIFT 20
! B s! O: u v) c! Q - #define ITCINTEN_SHIFT 211 K+ A4 K9 e3 U
- #define TCCHEN_SHIFT 22
' x9 f# q- `1 a9 ~( ?0 E - #define ITCCHEN_SHIFT 23* a& f& {+ n( d3 {! t5 \, g+ @5 D
! `4 t9 v8 ]( D2 ~+ u" L' T- static volatile int irqraised1 = 0;3 Y. H y( a- \8 a9 S5 ?4 [' A
- static volatile int irqraised2 = 0;
, |: X0 M* z2 @* h& \6 p
& {2 u5 w. f/ F3 N4 Z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 w! ]0 E+ F3 b# a8 _* z+ @5 L - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 u$ i. O7 L- q( v! G: V+ c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) r. K' S5 P) u) ?% I. b7 J - % g, B, ?$ W1 d7 T( A* b
- dma_addr_t dmaphyssrc1 = 0;
; I+ l" d: G* D& T1 E9 H# w6 Z - dma_addr_t dmaphyssrc2 = 0;5 M! j0 _/ s4 G# }0 B' u
- dma_addr_t dmaphysdest1 = 0;
1 J" ]6 @% [9 A6 v+ [ - dma_addr_t dmaphysdest2 = 0;
; D x$ h2 F8 L4 }- Y1 ?$ j: G
9 S+ x3 b$ R- H# v- char *dmabufsrc1 = NULL;$ [, H- k+ y& Z; @9 J
- char *dmabufsrc2 = NULL;4 M1 w! C/ b+ z8 ~
- char *dmabufdest1 = NULL;
7 Y# l/ N6 P9 ~; m1 e. ?8 Z - char *dmabufdest2 = NULL;+ n* b$ `; S" [0 t! q
4 ^# [9 y1 ~1 G- static int acnt = 512;# C& F: ?! b/ E3 [" a9 H: T
- static int bcnt = 8;9 s: O4 N9 v& Z& j# x' W
- static int ccnt = 8;2 |0 l9 @* c" E& a- S4 C' q% }
- . Q( j" o Y$ C$ c. D- C
- module_param(acnt, int, S_IRUGO);
; v$ E( Z& M) ]" y# V2 Z, w - module_param(bcnt, int, S_IRUGO);
2 h3 E* E8 a+ p+ E8 E+ i# X - module_param(ccnt, int, S_IRUGO);
复制代码
e7 I, k T+ L. w# S3 I9 y: q0 h: h7 L: J* k! W
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 s& P, Z4 G# X4 @* r& ?0 iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( a- w+ a/ F6 {( Z* Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 d' Z) _3 T- P, P3 s
* G& B; W! [6 }, B8 t. B0 Z: e$ C
9 K& d! w' T" Q |
|