|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 r& t8 q/ B. s8 P
- [code]EDMA sample test application: E% [, p* b; F- c- X$ Y' F
- /*! j) e Y7 E6 Z1 j2 J' W+ K( s
- * edma_test.c
* Z+ X+ l u: W - *
' ?" l6 W8 x l% S. `: H - * brief EDMA3 Test Application
3 Y4 N0 _$ f& B& o. v - *4 R2 b& R4 `$ p& n% w# q
- * This file contains EDMA3 Test code.
" O- o- A6 B' I& h' M$ W5 v' y' v - *5 M& M, @0 b5 {
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 ?/ z' P7 b8 ?' u! C# l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT }, ^3 {( k( I# Y0 U8 H
- * TO CHANGE.4 o/ y# O9 v+ v) J
- *
) b& H* C* y! {& y( H, d) M2 R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; ], C; y( L% d$ u+ L* w# B
- *
0 [9 }3 O7 p0 t! f* \7 p - * This program is free software; you can redistribute it and/or9 A* T0 O( X( u3 D3 e
- * modify it under the terms of the GNU General Public License as
9 a2 N% a- w+ o M( B) n% K - * published by the Free Software Foundation version 2.& w; e! A w# ]" a1 f
- *
8 _2 a" \3 v) n7 K. Z* k; v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 F4 |$ G) B; l" v' m - * kind, whether express or implied; without even the implied warranty: h+ _4 k6 l9 I3 {4 X8 p4 }
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the n6 E8 A2 X( d
- * GNU General Public License for more details.
# B4 v, `0 E6 h+ V8 q9 Z3 \ - */
* P1 {+ ^) u. x1 e8 p8 p# }6 i - : A' }' X: _8 s6 R3 l/ y
- #include <linux/module.h>" }+ q9 a. ]% R) O; F6 l5 o! ]+ B+ W
- #include <linux/init.h>& f' A$ p3 R+ K, K& ]8 h
- #include <linux/errno.h># j& |# Q7 F. v# \( e
- #include <linux/types.h>
1 k, s0 l9 V% k2 B, Z - #include <linux/interrupt.h>; x% m% i7 l. M) ~ G- D; o: A6 {! p
- #include <asm/io.h>
; M) u9 i/ R# } - #include <linux/moduleparam.h>
0 {4 t4 r6 Z' Y/ N$ ~ - #include <linux/sysctl.h>, k& m/ @2 ]( d* G! _
- #include <linux/mm.h>
3 }& u* S8 K' j0 n% X8 S - #include <linux/dma-mapping.h>
" q& ]* v9 o8 m; w7 ~& M
0 Q( h. X- h7 |: [- #include <mach/memory.h>
- Y! h9 R* j) O - #include <mach/hardware.h>
1 m! a5 u1 M7 ~ - #include <mach/irqs.h>, R( ^- L% c) w0 ]. e" a
- #include <asm/hardware/edma.h>7 w J& n: {7 v+ r! }
- : g/ A; M$ z6 E
- #undef EDMA3_DEBUG
( A- E6 N: \* \+ z - /*#define EDMA3_DEBUG*/
) Z. N. V' P4 a
! |$ E$ ^6 L. s E4 P3 C5 M/ ]- #ifdef EDMA3_DEBUG+ @& ~# I, z" ?1 V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- O! h: @( q4 _( n8 u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 P7 B6 Y7 ^, w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. E* v( j+ F0 @7 X. M V - #else
) Q5 Q" z3 t! ?) `+ B3 r8 f - #define DMA_PRINTK( x... )
+ D8 P4 E; k/ N, t. w) K - #define DMA_FN_IN0 o2 Q# w1 _$ i+ c. c3 q* `$ }- @
- #define DMA_FN_OUT
8 c; a9 r1 L4 V( Y7 q( `, q' J+ A7 R - #endif
. ^7 E( O( _$ `7 P9 k" v - 5 |; K; x9 m6 r# \( ~
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* J1 `2 l1 [, \% v! B5 ~$ P2 z
- #define STATIC_SHIFT 3
: y. C& {8 j5 A" Q$ x! u0 i+ |. t( C - #define TCINTEN_SHIFT 201 w( z6 e3 J4 V0 y
- #define ITCINTEN_SHIFT 21' Q6 z; g: w" ]1 D. L* \
- #define TCCHEN_SHIFT 22% h% q, w' L. A r0 Q
- #define ITCCHEN_SHIFT 23# i# x0 `' k( Z9 G! _, H
* x+ n: l( U6 J6 ?& n- static volatile int irqraised1 = 0;) s: y! u+ V* Y" @4 S
- static volatile int irqraised2 = 0;2 R$ W9 ^# G) U6 ~& W1 Q; l
4 M7 b7 z$ Z! X; V$ y( n- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' h! V, }4 E& F) e3 U3 t0 p
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( K- U8 n* G' t4 F$ r, [# a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 l) h6 [+ t; B$ h! c4 r
' ?# L/ a) O5 J. o1 D3 @- dma_addr_t dmaphyssrc1 = 0;
2 [9 h9 m; c$ I6 ] - dma_addr_t dmaphyssrc2 = 0;0 h0 }8 |: c# @) Q1 b6 V
- dma_addr_t dmaphysdest1 = 0;
" w) L! s7 A1 v) f - dma_addr_t dmaphysdest2 = 0;
3 K" c3 U( c q! W4 u; K
$ p' f- u1 k6 u. s- char *dmabufsrc1 = NULL;
' ^* j/ w& j) p' @ - char *dmabufsrc2 = NULL;5 E6 _; W9 g* _9 x
- char *dmabufdest1 = NULL;* S5 a4 t+ V6 c2 c3 h# E
- char *dmabufdest2 = NULL;. t, `7 T; c- q3 o' p
2 A. o% z% O1 @( {9 G2 |- static int acnt = 512;3 y( `7 s. e6 _8 _# ?, _
- static int bcnt = 8;
0 g$ G4 j2 {1 b' `2 ` - static int ccnt = 8; J0 F3 F3 W/ W# d. p* n0 S% y
- . }3 g7 D( ~7 L/ u! S" q: A& X
- module_param(acnt, int, S_IRUGO);
2 S; b' b) g. J. O+ \" i - module_param(bcnt, int, S_IRUGO);
0 b, K9 W9 l+ M - module_param(ccnt, int, S_IRUGO);
复制代码 3 X( j& D: g* c7 C7 H
5 E2 `1 g( r/ i8 W$ ?" `. A2 a 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 R# z3 v0 t7 d( {1 G! c3 O
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 L, r5 }5 p# s& D' v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 x) E# J6 O4 M, d( _ ^9 v8 I- h' j" t. d
8 }. W( a3 g. s |
|