|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 r9 X. Y( d" v8 J0 x! T/ b
- [code]EDMA sample test application
Y4 e$ F$ b' O& u. S - /*
9 E4 J: c+ {; E - * edma_test.c7 ?7 `6 `7 a! Z* g
- *
, W) j4 W- V( M* b0 i4 p' E - * brief EDMA3 Test Application
& P$ T6 j6 p; } - *
8 U g( U& T6 e1 _9 p; d - * This file contains EDMA3 Test code.0 B9 E# w C- N( t+ t
- *
! ], L+ `4 ` k3 A# I- D' k; R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! `) s! h6 [3 J0 p1 U) t! @. o6 v1 l
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- X+ P+ N2 o& s; }( I5 e
- * TO CHANGE.
1 K" U6 x3 ?/ o1 q - *
; c1 d5 {8 C4 Z3 [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 f3 J4 f/ U" t: J& D# _
- *
# o/ l& z' r9 E% ]& p% o( I8 N8 A! J5 y A - * This program is free software; you can redistribute it and/or
/ ~) Q/ f6 E! x& Q - * modify it under the terms of the GNU General Public License as4 I0 H5 p! c$ O# n) I: h
- * published by the Free Software Foundation version 2.
& d0 z" p a: o - *# w6 m! d2 q" p; {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 Q/ n ]5 Q* Y - * kind, whether express or implied; without even the implied warranty+ I: u* p7 g5 @6 A7 O+ W1 X3 R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 v4 |5 e5 h9 r6 r$ ?5 B - * GNU General Public License for more details.
( \4 |6 D/ u9 y4 e1 b8 N3 p - */
2 N4 S, y; E* `! g: G w% s5 R
' a3 X; @8 c8 U" Q) L- #include <linux/module.h>
( S% J5 o! `# Q& S" U. J - #include <linux/init.h>
* n- k2 t( P* Y% a d K& m3 h - #include <linux/errno.h>
@- T* D# r& a5 x' ]! \3 o6 J3 N - #include <linux/types.h>
/ c% \& v1 s' S: V+ Q- O. T' h - #include <linux/interrupt.h>
) v8 [" D1 ~5 S: z4 N! p5 D - #include <asm/io.h>
; S; x1 n: Y- y) q - #include <linux/moduleparam.h>
# }9 V) a. n0 @% [$ s! \ - #include <linux/sysctl.h>
/ K5 o5 ]% B4 N& c% B* B! J - #include <linux/mm.h>
$ D* \" V$ \1 x - #include <linux/dma-mapping.h>* ]) Q3 Z% m% m! o
- o8 f: Z% t& q6 |/ v
- #include <mach/memory.h>9 R- }+ Q3 y1 l9 [- s. H+ g
- #include <mach/hardware.h>
4 ]1 K# A& q5 X+ @ - #include <mach/irqs.h>8 _* ]. B' I3 x
- #include <asm/hardware/edma.h> x/ z# R z% |1 b' q' _
- 7 O; B3 s8 O2 L3 O
- #undef EDMA3_DEBUG% e! ]! V6 F, f2 V5 i4 Q
- /*#define EDMA3_DEBUG*/6 [( F+ m- H& W
; H+ @3 M8 C; |" e- #ifdef EDMA3_DEBUG3 T* @ ^/ D% S& `# f
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 n/ @6 B% {0 U0 n$ Y7 ?
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) l5 v( l- `4 K6 G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* ?3 ?$ x6 ]8 _# j. Z - #else" V- o3 U5 ^- ]
- #define DMA_PRINTK( x... )
9 t; r6 v: m6 m - #define DMA_FN_IN" i9 A6 L w ~- T/ X( A
- #define DMA_FN_OUT
. p) `. s O/ J$ d5 W! C+ n6 p - #endif! p' ? k+ h9 U2 q
& j( F, w! X6 J. }" ~3 z1 _- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' Q+ z3 r9 i3 [ w* t+ y3 `2 p3 f! {
- #define STATIC_SHIFT 32 v% U' }1 D" I; C
- #define TCINTEN_SHIFT 20
3 N, K: f) Z& s9 B; r - #define ITCINTEN_SHIFT 21
* x; Q) C6 N1 V7 Z% Y2 \8 `, [' G - #define TCCHEN_SHIFT 22$ G" j3 p7 n& z) ]; C3 G; [" C
- #define ITCCHEN_SHIFT 23
: y7 \. U- e# X. K8 H0 U0 T: Z8 \ - 8 @( u3 K) ?0 e( C# S9 [/ D Q* F
- static volatile int irqraised1 = 0;3 {4 A& X, a0 B) Z( r
- static volatile int irqraised2 = 0;
" s* O9 p5 I" J# o" j: v4 q
7 {# C3 K8 i. y k- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
_% `" d! Q* h9 d: \( q% ~ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( f5 B3 Z4 F, I8 i0 Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" z8 C+ D" j) T8 E4 q' H$ P
1 D- E* ^7 r9 e6 ?8 T5 |6 E H- dma_addr_t dmaphyssrc1 = 0;
; y8 Q J( |: u/ I8 Y7 d) i, Q - dma_addr_t dmaphyssrc2 = 0;- ?7 ?0 K: i) Y- p6 \/ w3 j; ` T
- dma_addr_t dmaphysdest1 = 0;4 S9 N! G" q0 V0 A2 v
- dma_addr_t dmaphysdest2 = 0;. s4 H* P' E- S9 B% w
2 S i) j6 [/ ]& h; C+ k4 f& Y! P0 v- char *dmabufsrc1 = NULL;9 ~: Y& d# g+ D% ^& s( S- q
- char *dmabufsrc2 = NULL;
: Y+ a3 P0 Y4 G+ }) v! F- J - char *dmabufdest1 = NULL;& ]# h' j; N/ l( n; N1 l% X
- char *dmabufdest2 = NULL;
" d+ g; W1 C# a4 ] - - Q. ]9 p( U8 G4 |
- static int acnt = 512;
0 [6 z* W( V2 {% v+ t9 Z - static int bcnt = 8;
' L0 W0 d/ \9 b5 O+ B' R% m o( D - static int ccnt = 8;
; `) ~' s7 K5 P. D
( P8 U1 U7 A. u% G* Y8 A9 ~7 X* [- module_param(acnt, int, S_IRUGO);! A4 Q. O1 N5 u; Q* z
- module_param(bcnt, int, S_IRUGO);! d8 o9 u+ o( P2 ]9 L' f% u0 A9 G. k
- module_param(ccnt, int, S_IRUGO);
复制代码 " F0 S. w5 N+ S; u+ d
9 f7 |2 c& t( l. o% [' I& X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 }4 I+ m& v3 k Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 j- C/ e- S. ~* G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# F7 B* {& [5 K; i Y# [4 t0 s
4 U5 k2 w+ v+ N9 B& K0 D
9 s4 g) _- c4 r; k1 v S |
|