|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* E1 {# Z. `( E3 o( d3 J- [code]EDMA sample test application+ y0 }6 ]% \# u3 P S
- /*
+ z5 U8 D5 } F - * edma_test.c
8 K. ^2 e$ W& z8 W - *
, G- \/ E# @( y3 W; i% O - * brief EDMA3 Test Application2 Y0 l0 J! L1 v5 k7 d; W
- *
& V9 b4 u% c9 o1 F - * This file contains EDMA3 Test code.4 ~& I5 X" w/ h, m$ R, C2 G
- *
0 a: b/ l& [$ z' _6 [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) u: k8 l9 i4 |( b$ X
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! v# j! x2 F( M6 O2 p* R
- * TO CHANGE.
) [3 G3 `/ A8 k; K3 @3 K - *
* e4 m! @, O' c8 f& X - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; w6 e3 F- j7 b8 ~
- *
i# P2 f. m# \: t4 F! I - * This program is free software; you can redistribute it and/or
( p* U6 c, M" L# @ - * modify it under the terms of the GNU General Public License as- g3 v$ q9 l' g0 f
- * published by the Free Software Foundation version 2.
( [( f9 j8 v5 B- ?6 S% S - *
; S/ A: `+ O: b% O, P - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' T, `3 V+ f, y, U; { - * kind, whether express or implied; without even the implied warranty, n8 Y: {" l$ |* k0 [+ t- Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 y6 L3 ^ M& N7 d; {1 e0 e - * GNU General Public License for more details.
! F9 p" v8 a& n6 L/ F* k \ - */
, v& q X% X- p1 L- [! d
( ]2 z) H3 V. ?1 m, _2 u$ i- #include <linux/module.h>& h/ ^ k4 ~2 y$ K$ V3 V
- #include <linux/init.h>
- O( r) M) K" l! L# I - #include <linux/errno.h>
" r3 D. D [/ n* ~2 v, x - #include <linux/types.h>9 z6 d; U7 J' W; b* v# e; I1 b
- #include <linux/interrupt.h>* @8 ~% V) \+ O0 V) F/ \) @
- #include <asm/io.h>
' i0 G# p& m/ k! G6 z( O - #include <linux/moduleparam.h>
( i2 a9 W9 P8 h7 e, H- T8 d/ q - #include <linux/sysctl.h>4 Q( t' V0 B4 P' N
- #include <linux/mm.h>
4 }& V0 k9 X- U; S; M - #include <linux/dma-mapping.h>
; p* j( {) V$ n( H3 _ - 6 h( o% [2 C$ X% B4 @5 C! o( p
- #include <mach/memory.h>
; d- f5 }6 S2 R; Z5 \ - #include <mach/hardware.h>) _' l; j# G# l4 N
- #include <mach/irqs.h>
: y% \) ~' t8 e1 D9 @: |1 g0 X" o - #include <asm/hardware/edma.h>6 c5 ]) \1 h7 h p$ n0 ^2 x
- " {6 \$ E- p/ D& X+ d; q, P2 |& l+ w% e
- #undef EDMA3_DEBUG5 \9 R: s0 d7 A$ q# K& K
- /*#define EDMA3_DEBUG*/
- V0 I2 y" R( L/ \ I: h- Z
0 ^5 @, ]" F" x" n/ f( i- #ifdef EDMA3_DEBUG
' Q( Q# a( u' s7 z' c. P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): g- w! s* B1 W2 O, N
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 P% ?3 j& H2 D5 H/ U! d% J* q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 [3 k6 }. j w1 i1 Y, i
- #else
4 H9 T1 R9 s' S- n - #define DMA_PRINTK( x... )/ u, X- N9 U% U/ X; F& f& _" F
- #define DMA_FN_IN" v7 Q( ]" M" W% v: c/ W
- #define DMA_FN_OUT
4 v: u9 w) m$ e0 }* O - #endif
8 V4 x n2 Q! u& [+ n' B - 9 W" l+ C5 K9 p+ C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); ], F1 _! m2 o+ q) i+ Q
- #define STATIC_SHIFT 3
% H7 e! U8 L, }/ r8 p7 F& ]! Z3 h - #define TCINTEN_SHIFT 20
3 g" v- |: T- H/ V) [ - #define ITCINTEN_SHIFT 21
$ h) t2 F# H+ v( U - #define TCCHEN_SHIFT 226 @$ I6 g2 @' ]0 t3 A1 A
- #define ITCCHEN_SHIFT 23
7 F; \4 b9 X; y/ O$ I% N
! V" A9 r3 ^1 c' U! V- static volatile int irqraised1 = 0;
, I. r+ v% O! H) x5 i - static volatile int irqraised2 = 0;
) \8 v+ V. t3 V" M - " o4 s/ q+ p8 w
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; K! g9 d- x/ Q8 w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; x3 k& v" H9 m4 G" A/ ?% E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, z4 }2 J. O9 A6 ?! v! s! e& [
' C4 W& W' e% ?8 ~6 c# e7 k* e- dma_addr_t dmaphyssrc1 = 0;
6 ~. }4 m1 @( _9 D. ? - dma_addr_t dmaphyssrc2 = 0;
/ l, ^+ T7 F3 o$ j5 a$ y6 t0 t" i - dma_addr_t dmaphysdest1 = 0;
' U3 E( w2 F b - dma_addr_t dmaphysdest2 = 0;
$ E5 l' C; U5 Y% r; \& n$ ?
2 F* G1 v: Q5 d" b9 K- char *dmabufsrc1 = NULL;5 N) a* y$ H& H" T1 m7 W1 b
- char *dmabufsrc2 = NULL;; g& V2 H& f9 z1 T6 V
- char *dmabufdest1 = NULL;
2 ~4 d, G# K m: p9 j# z - char *dmabufdest2 = NULL;
3 f, M# H) D( J! l$ c( [; ?
" b# y/ G$ I+ k; h: M- X( q" O- static int acnt = 512;+ K6 S7 O; T$ D0 k& g
- static int bcnt = 8;; [0 Y& I9 K/ T/ O S7 X
- static int ccnt = 8;& a) g0 s0 R# d) W0 l5 z
- $ S9 B' Y* l$ C- r1 d8 E) j# R
- module_param(acnt, int, S_IRUGO);
4 T: I0 K+ p: ] - module_param(bcnt, int, S_IRUGO);
; I- y% s6 ? @) W$ N2 G. E0 { - module_param(ccnt, int, S_IRUGO);
复制代码 3 y3 ]8 ]; n' b, |
! H) y/ u: U9 B" i1 c# a 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; x4 u4 y$ i& J- j+ j4 |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" q- x5 @3 }4 _0 e/ |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( ^% v8 o- P+ m% j W8 O
& j w3 i% r. `( T5 s4 g3 W
7 g, n, Q$ [, @& U/ ` |
|