|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " c* c5 [1 @% _( _
- [code]EDMA sample test application( K4 v1 J* D1 z
- /* D! u+ B" m( M V9 O$ S
- * edma_test.c
7 ~% h. `5 z+ `( q$ \; j# f" u+ J - *
z) ]" n' l# Z, T* s - * brief EDMA3 Test Application( y5 ?7 t, h, k1 i' N& N, n
- *
' ]1 G" O' `3 W# w" ?/ H/ q - * This file contains EDMA3 Test code.2 ]: H# Z: T& ], g G: a
- *3 v6 P. U8 D4 c. g/ T( \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
S: u1 \9 {4 _! {. z5 P; S8 \/ s( L: U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& Q1 U: t6 ~+ O# r S4 H& U - * TO CHANGE.+ R* J3 H- j# r7 o, v+ y
- *
( u& o6 l( N0 [' [' f7 s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& D1 S- G! N8 F/ C3 h+ Z) U
- *+ g3 W9 y/ b: F. v) Z4 H
- * This program is free software; you can redistribute it and/or
& D- K" ], R2 o" m* ] - * modify it under the terms of the GNU General Public License as
w$ s8 {; C- Q3 M1 w7 H - * published by the Free Software Foundation version 2.: d$ F! d9 c9 U) ^: v, B+ z
- *
4 \$ B( ^3 J$ @+ e( O' A: l% p* h - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" k/ S. e& s; e i( D2 Z
- * kind, whether express or implied; without even the implied warranty
& H8 O: f: H1 _& K - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 U- s, m/ L& g* s - * GNU General Public License for more details.4 K% h6 k: J. G
- */: U) b4 Q3 {2 X2 e9 A6 ^
4 T% z0 h, P( G' v! D5 l+ h& [- #include <linux/module.h>& i$ H! k& d1 E. s+ _1 J- m
- #include <linux/init.h>
1 i0 I! v n0 c6 n ? - #include <linux/errno.h>
8 T* X F. l/ [, G8 F8 j/ D - #include <linux/types.h>- p1 @# I& M' L! m+ A
- #include <linux/interrupt.h>$ Y5 m9 y& M- x9 {, C. S: a! T
- #include <asm/io.h>
: ?! k" y& ^; p+ i( X9 y) ?8 v - #include <linux/moduleparam.h>
8 b1 v/ G6 m. f" e - #include <linux/sysctl.h>
) W+ k F7 a; P) I: t1 Q# H - #include <linux/mm.h>. x" X( o5 a( w! S
- #include <linux/dma-mapping.h>5 k. ^8 C: Z/ K' Y, B
- $ v% C1 [+ V Q, k+ J
- #include <mach/memory.h>
- b! a9 B! p e5 h - #include <mach/hardware.h>' X1 m5 D# q) n: I5 u0 Q7 {
- #include <mach/irqs.h>
' f5 v0 X5 V$ \% @0 T+ s - #include <asm/hardware/edma.h>
- F4 A9 W8 a6 b3 N
2 S5 s! ^8 w+ h5 h- #undef EDMA3_DEBUG
: m, P0 J1 q5 ^: n" n |0 o - /*#define EDMA3_DEBUG*/5 E2 A! n0 ~! f% B( v, l) G, o
& f& P( B+ w8 }6 }4 m: D, n3 N- #ifdef EDMA3_DEBUG. a- T& l: I& {/ z! s9 ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 M' d3 |% l6 ~( J; {# M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ H; a. R, w U" Y8 c0 _1 K+ u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 M8 W1 T4 U1 J, H4 a7 ~ - #else
' G7 b! I. {* D - #define DMA_PRINTK( x... )* U9 s# l6 u2 u0 X. U. M! r
- #define DMA_FN_IN r1 [, i1 N+ j9 ?
- #define DMA_FN_OUT
4 k x5 R* J' q! V7 W - #endif3 f& F4 a3 Q- v# M* g; q7 u
- ! @1 T8 [$ D o! a; |7 y) r% l1 U2 y- o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). c4 P& u h! e( Q3 M
- #define STATIC_SHIFT 33 N- U7 y% h; r- U$ [0 y8 x. f
- #define TCINTEN_SHIFT 200 B4 {% C( b0 z0 `
- #define ITCINTEN_SHIFT 21
[ D; ~- R: h# b# x0 p8 U# {3 k - #define TCCHEN_SHIFT 22& T3 o8 @/ h* q7 K; j
- #define ITCCHEN_SHIFT 23! x$ [) o$ B" o) S* J- G1 [- s- h
- , N: y3 x& @; R. B
- static volatile int irqraised1 = 0;
/ S6 @1 T9 ^: o L0 D8 |8 o - static volatile int irqraised2 = 0;
# Z5 `; F- X9 z# `4 m! P
, h/ E! e' l7 a! ^3 F. z3 e Q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) R- M6 C0 F( i3 f3 `, e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, E$ ^ ]" |" v C
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# j+ T; k- A, ~" c) [1 G( L1 m2 g - 9 i& b/ a% B) ~/ S: o9 F8 X
- dma_addr_t dmaphyssrc1 = 0;
1 L( Q# [* t* K5 F: H2 `' ^ p - dma_addr_t dmaphyssrc2 = 0;% C! m8 v! j+ |* @) `5 j* V
- dma_addr_t dmaphysdest1 = 0;
7 L; G, P9 Y( K/ L& Y4 U9 T - dma_addr_t dmaphysdest2 = 0;
" T. C6 O3 D, j+ A0 C2 R( Y - 7 y/ D# w- \# _3 j2 C
- char *dmabufsrc1 = NULL;( m8 U; j6 u. S$ Y
- char *dmabufsrc2 = NULL;. n. ?7 x3 k, \# ~$ r& p
- char *dmabufdest1 = NULL;
% K- P( m5 Q: ], N+ R8 ]) l - char *dmabufdest2 = NULL;. ]- e2 g+ ^- L6 ^9 V1 C
- : p( N! ^/ P4 V6 E
- static int acnt = 512;" j6 O/ L4 f W$ Z$ O o
- static int bcnt = 8;8 H& V+ `! K/ I4 { A
- static int ccnt = 8;7 g5 _& z2 F: p
c5 O( C/ M" D8 o8 u+ S- module_param(acnt, int, S_IRUGO);1 k5 W: T- X& r$ X3 H2 Y
- module_param(bcnt, int, S_IRUGO);. Y2 [# a: ~6 k. L
- module_param(ccnt, int, S_IRUGO);
复制代码
. |. A- S+ R' P6 w. O4 s5 @
! K9 T' s1 K) }. ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ I) [" e# Z* b1 @' _/ t- Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- W. K( H- `+ S; g! R1 Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 {( h; P; v" f p7 K. i
0 X( e* c5 F* K: s
9 t( b3 J d$ E2 q |
|