|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; g/ D! y. W/ {/ N5 e
- [code]EDMA sample test application
1 v" ?# e0 I S* `- E; Z4 ^; T) g" x& L - /*
7 C( ?! M( N5 \, X - * edma_test.c
0 X+ D, T1 ?) n' y3 q5 K5 b - *2 I/ d* y. a9 G6 y1 g( B
- * brief EDMA3 Test Application
4 B) r1 Z- k# L7 D# e) E$ \ - *4 Y* D5 Q& g3 J* M- g" a7 R
- * This file contains EDMA3 Test code.) s3 N3 N" }% E3 U
- *
! ~& D- A, H9 P! B1 G# `6 Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 ^+ z+ ~# {5 o2 W. C" i
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# [! C; n! [$ y1 `
- * TO CHANGE.
' F2 A6 c+ i! ^& S/ p( h - *
7 P4 H, @5 O7 S- i% W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, K) d' _+ K" r) J. Y' y0 S* F( @
- *
1 O3 K& F8 {/ Q/ \( p+ [ - * This program is free software; you can redistribute it and/or- |" ], m/ Q9 g
- * modify it under the terms of the GNU General Public License as/ {& |/ b* l. V7 L0 l0 r& p4 L
- * published by the Free Software Foundation version 2.9 Y' ]0 J2 F5 t( g$ E
- *" Q# e3 ]( t( I$ U. S
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* w, O* @ I% l0 R
- * kind, whether express or implied; without even the implied warranty
0 L- S6 {/ s. L: p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% z( Y# I2 S+ W$ t6 {* y* O @ - * GNU General Public License for more details.) N6 f& Y8 d6 U$ B
- */2 _! F% B) c e0 ~1 U z
( L( H8 o# R. N1 N( h" B- #include <linux/module.h>1 C# }* B# ?, K; [
- #include <linux/init.h>* C5 W3 i& J: t0 Z
- #include <linux/errno.h>
% T% G3 y5 @1 y: l$ t - #include <linux/types.h>6 J' J* C Y& e9 F
- #include <linux/interrupt.h> ]! b f+ D4 S7 N" |
- #include <asm/io.h>
4 o2 F! u Q6 z, I - #include <linux/moduleparam.h>
" ^' u. T) a3 W( _3 E7 f: V - #include <linux/sysctl.h>
9 c; W8 o6 t5 J7 e/ z+ Y - #include <linux/mm.h>
: l5 z$ M4 r7 M - #include <linux/dma-mapping.h>
: P) ^! f/ D4 c A4 J
5 {+ c! X9 A0 V" ^" F' ~6 G/ W- #include <mach/memory.h>' d( G6 y9 F1 ^ {; U4 G6 ~2 d' {
- #include <mach/hardware.h>
& D% f2 H- p6 c# H, _$ y T# x2 N! A - #include <mach/irqs.h>
7 y1 @5 b2 _, k' ~ - #include <asm/hardware/edma.h>
; n/ ^7 n$ `. }/ H/ s; z8 g0 v - $ g' {4 `# y5 I4 f0 t; p* q
- #undef EDMA3_DEBUG
9 R' C9 j& ]' g9 g9 | - /*#define EDMA3_DEBUG*/( T6 v/ m" t+ m6 F
; ^9 B- H; `! l" \: U- #ifdef EDMA3_DEBUG- F6 \, l" p! F* `& Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) \6 x9 U: H6 ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 o! Q; i$ W- K! |3 |- o0 q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 L2 [: b; C9 v0 J - #else
$ w9 o/ H4 X- j s3 l% ]) d9 \) W% d - #define DMA_PRINTK( x... )
; j: B u7 u- H$ n - #define DMA_FN_IN# G& Z. U0 k3 { {9 A- \
- #define DMA_FN_OUT
~- k+ w$ l- c* O/ L/ m - #endif2 X. s) p' M" m1 w
- ) r0 M" u8 s& e9 N2 w
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& p" ?5 O6 a8 { - #define STATIC_SHIFT 3; T% v/ m; s1 O2 @& z$ f
- #define TCINTEN_SHIFT 208 K4 R3 ?7 h) H5 z, G
- #define ITCINTEN_SHIFT 21/ C" m$ h# c( c a
- #define TCCHEN_SHIFT 22- y5 \0 H: Z% z+ u3 ~( R# t
- #define ITCCHEN_SHIFT 23. ~ z! S. T i! F. ~! Z
6 ]; j9 ~6 [5 v. N U- static volatile int irqraised1 = 0;
- T# ?' k1 @* C& { - static volatile int irqraised2 = 0;: D" c/ h! {( m/ h! t6 Y8 E
- O2 T& \( m$ T) [+ r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ S0 L* d9 L' U6 P - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 P5 ?/ j8 r' a3 p0 @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ a7 a/ p, J/ x' k, ] @0 @
- 8 A, o8 x+ Q' J- j" s4 v: p, e
- dma_addr_t dmaphyssrc1 = 0;
% U9 g' T2 Z0 `2 S0 v+ i - dma_addr_t dmaphyssrc2 = 0;8 M2 Z$ f1 d' d8 o- Q9 s
- dma_addr_t dmaphysdest1 = 0;
* D& U% Q, w1 |7 j4 o2 p, ~1 R' w d - dma_addr_t dmaphysdest2 = 0;
1 w; Q/ T$ b& K- D0 I& Z/ E0 I: v - " L/ N1 x. p& d F1 u* _% S
- char *dmabufsrc1 = NULL;
6 V- ]: u" I8 L2 D d. w7 |* Y - char *dmabufsrc2 = NULL;
' x, f3 E3 ~0 R - char *dmabufdest1 = NULL;
8 t; [. d! L' e! y* W, K - char *dmabufdest2 = NULL;$ m2 B; Z: @$ u
- / s5 O/ F+ i( s) m! [0 a' ]
- static int acnt = 512;
% ]3 \- h \8 Q; W5 {9 q - static int bcnt = 8;5 s/ o$ Y4 d" o, `) V P# _. m( i/ X2 e
- static int ccnt = 8;
% N6 F8 c% C2 T
: Y) f" z' [; K' D8 [% _0 O- module_param(acnt, int, S_IRUGO);% @9 ?! l# [7 i. F4 D1 X" f
- module_param(bcnt, int, S_IRUGO);+ e& G$ c s* P6 d- I; M4 U( t
- module_param(ccnt, int, S_IRUGO);
复制代码 3 X, ` @# R4 f& {- S) f _' Y+ j6 P
: K: Y1 b4 S% B 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ V, ^; `* c: U; m& z! x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- I- o+ O4 e0 E! \, q* j& ~ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ e' g% y+ L3 |; Q/ t+ g: c" G3 l
( `; _% q( N' D/ j7 m( ~8 C- L: G% c$ J/ w% z
|
|