|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 X4 o0 A& _# u- [code]EDMA sample test application6 e5 @+ R7 B! ^* h$ T
- /*
1 D4 M9 S! X& | - * edma_test.c) g2 \7 t% o3 Q5 g( c, M! s0 _
- *) ~& R% _3 p0 C: A
- * brief EDMA3 Test Application
/ Z/ C/ |8 U8 ]7 m - *: [* ^, @, N' a8 j7 h0 F
- * This file contains EDMA3 Test code.8 y. Q& V7 G4 Q k% [& N
- *
# e. b1 z7 B# v- k0 Z) s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# e3 _$ g4 `/ S2 R5 U9 E! S9 Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
H' f( s# {$ n0 w$ h- J- Z* K' { - * TO CHANGE./ W# c, t' L' R( X- r5 c9 |
- *
1 _1 g; w7 G' B8 v4 `, V, `' N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' ?( G b) D3 ~# g
- *
# P# t: A1 {4 a: |' C' m - * This program is free software; you can redistribute it and/or; t% I4 Q3 }) U: L9 B$ H: o
- * modify it under the terms of the GNU General Public License as
3 C( \* {0 E: Q0 k( Z; \9 V - * published by the Free Software Foundation version 2.
0 F k" _" z4 |& b7 y4 @+ f - *
5 q4 |2 B' j+ e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any: K/ y8 _3 Z: v" B4 N, \
- * kind, whether express or implied; without even the implied warranty7 q' g" Z- m. B4 I) p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& O7 A6 x6 U9 C$ Z - * GNU General Public License for more details.
) T. ]* P: t- F - */# G [6 w1 o- o) \
: K0 ]3 Y9 e0 @/ h0 m- #include <linux/module.h>7 R' v- U& x: x# `: c9 E5 T; y
- #include <linux/init.h>) D1 Q$ ~; q6 {$ n3 L X
- #include <linux/errno.h>& L7 v7 @* r j; R# e3 i# U
- #include <linux/types.h>
- o& r f9 H8 v& a - #include <linux/interrupt.h>
4 [6 t" Q+ t- \% |) B' ^3 Q4 a; u" X4 } - #include <asm/io.h>% D: Z& M( I9 m* U
- #include <linux/moduleparam.h>7 o5 Z1 o& I$ v/ j S+ I
- #include <linux/sysctl.h>' V3 ]. E9 P! @8 {
- #include <linux/mm.h>) d W* O2 \+ ~- t, E, K ~
- #include <linux/dma-mapping.h>
* v: ^( r& |6 R. H
2 i; f5 W+ b3 h! Y, c/ B2 Y" w& f- #include <mach/memory.h>
4 z1 U: T3 S+ E& t: `9 x+ U - #include <mach/hardware.h>: r$ B0 `& U5 f; x
- #include <mach/irqs.h>
: z7 T; i# |5 W! W$ \ - #include <asm/hardware/edma.h>% [" k4 \- ?0 ?* R
6 v3 F- X2 D5 X0 ~4 _( x) L5 E* t- #undef EDMA3_DEBUG
9 Z. e% J, G; [: f; h5 d7 F - /*#define EDMA3_DEBUG*/" f6 H: ?9 B- Z! R1 y6 k$ t
- , p% q- o* W8 {
- #ifdef EDMA3_DEBUG, a/ Q6 z1 W: e% U3 n
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 u/ f4 c/ W( {- Y# F H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 q, }7 A7 Z1 O. e, K3 e! A9 ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 |. u3 B% {" [0 W' ~+ f' e. v - #else
1 P: e! t* z# K/ E7 Y0 t8 ~ - #define DMA_PRINTK( x... )% l, a" ^: P; ~" ^1 n0 a
- #define DMA_FN_IN
! S! w f I0 I% _ - #define DMA_FN_OUT
- I5 f$ W5 L1 ]& G+ ~$ H" C - #endif7 T% L& s1 ~3 Z' M. z4 a6 h
- ! w9 O& V( b o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) a- K& Z% m" E7 H2 R1 |' n
- #define STATIC_SHIFT 3
4 ^) r: w: ^/ Y' s) o - #define TCINTEN_SHIFT 20' W. {& C( e: U. x. w# t
- #define ITCINTEN_SHIFT 21' E* c; `2 ?# d) [
- #define TCCHEN_SHIFT 224 e( w, M* y2 S+ d% X3 v
- #define ITCCHEN_SHIFT 23: _- Y+ A+ v4 `" e5 m) E4 u9 Z7 z
- # V- N0 T! T% o3 t. i/ y
- static volatile int irqraised1 = 0;
3 G1 c% r) g0 s0 b+ s# H6 c - static volatile int irqraised2 = 0;
! I( j8 i3 A/ R3 w, L& T5 s
" M: s3 K/ z* A7 G! m1 {- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' R, l( H# j3 S; j4 t# j) H
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- M( P2 F5 @9 q1 S, s! }$ z6 R* Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ G+ O4 n1 D9 S3 x0 y! l7 w
$ |: x a5 V$ [* g y1 g- dma_addr_t dmaphyssrc1 = 0; i& J+ ?) p" W. y) l7 Z: t
- dma_addr_t dmaphyssrc2 = 0;
0 j8 D- ~% r- S4 [$ @* J - dma_addr_t dmaphysdest1 = 0;
( t; `7 e; w) q- j4 { - dma_addr_t dmaphysdest2 = 0;, L! z- ~. P! K$ O, \0 I
- % { @3 ~- H1 q& O/ |7 ]" x/ A H S+ u; W
- char *dmabufsrc1 = NULL;
! C: t7 s0 R/ q6 Y: Z) _3 Q - char *dmabufsrc2 = NULL;( U( J6 C/ K* H/ i& p' a
- char *dmabufdest1 = NULL;: j6 t) @4 A% J3 Q
- char *dmabufdest2 = NULL;. K" d9 {* j- W, k& W4 v
- 9 e0 Y% ]& X' C) v& L# Q& ?) I
- static int acnt = 512;$ w1 h5 Y/ B6 Q- T$ h* U0 p4 N1 b
- static int bcnt = 8;3 Y* I; O b$ Y3 N6 E; d. g
- static int ccnt = 8;5 }5 V( `1 ?' p5 H8 I# n' J1 |5 w
- ' ^+ N$ L$ k) E5 g% I+ e/ k+ G, D. V
- module_param(acnt, int, S_IRUGO);
- W9 S6 t. C* c3 O3 j7 }% o u e4 O1 B - module_param(bcnt, int, S_IRUGO);5 ], z! P2 h* c% P; T
- module_param(ccnt, int, S_IRUGO);
复制代码
+ M6 X. v" ]7 {' b
5 [7 `/ C8 [, G) ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 I$ c1 T8 @5 v- a' u- u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! T& K2 S$ \: I" u: ^2 W# j3 L) h& } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* z. S+ X$ C$ P/ y" x h
6 T# W2 c! d* O. a: d* ~$ k. E, p
4 f, W4 s0 P1 y1 }1 d
|
|