|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" ^* }, {5 } c/ j, P6 O) W7 u- [code]EDMA sample test application
- p2 Q" u8 Q- X4 A8 q - /*# K: N" D/ O( y5 f [3 R. B/ {
- * edma_test.c
4 c+ W5 T9 u1 } X - *
8 ]! D7 y) C/ E; S - * brief EDMA3 Test Application
! I2 u9 y8 i# ~* o6 e c+ P$ y - *
# n; [+ t1 |: @, D - * This file contains EDMA3 Test code.
" U' f1 |' y0 V- i: C ]3 V# [ - *
5 d! o4 w" }+ O8 W' [' M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 m3 q' X/ v$ y! x - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
Z3 M2 W. H% u6 E9 }+ S - * TO CHANGE.$ m5 a+ O: p ~) ], x3 f9 x& V# b0 j
- *! k7 ~* n- u+ h- z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! Y* `2 x, s8 i7 b, o5 k
- *8 w' a& l( c) P3 ]( D0 H
- * This program is free software; you can redistribute it and/or
- a4 ^5 y* w0 K - * modify it under the terms of the GNU General Public License as
, C+ @* ?+ H3 D9 X+ |, K - * published by the Free Software Foundation version 2.8 {& Y$ W- ?1 n3 V' f( m
- *; `, e+ T: G0 W; f2 }+ f0 K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 C+ d3 H: |' v: Q( p5 e, R
- * kind, whether express or implied; without even the implied warranty
, l' [* { o- F; t9 e; N6 M( D - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ `) F/ {* d4 w3 p3 v! } - * GNU General Public License for more details. K, P6 _$ A5 j, _- O
- */
/ n- N+ W$ z& j9 y+ _
4 U6 m. k) q6 }9 X9 Y6 z7 U- #include <linux/module.h>
) u. O4 q! e8 ~' @( r- U* b - #include <linux/init.h>
( n1 \/ u4 j7 l+ r8 k) w - #include <linux/errno.h>
1 L2 I* W: m2 U, e+ h - #include <linux/types.h>/ D+ H {- Z) W3 g' T9 u3 x
- #include <linux/interrupt.h>; L# i. g" x; M) w; \, w5 v) k
- #include <asm/io.h>
# V0 b# b+ V$ ]5 f( V& G - #include <linux/moduleparam.h>
% R0 G: d; V; j" T5 x8 z& B - #include <linux/sysctl.h>
# E1 r1 [' g. V! M4 S6 p% N/ D - #include <linux/mm.h>- P# x" }. V8 e. D* o) p
- #include <linux/dma-mapping.h>- P" E% a2 n8 U$ c e4 e7 T# D
0 W$ ~: Z2 x1 o; r+ y! p- #include <mach/memory.h>3 O& e7 b8 o0 B4 C
- #include <mach/hardware.h>; V! @, t+ p5 L [2 s {
- #include <mach/irqs.h>8 w/ V5 D7 B; C
- #include <asm/hardware/edma.h>7 Z' `) p( ~0 Z3 x) T2 O
- 3 h/ R8 I: q- b! C' F5 D; t
- #undef EDMA3_DEBUG8 [9 N4 A* ~3 r/ B" V
- /*#define EDMA3_DEBUG*/2 e/ I$ {4 y6 t; T! u
- & B8 s# {2 l( b
- #ifdef EDMA3_DEBUG
9 Y5 C) B2 S( ?$ o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ n* Z0 d5 [1 J' p - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 F# C# s$ p6 _1 J4 ~. ]) ^: a! X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ P, u& [& C( J& o) ] D* M% m
- #else! P* n' K' |( }% |% T
- #define DMA_PRINTK( x... )1 {/ j- v: g6 G
- #define DMA_FN_IN
5 @5 i* |5 A' g8 y l - #define DMA_FN_OUT4 |- O# M) ^& d, x6 A
- #endif- S9 V4 Q: U, n! j/ D6 [- K7 D0 ^
6 m( E0 I% T! r6 q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' |# P' b% C' G& z& _ - #define STATIC_SHIFT 3' e2 F( f- J) J8 T& E+ U6 x, e
- #define TCINTEN_SHIFT 20
& D! `% C9 n5 Z4 D1 x9 x - #define ITCINTEN_SHIFT 211 g! o" t, _& J/ g! T l
- #define TCCHEN_SHIFT 223 W* `6 k$ w3 }- k6 q
- #define ITCCHEN_SHIFT 23: k: p- q8 [: P' p
- $ l& x0 p, s; Z, Z1 a
- static volatile int irqraised1 = 0;
1 l t1 q b& V# [ - static volatile int irqraised2 = 0;$ ]7 {# W2 t5 {( [" S( s8 A
- 3 p7 ~0 x# p+ O+ j% d
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) @& q3 q( s' S+ W/ T! {
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" R" g& T+ i4 Y# x( H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" T5 X: v8 ]% z' I
) c" d+ i- c6 @7 S, ?6 N- dma_addr_t dmaphyssrc1 = 0;7 D2 g. H. g& D0 y
- dma_addr_t dmaphyssrc2 = 0;
5 C( R7 U9 ]: @0 k( B3 S - dma_addr_t dmaphysdest1 = 0;/ p% P5 z9 l# T2 w9 X
- dma_addr_t dmaphysdest2 = 0;
+ _" E, J: G6 A/ @2 F7 l5 o - $ o. y# k; n. J! D6 l: e# R
- char *dmabufsrc1 = NULL;) k0 Q8 |- y) S m. I
- char *dmabufsrc2 = NULL;# \! R/ F s3 O5 G
- char *dmabufdest1 = NULL;
' D5 S' k# ]. \8 ^5 m" @ - char *dmabufdest2 = NULL;" X& p. w7 }7 u5 F. q9 ~; V8 T& y
- + g9 {* {8 N9 n- |1 b
- static int acnt = 512;) m7 O( j0 G4 ]- I" N- p5 c
- static int bcnt = 8;
( m2 V) I; A* h) l+ T - static int ccnt = 8;8 d- f1 [: U4 T6 `6 G( M u
- - u/ Y ^* [: u( p e: U
- module_param(acnt, int, S_IRUGO);
, u# f- C* h* p/ y5 L! G+ V - module_param(bcnt, int, S_IRUGO);/ D, K0 Z0 p0 `4 J/ N0 R
- module_param(ccnt, int, S_IRUGO);
复制代码
, ?( o% y! \. m6 \) B# V8 q1 k
9 c+ n/ T9 Y6 ~4 X, g# e 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ Q4 r! ~$ T. F @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" `" ] Y% T$ z9 A% e3 s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 U0 }8 f% [3 ^% [9 T
6 X; b; h! H4 l% R; }2 L7 w
0 F' |6 w* @# `2 z9 S- h1 g |
|