|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# _# i! J* b8 ?* _6 N1 P- a- [code]EDMA sample test application4 G; f) l: Q* r: K4 w1 j
- /*" ^5 f, Z0 C4 t, h+ J% ]
- * edma_test.c
8 T2 |2 X- E+ r - *
4 \8 L1 m* o' m3 j& q5 d- P - * brief EDMA3 Test Application
n9 n6 j* K ^) P, B* @- G - *4 c+ i1 P2 {9 ^% [8 @
- * This file contains EDMA3 Test code.
( v9 M1 V N% i# Y - *& n0 h- p; o, s, x' b7 o) O
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, p) q1 s# {% c# |8 m7 h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) C ~, ? l8 v# ~* f - * TO CHANGE.0 R% w* F- l- p8 S: `: _- T
- *
5 U7 r# J3 h5 x4 V - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 g% ]( b! A0 i- W' F& R! F - *' N4 n8 C! T; P/ U- {
- * This program is free software; you can redistribute it and/or
9 L* \- W$ U% \4 A. P - * modify it under the terms of the GNU General Public License as7 D! M5 y5 ?0 W- e" b* W! Z! k
- * published by the Free Software Foundation version 2.; P0 U [) t, K* x8 ?
- *, E0 J/ R. x. r/ k1 U' e& k4 M
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- l1 n3 x* v6 t - * kind, whether express or implied; without even the implied warranty
- o9 r5 h, \. s2 K5 Z' q+ S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: q4 Y# D' s: f. U8 P" ? - * GNU General Public License for more details.
5 i7 Z9 W7 C! s/ J/ P ? - */
( E, k) X; Y& p) u2 P* [ - 1 O3 Y, m4 U1 z, q( R
- #include <linux/module.h>& v1 m/ R- R; s2 s% I4 T6 q- ` B
- #include <linux/init.h>7 _ O& ], l$ Y5 m7 b
- #include <linux/errno.h>
: c3 A7 a! P7 ^5 t5 i8 e - #include <linux/types.h>9 }4 t: V- I0 m- V0 w( F
- #include <linux/interrupt.h>2 h# C* @& Y8 l/ Z; v+ N
- #include <asm/io.h>
0 M+ H+ Q1 X5 p9 ?4 Z9 G) y - #include <linux/moduleparam.h>, H8 Z K$ O' e+ C- h* g3 i X
- #include <linux/sysctl.h>
% @& n2 Z; y; T. O. M - #include <linux/mm.h>
, c* \. [! p# w' k. Z# g - #include <linux/dma-mapping.h>1 a6 f1 M6 l# M6 e- q1 L/ g- n
! b- \ w6 W( d% {) ~9 K, Z- #include <mach/memory.h>
( m& V: H, X, W1 e5 h; |" b: w9 H - #include <mach/hardware.h>
0 T* `# A/ a( z0 W0 L e - #include <mach/irqs.h>5 p: }4 {6 G9 }0 R0 ^4 K+ }, i
- #include <asm/hardware/edma.h>
1 m/ Y/ f; o( A. y6 z* k1 Y \2 [. ?
" I2 k4 K; H. C6 a: K- #undef EDMA3_DEBUG7 Y/ }8 C& |" Z$ O2 g
- /*#define EDMA3_DEBUG*/ H; B" i% Z3 V. s7 A2 q: X
) [3 ^) M3 a3 B' a8 q- #ifdef EDMA3_DEBUG
* D9 y& S) D" |! L6 e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. f: Y% |3 S& O6 O- p. o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 T8 k: K; ]4 n }, K9 T$ }
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# t" l, h3 |; d( Q - #else6 i9 X. E! T. o5 ?$ r( N9 L
- #define DMA_PRINTK( x... )% {# o8 A6 o( M3 `0 { W
- #define DMA_FN_IN% q) G& n, e9 {) E: x
- #define DMA_FN_OUT; b& C, e. g7 g+ C1 R
- #endif
2 X- C" J; W3 R/ f# G2 e
8 `( }7 M5 a1 c R( K- #define MAX_DMA_TRANSFER_IN_BYTES (32768); j3 I$ a$ a' r, `( \
- #define STATIC_SHIFT 3' K2 b G* p2 \3 j+ L% g- X4 e1 e
- #define TCINTEN_SHIFT 20
5 I+ Q: ]0 d9 f2 Q' [ - #define ITCINTEN_SHIFT 21
( E) W/ u! O7 z" C; t4 I) ^ - #define TCCHEN_SHIFT 22
# I$ E' K5 Y4 t! S - #define ITCCHEN_SHIFT 23! u# E- V0 K2 L+ P4 C, t( {% f/ ~
- " g6 r! k9 q0 D( o
- static volatile int irqraised1 = 0;9 n0 P% o9 [1 W& K" k
- static volatile int irqraised2 = 0;! d, V$ E; I/ c0 v; N% M
i! [% z& s5 F( c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. b5 p) s* O) _ a" }/ K' r/ F - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ u3 P! p% A( i2 Z. L) B0 j# a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ ~7 E7 @ w# x) h# D R, a
- ) U v. z1 w0 @0 m, L" ?! a. l* ?* U
- dma_addr_t dmaphyssrc1 = 0;- W5 G+ M, c1 m+ R9 w
- dma_addr_t dmaphyssrc2 = 0;
* q* J7 l) |* o4 G! T! O! H/ }, X - dma_addr_t dmaphysdest1 = 0;' h/ I; f" O' h; ]% V) v0 X: K6 Q
- dma_addr_t dmaphysdest2 = 0;
6 Q F: e0 `) h+ f2 s& K6 u; H# ` - + ^# L& Y( Q8 v$ g1 J5 O
- char *dmabufsrc1 = NULL;; k7 r% P! X- N, C* Z e
- char *dmabufsrc2 = NULL;& {: U0 M4 U: [, Y
- char *dmabufdest1 = NULL;
* Y, L' g# s/ M. i1 _7 p( M - char *dmabufdest2 = NULL;* X% Q! S1 K% d/ ~' R$ e
. B* t) {9 G* h6 ^5 `9 U+ ~ A- static int acnt = 512;
% ?4 x2 \/ s- a' D+ r - static int bcnt = 8;
' n. a! F0 E" p" L" L6 w- p - static int ccnt = 8;) a* x" h* k& y x- a+ ]
7 r; H' [) U( E- module_param(acnt, int, S_IRUGO);* h; c/ C) \* M# x6 }9 L
- module_param(bcnt, int, S_IRUGO);
) x9 ? L3 l& c( p+ h3 d. ~2 x - module_param(ccnt, int, S_IRUGO);
复制代码
: f6 q5 S5 P& \5 m2 @2 C7 N g+ S: y% l# O* M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 o) |: Y/ d- G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) N5 ]- ] [ |" ^/ g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 `, ?- }6 W' z) }! h
; l# ^, Y1 @+ r; b2 z0 F
0 h9 j$ e0 G" Y8 o |
|