|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 @0 s; ?' O/ x/ s F
- [code]EDMA sample test application
, w8 U- A% w% B" r, P/ T - /*9 g0 |8 ~/ H, V
- * edma_test.c# ~6 {% T5 x0 r$ t5 Z' p
- *2 @$ y' Y0 N- x
- * brief EDMA3 Test Application8 f* q4 g* l: i- c1 O$ E5 f" B9 @( U
- *
! g& u3 X2 [# G& u9 G! m - * This file contains EDMA3 Test code.
, n# D* u# ]9 {3 h - *
/ j: P0 G8 X j! y, } J - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# }; A- s8 Q2 t; J! w3 x* Q" g) y. f
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" j1 g+ f3 m. K6 v( t8 N; D6 p - * TO CHANGE.
$ N# ~0 }3 d$ f9 I6 u - *
! n, o- `: R) W, Z# `9 ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% R+ \; q/ M& H! b* f - *
6 m5 F5 L2 f \2 L { - * This program is free software; you can redistribute it and/or
# _5 K. u; b; G4 S- K - * modify it under the terms of the GNU General Public License as; c: h+ i, D8 H- N8 _
- * published by the Free Software Foundation version 2.
* a- C, T- ]6 Y- [6 E, h1 C - *
5 ~$ p) S8 v& I2 a8 S+ L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: _1 |3 [8 }% W. K; ~8 K6 ]# Q2 b - * kind, whether express or implied; without even the implied warranty
0 C$ u# k" M: c' ?+ Z1 s - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 Y# J9 f7 B; @! o - * GNU General Public License for more details.
4 J- t. M. H# L) J3 e4 s4 } - */
" |: w/ e# Q- l4 x9 d( B9 l
o" |, |" n, G- #include <linux/module.h>
' }8 Y4 _# ~! A$ c - #include <linux/init.h>
$ V( H/ i2 o' r; N2 } - #include <linux/errno.h>
( l- K# @, Z' z: W7 }- i+ [& t - #include <linux/types.h>( T8 i( l5 m' T( b- x$ B3 B
- #include <linux/interrupt.h># E5 e* z7 ^! ~3 i
- #include <asm/io.h>1 d4 h# q1 _: }4 a: ^& ]- C- M! Z
- #include <linux/moduleparam.h> O: @% h8 S: C+ K f
- #include <linux/sysctl.h>2 M# A2 j' C4 p3 j
- #include <linux/mm.h>/ l) D( c+ d- h
- #include <linux/dma-mapping.h>
5 }8 v; z9 f+ Y" ?
6 L. e+ j. j$ e Y# e. i- #include <mach/memory.h>
- J w/ q: {& x& h' f - #include <mach/hardware.h>" Y8 X# D5 _' M+ n) t
- #include <mach/irqs.h>
" w: Z$ b+ D+ S w% y+ L$ ? - #include <asm/hardware/edma.h>9 L( }* c f5 D
) `) {% e" X, n2 ~4 H4 a' O- #undef EDMA3_DEBUG; R" O: ]& e: W" x0 D
- /*#define EDMA3_DEBUG*/4 j6 M+ t: K3 N+ v. X6 Q
1 G0 }6 J2 I1 t6 o- #ifdef EDMA3_DEBUG
# f, n$ H! z6 H: l - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' I9 u$ N% S2 \+ B2 g$ y9 T
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 C. |& p1 d" c e [9 E0 E4 e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( s1 `, b6 [* T, M: p
- #else: [; {7 j* u! y- H" d
- #define DMA_PRINTK( x... )& E' z+ b1 k1 S4 o! g
- #define DMA_FN_IN; b" t& N! r4 f
- #define DMA_FN_OUT8 S6 q; Y+ [' {" s. h0 A3 A$ e
- #endif
0 d) d. J+ A' i1 D1 v, {! }% K
5 }1 `2 I. }% K' v7 l" Y- \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' k( m. d. Q8 K% ~ - #define STATIC_SHIFT 3
& p7 I+ n3 C; v! c - #define TCINTEN_SHIFT 20
; O+ X) v% `- Q( R0 A" c5 B8 v, n - #define ITCINTEN_SHIFT 21
2 Y- B$ z. ?' ~2 `' H - #define TCCHEN_SHIFT 22
/ J. U- o ^7 n' }( M6 O' l - #define ITCCHEN_SHIFT 23
4 q$ c: w6 t, G$ ?
& U$ i2 }6 D" l, j. z0 K, o- static volatile int irqraised1 = 0;
# A# |$ J ^( A+ c - static volatile int irqraised2 = 0;
! f/ f) k8 U3 A" k
8 H2 H; r6 v+ f( S# t$ P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ d, E* B8 Y8 |: K7 }3 P - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 A! t8 }4 ^: r" A6 K2 N - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ H z8 b# N# A; D s - 7 M" ^. {& p1 w0 J; D& l
- dma_addr_t dmaphyssrc1 = 0;$ m( Z9 X1 k0 V4 u
- dma_addr_t dmaphyssrc2 = 0;
2 Q/ Z" `+ R, a! y - dma_addr_t dmaphysdest1 = 0;
1 {( I- S3 w4 Y& p, f - dma_addr_t dmaphysdest2 = 0;
4 t2 i) c5 j8 [3 |0 ]
4 o+ j+ X5 I! W9 }- char *dmabufsrc1 = NULL;
3 e; [$ {6 F! a' e# Y- [ - char *dmabufsrc2 = NULL;
" T! u C% j) K" l9 z+ V - char *dmabufdest1 = NULL;
$ y5 C/ { o B- M1 v - char *dmabufdest2 = NULL;& \& h/ C7 T% F' ^3 n
- 0 v; o" M, X. J" b5 E2 n0 r& p, T" f
- static int acnt = 512;% r [ `/ I! Q! z# y9 |# Y
- static int bcnt = 8;6 R( T4 b& {! s( U0 v i( j
- static int ccnt = 8;* P7 v0 l1 U& y; u3 c" S5 ]5 g
/ b7 F; w# t* Q9 {, v- module_param(acnt, int, S_IRUGO);
2 [9 S* v: E5 L) j - module_param(bcnt, int, S_IRUGO);
; k- D4 [3 q/ m$ Z - module_param(ccnt, int, S_IRUGO);
复制代码 % W' x6 D) }, K5 Y' }' d! S' e7 v
2 C" H2 Q8 X3 P( j! e 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 ^ v3 s# v$ ^' W5 M' g- Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ Z4 s# W3 e4 W
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 n8 m( [& y- c5 T" M0 a+ d, k( J* t A
- C! o& y6 ~) \" R6 Q |
|