|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% U: M% J7 W s+ ]* t- [code]EDMA sample test application: L! F8 J* m: {4 y
- /*. k* {( `, b) @) b
- * edma_test.c
8 B. u8 Q. n* ? z( u @! Q - *
+ w5 k8 `$ h" c/ F3 d8 Q! P; u - * brief EDMA3 Test Application" K; P: [% V3 K+ N1 E5 l
- *
: t; b" ]( H& |( o* j7 ~" G - * This file contains EDMA3 Test code./ l! Y: x: ^4 [1 D, Q( o
- *8 `$ }8 X8 |( c5 d3 j6 ^
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( [* ~4 x) Z" B8 N; W& k. J! `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) A3 l$ p) R+ a- I* f% F Z - * TO CHANGE.
, E! ~- b: r' F/ M0 A - *
" n# Z5 i, F: a' H' b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% K' V( n4 f: y! e' M5 x5 n - *3 _1 U( y& t$ z
- * This program is free software; you can redistribute it and/or
; w1 C8 d7 ?5 L+ T" n6 C9 d; `7 V4 f - * modify it under the terms of the GNU General Public License as! _- y8 ]: p8 }1 y) ~* x: s
- * published by the Free Software Foundation version 2.* r$ N+ u& \1 t8 U0 I O$ Q. z7 d
- *
) ?+ e9 r, R/ D1 U, N/ B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ G6 }# u1 W% q- S, w - * kind, whether express or implied; without even the implied warranty
3 e5 K' t/ C$ X4 x' n: ?+ k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 V" B8 H+ G+ G! {' v4 e - * GNU General Public License for more details.
! e8 a% {) M8 {$ s5 Q) Z* Y - */- x6 Y' I5 N9 O0 }, \' ]
) u1 P& h" H7 }) a m+ Y8 R7 L7 H% y* D- #include <linux/module.h>
. U2 D, b- \3 d" X' d$ f4 } - #include <linux/init.h>
& ?5 x7 P. \7 Z' B* m) p3 o8 {5 a - #include <linux/errno.h>9 j6 G8 L1 n1 Z- _
- #include <linux/types.h>7 j$ a$ _- T0 G, {
- #include <linux/interrupt.h>/ k. c- M" j& j3 L9 Y
- #include <asm/io.h>0 R6 \: J, Q) I8 M
- #include <linux/moduleparam.h>
) s* P- C& V+ C - #include <linux/sysctl.h>
% Y% Q s+ s/ J% ^$ S, l: w: o% F - #include <linux/mm.h>5 f% ]3 B T9 ^+ p+ D' b
- #include <linux/dma-mapping.h>2 t: E& Z6 p7 @+ i& Y( n
- & O8 f, v1 _0 P7 r7 o. M; L3 P- x( d/ z
- #include <mach/memory.h>
2 r9 B4 L. g' ]7 ^: U3 A, L$ h9 E" i - #include <mach/hardware.h>0 t7 {$ q) m' g: V
- #include <mach/irqs.h>3 R( a. Q+ h0 @- R/ \* o. R
- #include <asm/hardware/edma.h>
, p* @. R# Z! @' b - 2 ^8 s, `5 j6 R2 p& r
- #undef EDMA3_DEBUG: i. @: R1 }' q: b; J) ^/ @6 c
- /*#define EDMA3_DEBUG*/+ R6 P" I; Q$ ^6 ?6 S% h7 L
- : l9 a6 R) R0 [( b& A% v
- #ifdef EDMA3_DEBUG
( [7 o; _. k# x& ^ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( @0 m; V% _. Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# _- W5 _) s$ m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# F5 M$ t! i& k3 ?/ Q S7 { - #else6 x3 ]* ^$ P9 D4 c+ o
- #define DMA_PRINTK( x... )
$ ]3 q0 a6 {2 p, \3 h5 | - #define DMA_FN_IN
9 `/ e* O( U) c4 M8 D& ^ - #define DMA_FN_OUT7 |, {' z) i9 C8 E ]
- #endif) D' K( R9 Y* e0 e) Y
9 V2 O1 \* M! p2 k- ^6 J# r- #define MAX_DMA_TRANSFER_IN_BYTES (32768) A u+ S) H; K- G4 Z% Z9 W- x
- #define STATIC_SHIFT 33 V7 W+ a+ W9 T$ l2 r) F
- #define TCINTEN_SHIFT 205 E5 }6 i3 S- N3 i6 J# Z
- #define ITCINTEN_SHIFT 21( X# l) z0 o( o) [8 e- v6 J
- #define TCCHEN_SHIFT 226 I5 f5 P2 [+ b* c! V( W* L: H
- #define ITCCHEN_SHIFT 231 a3 L4 S) H( r' a3 Q( v
- 0 V- t/ G' @0 l! o( t) q
- static volatile int irqraised1 = 0;
( h, E: H3 M) @6 | - static volatile int irqraised2 = 0;3 y; w! L7 Y& N* {4 x
8 H( ^# @) u4 [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ?1 }+ J$ `7 h% U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: P$ w5 D1 `2 C" T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Y) [% Y: Q' O
# M; @& o: i: _- dma_addr_t dmaphyssrc1 = 0;
2 H; C* q5 e7 f: ^ - dma_addr_t dmaphyssrc2 = 0;# ?" V K, j3 X. \6 X
- dma_addr_t dmaphysdest1 = 0;
, N6 G' e8 Y3 }$ U; N# f' R - dma_addr_t dmaphysdest2 = 0;$ {& J8 Q. O& y7 v
" _' f6 C/ \* q. w$ h7 f, r( v- char *dmabufsrc1 = NULL;
6 j; R3 }# j5 T - char *dmabufsrc2 = NULL;- M; f/ }% q$ p0 t7 r5 d. n v" Y
- char *dmabufdest1 = NULL;0 v; l6 }& m$ z: T( Z/ w
- char *dmabufdest2 = NULL;
" i$ E$ z' x* y: r6 Y& i
8 I N2 C+ n n( _; T- static int acnt = 512;' R; [: {- b# r. c& y
- static int bcnt = 8;
7 ~2 c) H' h2 y/ y5 O* p/ z% m* [' D - static int ccnt = 8;
$ @) ^4 d. i* m# ^! c
( R4 l6 a$ P' n1 [- module_param(acnt, int, S_IRUGO);
" @& a- ~' o/ h - module_param(bcnt, int, S_IRUGO);/ a+ D3 U( i( T/ a1 V3 c& C% |
- module_param(ccnt, int, S_IRUGO);
复制代码 0 M* F6 _7 h! Q: }. a
" O% \) {( O+ t% d' ?& i6 b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# R8 w2 `, A% v2 Q H8 Z1 O0 G: tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 L' t! v* @2 ^) r2 ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 l1 C$ H% s5 H o* S/ y; O5 ~$ p1 W1 }( s4 g
' ]/ B6 ?4 T7 P* m% V! i |
|