|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% c3 a; _7 t6 G0 N4 ]5 S; E& W- [code]EDMA sample test application0 }) d% U3 o! K4 R8 S& {) _6 F
- /*! A4 T# o& d D# d. h( s( z/ ~2 h/ g
- * edma_test.c" L `6 D' X4 M$ `' y7 }
- *
7 J* c. C7 K; r; D: G - * brief EDMA3 Test Application( s4 x3 B, f8 T r) @. n) P: t
- *9 `8 @5 W$ X9 f4 U% s! G: G @
- * This file contains EDMA3 Test code.
! _# b/ V9 T4 _7 t L# o$ C9 R - *
! N1 o2 ?+ _. J) ~' K5 c# I( W: r0 u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 u8 ]7 ~. s4 n' }1 i9 P - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( a% h4 M: }1 V+ ^/ P
- * TO CHANGE.
0 L) [6 |5 J6 s2 l- E# W% Y6 q' J# o8 K3 M - *
, j% r& `1 O- |2 C6 m/ W7 L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- r. I" z" v( i - *4 B- S( s( s$ |( a, L! h R) \! Y
- * This program is free software; you can redistribute it and/or1 G ?1 ^$ h8 }
- * modify it under the terms of the GNU General Public License as! {5 n8 T$ t$ b; W: M4 g" s
- * published by the Free Software Foundation version 2.! A! e$ E6 B8 K }' `1 R
- *
; F1 u Y; `! A3 [ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& L# M$ {7 z6 D- ^ - * kind, whether express or implied; without even the implied warranty, J1 _( m! T3 ^" \7 S* I. J' W
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ G! }3 o4 F5 j# N
- * GNU General Public License for more details.
1 Z- z% L3 e1 B# ^ - */
! V8 J- \9 ]- p! ]5 C1 i- `) y
# D3 s, g$ _/ R9 D7 a" m5 S- #include <linux/module.h>' B5 P& d. |: {6 J" J, U
- #include <linux/init.h>
3 @3 n( V2 M% V9 u - #include <linux/errno.h>/ D/ J! N# P- m7 ^% f
- #include <linux/types.h>
7 m5 j7 [( B" d( L T - #include <linux/interrupt.h>
, l8 b& R2 f7 v( o; M% X - #include <asm/io.h>5 V; ~( c* Z' r Z4 k4 Y* ^
- #include <linux/moduleparam.h>+ h% p: N4 Z1 ~9 E% `) y% V
- #include <linux/sysctl.h>
* ^6 V1 `5 u6 p" n& ~ - #include <linux/mm.h>! c. {) e: d; ^$ A6 w9 t$ A
- #include <linux/dma-mapping.h>
& \( u' J+ k1 x# D- i8 P8 ] - ) k z' |. D+ \% c
- #include <mach/memory.h>
- o4 e% M1 |* |8 k8 ~ - #include <mach/hardware.h>$ a. {% ~9 v4 b8 `
- #include <mach/irqs.h>5 D2 R! ?( ?& ~2 @8 {
- #include <asm/hardware/edma.h>
8 I) m- w* O4 W$ L# {
1 b: W6 `9 E5 R. B- #undef EDMA3_DEBUG; a: ?% J: |* U9 `; k
- /*#define EDMA3_DEBUG*/6 a3 ^. I U% q" N9 M& f0 D
0 @; n; i: U7 \$ w8 ^- #ifdef EDMA3_DEBUG1 u) s8 a) _ b2 c! e! O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 I# l* p, O0 o1 Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 s; y8 R' O) [# k/ I$ j" ?0 @# T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 D: w' A+ r) P' O, E - #else( d" J2 S. k. c$ j4 [, P; n, o0 z
- #define DMA_PRINTK( x... )
. m* A' B% O/ B, }( y# g - #define DMA_FN_IN% u# p6 s! {, B" h$ f
- #define DMA_FN_OUT. j& }1 X8 F* M& a8 j0 {# _4 E
- #endif
* J7 t) r$ d4 O' ]) V2 H7 j - ) x- j, k/ s' y. W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ q" y4 @# ~9 a/ K W x - #define STATIC_SHIFT 34 h# P6 a5 k0 S
- #define TCINTEN_SHIFT 20
1 u- h( {% m# B m" d- x - #define ITCINTEN_SHIFT 21
F8 M$ `3 [! |' H$ ], P2 T! G - #define TCCHEN_SHIFT 22+ n5 O7 g" E B/ V( E r5 p
- #define ITCCHEN_SHIFT 23
) {# ?4 ], I: d7 {9 W3 n# @ - # G1 S( Q$ `, x5 ?% X% r* l% R
- static volatile int irqraised1 = 0;& H4 p! P) h9 a
- static volatile int irqraised2 = 0;$ F5 g0 i: u, k1 R
1 T8 N# N( E$ k5 J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, C( Y8 D3 P% |8 A6 q1 B: [+ Z9 U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 o. @6 C% R2 ~( t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; i0 c! ~* P' w; J7 \0 U( C
# j. D4 \5 X) W+ `: T x- dma_addr_t dmaphyssrc1 = 0;
5 H7 g1 F4 y; c; v - dma_addr_t dmaphyssrc2 = 0;
. Y! O: z2 v4 z6 D8 S - dma_addr_t dmaphysdest1 = 0;' I: b) h5 l8 g$ m0 ]6 U) K. H8 z
- dma_addr_t dmaphysdest2 = 0;
% ~; k' }6 b" ]
, i/ t$ g) k- ^3 e% F, q5 D- char *dmabufsrc1 = NULL;
( g3 B. d, \( r: \* ` - char *dmabufsrc2 = NULL;2 n( H* a) O1 u. E+ E
- char *dmabufdest1 = NULL;8 F7 c0 M: _) c# u- r% [
- char *dmabufdest2 = NULL;4 n/ `+ `+ \% d- \6 b
! R9 m& j, N& \- static int acnt = 512;
2 G$ n3 e1 V3 O - static int bcnt = 8;0 ~- W; C" L5 V
- static int ccnt = 8;
' ~( ]- d) e7 C( f) t( E7 ?
8 U8 M; {5 O' I e- module_param(acnt, int, S_IRUGO);
3 D4 H4 v ]! l) ?7 c- b6 Q$ V* J v8 k - module_param(bcnt, int, S_IRUGO);( s0 d5 q, W, [
- module_param(ccnt, int, S_IRUGO);
复制代码
( }5 r) s" P X& l. W' n' h6 U* M; F) x
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) o& i& L! B6 Z& ~+ k5 Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 r7 U& N: a6 Z% e. N0 E# o. \2 r" O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ m* N9 K- q; x. v' q! j8 ?0 W6 I j/ D6 f
7 w$ p/ c" N. `0 ]
|
|