|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 W8 l7 n& k" @0 I% ?- [code]EDMA sample test application7 Y1 I6 {3 @* `, O( K" t4 I
- /*7 p# t' H, F7 t- A) X
- * edma_test.c1 j- t# e: [; U
- *
3 D: C6 v, e1 ~ - * brief EDMA3 Test Application
; d# Z l: Q( D - *# d9 S( k' z- K$ ]3 B2 @7 L& l$ E
- * This file contains EDMA3 Test code.5 B$ C& s6 A z8 q6 ^4 u& A1 B7 q. I
- *
: c& o% V' K% @2 Y* a' ~1 i8 Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 |3 t, T9 m5 D. z- b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 z' n" Z$ n7 s- P - * TO CHANGE.0 [' Q* r. s- g" W
- *
7 P( f- a7 v! v - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 N* c$ K; S1 n8 ^2 ]5 u9 U
- *
4 @6 S& W/ [/ S- P - * This program is free software; you can redistribute it and/or
8 r3 a4 {8 Z" o5 Z/ G* B - * modify it under the terms of the GNU General Public License as C1 T; N* a2 ~% E2 W7 Y' E
- * published by the Free Software Foundation version 2.5 L" z; H$ J e6 U4 Z
- *9 l K3 ^- `4 U
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ k1 |& C- V% f3 S, W: x( n - * kind, whether express or implied; without even the implied warranty
% q- U- t1 L% F4 L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ d' K& b/ b6 j( \" ?5 ~& S
- * GNU General Public License for more details.
3 z7 U# ?; Z; D' ]( }2 m$ l - */. H6 q2 l9 Q& C4 Y9 s% V0 _
- ( v- ]9 V3 `9 _5 ]: y+ R" v
- #include <linux/module.h>
- [& \3 V5 G" v1 `$ G - #include <linux/init.h>
/ p% J6 b: o( V. p/ k4 }$ n - #include <linux/errno.h>/ R+ ^5 M* Y v5 F. z) E( }
- #include <linux/types.h>2 o$ T4 q$ ~5 r
- #include <linux/interrupt.h>* f! Q4 @( ~0 G+ l7 F
- #include <asm/io.h>
0 m" m) A8 S/ I' `: H - #include <linux/moduleparam.h>$ I4 e7 ]# `. E5 P
- #include <linux/sysctl.h>5 j, }0 s0 B6 i
- #include <linux/mm.h>
" ]8 r; T9 t0 {1 u/ d; c - #include <linux/dma-mapping.h>1 s* v4 i; H0 |. `1 _
- a$ S. p L$ M* E/ V- #include <mach/memory.h>. ]& @: c+ q& L5 _- l
- #include <mach/hardware.h>5 |( Q$ k) r/ ?; F. H* ~: `0 ~
- #include <mach/irqs.h>
. l: m# N, B1 V" s+ m8 z. U - #include <asm/hardware/edma.h>
9 ?4 W* A# }% U0 j' V- z1 S - # l" z8 q6 D) }9 A. O3 `5 i$ X& S" L
- #undef EDMA3_DEBUG+ G8 f! i g& J0 p3 A
- /*#define EDMA3_DEBUG*/7 v: x" M0 ? _
/ Y3 c5 J5 V1 x+ }- #ifdef EDMA3_DEBUG8 C7 \2 J% B2 t2 I: A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 b; v& S6 J. i y+ a - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- U9 k/ `% S' K, W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, i* I/ [5 D+ t - #else
: Q( G8 t1 v" o4 l/ M1 J4 ~; Q* J$ ? - #define DMA_PRINTK( x... )5 D3 M P/ A# ^' w K
- #define DMA_FN_IN
' L$ X: z6 W& V( ^8 ] - #define DMA_FN_OUT
$ J, I2 q( M5 V% U5 ] - #endif
2 y0 U4 D' Z P/ `1 q! h
& L9 w; F/ c8 G: r2 p" a* p4 J- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 t8 |' Q' S7 W! @
- #define STATIC_SHIFT 35 Y, P P$ T/ x: }
- #define TCINTEN_SHIFT 20
3 p3 K2 N# T5 k# i# ]2 [1 J - #define ITCINTEN_SHIFT 21
, t! [& l1 X+ ^9 b5 `% M2 T" M - #define TCCHEN_SHIFT 22
! _5 }3 L n; [ - #define ITCCHEN_SHIFT 231 t& f& r" S2 b- H8 s* S9 z0 P+ N
- ) k- w9 Y7 ]( i# G2 D( l
- static volatile int irqraised1 = 0;
' O- c( }0 t& w - static volatile int irqraised2 = 0;
+ P3 y: A3 f" W9 A+ |, u - * l9 N& K) A% m7 T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- @8 Y: b( x) R, T2 }
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 B. [& F0 _- e, q, t7 |1 |! n4 O. t8 ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 B# H( o: a. t0 J7 s) j6 D - & Q( e7 J5 ^2 M; H
- dma_addr_t dmaphyssrc1 = 0;3 `9 S6 x- l( d! D n+ ^" k, F4 R
- dma_addr_t dmaphyssrc2 = 0;( u+ R. t/ J, V' a
- dma_addr_t dmaphysdest1 = 0; T" ^1 S- o9 x' R5 V
- dma_addr_t dmaphysdest2 = 0;
$ n$ q0 R- |. [: U [# ~
2 e1 B7 _5 W; t- char *dmabufsrc1 = NULL;
s& h ?2 e; s9 k# x; k - char *dmabufsrc2 = NULL;0 ^3 f% J9 A6 f% i
- char *dmabufdest1 = NULL;" g1 r7 D( h7 h
- char *dmabufdest2 = NULL;9 J5 ?$ z ~7 \; l
- 1 {0 g8 D8 ?2 b; G5 M7 F# t- x
- static int acnt = 512;
' W5 {, D! z( {9 O7 y" H5 u - static int bcnt = 8;# |' Q3 b! q. I/ K+ _$ o4 m
- static int ccnt = 8;
+ G }+ p9 ]" F A& [% F - 0 }" u- x7 [5 n1 a1 h
- module_param(acnt, int, S_IRUGO);
9 [$ x- d6 D& X2 E* {. s - module_param(bcnt, int, S_IRUGO);1 q. ~) m" ?% j
- module_param(ccnt, int, S_IRUGO);
复制代码
. g! x# @" s+ w5 v# {, W1 z; ~. S- |) S* Y. `1 |; F! B: S0 O. ], C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 X) t4 D4 w& _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 O, e9 Y4 I& `' T H: X) n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 |9 x( {8 J+ O5 h- v* d
8 X9 w4 y" V' C
) d3 }4 Y: v) S0 A S6 S5 ] |
|