|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# K7 v7 B3 c6 t2 q1 @- [code]EDMA sample test application3 I- _- v2 @. z$ w, {; ^
- /*
! j6 l+ `+ g' e, ]3 V6 e - * edma_test.c% L: A/ g' g/ A
- *
7 E9 E s# v$ ?0 ^* ` - * brief EDMA3 Test Application: b& n- I/ g6 M/ v' ^# G4 R: F
- * P& t8 ^; L9 z/ n
- * This file contains EDMA3 Test code.0 M% @1 O; F5 ]6 d4 e0 b% j3 u' Y
- *
( T$ z! }# I9 |7 K- o- Y# ^2 ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ B1 F+ K! T T/ M& F' u/ Z' U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 n3 s% e# W4 Q! B; G: o( U
- * TO CHANGE.# P6 R. d0 Z4 T
- * ~* ~, T3 f+ \! M0 c% \' L
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 I- e$ A( V( e2 w2 s- `: g
- *
* M& A; ]8 r3 b; U* M9 Q - * This program is free software; you can redistribute it and/or
2 m4 h* e1 Y6 `- {* h. B6 } - * modify it under the terms of the GNU General Public License as
' M1 m: J+ ?8 u4 N" [/ q - * published by the Free Software Foundation version 2.) ^2 ]7 `) m5 T/ f- ]2 k6 x
- *
/ W: Y# C0 z' G/ c8 } - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" g' ^: g. e+ Z3 X' t- \' Y' P - * kind, whether express or implied; without even the implied warranty
. J& ]) M7 O& x5 d2 ~* J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 Y: x2 r0 F4 ~* }
- * GNU General Public License for more details.
- n5 E. \( }$ { C; B - */
: g4 f+ x2 j# t2 _( q: F - % n0 D8 o& G% |
- #include <linux/module.h>1 U& V4 W: b, @/ ?( W7 b9 w) H
- #include <linux/init.h>8 m4 E4 J+ @0 [% x3 H4 ~3 s% U
- #include <linux/errno.h>7 O' z3 M$ U8 n( O# W7 R
- #include <linux/types.h>
9 T! \2 L6 g' f ]3 C w) C0 N' F - #include <linux/interrupt.h>
' ]0 i Z& F( `+ T - #include <asm/io.h>
5 U- N; l7 M4 z6 {% J/ W - #include <linux/moduleparam.h>* s0 i' J. ~" ?
- #include <linux/sysctl.h>9 @" v$ W: H" b) ^
- #include <linux/mm.h>- }! f0 e% i' W5 e
- #include <linux/dma-mapping.h>
7 Y* z6 y, {$ w' s7 ] }* V - 0 C1 }+ ?4 u5 ` e$ t1 Z% }1 \
- #include <mach/memory.h>3 P% U+ f7 M; T. ` e
- #include <mach/hardware.h>
( l5 L4 p( a- B: G: l3 V - #include <mach/irqs.h>
5 u; u# l: a( O. v, a3 E, K - #include <asm/hardware/edma.h>3 @: u2 ^% @ Y4 t
- 5 c/ @' u V' G/ t" e
- #undef EDMA3_DEBUG9 _3 r1 N/ W5 o: q
- /*#define EDMA3_DEBUG*/9 n, `5 V0 r; @* `! a/ }1 y1 [* F
- 8 Z2 h: z7 g9 m! L; P
- #ifdef EDMA3_DEBUG
1 z4 ], ?3 X! O! Z p1 \$ r - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- Z) D! n G V/ x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) [7 H, v' p# y8 _4 {
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 q$ {, {9 p0 G* j. O - #else% G. W- v- o; o: Z% _
- #define DMA_PRINTK( x... )! S- ?/ D: `9 t# J8 |$ j* Y) R
- #define DMA_FN_IN
6 t1 e& c2 h6 r- x+ W6 I - #define DMA_FN_OUT
' H' v3 n8 L6 B4 o. }* J - #endif
6 q) ]( M+ ~/ x8 F. Q# j
& p! f3 f8 C$ }- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* W) M/ F( j: y" X$ p7 Y
- #define STATIC_SHIFT 3$ B' m# L1 G! ?1 @
- #define TCINTEN_SHIFT 20
3 q: w) k! U8 i& g1 [- ]( U - #define ITCINTEN_SHIFT 211 @$ c6 j. l3 \0 k) u/ U7 q
- #define TCCHEN_SHIFT 22
( y! ?% U* ?- q4 z4 J" D$ w( f - #define ITCCHEN_SHIFT 230 C+ ^+ K- H" j6 E9 p1 f( e7 {0 {( O
3 u) S, {# q9 [2 i1 H5 u& v- static volatile int irqraised1 = 0;
: x' @9 Z# @7 Q( ^% C3 ]6 Y! d$ ` - static volatile int irqraised2 = 0;
, J4 H4 n3 ~* S/ h2 ] - 2 K7 g' k" c! I) E2 A* O
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 i+ @: e3 x" J& X& ? - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 Y! L( C( ^5 U/ o, z8 C0 C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ q( b2 E0 t( K7 Q7 s
- . Y$ A0 }. I1 G9 I, M
- dma_addr_t dmaphyssrc1 = 0;
6 ^ z' y1 E8 ^ - dma_addr_t dmaphyssrc2 = 0;
: e, w: V( H( M5 _ | - dma_addr_t dmaphysdest1 = 0;
# ^# Y$ ?) B3 e. H4 g! o& M' r- ^; E - dma_addr_t dmaphysdest2 = 0;" D3 m4 [; f i7 w- s0 r! t
, I3 ?# E' Z7 |- L2 o( W0 f8 Z- char *dmabufsrc1 = NULL;/ T) E' C) z4 V% R9 }* f; T
- char *dmabufsrc2 = NULL;( d: W! S. }6 ^' K
- char *dmabufdest1 = NULL;, i/ ~' Q. h- v, Z, Z
- char *dmabufdest2 = NULL;
2 h# k" j+ I9 t3 G& d2 q; P/ P - 0 { e* K! P) O
- static int acnt = 512;* L* z$ T8 o7 Y) A/ s& f7 o
- static int bcnt = 8;, n3 W) l5 B/ b7 ^) f
- static int ccnt = 8;* X3 w& b" G2 J3 C% n
- % w. T5 J" N* p/ P; J3 C
- module_param(acnt, int, S_IRUGO);, b& p$ ^9 i9 S$ y6 V
- module_param(bcnt, int, S_IRUGO);
& y/ t) u; {9 x - module_param(ccnt, int, S_IRUGO);
复制代码 7 R7 O* w! U$ t/ r/ \& [4 ?8 L4 I3 K A
6 X( b) ] [5 b$ I 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 f& ?# r5 r9 r! earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 m: a0 l( N8 F
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ l( E D. J0 Q6 d& f0 R
5 V/ } R W) k% r0 F- m" e3 Z, a
- i; i. e8 c+ i7 O0 _$ G( V |
|