|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 P1 A$ N4 E. M' I) r5 O: v
- [code]EDMA sample test application
% g6 A0 v" D- M; t2 X: n% p - /*# w: n; l- l/ V& n
- * edma_test.c5 p2 \0 k' j3 E* j1 r
- *& u; R; n" X/ X7 ]7 p- q& Q% j
- * brief EDMA3 Test Application
! c# ^6 i: ?- d1 H3 z3 O - *' X5 `7 @8 p$ |! o: F9 r: ^) ^8 M7 O
- * This file contains EDMA3 Test code.
* k- O) f: C9 t+ {3 @ - *
4 F% E$ S2 `9 L+ a6 U - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ l9 ~& R% O* q! e6 l4 L) V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: H3 Z& U& J8 ^# A& p1 n - * TO CHANGE.0 |1 H# N! U# g
- *! U& ]% g1 i* K5 F3 Z& e+ t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" F( I0 w. L* B3 r - *- r0 O. V* u" X4 c/ n: p% h
- * This program is free software; you can redistribute it and/or
8 C; H0 y$ v4 W - * modify it under the terms of the GNU General Public License as9 n* J' Z3 f6 J& s
- * published by the Free Software Foundation version 2.* U; h# D) [' K S1 }9 l" x7 S
- *
* E e. v" j2 M8 @& h - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) E6 c5 x9 l& A: o/ z
- * kind, whether express or implied; without even the implied warranty
0 G( y& b6 u- | p* G# r3 K, {8 d$ e - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 n2 U: m m/ y, O) D) Q, T/ g
- * GNU General Public License for more details.- _$ \: |6 i3 B9 t
- */
: Z- ~# _* n) p( }6 P8 g - $ S8 P P6 ^( m" K( q
- #include <linux/module.h>
" @- d1 G; Y2 k. i; K - #include <linux/init.h>
- [" w- z' f( s3 v! S - #include <linux/errno.h>
4 U: D: u' a1 q- Q1 y' A - #include <linux/types.h>- N7 U/ W6 T5 G4 u
- #include <linux/interrupt.h>
5 m* A% h; r& r" @8 }- \ - #include <asm/io.h>
2 W( m/ p1 X5 ]' h - #include <linux/moduleparam.h>( c; m- _$ |# D2 \ G3 U
- #include <linux/sysctl.h>" C* K2 i1 q) t
- #include <linux/mm.h>4 }% o- u4 z9 l. w' `- Q
- #include <linux/dma-mapping.h>; i3 u; w0 |4 g/ S0 K
0 R8 o+ u* z k U' a- #include <mach/memory.h>
& ~* [' ^$ @$ J$ @( Q - #include <mach/hardware.h>5 m7 Z) O" y/ G: S( B/ `; |3 ^9 F3 }
- #include <mach/irqs.h>. ?+ D+ b& B( c/ z$ c" K( x
- #include <asm/hardware/edma.h>9 G( N/ c- j; \& ^
, R5 E$ L- G9 ]6 Y* u9 l- #undef EDMA3_DEBUG0 }" G7 n' ]: _4 R, ^* k1 b
- /*#define EDMA3_DEBUG*/
' P: t1 a- g6 Q
) h+ P g% J* ]) ~) g- #ifdef EDMA3_DEBUG3 G! h" h$ V; r( E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); W5 L z; y8 _
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 ^5 G$ X1 M3 l3 F- D$ w$ y# A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ @3 C$ o& s6 @5 U
- #else) c) h! L0 u. g( R* |( C; w
- #define DMA_PRINTK( x... )4 g4 p! n. ^6 {+ d X* p% H
- #define DMA_FN_IN
* n+ x+ b+ p* d, q2 A& l* Y/ ? - #define DMA_FN_OUT
" a0 z3 e; ? }; J. j - #endif
7 {; J1 A7 \% G! G - : Z% Y w, q" d4 \9 E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" P( ]8 E8 n) b" J3 @/ ~- F- b$ ? - #define STATIC_SHIFT 3
0 v) T5 [7 p/ b8 w3 } - #define TCINTEN_SHIFT 20
; D7 b: P, K+ N: Z& d4 R d - #define ITCINTEN_SHIFT 212 W6 Y, H, y1 } h {" t" p) S, s1 ?
- #define TCCHEN_SHIFT 22! N( q7 y, o; S, q
- #define ITCCHEN_SHIFT 23
$ D4 _* l' u5 W+ f1 w
7 x% t4 Y- N! h G, t- static volatile int irqraised1 = 0;) Y* |/ y R( e/ X
- static volatile int irqraised2 = 0;
( m# k2 k( S9 K% h) _
: J: {$ Z9 H/ ]5 y3 s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ F$ s7 b0 P1 v" I" `& @2 Y4 V9 ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 M Z, o6 b, v: `& ^) @* G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" J) N8 x) y! B" [" ~. f. Q1 U
9 H! V( Z! x* l7 j+ H- dma_addr_t dmaphyssrc1 = 0;* N. ~5 U$ S* |$ t
- dma_addr_t dmaphyssrc2 = 0;
5 n. o4 L9 ~7 {0 a2 M8 t - dma_addr_t dmaphysdest1 = 0;
# r9 C6 s1 P8 X9 o9 X - dma_addr_t dmaphysdest2 = 0;
# [* F9 W: h8 E8 G1 ]7 r- l9 g, m/ a4 d
8 ~. Z+ D/ ?8 S& D8 h- char *dmabufsrc1 = NULL;! n$ V/ W* k, r9 M& |0 t
- char *dmabufsrc2 = NULL;
/ j3 ?; D- ~1 I/ K9 W8 I - char *dmabufdest1 = NULL;% f" t% u2 w! O
- char *dmabufdest2 = NULL;
. l" ?: z3 t: P: A/ e+ B3 U/ u - - `) B j& t* R0 k, i! p# V4 D
- static int acnt = 512;
3 m9 T( d7 T, @. I& l( J2 |: L! e6 s1 R - static int bcnt = 8;7 E `; r `! |, B9 A8 w, U
- static int ccnt = 8;+ M6 o: N3 R. M7 c
- : q" N, X3 _; b0 F* n) T) {8 t& M$ {
- module_param(acnt, int, S_IRUGO);
! e X, ]( @) |& q( x0 }/ s - module_param(bcnt, int, S_IRUGO);! R* [ Q: p& f; R- o
- module_param(ccnt, int, S_IRUGO);
复制代码
3 b" [) v2 h1 |: Y( [, @
; b3 ]) V+ g# k( _, L% [ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 w& y$ g( `( m3 farm-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 l; v) H5 b5 b6 o# { 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 e- L4 G4 |) p3 B- T) R( t3 I, G3 q7 H8 S
6 f$ E5 n0 @* B/ i |
|