|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 Q0 e7 I, S( O" G, x5 R4 G' B- [code]EDMA sample test application
' _( `& _# f: K& t, I6 \8 k - /*" ?( Y# {5 F- e# `# G" v9 N6 P
- * edma_test.c
2 ~/ g6 m8 C0 w( v - *( t$ G# a- h. L' C
- * brief EDMA3 Test Application2 Z& c* X. s0 a) S
- * W! X& W+ _- M0 ] B3 E3 R
- * This file contains EDMA3 Test code.* x% x) r: g( N6 v+ B
- *: j" b7 G" h4 O9 g
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 c! ?7 h3 z/ p
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 d+ }, F( l- N* {( e8 N5 J
- * TO CHANGE./ G4 m7 k9 Y" U) \% G( }
- *6 n$ G" g( V, }( N" d
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# h/ H3 Y7 Z. F3 P ^% i - *
5 v0 o* y* h0 `/ y1 `2 Q - * This program is free software; you can redistribute it and/or3 {+ D5 u# j! E9 T
- * modify it under the terms of the GNU General Public License as
& u7 a+ ~3 B8 f8 L$ v! b9 ^2 \1 b - * published by the Free Software Foundation version 2.
" U b- d& F' K/ `- V - *
^& |9 h- ^, X- D/ f - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 J ^' G6 R/ e" i; Z - * kind, whether express or implied; without even the implied warranty" o W4 P0 Y0 v0 m o# W0 H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 }1 @0 R3 v" @% l: ?7 Q5 K
- * GNU General Public License for more details.- {3 ?& i6 A z* F! a4 G
- */ q# ~6 x3 s2 H$ ~3 M2 ^4 H
- * n. j6 ?8 [$ \( \ U( I
- #include <linux/module.h>
! P7 j; r7 f; h1 X - #include <linux/init.h>$ X, d' t; p" e# _
- #include <linux/errno.h>
( @: b+ r( e/ W& e0 y - #include <linux/types.h>
4 g; J8 }5 {6 J. M+ d! M - #include <linux/interrupt.h>
! U7 h8 g! a6 B- Q8 s - #include <asm/io.h>
0 E7 F& G) }4 w; L6 [9 Y - #include <linux/moduleparam.h>9 O6 h$ O0 P! W2 x! y+ Q
- #include <linux/sysctl.h>
1 k9 g0 N7 x3 N. \: f, [0 L) X - #include <linux/mm.h>4 o" H* _! D$ Q* X3 G0 a" L u
- #include <linux/dma-mapping.h>, g' F% k* D$ ^
. ~9 d1 ~$ V# K" l( X" x3 f* Z- #include <mach/memory.h>1 |, \6 U5 M" x, Y. i
- #include <mach/hardware.h>" A% t, i8 _9 L
- #include <mach/irqs.h>
9 b7 f" C- @+ G - #include <asm/hardware/edma.h>3 _7 A1 m2 u" d! o5 p7 {
+ L. M" x0 } A% {- #undef EDMA3_DEBUG/ W( R% x5 j. S& J; p2 O
- /*#define EDMA3_DEBUG*/
9 I1 c7 V& {6 e. q5 A - 0 |" T) P2 H5 `
- #ifdef EDMA3_DEBUG1 l s1 o2 {" R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, _0 a6 Y( {! R9 P - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( j3 U" H" @$ v3 b; ` - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 Z# t; F0 h7 U& I
- #else6 m. d3 v& l; C L
- #define DMA_PRINTK( x... )
' Z$ |* x# F& U% b3 |7 P! b- i - #define DMA_FN_IN1 Z! R/ a1 i3 i8 a3 V" @( l
- #define DMA_FN_OUT6 {( @: s w9 |2 u5 F
- #endif
6 d; u/ X9 }* e' M4 E2 d - ! o4 H, v; d+ B! S
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* }4 b* G9 j6 e: h' m1 O" t
- #define STATIC_SHIFT 35 O5 N5 [2 A+ n" N4 t& C
- #define TCINTEN_SHIFT 20
8 W1 X% a8 W0 K+ Q( A5 \$ P9 ^ - #define ITCINTEN_SHIFT 215 u4 s2 }% E% ~' p! T3 H
- #define TCCHEN_SHIFT 22* b/ c: p; A9 I
- #define ITCCHEN_SHIFT 23
& }- Y+ \3 ~* h" X) Z - 1 M2 _ Q& C) h! F
- static volatile int irqraised1 = 0;
4 y6 w- W) o9 h9 }3 V& d+ [ - static volatile int irqraised2 = 0;
0 S8 _) l$ p2 B" q8 x7 L - 0 B, |% j; c6 t: W3 c8 V
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% z9 w+ f5 _3 Y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; p$ ?) n7 C7 k$ y4 s' ]: \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 V4 C) x1 |9 e1 g0 D1 Y v' k; a
- : r. d* t- ]5 D1 Q$ j. `! c( R$ C8 q1 Y
- dma_addr_t dmaphyssrc1 = 0;
3 X- e( k2 k M: t5 ? - dma_addr_t dmaphyssrc2 = 0;
( Q; ~6 q. P1 k3 ^ - dma_addr_t dmaphysdest1 = 0;
/ [, h v6 ?4 R( i J o - dma_addr_t dmaphysdest2 = 0;5 N6 N, t- W. B( S! g4 I/ |( O& Y% `
( Z( [! J# Y) ]- char *dmabufsrc1 = NULL;) b( q( C6 w5 U( K
- char *dmabufsrc2 = NULL;
& t, R6 K- L, F% t" D* d - char *dmabufdest1 = NULL;, f2 \3 m; L* N- R
- char *dmabufdest2 = NULL;7 [, x: {7 G6 Q
; ?7 D, g2 r) [5 v- static int acnt = 512;
& ?7 o% C7 i( f5 v7 K& n - static int bcnt = 8;
; x N% X+ X: U- y/ S) K - static int ccnt = 8;
# w- G" v+ T* T
0 X* T' K' m" S- `. u) Y- module_param(acnt, int, S_IRUGO);0 Q/ O; Q. [/ x: v( U
- module_param(bcnt, int, S_IRUGO);' W3 z8 H6 c7 k' s% T
- module_param(ccnt, int, S_IRUGO);
复制代码
" `5 V0 P* V9 ~
, |9 a* Z" l9 Z& @+ o 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% n5 h, q+ z/ I+ ^9 \; V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ M3 c* t6 @# X. i4 I0 G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 ^) w4 A* h) U0 l: |) P, }2 H- ^. a
3 E( y: u4 |0 E$ o/ e8 j' r( V8 q' H. {
|
|