|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 k7 o9 Y/ Z! g; W- s, T( S
- [code]EDMA sample test application/ R- T7 n0 M; Q5 _6 r
- /*; Z( n% F8 d4 ?) l% j
- * edma_test.c: u! g: y7 E4 P& V
- *
4 m& D+ p1 p3 m1 g) w% ] - * brief EDMA3 Test Application
6 `+ m2 ^- E d; M7 C/ o; k - *6 L" C6 c4 Y/ {: W, m
- * This file contains EDMA3 Test code.* H3 F5 L* N& \# o& u9 {- ^: {
- *
+ }; o& Z2 ]9 V8 t3 { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
Q6 m( \6 d8 _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 x( n5 \ B) P8 A; q ]; G - * TO CHANGE.* c6 ?" ]6 _/ M
- *5 Q- Q( `4 H/ V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 J% \4 I' t; ` B( p+ Z; j2 e - *
) k/ n& Y. j- n+ |8 f4 Y( Z, T - * This program is free software; you can redistribute it and/or+ i/ V3 a' n* i
- * modify it under the terms of the GNU General Public License as$ W1 T7 i2 P$ m' ` }0 Q8 l; U4 v- f$ B
- * published by the Free Software Foundation version 2.
; l. Y2 ~- W+ }( q1 @! w2 H - *
3 L/ A; `7 d5 }9 d9 `- N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 S5 Y! o y6 M/ d* x) s0 o3 O
- * kind, whether express or implied; without even the implied warranty# R$ Z* [; Y( m
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& j( `% K$ b- e8 D9 @ w - * GNU General Public License for more details.8 ~5 {) b+ B- w1 {) m* a
- */! b2 J8 X* d0 K
- " y; p. z1 a3 S
- #include <linux/module.h>
- h- d( h3 l! P* |$ F% N - #include <linux/init.h>
# p Z z( E- s: N5 l1 l( @7 R - #include <linux/errno.h>3 z3 H8 n) N' Y. y
- #include <linux/types.h>
0 G$ B0 [6 N& W9 q! l - #include <linux/interrupt.h>, O: P/ N; A! \1 F
- #include <asm/io.h>
: D8 ]' y% D' T3 D - #include <linux/moduleparam.h>
( A+ ]+ ~% n& ]! w - #include <linux/sysctl.h>, `# s& l) C) z$ a& O
- #include <linux/mm.h>
{$ j) D9 L. x* D/ m7 R - #include <linux/dma-mapping.h># J' N5 m3 b6 ?/ K& K
$ H' z1 o! B7 n6 d8 J- #include <mach/memory.h>
! W' L( o( U: E4 A# `- Z( W - #include <mach/hardware.h>
6 [9 M: w. n4 J% P% O& Q - #include <mach/irqs.h>
( N `5 q$ K p) g - #include <asm/hardware/edma.h>8 O. I4 G$ Y$ W# N3 a3 Y. D3 ]
- ) `& s. s% J- G" T$ f* c! r7 g& C
- #undef EDMA3_DEBUG
1 Q6 m6 g) ?: t4 D+ s& a - /*#define EDMA3_DEBUG*/
5 |+ K% i- h) v |3 ^, _
9 Y1 Z4 E- R5 G+ p0 B- #ifdef EDMA3_DEBUG
4 Y# i1 c) f+ C# C" m- G% k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 u) C9 F) O7 Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! n) {! D) s3 A( E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# a0 i( o* Z' N0 s, @( [$ B' r" d- R
- #else
; V8 P1 }% f! M; F - #define DMA_PRINTK( x... )
; X+ L1 a3 \3 h8 {; \ - #define DMA_FN_IN
2 k: p9 x; |9 m' X6 s9 s - #define DMA_FN_OUT
1 m; M" U# G/ ^ - #endif5 ~& U7 q3 b3 f B
9 x9 R. ]9 N v+ ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# W3 J7 N9 M4 f6 A% \3 ^
- #define STATIC_SHIFT 32 f" e5 a& o% x: h' g
- #define TCINTEN_SHIFT 204 }# B. q1 q7 f) f6 h2 h
- #define ITCINTEN_SHIFT 21
- k# D: n2 j4 C/ m - #define TCCHEN_SHIFT 22% C7 S( G' S4 S+ |) ~1 }& M* V
- #define ITCCHEN_SHIFT 23' E, h6 r# w( x4 C
- 4 e2 t' V& D; ]. ]$ ?/ g
- static volatile int irqraised1 = 0;
: Y) _& k. m7 i/ G* k8 F& m- Y8 y - static volatile int irqraised2 = 0;6 a& r8 Z! @" u! ^- B% z/ p
, H% Q1 v1 j! B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% H6 {4 Q" C' q0 K+ g* M! E - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 g4 s$ b3 c0 d, R$ L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 ^% e* h; d7 p1 G - $ p# H' Y+ j2 u, E# \/ w( Z% e1 P! P8 A5 C
- dma_addr_t dmaphyssrc1 = 0;
& q q4 {( ]. h6 Q - dma_addr_t dmaphyssrc2 = 0;: }- J& a# W* q3 O1 _! J8 i; _
- dma_addr_t dmaphysdest1 = 0;* Z$ [/ E( ]$ h" H8 t
- dma_addr_t dmaphysdest2 = 0;
/ V* V3 v E! e* c" v - 6 x* H2 @! K& C; h7 b
- char *dmabufsrc1 = NULL;
$ ?* C: c4 `% J - char *dmabufsrc2 = NULL;! t9 }/ o0 X8 a7 y6 K/ x2 p( S
- char *dmabufdest1 = NULL;$ e: A3 {+ f. |7 E# z8 G9 H9 V
- char *dmabufdest2 = NULL;2 [; P, P# X# E, O/ o
/ a4 r: D- ]) J* S! V8 v- static int acnt = 512;
5 m( U' j Y# \1 w$ ? - static int bcnt = 8;
; ?- V$ A7 e+ }' j) X* L7 z - static int ccnt = 8;3 t1 @9 F7 }* p9 l/ O6 Y I% }
- , q) b" H$ P, x W! R' N6 N
- module_param(acnt, int, S_IRUGO);1 V/ S5 m, b6 L" E; Y
- module_param(bcnt, int, S_IRUGO);7 v( t p2 |. h7 A a
- module_param(ccnt, int, S_IRUGO);
复制代码 + D' D" m6 T$ J: H2 P- _2 D
0 I4 b/ |$ y1 @5 B 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: f: ]+ z/ D2 P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, J. R8 m v* ?& H% K+ q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 _2 Z m( M9 P( }
! y/ j* \1 h) x! Q/ _" o& Q: B: _6 e8 j: o- O4 z
|
|