|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 I0 K$ \& {0 j* q) r4 m- [code]EDMA sample test application' O3 k; J. I/ d. ~
- /*
* e, G# z* f, x ? - * edma_test.c/ Y2 M9 y' B4 W' m
- *1 _+ S# s- r3 m* }; ]8 X+ q
- * brief EDMA3 Test Application
% [1 R0 r- g# } - *1 m: @4 [ g/ X! R% [6 i3 ?
- * This file contains EDMA3 Test code.4 j P4 F( r: P9 I! n/ m
- ** Z6 q+ ~- x2 k4 U1 b
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* I0 a; {, T o! ]* Z* C" k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 Z" L8 q- ?# u& j2 I - * TO CHANGE.
, C; k0 B' y! J9 a - *
# x/ x; g9 q8 B0 O2 T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 Q8 b$ d8 E% v( Q2 P - *
1 r e; s9 {* c% B- [- G' K# i - * This program is free software; you can redistribute it and/or
( V5 h4 I9 Q" A - * modify it under the terms of the GNU General Public License as# E3 Z' t0 _" m2 j( Q. R3 E
- * published by the Free Software Foundation version 2.# D/ A0 u# s0 o% ~2 b$ Q
- *& X+ j: f0 \! ?; d' z2 W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, ]% X% s/ t( a# x8 n6 f1 x1 b
- * kind, whether express or implied; without even the implied warranty
1 d& h9 K) N6 g - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 |7 o, w" i2 h/ ^ - * GNU General Public License for more details." h6 b% G/ a; t2 p7 \( |* {
- */- R6 o2 l |9 s1 }' M0 ]5 S
- # b$ {) F3 M; t6 E& Y
- #include <linux/module.h>! Y' U. \* m6 \
- #include <linux/init.h>) u% ?4 r7 E3 _1 f
- #include <linux/errno.h>
3 q Q5 t5 H G2 x0 j. Y! O, h, o& h - #include <linux/types.h>8 W- f& F. r1 x3 T' J( m9 ~# |
- #include <linux/interrupt.h>; O# e6 c7 o; @4 z
- #include <asm/io.h>
. M7 H* V( m7 o0 S3 e - #include <linux/moduleparam.h>
% D, ~- H l$ S% b& B) _! X6 l - #include <linux/sysctl.h>
9 t: _# Y6 P/ |, _$ |' R - #include <linux/mm.h>( e( h g: x* D$ X7 P$ r
- #include <linux/dma-mapping.h>0 T: L+ [. f; v
|0 q9 `. s" Q* G# V) q: c- #include <mach/memory.h>
/ q5 J; ^$ [+ N3 A$ O; S6 M - #include <mach/hardware.h>% R3 w& e1 r/ B Z; U5 `
- #include <mach/irqs.h>, N. G5 a [/ L# _ Q
- #include <asm/hardware/edma.h>& x5 O/ b1 J [7 p
- 8 r5 D& w" \2 w' L. _
- #undef EDMA3_DEBUG
' }$ m3 }9 t, m# V4 |4 L - /*#define EDMA3_DEBUG*/
2 J' Z5 e: e8 ^. f+ ~
* J6 W7 h' D) J" i- #ifdef EDMA3_DEBUG+ U5 s+ ^ G5 b+ z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 b6 k+ ]/ [2 p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); R. Y& i7 ], {% L* r
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) A C" i# t4 a% B
- #else( g" K+ K( `# E5 ~: p: l7 l9 b2 z2 B
- #define DMA_PRINTK( x... )
8 x. N7 ?" V7 V4 R8 ^ - #define DMA_FN_IN- g1 V0 z# q' F, f/ Y4 u# y
- #define DMA_FN_OUT
1 I/ Q. O! d% D+ M7 k1 J3 U% F - #endif
3 ]: X5 B8 H* _0 Y' _0 z" q: a$ v/ ]
' Y* c9 m6 w; k1 |- o4 e- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 k% j, i$ _; {* U. t# T
- #define STATIC_SHIFT 3
% W6 i7 j% `1 O2 U6 O - #define TCINTEN_SHIFT 20& y9 y& z2 r( [* M# D f7 ~
- #define ITCINTEN_SHIFT 214 A p8 S6 X! T \4 R$ r4 @
- #define TCCHEN_SHIFT 225 o1 h9 ?$ y( j: ^1 s" ^+ j
- #define ITCCHEN_SHIFT 23! c- E2 s; L( E( ]) f; p
- , ^( R) }7 {4 Z* ^) V* o+ H
- static volatile int irqraised1 = 0;
$ ?; s: l4 _$ `. z! H - static volatile int irqraised2 = 0;- a' w! S# L) |
- : s6 I+ a5 b( X! t6 f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: H! F6 x4 H! \7 i# \: t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; _+ W6 p$ ]9 V/ N3 K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 u6 |: V+ _3 K/ M
- ( z2 j9 E; v7 `) s
- dma_addr_t dmaphyssrc1 = 0;3 B6 S/ Q+ [' \6 |. J! |4 B
- dma_addr_t dmaphyssrc2 = 0;1 X5 x8 s" O; w' H, K
- dma_addr_t dmaphysdest1 = 0;
9 J: m1 z5 U$ P) s - dma_addr_t dmaphysdest2 = 0;
5 }/ ~5 [9 y8 N+ e* J# @$ W6 j( N - 0 {8 g4 U8 H9 e; S$ b& P# N; A6 G
- char *dmabufsrc1 = NULL;
5 J% n) q# `" C - char *dmabufsrc2 = NULL;
* ]5 G' R! H4 {4 |9 k4 d - char *dmabufdest1 = NULL;
; w5 t+ H- |) Y2 h4 W. _+ S - char *dmabufdest2 = NULL;0 p: p1 N6 o" y6 e1 k5 W- t3 `
- % z2 @0 L7 I; \; A/ m" o
- static int acnt = 512;0 U6 \( D& ]& o# L0 R
- static int bcnt = 8;$ J. ~& T. w5 [
- static int ccnt = 8;
6 N8 C) E+ ~6 k D7 t
) g- ]- J4 E" m, ?- module_param(acnt, int, S_IRUGO);
/ n9 g; o; U' X0 X4 y3 q' r - module_param(bcnt, int, S_IRUGO);( Y$ m) T/ d. b# o9 S' D
- module_param(ccnt, int, S_IRUGO);
复制代码 5 R1 g; U6 D7 V% {$ E, S1 Y" m4 \. p
. g( j9 s" V4 j# y# S) a7 a# S9 } 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! L z2 G& x% e; p# }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% w3 c' B0 x5 ^* d4 | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 n$ `2 R! y1 s1 o
% ~) K( _: y) I, e$ `; m6 F( D# G+ F/ G$ P" U
|
|