|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 Y, a. p2 \( G- [code]EDMA sample test application3 \5 M; C( b) V5 T8 p8 O
- /*, |" f, _6 W1 W! F6 ?
- * edma_test.c. s! b" \3 F7 W8 J3 _% d
- ** r$ k- P0 ] j- k
- * brief EDMA3 Test Application
+ J# C8 d, f! U# w" P; V/ X' f8 E - *
; W" B1 S4 L' v/ R8 ]. q - * This file contains EDMA3 Test code.
( M$ R! E8 U7 q/ [ - *
: _, ^& W% S+ U. R" i+ k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( l" u7 J9 X0 E/ p6 M1 y$ K! R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* S t* ]7 h4 ]0 _$ q* B- v
- * TO CHANGE.
* o) {! j$ `- H7 I% v) s$ Q - *- ?# V7 g& _5 y2 \! ^8 E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% Z" x8 V" M8 S+ B* c
- *0 G* j% l. ~8 |6 \+ n4 f* w
- * This program is free software; you can redistribute it and/or
: ~; v& r7 b; ^ - * modify it under the terms of the GNU General Public License as
3 Q2 T7 R; N) _# ~. e2 {- M - * published by the Free Software Foundation version 2.2 b7 E7 A) A, |# S0 s b
- *
* v* E: G5 O4 D+ u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ Y7 X2 P# t; w& W1 g$ U
- * kind, whether express or implied; without even the implied warranty
# I9 x( a4 f* C- I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 b4 M( u5 K) [2 `
- * GNU General Public License for more details.9 o V6 }9 {6 y7 u
- */, \0 R: ^ t7 R5 ]7 m
- 6 A3 C9 R! [! k
- #include <linux/module.h>& z+ a+ w4 x# g9 s2 [1 q4 S
- #include <linux/init.h>" O9 `- B; S4 e7 G3 v
- #include <linux/errno.h> f5 |5 O4 p( d2 p
- #include <linux/types.h>( A p" h9 V9 i& }7 Z3 }
- #include <linux/interrupt.h>
2 M$ \1 o+ ]* Z3 [ - #include <asm/io.h>
P9 m/ j7 H% f - #include <linux/moduleparam.h>! D3 m3 a3 J' m7 p
- #include <linux/sysctl.h>
; U3 S2 B5 b: S. f/ C/ Y0 @: P) A( \ - #include <linux/mm.h>
6 i6 l" V a) [6 C6 [7 h - #include <linux/dma-mapping.h>1 U4 ?8 ^' O/ \" D t
8 \6 L6 R, b* Y' R- #include <mach/memory.h>
_4 D. S8 Y& O# Q - #include <mach/hardware.h># f' u! j( x5 R l2 q- M
- #include <mach/irqs.h>: k9 u3 i9 M/ g+ j) u
- #include <asm/hardware/edma.h>* X4 ]/ F& }: L9 D8 E& Z+ [: t
* i5 h" c" L, G& n# q2 t R- #undef EDMA3_DEBUG
" ~& I; k' j& M) K$ h) R4 K2 ~& K - /*#define EDMA3_DEBUG*/" Q) R$ z- I) ?" _. z
9 M7 y: x: d6 X1 N. U* t _- #ifdef EDMA3_DEBUG" f2 ~2 ? p6 u2 I4 A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), Q/ M. g0 x) C( ^1 ~
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ O; {& v4 {8 B3 n - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 C4 I: S ~: a0 W - #else
, d$ {* _- w* e8 T9 F - #define DMA_PRINTK( x... )
8 U9 g& ~' h0 U p0 L9 G; B - #define DMA_FN_IN
3 g; p8 _! Q+ S; ~$ I - #define DMA_FN_OUT
( h5 |1 z f+ @/ b1 q; B- x - #endif
9 F% k* K# _; g
7 P3 s* J6 J) h( {2 g3 a9 s- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ j; ?( T, {" M* _6 N7 p" M3 O, l, ^ - #define STATIC_SHIFT 3
Z8 f a) ~% p! q7 p3 q b( a - #define TCINTEN_SHIFT 20
" Y- t2 T$ f! t- _3 c* G' F - #define ITCINTEN_SHIFT 21
! } M. _& V8 ]' J( H6 N - #define TCCHEN_SHIFT 22$ `3 d# h5 A1 Z) c
- #define ITCCHEN_SHIFT 23% ~5 U1 A( @) F& x
- . m! ?7 K) r8 o
- static volatile int irqraised1 = 0;
$ h! j1 y: q$ ]1 k3 v" l1 { - static volatile int irqraised2 = 0;$ F! g- T; t& H- U
- * W( ?; P1 d1 W, j5 E- i
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: q! E6 s1 Y* J# k' j2 h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 i. m2 M9 @5 G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ t Z& ^6 w+ R D1 e' K( U" I, J* K
- 4 C" k* D. d8 Y! A% R7 }
- dma_addr_t dmaphyssrc1 = 0;
, m9 H8 z& h4 q/ R2 q$ C3 g; ? - dma_addr_t dmaphyssrc2 = 0;% y8 E+ V% F: U
- dma_addr_t dmaphysdest1 = 0;
7 U% V. z( y- ?2 j) f2 F - dma_addr_t dmaphysdest2 = 0;( o8 j$ y7 H+ t" u9 u
- # p! n; J) ~( N) m0 Q8 s5 F1 J. c" `7 a
- char *dmabufsrc1 = NULL;
6 z7 r0 }/ q. W& X - char *dmabufsrc2 = NULL;
% G: t7 E6 u7 u - char *dmabufdest1 = NULL;- i3 b3 d" _! A& f
- char *dmabufdest2 = NULL;* ?& Q0 c5 ~, W; O2 t) o
- 9 u# g( o7 u* y! a# p. m
- static int acnt = 512;
4 P6 A& w; h! x9 X# e6 t& S - static int bcnt = 8;
& s' n6 y* B5 s0 @4 r8 m% j- e. E) | - static int ccnt = 8;
' Z4 G* J6 R, Y: F6 p7 ?( I - - p( X# z( k x) G* r3 B6 O3 d
- module_param(acnt, int, S_IRUGO);9 c! E& N. O; v
- module_param(bcnt, int, S_IRUGO);
% u, ^6 R/ ]7 U1 Q( U0 F; \ - module_param(ccnt, int, S_IRUGO);
复制代码 5 h) e" o: p3 }; E9 C( _
7 [& _. ?3 {8 U* f" a 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- ?$ C& S* j! [: Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 q! P: i7 ?. ~/ L& Y' D G0 Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! [" s$ W! \2 ]& T
3 q' S, Y5 Z u3 z# @
' G e/ |$ n! p' J2 a8 t& [ |
|