|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( ^8 O% d7 E, F8 t0 q- [code]EDMA sample test application
* x! H# T. Q" N% }5 m1 K" u - /*3 R) P* }" d* h" r/ x( \6 X9 {, l
- * edma_test.c
2 x% m# Z9 X1 U" e# N - *4 X- c3 T; l* o" o* @0 n1 R4 v9 A
- * brief EDMA3 Test Application
/ Z, y# E- u4 }4 a6 m; s3 _- d2 L - *6 P1 y: {8 A' |9 J0 B: N8 K+ }
- * This file contains EDMA3 Test code.
' u. {0 M! _ ^! g: i6 h - *3 g1 o6 Z6 C8 y! i$ K: D4 g
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 L$ O" F k$ v0 i
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) R+ e! J* X8 x. k
- * TO CHANGE.* J5 T; m% h% U6 m
- *
" @8 E2 H) {" P- Q& y9 @ b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# o8 Q M% l; N$ _2 X - *
" ^ M9 r' l: l$ n& m; c- f - * This program is free software; you can redistribute it and/or$ r! m3 ^: |& C
- * modify it under the terms of the GNU General Public License as
; z& w5 p/ V' R% ?! B- d( Y# R, i - * published by the Free Software Foundation version 2.4 v$ m! x0 z4 ]
- *
; S. B. b! P3 Z1 B6 x5 _# u& B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 r& _, `- \( s# _4 [# ~1 u - * kind, whether express or implied; without even the implied warranty
/ F7 z# C: M5 d9 X( h% Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 `- p) i2 J+ G+ f - * GNU General Public License for more details.
1 ~$ b0 R- O2 d5 N4 x) f% J - */. W8 o! O0 S1 l* h9 E6 y
3 ~! l2 }$ y F- #include <linux/module.h>
: Q9 C6 H) x( o( i& d; {6 p7 b0 K) a - #include <linux/init.h>
, a u- p% p( k) d; L9 _4 U( \! U/ ^ - #include <linux/errno.h>
: h% a( q) A: f& F/ ]" T3 x - #include <linux/types.h>9 O, _3 ~& k0 {# \) D5 A/ q/ _
- #include <linux/interrupt.h>
4 S2 o& M8 p |" y! G6 m% U, I( T1 h. m - #include <asm/io.h>
; V& Z! }$ x8 o* ^; f4 ? - #include <linux/moduleparam.h>* F/ w7 \/ |/ U& [
- #include <linux/sysctl.h>
8 p5 B3 W8 Y( s9 Z- D- H - #include <linux/mm.h>6 S9 b; I8 o/ [# H& K1 g) m
- #include <linux/dma-mapping.h>
7 r0 m9 j% q. u/ v# M - ) i1 O( X: k! e8 I c1 g4 e
- #include <mach/memory.h>- d6 T N! `( y( A3 n0 I
- #include <mach/hardware.h>( b+ ?& Y0 p: K H1 L
- #include <mach/irqs.h>+ i* T. y/ t8 t" F9 F
- #include <asm/hardware/edma.h>% K/ U# e$ H& M3 C
M8 g `* x7 b, R$ g U7 E5 ^- #undef EDMA3_DEBUG
' n R( o) w+ _ - /*#define EDMA3_DEBUG*/
6 E* ~' O' S7 A1 [4 ` - ! X! d1 w$ w% R* V" g5 q
- #ifdef EDMA3_DEBUG
% r" Z# T. R" r - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 q, C* Q! j' p- k( H! F5 }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% @# E1 \% s7 U, q) | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 l& ~4 y9 v1 A6 t J) s0 \" B
- #else
2 m) ~/ M2 v P* k& ]3 R- B% N3 P' F - #define DMA_PRINTK( x... )
0 H9 U: n% s- D - #define DMA_FN_IN
! N9 Q5 {' e7 p: ~# J I - #define DMA_FN_OUT$ A. d8 Z1 H; {$ I8 L3 u7 ^. Y
- #endif
; V# ^' j) i! D" W8 P6 | - 8 ~; b0 Q) _+ f9 ^5 p; m$ u! [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( Y6 E/ n# {* T$ D) c) K6 o - #define STATIC_SHIFT 3- T* [% I" b) b7 _ M
- #define TCINTEN_SHIFT 209 G! Z) d( U8 Z
- #define ITCINTEN_SHIFT 21# `. N G& Q8 P: S& h
- #define TCCHEN_SHIFT 22
; K7 x, K2 x) Y - #define ITCCHEN_SHIFT 23
v- m! D! d. T3 N7 U
, W0 i) P3 x1 ~( Q: d- y- static volatile int irqraised1 = 0;0 v" @6 t$ A' j$ I6 V1 `9 j& z
- static volatile int irqraised2 = 0;3 W6 U# J- h- O9 r. e
- 5 y* q( z! ^$ W$ W7 I i
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" }3 n* r; ?" h e. [6 z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 _! d" \; g. K4 U* H, I
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 |7 \4 F M$ G7 m - ; o: N$ J9 ?6 a# M
- dma_addr_t dmaphyssrc1 = 0;: [3 J) i# j. e; N
- dma_addr_t dmaphyssrc2 = 0;
4 F5 v4 K+ B' Q/ B2 r - dma_addr_t dmaphysdest1 = 0;7 j2 N0 Q& @) j' l! y
- dma_addr_t dmaphysdest2 = 0;
* q6 c2 Y, v0 @6 B4 p* B - 7 x1 Z: b) n. I+ U3 Z" ~: r7 Q
- char *dmabufsrc1 = NULL;
9 W- a' b; O( `3 C* y - char *dmabufsrc2 = NULL;
1 H& c. a/ d& W+ |8 G6 X) i+ ^ - char *dmabufdest1 = NULL;
4 a/ H/ J' p* I/ e+ |" L5 V1 k( _" ~9 z - char *dmabufdest2 = NULL;1 O& j9 T: L* K) N- u X7 e" h
- / m. g* `" |# B E* {
- static int acnt = 512;' U0 W6 ^6 d3 m* A' Y
- static int bcnt = 8;+ C: Y! ~& L: @2 z$ {
- static int ccnt = 8;; ]: o; l1 h6 I2 M5 J' q8 b# s% W! @
& `3 l1 ~1 c$ s) _: k- b, s# C3 m- module_param(acnt, int, S_IRUGO);
9 R/ i+ Y6 F* M8 r7 x - module_param(bcnt, int, S_IRUGO);
1 p& Z' h+ R% H" V' j4 M7 c. ?$ v/ K - module_param(ccnt, int, S_IRUGO);
复制代码
+ F1 P. V8 F* D, g" L% ~1 t
- p E, \' g0 | 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 k& Z- ]( T4 Z7 `- N, @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" m8 j9 k5 C- |7 @ a6 P 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& a2 l/ G7 N( @% t! V% |* b5 G
! O* @+ ?5 e/ ~# r& B |
|