|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 M) Y* C+ k) A: G; d9 v6 A0 [
- [code]EDMA sample test application' ?7 X- A1 z4 c( X# l" R
- /*
a# E& E( V6 R. ~6 s - * edma_test.c0 E( H4 ~) r/ [1 l
- *
! }, _& A$ a) C4 s& q* W$ ? - * brief EDMA3 Test Application5 B9 I( q8 ~5 _" \7 ~
- *
1 g+ [( {8 L: e' A- w - * This file contains EDMA3 Test code.
4 h: ?. F; I. y$ @5 r - *" N0 ^( a% U/ t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) m _8 L9 s% B# I v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 y1 d* E% b0 |( C" @( Y
- * TO CHANGE.
u0 E) E7 }" f, F! {4 l2 M - *
0 h4 A. K2 A* E6 @ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 C( J' {3 i4 C% L1 M# x - *3 Z3 y: [1 d- B# J% t7 a
- * This program is free software; you can redistribute it and/or
; o! K: a o0 z2 S- o2 \ - * modify it under the terms of the GNU General Public License as( I0 p; z: @2 |! @8 V4 w* R- _
- * published by the Free Software Foundation version 2.
( O1 {- U# _9 M0 q& p' B - *( _# M' `2 C. F0 j4 b% f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 V, j- C6 ]8 O3 Y( a4 c# D D: t - * kind, whether express or implied; without even the implied warranty
( W2 m6 L4 v4 J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" }. n/ a9 n- v0 {: P- |
- * GNU General Public License for more details. J9 F; V. K8 |" ]) ~
- */
; y! B6 R+ j( s4 S9 h
6 a3 Y4 a: u" k6 @8 W9 l, J- #include <linux/module.h>5 z; U G' E% g8 k1 d
- #include <linux/init.h>* a. `4 h u& X2 Z7 U: M- h( b0 H+ h9 F
- #include <linux/errno.h>) S* \# ^* N+ ~
- #include <linux/types.h>9 `# D" u# P- F: Y: c4 x( H4 F
- #include <linux/interrupt.h>
; r7 S3 f$ U2 _3 g, o5 y6 R - #include <asm/io.h>/ g; Y+ d5 _/ Z- E. n0 \ u% o
- #include <linux/moduleparam.h>+ K: W: k: E2 `8 u$ E% C- M- P6 S3 {. f
- #include <linux/sysctl.h>: B( e6 l8 d n! p" }/ j! r& ^
- #include <linux/mm.h>
/ n4 |' V; b F( M8 j1 _+ R& w - #include <linux/dma-mapping.h>4 j* w9 G# I/ C, Z, |( C0 T
- v7 e1 l8 l2 D3 o! s# y3 R+ n/ c- #include <mach/memory.h>/ B* C( _1 w) A8 t$ V0 \5 q! d
- #include <mach/hardware.h>- X0 o" c& N: m6 A) G$ X
- #include <mach/irqs.h>7 j; w {! ~) O$ v: b& v
- #include <asm/hardware/edma.h>4 `6 F# ?3 {; f( h
+ ]! H5 I: H9 c4 h" K- #undef EDMA3_DEBUG8 @. {4 z% l1 x7 p9 f: \
- /*#define EDMA3_DEBUG*/
2 J1 I0 j2 d$ B+ o6 c! J) f - 6 O, k; w6 Y5 x; S$ K6 V
- #ifdef EDMA3_DEBUG6 F& L0 C! \" z* c0 r g" [) V, L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" W- W% J# U1 i( X1 [6 p2 ]# a - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ Y1 J2 H; n1 A; d. I
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# B- H7 K" \/ o& X. D9 i - #else/ }. l$ S$ y# q( L+ v- d
- #define DMA_PRINTK( x... )
! j; A/ B. L) c: V) I - #define DMA_FN_IN
$ Z2 o& ]9 c4 J* ^ - #define DMA_FN_OUT+ M+ _ v- l8 B8 R @; ~; M- n5 P
- #endif
9 f: H' F' F f2 h- F
0 X! t' m# p5 Y) w$ s$ p, I- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& W4 a: E `* B3 L8 A* G- y - #define STATIC_SHIFT 3
. C7 \# B; {0 A+ a - #define TCINTEN_SHIFT 206 _: w- n# @+ Q$ Q0 A* M* k
- #define ITCINTEN_SHIFT 213 O' E# d+ f! M6 t- I- I. X
- #define TCCHEN_SHIFT 22
2 Y( S p: L4 ?4 j# K: R - #define ITCCHEN_SHIFT 23- W4 L u5 w: ? d9 W
- 5 i8 _5 }2 j7 N0 j9 w
- static volatile int irqraised1 = 0;, W6 a$ S/ W+ t9 P! T9 L
- static volatile int irqraised2 = 0;$ b" k, v% `4 n
; K+ B. f( c% H& U+ P. g, ~) }1 P R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% Z6 o% z% K5 g+ i3 b: r
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 P1 {8 O' a/ U" \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 N Z) [3 t) a+ B9 K& c( U3 p" V - & t) r, e. L3 W+ f( a( j- k
- dma_addr_t dmaphyssrc1 = 0;# a0 U- ~. Y6 V
- dma_addr_t dmaphyssrc2 = 0;1 K g: i7 O; h+ B! O! i
- dma_addr_t dmaphysdest1 = 0;9 \& y4 k, d# j2 s% K& T
- dma_addr_t dmaphysdest2 = 0;
7 w: ~7 S- q W S; l( q" t" w+ s3 y - - f' ?' c n! d! b
- char *dmabufsrc1 = NULL;
$ `+ a+ I, O/ s$ t$ S4 R8 M& F. I - char *dmabufsrc2 = NULL;9 Q. j+ Q5 ]1 ]$ I# d' w9 b
- char *dmabufdest1 = NULL;) M/ F2 g8 _9 L! a- j3 N
- char *dmabufdest2 = NULL;
& u( X% O, T" ]& x- M# U: }) E - " m# N" C# Z G0 J9 G5 D
- static int acnt = 512;: s- J2 K& b* s9 S
- static int bcnt = 8;# O2 \ \$ S, W& m* n6 u$ ~% Y
- static int ccnt = 8;
- \9 G k% X# W6 Z0 P
8 l' d& S7 ?4 ]2 ?- module_param(acnt, int, S_IRUGO);
' ^$ K3 X2 A& r, X9 b - module_param(bcnt, int, S_IRUGO);3 ] O7 c5 _- W* i6 k# k5 H
- module_param(ccnt, int, S_IRUGO);
复制代码
5 a; B) P+ b1 t& S: J! m6 c6 }* s* O: ^( @% }/ M8 B4 g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 W% l/ Z5 T( y. S2 R5 v& K1 ?: H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
H9 @, C+ x7 ~/ N( w( J2 R7 } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& v/ u$ _ b9 M3 r- k( F7 Z
% m0 T4 R$ ^1 g
% @* {& y S; d3 B" p7 g x0 r |
|