|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " F9 ?# h: F9 W% o( J
- [code]EDMA sample test application
4 Q7 f, E0 V7 q0 o, F8 U - /*) S; Y5 o; x5 |- I% I
- * edma_test.c9 e5 I! c0 `9 @% u
- *& Z" R8 o8 }6 D% j" ]3 Q
- * brief EDMA3 Test Application
4 r. p& J- _+ ^& f - *1 S u0 {5 j0 A1 m
- * This file contains EDMA3 Test code.' {* R1 a( u" S, j5 D
- *
" C! H" B) J( t" p9 @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
y" `+ @! f w k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 f! U/ Z O% C2 O4 `: N2 z - * TO CHANGE.
2 m. h" z# G( o - *
3 P8 T+ m1 B3 N5 F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 ~3 K4 x' P1 @1 M, ] - *! g3 ?5 t( z" q
- * This program is free software; you can redistribute it and/or( G" B) T e0 p+ r' a
- * modify it under the terms of the GNU General Public License as3 r5 M6 l1 O( @4 ?
- * published by the Free Software Foundation version 2.# X+ @8 `6 Z) f
- *+ r6 d- r& i' g
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- m1 U5 B+ s7 [: t - * kind, whether express or implied; without even the implied warranty
( u& W$ J' d, b. z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" t9 r& T- A3 }2 f, g. W# a - * GNU General Public License for more details.
6 ] b* H" A2 M# k, U1 X3 i - */+ k, `- c; }( c0 g% _: Q
- 4 [. N$ x5 m& |; ^
- #include <linux/module.h>& [/ z9 c& w3 q" f5 Q' |/ ]$ X
- #include <linux/init.h>
# ?/ B& ?) e3 N* I - #include <linux/errno.h>( I/ G R. M7 t$ d
- #include <linux/types.h> k. T' p: L" c- E9 n/ `" b: W
- #include <linux/interrupt.h>
% s4 X% e4 p2 z# C3 N# w! {$ N - #include <asm/io.h>+ X* O5 b- ~0 H
- #include <linux/moduleparam.h>
1 p6 }+ e, }2 ?, m! R - #include <linux/sysctl.h>5 h7 U& o" g' s# j
- #include <linux/mm.h>& s- X( {' m& W5 c6 [
- #include <linux/dma-mapping.h>3 L5 z1 S$ ]& Y7 j
+ ]# F9 [- H3 c7 d, d3 _- #include <mach/memory.h>) {) m/ t9 Q3 x. z+ |+ v7 ~7 R
- #include <mach/hardware.h>3 V* {0 t9 ?+ n0 `
- #include <mach/irqs.h>5 @7 Z0 K* g0 _2 i: @. V u9 _
- #include <asm/hardware/edma.h>! E- z& D/ h6 o( B5 D
" s0 R8 _, k; P( g2 T8 j$ z$ K- #undef EDMA3_DEBUG) O8 N/ B2 _1 {% v7 ~ X8 g
- /*#define EDMA3_DEBUG*/
- }$ i- s8 H6 f9 G4 P; ~
9 u7 i7 A: W* ]. ]; e5 O- #ifdef EDMA3_DEBUG. Z8 y+ \/ D$ ~( K& U* b* [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 D& Q5 T% s) ^0 r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& `1 R& |4 Q/ z c, I: | J* h# D - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ e5 u2 @& ~- e3 n - #else/ w4 A$ g: |. T; S
- #define DMA_PRINTK( x... )
9 ?. [0 O- L! h8 C - #define DMA_FN_IN$ }, q* Y1 J6 u% K2 P
- #define DMA_FN_OUT0 N' @: T3 f5 @- U
- #endif+ i, O% N2 z- o# E% L/ N4 S
- ' V- l4 ` H% a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% ?9 v h5 O; |: `; c$ h, u6 I - #define STATIC_SHIFT 34 u4 ?/ g5 `0 u: }2 s
- #define TCINTEN_SHIFT 20& l7 b5 b9 p. O9 L
- #define ITCINTEN_SHIFT 213 n1 }) A3 J* k6 S! q! P
- #define TCCHEN_SHIFT 22. P1 J8 i: A) p% E" X4 ? v
- #define ITCCHEN_SHIFT 233 S/ O. }3 R3 P1 u+ d2 K
. ]7 h( b+ S0 v- static volatile int irqraised1 = 0; ?* S8 B4 T% W/ V/ n/ \% b
- static volatile int irqraised2 = 0;/ P* h/ J. j6 e
6 T' M' B' [ [3 A& X" }, t( }5 }* x% I- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( _3 E' y( l4 ~# {- f7 J! ~$ ?3 P/ L - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. q: T; T) _' i |1 u1 V$ w1 |4 d
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 }9 s+ F* r$ W) @% T/ F
- / U2 e5 Y# L; U( u# f. G
- dma_addr_t dmaphyssrc1 = 0;
+ i. f9 x) @& Z - dma_addr_t dmaphyssrc2 = 0;
. s0 \7 w3 a! c8 i - dma_addr_t dmaphysdest1 = 0;
4 C- }- z7 D. }- J; C# T# y2 r- ]9 J! X5 j - dma_addr_t dmaphysdest2 = 0;% F% K6 L6 P5 e9 w1 ^% F
' t" h2 K. c$ \1 g- char *dmabufsrc1 = NULL;
2 P( Q5 X# V3 w# B( q4 x% s - char *dmabufsrc2 = NULL;' S+ r- |: T2 v) n: o( |
- char *dmabufdest1 = NULL;
7 [# T" o9 n5 r8 _6 Z - char *dmabufdest2 = NULL;
& [* U0 O# [; ] - % U1 Z0 |0 I; r" h. g
- static int acnt = 512;
0 j6 C' l: Y9 {0 A; n - static int bcnt = 8;
/ Z/ w3 S9 o! {" H+ ` - static int ccnt = 8;, `/ X$ q, J2 m5 R0 |: W
- 9 v" `; v' E$ u2 m& [: P
- module_param(acnt, int, S_IRUGO);
7 B1 s5 Q) q" Q6 K" \6 V3 R1 g6 P - module_param(bcnt, int, S_IRUGO);
3 t" c3 U( a Q& P) L - module_param(ccnt, int, S_IRUGO);
复制代码
2 @; H2 R3 N* i5 q+ q8 e' H+ E) v& V! W) J0 C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! L' {. F" Y, [8 w% u! zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 F/ _1 L, M2 o4 j8 x 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ `* e( i0 r: V$ }5 \5 t% J3 @6 L; D2 R0 E$ i! e& I
$ x! o# _" E) G
|
|