|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- N- s3 _$ C) G( t3 Y- [code]EDMA sample test application
5 s; S$ U- w8 J/ R3 ?1 \ - /* `7 s$ v! ^* d
- * edma_test.c
2 ^# R4 }' T! |# c - */ y, v9 n# j* y
- * brief EDMA3 Test Application
j) X8 v7 C8 P0 y. i. y! w - *+ _8 `% U7 ]( _5 e) i9 N( l6 _0 Q, C
- * This file contains EDMA3 Test code.
. x+ C, u5 Y% R, r( R" Q& E - *
. J9 X2 B3 O M7 r( ~! e( R; y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 Z2 C H! ~7 h# o9 O1 [9 q. `6 t" L - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, k' g: x M5 r7 u
- * TO CHANGE.# v4 k6 p8 g' p# e v) V) N
- *
9 k; h; y" u& h1 c0 v& V1 N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 v9 h! q% D2 z$ z - *; E) G5 n3 N5 {1 D D# b
- * This program is free software; you can redistribute it and/or
9 }# J1 }. p. Y9 d6 R, A' Y - * modify it under the terms of the GNU General Public License as; h: H, ^6 e. c& g' x( X8 t
- * published by the Free Software Foundation version 2.
3 }; J- A# }* S, J1 Y - *: r L3 \8 p0 J# B+ h0 E2 U I
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- s s. i9 ~( M3 C! W
- * kind, whether express or implied; without even the implied warranty
0 r8 Y, N. ]$ i. w3 [* A - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 I! B* q1 Z$ D2 e% X8 i% J5 R
- * GNU General Public License for more details.
6 w2 Z4 L Y( Y; o) w5 a8 B - */
3 ]& i& u, ~/ } }4 }$ w
8 @2 |6 i' V* L. O( B# X' B. z- #include <linux/module.h>5 Q: ~: }" [6 i: n
- #include <linux/init.h>0 S3 t9 D5 K! b9 H' \: q9 @
- #include <linux/errno.h>: G: x+ S- w# U4 z
- #include <linux/types.h>
' U. m4 E) y t - #include <linux/interrupt.h>
/ g% A" V3 l# V$ ]$ K$ U2 `) r; B - #include <asm/io.h>
+ C6 L, @1 X0 ^+ Q5 U - #include <linux/moduleparam.h>! c4 d2 h- M; y8 V( v% [- i: E
- #include <linux/sysctl.h>6 s a1 u4 g5 |; j2 w7 Y+ g+ N. u
- #include <linux/mm.h>- `) n9 ?, c0 G9 F; k
- #include <linux/dma-mapping.h>
% M4 m. L/ |6 A9 b0 ?7 L6 W - / D* Q- V; y( W
- #include <mach/memory.h>% l6 \7 f. @! o; J5 T( m* [( j
- #include <mach/hardware.h>
# U( {9 V) B) R/ a - #include <mach/irqs.h>
2 c+ {% m) i) W - #include <asm/hardware/edma.h>
5 c6 N. ]. H9 Z) I5 O! T/ a
) D' H: M# \9 X7 a" ^9 y- #undef EDMA3_DEBUG; V, g; d9 L* W( e
- /*#define EDMA3_DEBUG*/
5 N6 ^9 h! r8 T ]5 r
/ ]6 O3 i) }7 S8 P0 n% K- #ifdef EDMA3_DEBUG7 m# X3 k+ }1 Y) \2 m9 r
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ R$ ? G+ _2 z0 m3 G0 z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: A, i6 \- W) ?- e, P* ~3 k5 h' T - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). b8 B7 U( p: b& h) I2 u
- #else
0 \6 H8 r- J/ H( g$ S5 m( m - #define DMA_PRINTK( x... )
5 v+ d' |5 g1 O - #define DMA_FN_IN
5 w* ?9 M3 l# Q6 k. l - #define DMA_FN_OUT: Q4 {6 o! @9 z; f6 O
- #endif
! z3 b( N) d3 L
3 x& i* d/ E9 A) p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
Y3 O- o! O- p- X" }9 P - #define STATIC_SHIFT 3
8 e: C4 }' E: y0 _7 } - #define TCINTEN_SHIFT 20
$ q7 t; [; D8 @6 _6 U - #define ITCINTEN_SHIFT 21
& p; i) \/ j6 e# v* J8 a - #define TCCHEN_SHIFT 224 u1 q. W V9 x! A2 @) m
- #define ITCCHEN_SHIFT 23
& J9 Z! G$ g; I' t! c
5 h- ~+ V" W$ @4 {" p- static volatile int irqraised1 = 0;
) E0 A0 v# o% l! v6 q# J - static volatile int irqraised2 = 0;' X( ?( F! @6 s- o! c
9 U% I; B( }6 e. r2 Q- a! s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 z3 j: n9 l, o/ ?+ d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ v6 ]/ i/ s+ d; q, K! W& d" O( b" d
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( d2 Z+ N7 U; E) ~. \
( K1 r0 w. G) z6 v- dma_addr_t dmaphyssrc1 = 0;
0 q% ^ o8 q8 u+ r+ a - dma_addr_t dmaphyssrc2 = 0;4 L, r0 L1 j) J9 g& q/ W' ]
- dma_addr_t dmaphysdest1 = 0;
/ o% s" \6 n, z1 N' J4 p - dma_addr_t dmaphysdest2 = 0;& c9 i# K$ T1 `! y% E
' d; S" s1 q) ?! ]3 C. d- char *dmabufsrc1 = NULL;5 Q9 ~8 O P1 o. l' ]: G: v/ ~
- char *dmabufsrc2 = NULL;
. u+ R( |; U7 `. ]* G. z! U: g* V - char *dmabufdest1 = NULL; x2 F) u$ o8 W- }8 \3 d( r
- char *dmabufdest2 = NULL;
8 Y& p7 B6 h0 ?; J$ D$ U, ], P- s - 0 s/ [. t/ T; v+ p" _
- static int acnt = 512;
! v* F9 N! e) w$ w, o& a( n, E, G - static int bcnt = 8;
& @8 Y7 ]5 y) b" I) U2 V( D - static int ccnt = 8;1 l# U* a, u" P
- & f" }+ q: p; J2 i/ f7 V
- module_param(acnt, int, S_IRUGO);
7 u& L; [$ i& U/ ~2 y - module_param(bcnt, int, S_IRUGO);
6 [5 L2 R5 a% d - module_param(ccnt, int, S_IRUGO);
复制代码 ( C) b5 D0 B! q7 W$ Y/ w
) r0 L) o2 i3 f
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, P* X$ q2 R( Y: Z i7 xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 Y8 X) M% N8 U4 T: `/ C, H1 a) h
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
`6 H% S& }1 t: e g; O/ @& X5 ^9 }0 `4 U: K/ Z7 `
, d, h4 ]3 C# K) ]8 n2 l! S
|
|