|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & d! D( v6 O Y( t) O2 Z9 N
- [code]EDMA sample test application
n* @# q4 q2 _/ t - /*4 k) |- }* e, K" l! ~9 h+ [
- * edma_test.c
+ X/ M+ \5 T8 p u& U0 [- L - *
' x9 S) L0 X' y1 I2 _6 S' q8 f - * brief EDMA3 Test Application3 P- L1 C# ]4 N- U
- *, y; ~/ h, {8 H) H, u3 p/ [& _
- * This file contains EDMA3 Test code.
8 H. q/ o& E4 _' o, Q$ J ^ - *
9 B' U9 T4 I9 m - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- Q7 A( [5 F/ P( `; j ` - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ ?! {9 S( I" |2 \ - * TO CHANGE.1 c' U( \, E. u2 e* Q6 l @6 i
- *
9 @4 j/ ^; {+ ]3 f& l0 J# Y8 | - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% Q5 @9 L2 X, O* z9 z8 i - *# u8 B# {: u6 O2 p
- * This program is free software; you can redistribute it and/or
* n9 j& f/ `4 Z0 e! ^$ }! {; _# b' L - * modify it under the terms of the GNU General Public License as" W5 w' @; O* S4 q- b( |
- * published by the Free Software Foundation version 2.: t' I& Z0 `7 D# ~8 \( U
- *
1 ~3 p# ~$ h6 k; u. g' o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 I4 D" \* K! ]# }8 s. f
- * kind, whether express or implied; without even the implied warranty
& s; Q' O T% Z+ e% p) E - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% K+ I4 n9 K e- V - * GNU General Public License for more details.
9 I; u6 k$ j. C" \/ m3 j - */
( o. b5 J0 a( H3 ?
9 \' h/ C# F* g6 {# U- #include <linux/module.h>; b6 p- x4 k/ G5 }
- #include <linux/init.h>8 F5 ^: x* P7 j2 `
- #include <linux/errno.h>
) i- k) g+ N/ q1 o6 x8 W3 m8 R - #include <linux/types.h>
2 F6 n' p3 p/ u: J$ D% } - #include <linux/interrupt.h>
9 w7 F* v- q5 y: S4 r. G/ x - #include <asm/io.h>
7 |2 ~+ D) d& y - #include <linux/moduleparam.h>
; j: v; o0 K) C) G1 P6 I3 o - #include <linux/sysctl.h>9 M: P: s( F5 N
- #include <linux/mm.h>
+ V3 L/ C2 y7 u) p+ T( ~% R - #include <linux/dma-mapping.h>
/ t d* A) m. Y - 8 U4 m7 Y7 c1 q( r8 s# c
- #include <mach/memory.h>
( s7 O3 x5 Z) q+ r4 }, v - #include <mach/hardware.h> G4 p) G. Q/ Y; D, T
- #include <mach/irqs.h>
5 Y Y. F9 y! s+ M) Y - #include <asm/hardware/edma.h>7 Z" v5 k; }' ^3 [
- 6 P+ }. q4 ?& j. G) G
- #undef EDMA3_DEBUG
1 \8 P* O" \3 ?" b* k - /*#define EDMA3_DEBUG*/
) \; Y' D3 y% x4 ?' _
) E: y) h9 r: D! f- #ifdef EDMA3_DEBUG
) M! g) ~8 u; E. i% J3 c - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 |5 G q- ^; Q4 f# U, a7 b
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- A* M7 ]/ t0 {' k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( l7 v5 }0 C1 K# ^$ \0 m
- #else6 I; A, r1 {2 {5 U/ Y
- #define DMA_PRINTK( x... )
" P2 r! n8 P4 z; ^% L! \0 B - #define DMA_FN_IN1 E, K0 ~# ]2 w9 Y
- #define DMA_FN_OUT
7 M" B: y- t2 U- Q, `6 t - #endif
, e9 b9 W. R! |, U, d! @- }: E - ; Q" R- n3 B& t' q0 m `3 [7 j
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% T2 S' V: n# z+ a6 ?, n( a+ N
- #define STATIC_SHIFT 3
$ k3 ~6 o. u$ R5 q% b" U - #define TCINTEN_SHIFT 20
6 F5 i( U. ^+ r$ G, b- P - #define ITCINTEN_SHIFT 21
4 @1 E7 g9 @! P( |( ~$ B7 S - #define TCCHEN_SHIFT 22
$ R+ J$ L* U( d- A' Q& `. D" T - #define ITCCHEN_SHIFT 23: h% J p& X/ F5 K
- 9 z1 W% r$ Y/ v' O) i
- static volatile int irqraised1 = 0;
: d) c F" c/ T- ^# [ - static volatile int irqraised2 = 0; |* r9 |; _8 ~
! q2 h0 C; e& V, h+ J9 }% B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 L/ E9 g. {' x! x, z# K$ k" C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 c! e3 _9 o( `1 p- C
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 ?6 b) R& s4 K( g
; i6 l0 T& J1 o0 Z* q- dma_addr_t dmaphyssrc1 = 0;* g2 Q3 ?% x9 ?8 m) z4 f, u
- dma_addr_t dmaphyssrc2 = 0;
2 \; N8 q* F, W* D; E - dma_addr_t dmaphysdest1 = 0;
" g6 L' ^$ _8 A/ ~4 z5 O - dma_addr_t dmaphysdest2 = 0;
" o5 j* }& L0 b4 a; e
( N+ K$ d0 I3 W- char *dmabufsrc1 = NULL;
9 L+ |1 x% v0 Y' @ - char *dmabufsrc2 = NULL;! u5 j/ ^$ z% z. e1 F+ W
- char *dmabufdest1 = NULL;4 {# J( |( ~2 }' N5 d, m, j2 i
- char *dmabufdest2 = NULL;
! j6 Z9 w/ x. k- B" k2 e - 5 B& k/ z) }- e9 v; y/ V6 R
- static int acnt = 512;7 g. b# d$ [$ w' m' s5 x
- static int bcnt = 8;
4 ~1 e0 f- i; P - static int ccnt = 8;
# I V* l, W: f, K( [4 X - + j; S3 a7 G4 T/ Z
- module_param(acnt, int, S_IRUGO);. e! Y2 P2 G% C6 ~
- module_param(bcnt, int, S_IRUGO);
/ o6 @5 [: {& D$ } - module_param(ccnt, int, S_IRUGO);
复制代码 6 E3 M0 F' M6 e% I: h
) I- o' ?: T0 F6 G5 ?1 A9 Z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 t; h9 x3 [% o. h* }( Z( \2 uarm-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 N) {* e& l$ g% m; @: [ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; L, |. F' d6 w3 W* y& e; ^, V, b4 R. Z6 i
" c" \9 r0 b- ~* x0 O) @
|
|