|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! J6 \6 r5 w4 I9 g2 y- [code]EDMA sample test application
% q5 j4 F/ \- y/ j; |1 b - /*, G& K1 n+ V6 d# E, C2 G
- * edma_test.c2 k6 l9 A' O m
- *3 R- w6 W" E+ {& [1 A
- * brief EDMA3 Test Application
' ^# |3 m; x% ?, Y' v - *) o1 E7 f* ]) ^
- * This file contains EDMA3 Test code. k& @% W! a0 f, ~9 X1 P
- *
3 Z% `- w# ]9 u- m6 Z! ? - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 H- E+ w% X8 M( J' C& T - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: q2 ~# ?2 s, Q+ J6 c- j2 }
- * TO CHANGE.
1 ?$ M, ] W/ K5 | - *
5 u0 X8 k6 p( }1 a! C1 F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ i! {! f) ^8 \: t - *3 t" T Y# t% C: n% z5 M# ]
- * This program is free software; you can redistribute it and/or) D$ n/ r. h" h ]+ C# r: Y
- * modify it under the terms of the GNU General Public License as
. ~3 [* r/ t: w- R3 Z/ u& v - * published by the Free Software Foundation version 2.
3 ]% t$ d3 d/ `0 U) P1 ~ - *6 \5 |4 _) n7 U) j6 K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ y3 a! s+ _6 n6 R! U0 v - * kind, whether express or implied; without even the implied warranty
/ q* j( C/ a2 w$ L( `7 t8 [4 o - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 [/ G! G0 E! ?: W% P - * GNU General Public License for more details.( T5 r$ x1 B( }( m) \+ y) D, t
- */7 \0 G1 Y9 X- |/ B7 Z
+ L" i, s- H. X; Y5 S, J- #include <linux/module.h>8 g/ d3 k( B# u& X) s( R
- #include <linux/init.h> D$ y4 D/ P; `( Z0 I7 z4 p9 }% p
- #include <linux/errno.h>3 d6 `0 K+ W3 O- J" P& g
- #include <linux/types.h>
/ X! l, f5 [ Y7 ? - #include <linux/interrupt.h>
" C" A1 _$ C& ^ - #include <asm/io.h>
/ O. H, U) D& }, \# {5 ] - #include <linux/moduleparam.h>
8 d( u# `* E8 ~: l7 N& G - #include <linux/sysctl.h>7 Y1 [, p# k$ N9 D6 m
- #include <linux/mm.h>/ {7 U8 h+ p; {7 \6 F
- #include <linux/dma-mapping.h>/ N& w( y& e! [9 A5 q; B" Z4 v# O) o
/ \; C2 [6 B* V4 }! X+ p* w- #include <mach/memory.h>
1 |& _/ p+ e: y8 l/ f - #include <mach/hardware.h>5 i# p5 P1 A0 U6 u
- #include <mach/irqs.h>. ~1 `9 C" X8 T6 _# v% z
- #include <asm/hardware/edma.h># l, F* @( t. f3 o" c5 h
5 X. \" n% {6 j6 `" o p- #undef EDMA3_DEBUG
* E* t) ^, |' P - /*#define EDMA3_DEBUG*/5 O8 A) z3 C- H3 ]2 I
- 3 N- E1 X$ F7 }; n
- #ifdef EDMA3_DEBUG
7 m7 l i3 P! \4 p4 B: C w* } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 C- Z) R9 g' {% i E a6 R4 ?; g% U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! V' [3 i( R, E2 e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 i9 P' ^( ]! ?+ G5 O
- #else
* s% E# A* W2 y. [% I- j+ b/ } - #define DMA_PRINTK( x... )3 `+ Z' ?3 N+ L; K7 k6 I A
- #define DMA_FN_IN+ }8 h4 s$ P* v i, x8 D4 V9 N
- #define DMA_FN_OUT) [/ g/ M: |- e: q- V2 O
- #endif
& P2 V7 e# U5 N8 s - & J* v9 t# T R$ z, M2 U: V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* V- y4 i( C9 F9 |) E N. n$ j9 k
- #define STATIC_SHIFT 31 }( `: O5 G2 S3 u* [
- #define TCINTEN_SHIFT 20
9 y1 j# w0 c/ |2 t5 S" { - #define ITCINTEN_SHIFT 21
4 F* ^$ h- |- O5 H - #define TCCHEN_SHIFT 22
, ^% U, X# |/ ] - #define ITCCHEN_SHIFT 234 [9 I: o& n, B
- 2 c S3 k+ v9 n6 W% P1 G# u( |
- static volatile int irqraised1 = 0;
- F. j+ C% y$ g D2 I0 y2 @+ o8 V - static volatile int irqraised2 = 0;
N4 r. u4 N9 y/ k+ z" G - ! P7 H' [- R. h0 ^4 d" E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ E: L" `8 h t- K) | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: j+ |$ B. S8 J( q- }
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
_7 [5 X8 a! \, ~! g) X - 7 j% o: D/ d2 j8 }9 S0 ?! P2 e
- dma_addr_t dmaphyssrc1 = 0;; b4 X2 i3 K6 x8 H2 z- V& ?% O
- dma_addr_t dmaphyssrc2 = 0;+ H }, N* U0 U2 r" M1 Z
- dma_addr_t dmaphysdest1 = 0; R" p1 U) D. L' A
- dma_addr_t dmaphysdest2 = 0;
. {6 Q6 p4 z9 q4 T5 t- X' Q. q" F - , f, `1 Z3 a S6 D2 y
- char *dmabufsrc1 = NULL;- D0 O4 u) ? J: `
- char *dmabufsrc2 = NULL;/ g, P4 w5 ^2 [
- char *dmabufdest1 = NULL;
3 H6 Q D O' k0 o. h* j - char *dmabufdest2 = NULL;
2 B* d; [$ R7 q5 E% G& s - & p5 l; F. A- y
- static int acnt = 512;" N! J& s/ X$ H! r1 }4 W% M' K* ?
- static int bcnt = 8;
2 ^% M$ m! U$ u( O! @9 ^ - static int ccnt = 8;* b1 \% }- z1 k$ }( c/ f
- ! j0 W; H3 ^( j7 X" |* ?' N, y
- module_param(acnt, int, S_IRUGO);
! }0 N& D% y* Y0 J3 ^0 e - module_param(bcnt, int, S_IRUGO);
% F3 B r. a7 _" Z. S1 v - module_param(ccnt, int, S_IRUGO);
复制代码 % U' \: M9 b: u& n6 A8 m: p5 Q' d/ l
. X1 u1 T) [9 ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
w9 }7 \/ P# m- }5 r' Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 l( T. F8 H& B7 Y# u, Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* h" g3 I+ r; D/ `) P/ \' a
3 G0 c" i* G4 f3 Y% m9 {! I7 @& i# S6 x3 v3 m) m0 D, ^
|
|