|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) C( a: ~$ a/ J; p4 U- [code]EDMA sample test application
/ |- K l- c( L! P3 a: H - /*6 h" ?4 z% H" K8 m
- * edma_test.c( D5 R; G: O+ O+ d& i1 h
- *
. _5 u% p2 `0 B, f5 T% m3 M - * brief EDMA3 Test Application5 ~5 q. }& g8 v3 ]: B1 Z
- *
4 o) Q6 j( r0 i9 A# Q2 W - * This file contains EDMA3 Test code.
0 K8 }8 n( d- Q1 A - *; S: D3 h7 i. r( }( J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 Z! i0 d0 }5 }& u* M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) I8 m; z2 S" k$ y2 J5 C- w - * TO CHANGE.$ o5 i* O6 h; G/ b
- *1 j/ [ t& u; [, D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* N. `% y, |# N a - *
* Q, F+ Q( c$ }. V - * This program is free software; you can redistribute it and/or8 {. J* }# V! P' w; e
- * modify it under the terms of the GNU General Public License as
& b9 @# S3 X/ b" x/ H - * published by the Free Software Foundation version 2.
9 c& Z; P3 y# M0 e - *
! E* \! n A1 u3 r9 o% H8 C - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& D& I1 p% X! t - * kind, whether express or implied; without even the implied warranty3 Y# n$ C0 Q! s: {) T1 Q2 q# @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ @ N2 l% y+ K& j5 R: r$ P - * GNU General Public License for more details., V3 Y; L0 `" q( T& e- R1 G% K
- */
0 K' [" ~: a1 C6 {* } - 9 o6 H o6 e( {+ e. c/ ~: P# K
- #include <linux/module.h>1 p% v4 O8 E2 J# s
- #include <linux/init.h># U2 W1 x( q# z5 n1 ]3 M# I: ]
- #include <linux/errno.h>8 _; t4 h2 {" t: t& i/ o7 G) ]2 s3 g
- #include <linux/types.h>3 E! r4 A# y6 ?' A3 x4 L
- #include <linux/interrupt.h>
( n1 U) H9 A) I0 ?' O# f# @" V - #include <asm/io.h>
5 v5 o2 r- Q9 R) X9 U. ^* | - #include <linux/moduleparam.h>
1 W V" ?2 d3 u/ K) q' ?! e# z - #include <linux/sysctl.h>
5 d! d1 q; m# T' N% ? - #include <linux/mm.h>5 {7 ~5 Z* V+ b6 J( ]
- #include <linux/dma-mapping.h>
: x8 s! @" d( S
. c$ R3 i! `" T6 d& R- #include <mach/memory.h>) K2 y" y. x' j' c
- #include <mach/hardware.h>( V" J" l: t, w( s9 C# h% o
- #include <mach/irqs.h>
9 q W1 S; b- }$ C - #include <asm/hardware/edma.h>
5 |1 O& T- y; n3 t' G- h - ) ?; l& }1 W& Q4 x. U
- #undef EDMA3_DEBUG
- k6 x0 g. g2 u: M$ r - /*#define EDMA3_DEBUG*/
. J% H; E* B. f2 F - 7 V. `6 ^# \! E
- #ifdef EDMA3_DEBUG' E3 D! z m3 w9 h* ~) S l3 B
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 _- |, N3 t/ M- t5 X) B6 C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 N4 @! A U) Q, M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 C% r& ~! \5 E0 M
- #else" I: y9 U8 H; h9 E7 W& `' K9 h
- #define DMA_PRINTK( x... ), P; o& L9 l6 j! J
- #define DMA_FN_IN- o# t# \4 F v* ?3 n% @) o
- #define DMA_FN_OUT
' l5 b0 d9 t. E; o3 v - #endif+ ~6 k: T( E8 @$ ?4 ~, O9 w# K2 J' r
; _# H. y. y! P) D- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' x& `+ ]% P+ y& S - #define STATIC_SHIFT 3. G- _4 J5 }, O
- #define TCINTEN_SHIFT 20
8 S( M3 g1 }. [; }5 X" D5 A - #define ITCINTEN_SHIFT 21
! m. B7 T' P4 j4 N, n P - #define TCCHEN_SHIFT 22* I# }8 R9 x9 v L. Q
- #define ITCCHEN_SHIFT 23: ?0 k2 ~, o6 c* c! k5 I9 n. h# s
- ; e( K1 [+ G% _6 w" a, w7 T
- static volatile int irqraised1 = 0;
& |; O+ ?+ z+ Q4 A - static volatile int irqraised2 = 0;$ l8 D0 @3 C3 g4 C& h
3 J$ Q: W; C4 X& l+ [4 }; \5 T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 C) n6 n5 E, t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" U9 Q7 T" e9 v5 r7 S' p
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" D3 s# f9 y# N. q
- 7 z8 V! h; c s5 @$ _) s0 S
- dma_addr_t dmaphyssrc1 = 0;) [& H; p+ D: n# T: A/ n L
- dma_addr_t dmaphyssrc2 = 0;
5 Q% m5 V) q4 T/ J) d: q! { - dma_addr_t dmaphysdest1 = 0;
- V% b% U6 v) M0 `( r8 o - dma_addr_t dmaphysdest2 = 0;$ G2 A/ m1 y8 M8 N1 F2 Y
1 O2 z, S0 N3 Q* o- char *dmabufsrc1 = NULL;' G; v, V n$ t1 Q4 m s
- char *dmabufsrc2 = NULL;
- f6 V y Z$ Q! _5 O( G - char *dmabufdest1 = NULL;
2 L: k/ S9 A! V" X% r9 B. w: ] - char *dmabufdest2 = NULL;
" m/ Y3 _8 n' h& D; p; F& k4 N
* j$ v/ Y' H3 n8 [& ~/ w- static int acnt = 512;
# O) ]1 K% w, H1 N% ~: W - static int bcnt = 8;
4 M8 w/ ~% D) f, t6 K - static int ccnt = 8;
- S$ k& K' [ N- s: H- x
3 p' C' c0 h* y4 {0 {. T- d- module_param(acnt, int, S_IRUGO);5 H$ D5 ?6 S5 i/ r$ ~7 f' I
- module_param(bcnt, int, S_IRUGO);
1 q' }1 u- a; L! [+ _ - module_param(ccnt, int, S_IRUGO);
复制代码 5 Z" D3 F0 [1 |6 E
6 i, x; Y+ v$ Z$ G
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* p6 M [+ N- N$ N; _# X1 I" D/ k$ H+ L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 H; o: t. @9 n7 _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% h( J; W/ k k1 i: A
2 U z" l+ ]) Q3 @8 _' M9 g; J$ b9 q4 ?; E
|
|