|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 L' ~2 x2 \, u7 y
- [code]EDMA sample test application! T X- o$ B5 V" C: }
- /*+ g9 J1 `8 u9 ?! M" z0 [3 d* |
- * edma_test.c
! P, e- z2 D+ `$ F1 j m1 U2 t - *
; J6 ^6 H9 `$ T( R - * brief EDMA3 Test Application/ d9 K N8 s: @. K' b) I. L
- * J5 ]! x) i$ \5 S
- * This file contains EDMA3 Test code.
! b7 M* f, I& e, t. J - *, l9 L' n/ O, p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 j3 e% M+ e6 X& }; _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 U' G8 T: {" P7 P. ]: u* W9 v
- * TO CHANGE.
0 i3 t" \. O. h# u i2 C0 M2 b; o - *
8 j" ~$ ?! t9 Q/ U t( c2 e' F+ A$ a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 a. Q" i3 o& e6 \, _2 k% I - *, C& v" ?0 d( E4 A( W% F
- * This program is free software; you can redistribute it and/or
3 G- ^3 ^# E. U4 q1 H2 d; ]! _ - * modify it under the terms of the GNU General Public License as
7 E9 L) q* {4 v4 s' o - * published by the Free Software Foundation version 2.
; P# G" i! }& k! x/ B# j - *
: o: I$ P5 R5 R. `% C3 T. e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any* P" Q9 ?2 Q" n; v
- * kind, whether express or implied; without even the implied warranty% Y' H4 U2 Y( |/ i+ q' _0 ]
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 F# E. ~5 @* @9 W4 s2 f7 {) R6 z - * GNU General Public License for more details.4 _% k( j3 ~: E' C" e+ l
- *// F- \5 x7 M( Q) A* }# P4 T
- % f7 n* s% [ K8 @$ f6 r% ^! R& h6 j. |/ g
- #include <linux/module.h>( a9 i/ B6 C6 p0 g0 a
- #include <linux/init.h>
3 b3 F2 p4 j7 Y3 J5 A( i9 m. h- b1 W - #include <linux/errno.h>+ Z+ W$ c& n8 U' ~( e& D, C
- #include <linux/types.h>; j/ i& n f- s+ D1 ]& f
- #include <linux/interrupt.h>
* ~/ M4 L- @! o0 v- P - #include <asm/io.h>0 i$ t3 V# E7 T- o
- #include <linux/moduleparam.h>
7 M; \; q8 ~+ O9 C& f ?* R - #include <linux/sysctl.h>& ^& U, l* ~$ J$ |+ x) ^+ H
- #include <linux/mm.h>
( F. T8 U( j# f' \ - #include <linux/dma-mapping.h>
2 z! V4 Y* h1 y5 r
4 ]) a Q. }8 g$ i. k" c5 B- #include <mach/memory.h>
2 _; d) m$ W5 u7 _) h% C - #include <mach/hardware.h>
8 w. A& y- K- `" j - #include <mach/irqs.h>4 [+ E% o7 ~) s% R
- #include <asm/hardware/edma.h>6 B: d& S1 ^: R4 T2 N9 t
- - u: L4 O, X4 @) z
- #undef EDMA3_DEBUG, p3 h- Z4 Y% o% z1 u- [( E: [) ^
- /*#define EDMA3_DEBUG*/
- ~6 Y1 a. J' l! K1 B - ! k5 j! d- @' ~$ D3 q- b5 r" o
- #ifdef EDMA3_DEBUG+ F g6 Q, Y2 ^2 Z+ @/ a" y. r" Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) ?6 y( l) t# V# O+ l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). z6 E6 O8 z K4 I0 \
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- d! ?- Y; ^: B3 l$ r
- #else
. m# F7 b9 K, f2 j8 d - #define DMA_PRINTK( x... )
% D' y7 }# j& d8 W+ R! n - #define DMA_FN_IN" k2 b& S+ I, ^) T
- #define DMA_FN_OUT
& l& w z$ q/ V% j; B - #endif
* B! Z: I9 y, x$ G3 }! _% e
0 L0 H" p4 |' c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 I3 N3 L5 Z8 K
- #define STATIC_SHIFT 33 y/ ]8 v( f3 q; o6 F* f
- #define TCINTEN_SHIFT 20. j7 L8 V+ N& y7 k, m1 m2 [
- #define ITCINTEN_SHIFT 21
+ V3 F3 N* {) z# Z! H) u2 ^: a - #define TCCHEN_SHIFT 22
, i1 g, A; V) f u9 H* U$ |9 T - #define ITCCHEN_SHIFT 23
/ L/ Y8 y: J. ^, ?+ h7 s* z
7 N! ?* Y1 Z1 P( Q, C) q; C- static volatile int irqraised1 = 0;
0 @0 ^( V8 F: p: R - static volatile int irqraised2 = 0;
0 v5 u- \/ b6 a6 [ - ! l t4 s6 N& [, b& w
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 E8 p- r6 j" L - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; M. @) x) l/ Z* B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 p" u: A) L2 M a2 V" j
0 o9 p( U, c; H6 {- dma_addr_t dmaphyssrc1 = 0;
, X! ]6 Z/ P7 ? - dma_addr_t dmaphyssrc2 = 0;
8 f7 H) k. |' _3 p7 a" x - dma_addr_t dmaphysdest1 = 0;( [) r( o& X; I0 u# k, w$ V
- dma_addr_t dmaphysdest2 = 0;0 N% p6 x' k( s; l
- - P& c m v+ t$ [' g
- char *dmabufsrc1 = NULL;& Q) R& I. n2 O5 S+ F5 f
- char *dmabufsrc2 = NULL;4 F5 K: P2 h" V) l
- char *dmabufdest1 = NULL;0 X! J' @) t; i1 A8 h
- char *dmabufdest2 = NULL;1 [& B' z0 L6 M
- i9 C! ~ m3 ~! P+ A- static int acnt = 512;/ o0 ~$ q5 V6 C) x
- static int bcnt = 8;& ?: a) O0 Z' ~7 A/ S
- static int ccnt = 8;2 T$ b# Y4 E, \9 i3 T
- ; v6 W. m) _2 o( R. H. P/ ]% L
- module_param(acnt, int, S_IRUGO);
3 q$ C* V. U7 l) W& o) ~5 p - module_param(bcnt, int, S_IRUGO);
) [% u# ^. C; c: ?$ O6 V0 K/ K4 v; W* V - module_param(ccnt, int, S_IRUGO);
复制代码
* Q9 a) f( D9 R( T; m+ f8 A; |1 x7 q3 { V1 s0 `+ h% [9 R. l
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# R$ ~. I9 B5 n; ^% T/ d% J) o; warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 g2 |; L: A) z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 k2 u- B: B0 w2 ?* b
; I6 M6 A$ q# d5 s, q Z: J/ z" G
|
|