|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' F# |( `- h# [5 `! Y1 j
- [code]EDMA sample test application
2 k6 A3 K9 }; b7 Y: u& I - /*
4 w: a, b; v6 z; [# R - * edma_test.c1 a$ I: U0 z3 ]* j. k$ ]( x0 m4 U" J/ z
- *" w3 D) {% Y! E+ c/ L1 Y& O
- * brief EDMA3 Test Application
$ ?. }3 n+ [ G- \. K - *% `; \. H9 c, s" M4 I+ Y! f& ^
- * This file contains EDMA3 Test code.- `% Z: g/ V6 a; E8 Q, U; P+ E6 i
- *4 P* A2 P" p7 r' _* w& s( P
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, P7 a+ j# X0 X; w
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 A" P5 X o+ I
- * TO CHANGE.+ e+ l. A( {- v9 k5 L
- *+ G1 G# @! e8 b( {% @8 {; k* P& c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 I0 M3 X4 B) J1 B. T
- *: j1 l% U/ B h
- * This program is free software; you can redistribute it and/or# p' \; ^* y0 H
- * modify it under the terms of the GNU General Public License as n3 `. g+ q4 e& f, ?: E& K _
- * published by the Free Software Foundation version 2.
1 I8 W/ j9 v6 L - *5 g0 H7 X1 u$ i0 u# l; u r6 t" O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ v( r" R" y# o: s; }) T' k& X
- * kind, whether express or implied; without even the implied warranty/ y4 J7 A+ ?/ l, E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 l" w% a c' M. y/ W - * GNU General Public License for more details.- M6 i0 ^" ]% ~- N4 M- e
- */$ S5 O: l6 U* D+ n# z" X; D# V
# j u7 {$ H9 U) W' p1 \( f- #include <linux/module.h>( p$ A5 x' G( `& C5 ?; R
- #include <linux/init.h>
/ }) W0 c( C5 H6 c9 [9 s% i - #include <linux/errno.h>" k, p ?# G& f% d9 k
- #include <linux/types.h>" ~& Q) J* W; z$ ~1 h& v
- #include <linux/interrupt.h>
8 ]8 U$ i4 u3 [& c) T - #include <asm/io.h>0 c: c9 a% m7 Q' W* ?& u
- #include <linux/moduleparam.h>, G, q: X7 h" D; D% J
- #include <linux/sysctl.h>% ~3 M" Z1 I- g3 U, x+ u
- #include <linux/mm.h>- g3 ^' X0 k) a3 J9 ?% S6 @
- #include <linux/dma-mapping.h>
. ~ |+ Q2 O$ l
! D7 T2 d8 Y7 A- #include <mach/memory.h>, W: `. W5 u) V7 l# q
- #include <mach/hardware.h>; M5 l4 p" Z7 l$ g2 [; ?
- #include <mach/irqs.h>8 F' c7 b7 m; J4 _9 K# \. {
- #include <asm/hardware/edma.h>
$ V1 l3 o* I# _6 f5 z - ' g7 v' j. I- m
- #undef EDMA3_DEBUG
1 p1 }+ S5 R0 U/ Y6 \( Q, ^" w - /*#define EDMA3_DEBUG*/, \3 V' |# L- L( }" g3 l- Q' K6 a
- - g: m9 \) O6 L
- #ifdef EDMA3_DEBUG
3 ]2 ~# K& v# L - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
C; g, q* l% A T; d2 N - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 t, T2 u/ h3 ^( b0 o" B
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). c/ @1 |. T% U' }3 R
- #else. z& N3 e6 P9 i/ K& c) ]3 I
- #define DMA_PRINTK( x... )( {5 h4 ^# A$ A
- #define DMA_FN_IN' |+ ?" n% z" M0 a
- #define DMA_FN_OUT
9 J( n0 b2 t! [ - #endif: d. i: l7 p0 O9 k
' S' r7 H3 _: L5 x- #define MAX_DMA_TRANSFER_IN_BYTES (32768); ^/ b" `3 S5 S e) h/ ?; f0 x& K
- #define STATIC_SHIFT 3
! p' B8 W5 u# T3 F - #define TCINTEN_SHIFT 20- q5 x7 B2 K$ C* |7 e
- #define ITCINTEN_SHIFT 21
- d1 M& z/ T9 x6 I- a8 u - #define TCCHEN_SHIFT 22
0 @% D3 V" W0 G# Z; \/ o' a0 Y% z - #define ITCCHEN_SHIFT 23
! ~8 d7 {8 [9 f& ^ - 6 g: h1 ?; p1 j/ @+ y8 A: @
- static volatile int irqraised1 = 0;" I: S& Q. H6 B, N0 F
- static volatile int irqraised2 = 0;
6 H) k7 o# w0 X' k+ b- k/ } - ( F# C0 B$ ^% l7 E1 N6 K3 a4 ?' D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ @1 I4 @) ^. y$ s6 a0 _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ B9 K1 ]0 ~1 g* r; f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" j% @1 s+ S5 t1 A# g
- \8 w/ ?% d3 J- |+ b- dma_addr_t dmaphyssrc1 = 0;
* h- D1 E) `/ { - dma_addr_t dmaphyssrc2 = 0;9 {( D; g! k) _& }
- dma_addr_t dmaphysdest1 = 0;2 y. S5 _1 s; ?# `. p& P4 s- W
- dma_addr_t dmaphysdest2 = 0;& V1 E* z- y! |2 ]7 l8 f* b$ \
- ) T4 L2 k5 M$ B) a
- char *dmabufsrc1 = NULL;
" o3 I( T8 i& T3 N' D9 @2 w - char *dmabufsrc2 = NULL;
8 v& d, ^5 d& v. X, |- V1 Z - char *dmabufdest1 = NULL;
" D( e/ Y/ W( l* e7 b( O2 s2 ^7 Y& e - char *dmabufdest2 = NULL;
6 R# W0 R& I# N2 a. w: h" C% I
& [2 ]# r" Q- I( @: y+ u0 W- static int acnt = 512;" h$ \- l9 n! f5 D+ J8 U
- static int bcnt = 8;' N( O7 N% ^3 {7 j7 Y# }& s; F0 q
- static int ccnt = 8;, L; i S' L0 c& m6 X
; _/ Q0 n" z4 R. d; V- module_param(acnt, int, S_IRUGO);
5 O y a8 R, I6 U/ h. L - module_param(bcnt, int, S_IRUGO);
" P% D7 T9 X! ?" z0 B - module_param(ccnt, int, S_IRUGO);
复制代码 7 z2 p4 Z3 n& S4 b ~. P4 H; A
' c# u1 _5 c! ]( l$ l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" s" h" W* a8 r# r% C4 j+ }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! b8 \& L: M' A8 n6 c: m
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. t G5 p- H5 I r. ~ ~0 P% ?
. w6 Q, P) w0 J( z5 @1 f: K& U+ x: j2 ]# T2 g) J* H0 a
|
|