|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 Q5 z5 b9 I/ U C) [$ W$ s- [code]EDMA sample test application
' o9 W* f% n; C5 z* m5 I - /*" l9 Y2 v& t5 R9 K
- * edma_test.c4 D! z; h( g; o* l
- *- l# k# u" N* z2 T' w( y" ~. Q Z0 q8 m
- * brief EDMA3 Test Application
8 l( W5 |% E8 |0 @' y- a+ P% w - *. v! X* b p7 A: ^3 F
- * This file contains EDMA3 Test code.4 u6 |( Q- K% V$ U& P: M! ^; {
- *' D6 w- \5 Y( ]7 {4 G
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ B# y( z) W V( V+ q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 T6 N2 s5 P% W$ t
- * TO CHANGE.
) R) N9 \8 x S) [5 u& a7 N - *
$ H$ M# f4 b( a& v. a) h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 D/ o8 L; Z" V% @1 y. { - *# O+ o% W% `- l/ n
- * This program is free software; you can redistribute it and/or; {" m r, t0 v4 R' y3 f0 D
- * modify it under the terms of the GNU General Public License as
2 h& o; ~8 ^ F1 }2 t+ d - * published by the Free Software Foundation version 2.3 y$ } X1 W8 J: {
- *
: a+ a- o$ K j: Q( M) \6 O$ c - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 F: T! g% L4 L2 l/ d
- * kind, whether express or implied; without even the implied warranty
% r. e6 T- ^7 q6 |7 u - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ E! c" H/ ^/ l! ~7 y- k0 a. ? - * GNU General Public License for more details.# A( i( E2 \9 y3 y# a+ X" h
- */
( z! ` X4 g3 S: j - 3 S, P) L% C6 {$ r5 O' ]; j* m I
- #include <linux/module.h>+ O# w2 g' {& H' h* p0 |, I* J1 w
- #include <linux/init.h>9 |/ {( d* o# r9 f( w8 y: i7 t
- #include <linux/errno.h>
3 q: o/ {9 A0 g4 d3 [! z k4 T - #include <linux/types.h> v' i6 {: ]! ~$ o' c, g! z& f
- #include <linux/interrupt.h>5 C7 ?1 E+ H6 Y! q' m+ Q
- #include <asm/io.h>
A: C" h. b$ E - #include <linux/moduleparam.h>2 V! v1 p" S# w: J+ r8 @, a
- #include <linux/sysctl.h>4 S7 F$ @: W. p$ }& j3 r+ X
- #include <linux/mm.h>
7 @" L. d" B' e8 S" K* R- e! X - #include <linux/dma-mapping.h>5 K: _, o$ C }9 E5 Y3 F- d
- 1 O5 D `+ ` y
- #include <mach/memory.h>) P% Z& [$ ?9 F% K( W6 B
- #include <mach/hardware.h> `# S X2 z5 U/ K" V6 Z0 e
- #include <mach/irqs.h> {3 d% _+ P5 A- \ x6 y9 ?
- #include <asm/hardware/edma.h>& s% ^" ~) |+ A5 M) K' p3 X
4 u% ~7 l3 o" G# c" k' {, s- #undef EDMA3_DEBUG/ K. D J( U; `2 V* d8 S
- /*#define EDMA3_DEBUG*/
8 L4 d7 U0 K( h3 ?1 o1 h3 ~ - 3 s2 m4 V; Z# C5 R5 {# B
- #ifdef EDMA3_DEBUG4 u! X# x' [' V& A& K: s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 b3 {! G8 t/ ~! j% k& n - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 r6 d9 q7 P6 L7 X; G8 W' @: `8 C8 w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), e' k4 ~) Z) E+ K2 P: Z& |& K i
- #else
3 V' p( `* c2 ^) ^( I$ O- ` - #define DMA_PRINTK( x... )$ b( E0 i$ _$ E; [7 b6 N# |
- #define DMA_FN_IN0 k1 K- m/ p: ]( X% D3 w
- #define DMA_FN_OUT) x w/ r- | o: R0 T; K6 x
- #endif8 G4 t% ]) \5 n3 H4 p! g( X" E
) Z$ ^9 I4 \& ^! Q9 c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% v f0 y: Q* G Y! _2 I9 R1 T: `
- #define STATIC_SHIFT 37 ]* K; P4 a. N: [# M/ j! x/ _
- #define TCINTEN_SHIFT 20; n, w7 G2 s. I% H6 n3 D# Z
- #define ITCINTEN_SHIFT 21
% k( c+ z# y" p. T) \- w4 l - #define TCCHEN_SHIFT 22
6 O, u" i6 a) ^0 E, ^( M1 N7 {$ d - #define ITCCHEN_SHIFT 238 \7 s! l! m7 X# O
# ]% O3 K* L7 [ [, i5 e" |2 u3 T* J" Z- static volatile int irqraised1 = 0;
; r; w% d' }6 D$ o7 s - static volatile int irqraised2 = 0;
& B' i6 N j- l - 7 i. ~' A# X$ o' ]& t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 \# @6 ~3 N: S* _8 d& N3 a4 \' V
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. ^8 I: e' A- Y& b- } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 @ F: t3 C; j# }8 i
1 ]' o9 }: `5 o6 F$ f- dma_addr_t dmaphyssrc1 = 0;
: g! i$ O) ~, x# R, ^& X4 j - dma_addr_t dmaphyssrc2 = 0;9 E0 x6 l5 P# V* |( T- v
- dma_addr_t dmaphysdest1 = 0;: o( I- M$ m3 f9 u7 V
- dma_addr_t dmaphysdest2 = 0;6 ~/ r0 x' W. n0 O7 C6 b
q. W2 P# E: t: ?- char *dmabufsrc1 = NULL;
7 X2 ?5 e! X8 a, V - char *dmabufsrc2 = NULL;
& |' }' G ^- |# B - char *dmabufdest1 = NULL;
6 r9 Q' K) f& Q7 x, J - char *dmabufdest2 = NULL;
: b: W9 J/ V0 {* l% l% ?
% x) ]- j4 `) R8 R' G0 M( ?- static int acnt = 512;
( @( n; M* i) Q( O4 Y4 g) i: E. c - static int bcnt = 8;
2 H- V; u4 W. ]+ t ?1 p9 j: ] - static int ccnt = 8;: d! _: E5 j( z, L+ Z
- : q0 c9 t) z' v8 B
- module_param(acnt, int, S_IRUGO);4 L6 b" r8 `$ i( r
- module_param(bcnt, int, S_IRUGO);
0 @3 Y9 v, I: z U+ o+ M7 h - module_param(ccnt, int, S_IRUGO);
复制代码
: w. k; a* L3 \9 l- r$ ~/ y* f( f/ r0 [" H( k
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: S8 r1 E% |$ t4 H8 v: [; B- Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' r1 p; E1 P% j 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
P5 {" o5 D0 c8 j# R/ I) Q' M! g
, @9 m7 z4 x) C% }
* ~9 J1 |) ^6 i( L0 Y |
|