|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 G3 Y; \, S8 B, z, \8 k) O4 ]
- [code]EDMA sample test application
# o. r/ I6 t# z9 k, i& p. c - /*- c* @) v8 s9 ?" z5 ~
- * edma_test.c
3 f0 E) ^* H8 B+ ?8 {2 W% P - *+ V2 u2 Z t+ Q; N! K4 |0 G
- * brief EDMA3 Test Application$ h, s3 n4 @" K1 d, G! F
- *
6 a3 r* ]( t4 E3 j. Z4 ]- g - * This file contains EDMA3 Test code.
- J* n7 F4 }& V2 y - *0 l% v4 u- K" P: j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' ~3 ~9 M& V8 r( [2 C& q$ q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 R D+ L- n9 o) ]9 L( \
- * TO CHANGE.
/ t% d/ w0 ?4 F - *2 S/ @: x' J N) y8 c* z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( L6 ~# d% \. j. ?& _4 C0 b |: h8 ?( @
- *
3 Y5 w' U, x+ h% S. N1 u5 X3 `# k - * This program is free software; you can redistribute it and/or
$ N4 n+ T+ t, l& G- o! l - * modify it under the terms of the GNU General Public License as
& s: ?+ h- I) S2 P6 A% V) W) i" U - * published by the Free Software Foundation version 2./ m' z) ?' U. d# g1 r. u
- *
8 L" q# @1 A- l1 P4 Y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 E3 n) z' H" W" p2 H W - * kind, whether express or implied; without even the implied warranty3 F1 v" \. `! t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ g3 ~: Z4 o r+ T: i3 @ - * GNU General Public License for more details.+ p* J T2 S4 S3 ]2 q
- */& H$ j; c& \5 [3 x9 `* |; c2 ]
' N0 {# |! ]9 v- #include <linux/module.h>
B7 R4 O& n5 y; { - #include <linux/init.h>
9 E& P s. m& H" \/ \ - #include <linux/errno.h>
* o+ O4 ~# E& e% v - #include <linux/types.h>
{* q. |2 p6 W* L0 g) M; E3 b* C: f- V - #include <linux/interrupt.h>3 n# Z: ]; ]/ {1 ]6 }
- #include <asm/io.h>9 h- d P1 b% T
- #include <linux/moduleparam.h>" R$ W3 N: \1 i( b( p3 v
- #include <linux/sysctl.h>* `; A' z9 G {0 k" J# I
- #include <linux/mm.h>6 D$ `5 _9 l+ N1 X
- #include <linux/dma-mapping.h>& ?, g, ?1 w, l
* ^( g, U1 `: B3 _2 F- #include <mach/memory.h>
) R- K1 F4 o! Z* @5 |3 O - #include <mach/hardware.h>+ h/ P4 I* H" l$ p! d
- #include <mach/irqs.h>7 }# q6 ~3 a1 H6 [2 ]4 Z8 N5 X
- #include <asm/hardware/edma.h>" A" ^2 C& S% V. G$ ]- H
7 `, F a3 p* w) D0 G: ^- #undef EDMA3_DEBUG2 g2 T. @' C, p
- /*#define EDMA3_DEBUG*/
9 m3 P8 y7 V, ^" u/ D+ } - }7 R! ^) c0 h# ?* t
- #ifdef EDMA3_DEBUG
7 [; C, }2 `2 ?7 B- w' g" L - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' J& V2 G! S$ ?" d" B
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 N+ B$ D7 p; J7 p! t$ |( F0 j
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 i3 Y1 W+ Z. h: W0 e - #else$ y& O" j$ K$ Z0 ~' p6 L
- #define DMA_PRINTK( x... )
6 o0 U* {* T& S3 u: _, S; f - #define DMA_FN_IN
3 L& B- Q* C- j - #define DMA_FN_OUT
1 p1 A4 `$ X, P- f- b - #endif
8 y* m+ I' ~ H; H - % Q& ?, C) n" l. V+ V0 u
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% k% ]& J; G- \ - #define STATIC_SHIFT 34 ~# ^& \. x- R' v7 k; E$ a
- #define TCINTEN_SHIFT 20
: t, c' r% @: [- ] - #define ITCINTEN_SHIFT 21
9 u+ a T2 y0 V2 B& [4 U6 ^1 P- |/ h - #define TCCHEN_SHIFT 223 q" i+ O9 F& ^. Y# R$ C
- #define ITCCHEN_SHIFT 23
% @* [1 M( g2 |
5 p+ I& ^1 `5 k" }/ e9 B& A* H$ D- static volatile int irqraised1 = 0;* k' v2 g3 M. C! ?& m1 G! _9 d
- static volatile int irqraised2 = 0;
7 b2 i7 ]: ~* _ - ; t, N% y! b+ M! U
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" J" [0 ]7 R2 f# P% B0 w) t- i0 @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 `1 y! G; X9 Z/ Z% x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 n. Z# [9 W2 K; Y& Q5 U
- / A% u7 M9 I4 o9 N
- dma_addr_t dmaphyssrc1 = 0;
- A0 M8 C( d, V+ a: v% ? - dma_addr_t dmaphyssrc2 = 0;
6 o8 r2 d4 A9 g: `1 y$ I3 g - dma_addr_t dmaphysdest1 = 0;
& U+ Q0 b9 c0 d9 } - dma_addr_t dmaphysdest2 = 0;4 r8 P- ]4 t) Z r' K6 `8 J
+ u2 A1 q( R- }' g- K& M- char *dmabufsrc1 = NULL;( y! M/ [1 P, x2 L7 F" B/ i5 H
- char *dmabufsrc2 = NULL;/ U: {' ]# Q) w1 p
- char *dmabufdest1 = NULL;% v0 s) _6 ^5 k+ C0 X+ d2 ~2 t
- char *dmabufdest2 = NULL;
/ E% U% p- c, w, C( R2 C/ G/ ~ - 8 Q$ |8 |3 Z" c7 L" F) J
- static int acnt = 512;9 w. M Y3 M4 _' D0 t$ V
- static int bcnt = 8;, v5 u9 h3 D# g* i# [, S' A( m$ n
- static int ccnt = 8;
2 q5 Q1 l |4 L5 |5 T - ! Y1 S8 [+ ?% i
- module_param(acnt, int, S_IRUGO);6 ^2 L; o' ]6 n- G. x1 _" v2 ~
- module_param(bcnt, int, S_IRUGO);
8 u7 C6 x2 A& ^4 C9 f - module_param(ccnt, int, S_IRUGO);
复制代码 " E S9 D5 y4 b" S
5 V, B) E2 {& i# @, O) U8 ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; }. W) M1 n8 L7 @3 {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 G3 {; }; m" [5 N) g( O: X) @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ z3 {2 i0 h4 X; M* @1 h( Q) m
& \0 I4 g, k+ U/ l# }, {& D
& A* a- \9 F$ E) q! L |
|