|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 n* M: l/ F: g6 r' `# O
- [code]EDMA sample test application
# a0 J0 i6 I7 K5 s3 x- H - /*
5 ~$ |5 ~& T Z7 U- b - * edma_test.c& t7 I* c3 s- {4 ?/ v
- *7 c7 H. C& ~+ ~& s4 W2 I! b% v6 O
- * brief EDMA3 Test Application5 ~% f E) d1 H7 x; Y1 i) y, M
- *
6 A" S4 e n2 i0 M# |$ o/ R+ K - * This file contains EDMA3 Test code./ o- Y) r4 H1 a6 i) t4 W% t1 ^& _
- *
! ^& Q0 m: Q$ C) M1 b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ I2 ~2 ~$ w8 m, k1 [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ p% i- }6 i) t* X) N
- * TO CHANGE.
3 J1 B: c) B5 y8 t - *3 _; M( C# ~5 \( L* U) L. E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 t$ M! {) e$ n: e. J0 g
- *( f' w/ _5 c: x/ j/ [
- * This program is free software; you can redistribute it and/or- `4 D3 Q8 k6 x) M* P: X3 |# w' a
- * modify it under the terms of the GNU General Public License as
3 \; S) ]% E X# h7 A8 t# Q3 f) v7 r - * published by the Free Software Foundation version 2.
' W3 L! f: G3 W' ]# m% C - *
. F: t9 r. o7 r* u _- | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any: p! h9 k- `9 @
- * kind, whether express or implied; without even the implied warranty
& w0 U+ x `. j7 y8 l+ B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the t1 a1 _; E8 ?( }
- * GNU General Public License for more details.
( B& D/ D; I; }( T9 H: z! g - */
" u9 ~+ @8 l7 d; [7 d
- n, o0 M2 T; l" x" E! B- #include <linux/module.h>
& D3 r+ N# e6 ` - #include <linux/init.h>9 ~# O/ H+ }# `
- #include <linux/errno.h>9 t0 q, v- `2 l& x
- #include <linux/types.h>- P. D Z) R4 l7 ~0 ~8 e8 o5 m/ u
- #include <linux/interrupt.h>! Y2 [; H4 `3 U
- #include <asm/io.h>
" L) ?4 j; f" Y3 h% H0 L4 \ - #include <linux/moduleparam.h>( T& {. \4 p0 R, S* Z- u
- #include <linux/sysctl.h>
D4 m& B1 g" R# t) W; T - #include <linux/mm.h>! i, n9 j" @. q8 V
- #include <linux/dma-mapping.h>8 n& k' Y8 d1 b! }* `" u
- ' F# n7 S5 ~& c# m- _
- #include <mach/memory.h>8 z0 x+ I3 u/ o9 ]: d7 z5 y) `
- #include <mach/hardware.h>( w* a0 [, S; l( d6 O
- #include <mach/irqs.h># ^- [8 |( P$ ?, f& x3 l& b' n. R
- #include <asm/hardware/edma.h>
9 D" N; v6 N$ t% \" C4 a$ \ - ( ^. U: v8 T/ S0 ^* F# C2 K
- #undef EDMA3_DEBUG
9 ~2 S D& p, o" R5 ~% g4 [ - /*#define EDMA3_DEBUG*/$ j& v% B2 ~ A! S
- ( @8 `3 l; [! V r" W) C
- #ifdef EDMA3_DEBUG
2 D) ?, j! `$ y. ^ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) B3 z ~7 R- y$ K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! x' I! ^% J2 n7 d8 H/ u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( [: m9 N/ `) o- U3 x5 K {' z - #else
+ Z2 w3 l2 K6 v9 N% X S. w - #define DMA_PRINTK( x... )8 A5 @# Z2 b1 y1 j
- #define DMA_FN_IN
9 }! S5 Q8 q! z$ c- a L - #define DMA_FN_OUT) p+ j2 ]4 ?. [/ K# K4 K" Y
- #endif
. T+ e( L: k- n5 G0 } - ) v- d* [, ?6 t. ~) {) ?) n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" ]; V( g. X# T: }" a( A, t - #define STATIC_SHIFT 3' @ Q* o1 i8 c+ b2 g% Y! _8 l
- #define TCINTEN_SHIFT 20
2 ]( C& `' Q8 E! N - #define ITCINTEN_SHIFT 21/ L" O% X! Q; F Y% F& K" a
- #define TCCHEN_SHIFT 22
! E l4 T% X: s2 d; s& u% V H2 e - #define ITCCHEN_SHIFT 23
U" n' E% z4 f) d
9 U+ |% u6 t$ @4 I6 e! P6 J- static volatile int irqraised1 = 0;
, Z0 s3 F! a6 l4 \, O+ R8 _$ S2 Q - static volatile int irqraised2 = 0;* a; ^ A$ u1 k7 B9 }* i
' H* r% W! Z2 n/ i- u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, S8 g0 r u! u) I. j3 Z. z) \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& m0 r% R; a1 C1 N6 k$ E: F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ^! X& \- ~# N; A9 a! W. _& W
- 6 s! L) z& K" N( n
- dma_addr_t dmaphyssrc1 = 0;
, ?7 {# \' M1 m* r - dma_addr_t dmaphyssrc2 = 0;
+ B% y5 S6 r2 A, z - dma_addr_t dmaphysdest1 = 0;
" i( K7 g m2 o: d4 _ |3 L$ ^$ Q9 }# k/ x - dma_addr_t dmaphysdest2 = 0;) `$ |; |' v4 B9 i+ C( b9 U
- " H) j5 O C6 u' S$ t# ]
- char *dmabufsrc1 = NULL;, M3 v& ]' R( h, n% Y4 \
- char *dmabufsrc2 = NULL;
7 V9 ]" u8 z1 k9 p0 C! G6 l" [ - char *dmabufdest1 = NULL;
& y: X$ M" ^, X - char *dmabufdest2 = NULL;7 w! u0 f( F/ z6 @6 g
- " z' a4 l; J8 c |+ G
- static int acnt = 512;# o: ` Z5 m( D
- static int bcnt = 8;) e/ ?5 N( @/ A3 p
- static int ccnt = 8;
9 [7 K+ w( I) R7 s% e$ U4 p
9 t) o9 o4 Y- \; [( m C' d9 ?! ^- module_param(acnt, int, S_IRUGO);
4 c- j6 q% g2 m. b6 @ - module_param(bcnt, int, S_IRUGO);3 @1 v9 A( H; z# z& n: D
- module_param(ccnt, int, S_IRUGO);
复制代码 , X2 \ c9 l1 R C
7 Q9 j9 N4 c8 K* M5 [! ^- n: P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& ]& n" d2 \" [- }. f8 |( r! R5 `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: X% F8 G) V% V' J: U
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# }9 ^, f( d( R# ]: W
8 \2 g6 s. g; h! i! d, b, S5 ]5 w% Z
|
|