|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 W% e0 p: G: E3 T7 Z; h
- [code]EDMA sample test application b6 Y: g7 E& Y
- /*
) N# ]! t" w4 P/ L; ^ - * edma_test.c/ ~! x( v9 J2 N3 `- p
- *1 g6 T& r1 T; r1 F) J: B
- * brief EDMA3 Test Application- l" E! X' P1 t) e- j
- *; f6 J6 A& ~. W0 M0 c
- * This file contains EDMA3 Test code.
& R' b. Y$ m5 \8 F% w! l - *
H! W( s8 W; f" B9 k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' u8 d% x8 t/ [+ V# f/ o7 k0 w - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 E7 _- N0 j* s7 k, n
- * TO CHANGE.
8 j- v3 F! D% E4 a5 B1 }! S- j - *
0 y3 @0 U1 V. d$ K t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 K; j# \( d! u) s) C
- *
7 K/ k* \' h! Z - * This program is free software; you can redistribute it and/or
% K7 a/ y6 k: m' `% e - * modify it under the terms of the GNU General Public License as
. ~. q" L. r3 U4 q. E, R9 X - * published by the Free Software Foundation version 2.
8 @) p- p, a8 ^. H4 v8 x, q$ | - *
; |* s* V$ u( e7 j- U7 g5 v; D - * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 c n7 ~- w5 P& i5 Q) J, {+ P
- * kind, whether express or implied; without even the implied warranty
3 B& t$ M; P0 ] r) k7 S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 A/ Z, r8 |3 s# L
- * GNU General Public License for more details.
; t% [8 O. j* W) ^8 G( f* s - */2 p" e9 y/ E$ @3 O0 t i3 T
- 8 W+ P! J' @! D# G- i
- #include <linux/module.h>4 G8 r1 U& I: ^
- #include <linux/init.h>2 r7 ~3 D, a$ G2 @$ ]( E/ p: j: I
- #include <linux/errno.h>- g# ?" d! b, y8 f2 T4 V9 G
- #include <linux/types.h>/ Q2 u3 z" M. h5 c
- #include <linux/interrupt.h>4 Z. Y( |! K% s& v& J8 v
- #include <asm/io.h>
1 s! g. ` S! S4 P n - #include <linux/moduleparam.h>
' W% O7 p9 y0 J9 z- {! i1 N - #include <linux/sysctl.h>
- X% s) j( }, f/ w0 V; {5 i - #include <linux/mm.h>
p! R( a( p" V) K) V - #include <linux/dma-mapping.h>
, K9 s# [0 l' @3 _' \
# C, O; F- g4 ?* ^- #include <mach/memory.h>
0 K' t8 |2 J0 q5 z! r - #include <mach/hardware.h>
* Q- A7 E6 F! X' Z/ P) c - #include <mach/irqs.h>
$ N7 T! Q% S$ k$ B0 [! @ - #include <asm/hardware/edma.h>
, R! z; E5 N: d) C - . V7 F2 T& K' H# ]* k y3 D# ]+ b: @
- #undef EDMA3_DEBUG
1 ]* L* P+ P9 ]1 ^. ~. C - /*#define EDMA3_DEBUG*/, ~- P( F0 R- O/ P) c1 `
* u% T! ~1 y! B. t# B r8 q- #ifdef EDMA3_DEBUG1 I) i" Z& p4 a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& g; D, F; ^ h! Y6 \
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( x3 H0 C! E2 b$ E" \( C' U - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# d; s1 k$ |. w# V& p" c3 \0 x/ C - #else7 S2 Z' }+ R7 r. |2 v, h" a
- #define DMA_PRINTK( x... )
) \2 D6 { O0 J" U/ L: ? - #define DMA_FN_IN6 R, C" i2 ?- R7 Y( U% a `
- #define DMA_FN_OUT
: c% M, N' }- ^) Y - #endif
: j- S G! @- f ]6 V4 p) z - ) y& ~" O- R5 K v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 b( X# K/ _# L! E1 @ - #define STATIC_SHIFT 3
! z" L5 b7 |$ u" n2 G' k - #define TCINTEN_SHIFT 20
) k, O" E* x. V+ ~ - #define ITCINTEN_SHIFT 21
! d8 d+ b& G% B" d' b - #define TCCHEN_SHIFT 22
$ a# R5 G9 C2 Q - #define ITCCHEN_SHIFT 23/ O; ~$ U- V) Y) O" I% R6 l& J
! v# {4 h# D t5 Z" l- static volatile int irqraised1 = 0;
" L9 J" w3 g' N D6 f0 |% j - static volatile int irqraised2 = 0;
9 F" j6 l- p# i" F8 D0 r7 I; a - P. u: `( e- }: i1 J4 I
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 E- h8 A5 m, k3 g% f* p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; `; ]5 N" U9 L( D6 A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 ^# T3 G' p9 w) V1 U
- $ Q4 d! O. ^7 h, ?/ q. Z4 K" i
- dma_addr_t dmaphyssrc1 = 0;" C6 D- n. b% [* u* W
- dma_addr_t dmaphyssrc2 = 0;
2 Z6 C( Y" ]5 z/ d - dma_addr_t dmaphysdest1 = 0;
& y5 l3 O+ ^0 d5 G1 N( [ - dma_addr_t dmaphysdest2 = 0;/ w$ W( u, o) {5 b/ @. j- g1 h
- : C' H4 f8 k% q. S5 q8 q
- char *dmabufsrc1 = NULL;8 L9 X; h$ ]/ [. p4 B6 P0 k# P
- char *dmabufsrc2 = NULL;4 s$ ]$ O6 H& u% [- F8 i5 }
- char *dmabufdest1 = NULL;: n1 h& c; L; Z7 I4 [: @
- char *dmabufdest2 = NULL;2 c* r/ \1 k3 g1 [
4 k( o G" j+ R$ M; [- static int acnt = 512;
+ T: B+ G* ]1 |5 k. F+ x - static int bcnt = 8;
9 D4 `- [+ P# \9 j6 q% ?/ C - static int ccnt = 8;
8 D, ]) u0 u; w" V- z$ g5 ^
3 A t* L C- Y7 D8 h) q- module_param(acnt, int, S_IRUGO);+ p$ {3 m( C: U6 ?+ d- f, C
- module_param(bcnt, int, S_IRUGO);, k: r ?' K6 w# n2 V3 G4 l
- module_param(ccnt, int, S_IRUGO);
复制代码
' _* |! t! ?4 S K0 B: d# R1 f" D
; ~# h7 Z% k( V; E( {6 V6 T 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ g7 U! ?( q# m0 P$ yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) n" t" m, W, O5 n2 H: D5 K6 m 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 }1 w# ?' Z9 k2 D
% t& h& |) }/ p4 n5 j) p/ t. {; ?8 P+ `
|
|