|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 a4 m% W; j7 B% y( \6 M- t* ?# d- [code]EDMA sample test application
, g6 h" {+ n: D' c - /*" T# }: Q* v+ ]" w
- * edma_test.c/ t6 m6 Y6 b1 ^5 X
- *
9 `% C8 c$ q6 w+ P7 d' j - * brief EDMA3 Test Application8 {9 y: {0 v0 Y
- *: T0 q9 v! s: G4 r2 u3 \/ F
- * This file contains EDMA3 Test code.$ T& j6 b \' @8 U, U4 V8 O
- *4 N- {9 [' Q- o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; F2 i2 x3 e' k( o7 B/ }% z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 }9 {/ {6 J' n& g, ^/ R - * TO CHANGE.
5 |5 J" k5 F1 _5 J4 r6 f( | - *
; `& z! P, ^6 J, S+ y# r - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; w" A/ [5 |% r7 ~. A. U) g8 x- [ - *+ j# z6 k8 H( X9 D. E4 x0 L
- * This program is free software; you can redistribute it and/or2 g: Y% r8 d6 V
- * modify it under the terms of the GNU General Public License as" z1 P% ]# N# x4 }7 p
- * published by the Free Software Foundation version 2.* p2 Y9 M w' k; b$ s/ x! {
- *, r. E8 A% P' b }: w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! ^# N% ?5 u5 {6 g) Q, h5 C
- * kind, whether express or implied; without even the implied warranty
# @7 b+ t* C' m' Y% x - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# {+ d# u c M" k( X1 n, Z% L7 L6 @
- * GNU General Public License for more details." u l* m- o6 Q% V4 g
- */
1 ~2 z# x9 K0 z0 D
$ z X2 y- ]& z- #include <linux/module.h>' F3 M& R, _! V ~, x- u
- #include <linux/init.h>
1 B: \& x% e% D" ~ p* _2 E! L, F a, E - #include <linux/errno.h>
# N! j6 y% M9 ]3 k: d' {- ?+ c) m0 ~- q2 ] - #include <linux/types.h>
3 y# `, J% c4 r/ K& { - #include <linux/interrupt.h>2 y$ Y; K) V5 E) G, l" h
- #include <asm/io.h>5 t9 [$ g3 }9 B! \5 {
- #include <linux/moduleparam.h>! X9 U2 h0 M2 D
- #include <linux/sysctl.h>
2 p. i4 M; d9 L4 N2 ^$ P - #include <linux/mm.h>5 r/ ~2 N8 f p, V: n( q* `
- #include <linux/dma-mapping.h>
5 {0 `; G& C/ E
3 W1 e* z1 d, V- #include <mach/memory.h># p1 Y2 S0 Q9 {# d" X, y* h# K7 q
- #include <mach/hardware.h>
$ S& b( _/ z% Y/ N7 O- X" ?- I - #include <mach/irqs.h>/ F# H7 u8 L: b) e# N3 j
- #include <asm/hardware/edma.h>* W: l+ ]; C! J2 z8 j6 H
- , `; I4 s* v& L5 T# }- N4 o# B: {
- #undef EDMA3_DEBUG3 B+ m- P2 d! W2 {0 B
- /*#define EDMA3_DEBUG*/
7 b( j* S. T. y# X9 A3 a/ L - # H# l) f) X" Z
- #ifdef EDMA3_DEBUG) ^: g) n# A c7 P% `# Z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): E$ q1 x! k- a( D) _
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# T7 `; w9 {. n8 I" d - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
O2 y# J G. y0 Z/ ~ - #else
# N8 F( y) j N) k - #define DMA_PRINTK( x... )7 ^- Y2 \! T3 H; H2 C) \5 Q
- #define DMA_FN_IN
. V. O( q/ X$ |$ J1 u7 v- g" ~& d8 G - #define DMA_FN_OUT
0 X, ~, v9 V1 u4 F; i8 E - #endif
) L0 Z( r* p) s$ F6 {/ K - , \+ g7 j5 b( y; g) e% @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
g8 ]6 t5 e, N. A3 U4 N8 | - #define STATIC_SHIFT 30 @/ m7 W$ V5 L# P+ [; K6 t1 ~9 ^
- #define TCINTEN_SHIFT 20! H+ v. u" n1 F L/ G8 L6 J
- #define ITCINTEN_SHIFT 21
$ j/ z, [5 m% @6 F& B - #define TCCHEN_SHIFT 22( q1 |- D" {/ Z- Y
- #define ITCCHEN_SHIFT 23( j+ c. {, {# h$ c8 f& y- F5 k( ~
- 0 j2 }! i1 D* H; N! |
- static volatile int irqraised1 = 0;6 X8 G- K% K9 y+ A
- static volatile int irqraised2 = 0;6 f+ v& l3 ^# C, ]) c
- 8 H; [4 l% U6 @
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 c+ y4 ?" C5 i7 H/ S* I1 @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) c( {7 `0 J2 @* U; z2 g& O, L( j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ V8 f* ^" S5 S; i, v9 N
- \1 t: v: C/ H0 c- dma_addr_t dmaphyssrc1 = 0; G" Y' R2 ]) }. _( f
- dma_addr_t dmaphyssrc2 = 0;0 i4 ]* H# ^- Z! V9 N/ ^
- dma_addr_t dmaphysdest1 = 0;! V4 m7 \- i, E) u7 f, \5 ]
- dma_addr_t dmaphysdest2 = 0;9 R3 Z! c! ?8 K% L
2 W: ^6 ^; c$ ?- ` P* ?( K% A: l* X- char *dmabufsrc1 = NULL;0 A# D' r# K! B( w$ J( z3 i5 g
- char *dmabufsrc2 = NULL;* K% d* h, D% T8 U3 a, M0 y0 B; X
- char *dmabufdest1 = NULL;5 L Z4 W5 T# H) ]/ o
- char *dmabufdest2 = NULL;: H* v1 q' n& r8 p
- , n& n8 H0 ^3 c# w
- static int acnt = 512;7 c0 ~6 y& E: g! ^/ W
- static int bcnt = 8;
+ N7 z0 T1 h! o7 e! G5 ?. a - static int ccnt = 8;( K* [) e5 c: z4 b8 w$ _
- 0 S" G( I5 c' C% ^; e* N$ S
- module_param(acnt, int, S_IRUGO);% _! \2 H6 T3 e/ @. `% k r
- module_param(bcnt, int, S_IRUGO);& z! U# ]: n: L# r' I! y6 g( x& A
- module_param(ccnt, int, S_IRUGO);
复制代码
6 z" v, X: K& u- ]! F, y
7 O1 k+ s& \$ x& M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; T# ^. E0 h8 V7 U$ {$ Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' g2 _- m' s4 l1 x7 C7 u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 ^0 F; W. O, o# F) \' T5 I# H# k) C! ~! J
: ~; t8 u+ k/ j# z/ @* @
|
|