|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) F1 q) y% L, T. V0 ~: v# Y4 M- [code]EDMA sample test application
" p2 Q9 p! {' a# j/ d, {$ _ - /*
4 e* c! y7 s! ?7 T2 E2 B, G - * edma_test.c
# y7 @3 @. Q# h6 E9 X6 l) P - *
! u7 C6 a& a) o5 N& }1 {' d+ q - * brief EDMA3 Test Application
) V2 F- A* ^$ ~# I% V, I9 g - *
8 H8 b. Z% S: E, l) u$ f - * This file contains EDMA3 Test code.
6 O. Q8 O9 [& k M& z" u - *, P4 U5 b1 G4 I7 P% \0 h, \$ ~2 z+ r
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 ^, v0 E( n9 D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 y- z. ]1 T3 S3 |
- * TO CHANGE.( U6 y( s& v1 j! I* A' f
- *! x7 B E5 ?/ P1 u
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: Q ]2 X5 s+ E - *
( M0 a& ?1 s* ^9 c& y# L3 r5 Z; H, E - * This program is free software; you can redistribute it and/or& C, Y, b* u+ ]: O4 V! c: _2 Q
- * modify it under the terms of the GNU General Public License as: P7 K2 ~* p! U# P
- * published by the Free Software Foundation version 2.
( I$ o+ e- v8 A, W/ I - *) |3 t' e. p p: L1 D3 l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: F, Y D) F6 m; k - * kind, whether express or implied; without even the implied warranty" r; w) ?: c) j) o5 n
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) c/ W2 d: B2 \% ]- a. F
- * GNU General Public License for more details.
! }2 d6 M* K& p& } - */9 Z: n4 P8 r! |# [/ A
{8 x7 ^# n) h T- #include <linux/module.h>
% ~" p, J3 \; q( ~* L: l - #include <linux/init.h>) A8 m2 V0 l ]! c
- #include <linux/errno.h>
3 M$ [ X. ?; n: z+ Y - #include <linux/types.h> u: G6 d+ D# w- ]6 Y
- #include <linux/interrupt.h>, ]) d& O+ Y6 X0 X" p
- #include <asm/io.h>4 ]# \8 l; j0 h
- #include <linux/moduleparam.h>
( y/ R4 N/ `+ r - #include <linux/sysctl.h>3 K+ i& [3 d/ a8 k+ a) T
- #include <linux/mm.h>
' ^/ V0 n% G ^8 c9 v& K; C) Z9 ~ - #include <linux/dma-mapping.h>8 v; W# H5 C1 r2 \/ C" U
- 7 W, ^& c' i7 X5 c2 f$ v, f$ n
- #include <mach/memory.h>! B* H6 }2 \5 a) H2 J/ X
- #include <mach/hardware.h>+ v1 c+ }# L" J! w# i3 m8 U2 z0 v
- #include <mach/irqs.h>7 N( v. L3 n) n) Q
- #include <asm/hardware/edma.h>
( I. N& {; h0 a% b
8 {2 b$ J( d- f- #undef EDMA3_DEBUG
: {! s, _' W ]' t. |6 B1 k - /*#define EDMA3_DEBUG*/( n$ H1 Y. c) ~, m9 Q8 l; O7 r7 [: e) ~
- % w5 F$ o; ~3 _
- #ifdef EDMA3_DEBUG2 v! u4 a/ s: \3 O6 \0 Z# R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 O5 F' K3 g8 v5 Z! X- u; F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& x. q. X8 a% [1 \- R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- I, n' c( r% D5 J
- #else9 g8 g. K2 x0 G5 C* P1 U2 B
- #define DMA_PRINTK( x... )
B% U, a* L+ {, A) `+ h! x# S3 ] - #define DMA_FN_IN( y: E' J5 y; h: ?
- #define DMA_FN_OUT3 X/ m% \' ~# y5 d% A1 m. J
- #endif1 z6 s M3 ?: }7 t3 e) a C
% e( u9 C. Q- T% a- #define MAX_DMA_TRANSFER_IN_BYTES (32768) q$ j/ r7 g2 Z1 B
- #define STATIC_SHIFT 36 O/ m! S. {5 R1 h; p
- #define TCINTEN_SHIFT 20
$ u! Y7 _5 [# G; L - #define ITCINTEN_SHIFT 21
+ N/ Q8 F; w% A% c- @( @" Z" w - #define TCCHEN_SHIFT 22
! s3 i" U, E0 H+ _; I - #define ITCCHEN_SHIFT 23
: _% ?5 O& h' O' d. t; t
. w) w; A" B k; A) m1 m2 h1 ?$ `- static volatile int irqraised1 = 0;
( W0 ~& ?- u$ k' U - static volatile int irqraised2 = 0;# k0 `8 d2 _2 F
- , t- X% k: B$ F; V8 l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" |& Y! U9 ?5 _- s - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 M8 G9 M0 B( _& O$ V" _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. L1 S( E. r1 G0 |# t
- 2 G! c/ L2 ~9 G3 R
- dma_addr_t dmaphyssrc1 = 0;, F5 ~) x; V8 z7 n: p
- dma_addr_t dmaphyssrc2 = 0;
1 b9 x7 T" r4 V# J8 ` - dma_addr_t dmaphysdest1 = 0;
* h% B7 r& E) I, [+ \ - dma_addr_t dmaphysdest2 = 0;
, I; V7 M" e2 F- K( f
+ q H5 ^! N) u- char *dmabufsrc1 = NULL;" Y, w5 A8 J% k0 G( u
- char *dmabufsrc2 = NULL;
) |' `% U6 m x0 R - char *dmabufdest1 = NULL;8 r; W3 K% Q" T
- char *dmabufdest2 = NULL;
4 r2 w$ D5 P% o6 ~' O/ J - & b& G5 j9 t! X% q3 O
- static int acnt = 512;
d" m: s7 D$ j - static int bcnt = 8;
2 {2 Z. A- P1 H3 I- |0 N1 U* w' ]" a - static int ccnt = 8;
* [* F2 o! R. K, z( m% _, b" B8 e% ^ - , o% k4 n$ J8 J7 s; g& [* d* n
- module_param(acnt, int, S_IRUGO);" m0 t) u# ~% \2 B8 M: }
- module_param(bcnt, int, S_IRUGO);% m4 }/ }3 D; b" ~
- module_param(ccnt, int, S_IRUGO);
复制代码 ) F* D" j/ `( l3 \% z0 C
3 Y/ u& M- i; @& X d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% x/ I7 t6 |* T- ~: J. Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 K/ [- z) L% |1 b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" i' \# A7 S2 |
5 k5 I4 n5 B" l0 d2 x1 h# l7 Y9 i J) W0 R4 G$ x
|
|