|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 n* u- u% t1 F, A6 b; ^7 m
- [code]EDMA sample test application
5 f: [+ a+ W. g6 k - /*5 T4 p: C( s' ?$ \) i
- * edma_test.c
$ [8 `3 m# c# K8 J+ }% n( @1 C - *
. p6 Z4 M; ]3 X - * brief EDMA3 Test Application
8 z: ]2 b9 Q* R - *
# [/ S1 E X3 f+ ~- C1 b+ ? - * This file contains EDMA3 Test code.) d/ Z/ \! L& B, A/ k+ b
- *
. d/ k! e$ H( `) o" `. \) c - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 N2 J" E" |* }, }
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! Z7 V& g$ d; G @7 v+ ^# F - * TO CHANGE.) m8 F& v* R: s g, s
- *
6 A% d% \) a2 L: N& J - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' b; Q' z1 Y5 ^4 @$ H
- *
6 U/ F# V- x4 t' K - * This program is free software; you can redistribute it and/or
3 r0 ~6 N" D8 w: ]9 @ - * modify it under the terms of the GNU General Public License as: M' H: P. @/ W, [ M9 l
- * published by the Free Software Foundation version 2.5 u3 f$ h% Y/ q$ h
- *
" R. B+ [5 j: @) Y, ^& ^* a' s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ T/ |; I4 I* H- J7 p - * kind, whether express or implied; without even the implied warranty
! X0 M) T: c& B- J, }0 d" l Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 |! G: g3 i4 U& z
- * GNU General Public License for more details.! Q; c$ L+ ^0 Z6 @
- */
; |9 C# F& y3 x8 m9 F/ k2 _% J! `
4 q9 W2 H8 @2 D% H" P; z- #include <linux/module.h>
7 j @# y, b. p2 h5 P - #include <linux/init.h>
0 }" o7 o# M- E2 `4 e/ f - #include <linux/errno.h>
! P9 i* C$ m; G7 e4 O - #include <linux/types.h>6 u: j* k* U( ?# \ y/ a
- #include <linux/interrupt.h>; J z* v& v. |5 v5 m7 x) b& G; }3 S
- #include <asm/io.h>
( R, y- m( M$ ~( u) I2 [' B1 F$ o- W - #include <linux/moduleparam.h># b- i+ @+ w7 [4 ?( S7 G; a
- #include <linux/sysctl.h>
; `8 l8 y F0 u' W, B - #include <linux/mm.h>
5 u/ |7 z. Q. |* L - #include <linux/dma-mapping.h>, n$ a$ h- B% J0 k; o: V
- " V8 p% G$ k7 C( B" U" ~0 ], x" J
- #include <mach/memory.h>
" n- k. K7 V. p+ c4 s - #include <mach/hardware.h>
3 D B3 S n- Q: L - #include <mach/irqs.h>
( C% F8 H& @0 q& V0 w7 T, g" \* b3 X - #include <asm/hardware/edma.h>
1 T; V$ f- k# C3 [+ C; J - `7 d- P; o0 x' `5 Y7 u
- #undef EDMA3_DEBUG* i7 c# Z p9 f" N6 H
- /*#define EDMA3_DEBUG*/
! j( n! @4 E: i
4 R+ _4 E* T. [, C- #ifdef EDMA3_DEBUG
% A* M0 c F4 T - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# W; w) x$ [7 d2 G: W: `9 R7 y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). r- `2 {6 b6 }& t0 G" h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); X) h) F& s, N, Y% U1 ]* b
- #else
( d! r% i+ N* H - #define DMA_PRINTK( x... )
3 k( M+ B, Z1 h4 f. k8 u - #define DMA_FN_IN
# c+ ^; `2 R& F/ G. a - #define DMA_FN_OUT
0 t8 n, }1 C% G4 F - #endif
! I3 k8 ] _: X) G - 8 ]8 o* J; s& L6 o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 [ `3 N/ P9 ^$ h+ g# Q9 D- r - #define STATIC_SHIFT 3! J* W5 n- d V. p2 m
- #define TCINTEN_SHIFT 20
! e& M* h& U# U i' \2 [5 Z6 e - #define ITCINTEN_SHIFT 218 }$ C$ h- U: H* ?: x, x$ K# m; N
- #define TCCHEN_SHIFT 22
( Q/ m* `5 F5 q: C ~5 x - #define ITCCHEN_SHIFT 238 ]- }) D& T6 Y- b
- ; ~/ y1 H; a& z: [/ \" r5 a& v
- static volatile int irqraised1 = 0;
! O3 h/ } c! U9 j7 L z+ U* n - static volatile int irqraised2 = 0;, l b+ ~7 J0 A+ D! N
- 0 X0 t' ], C2 g+ } A# N" j8 b3 ~
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 o; O7 n& c* X( h( g" |' f
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 k+ |" p1 Z* d1 l
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& G3 m4 W# _0 e; t, W' b2 I
- 1 g3 A1 r" p1 Y3 v) G. f$ O! U
- dma_addr_t dmaphyssrc1 = 0;! Y, S2 g5 G2 j5 ?& \( t, \( K& k7 J
- dma_addr_t dmaphyssrc2 = 0;) B; x2 X8 a" E1 ?6 t
- dma_addr_t dmaphysdest1 = 0;# v7 w* b; L. i$ [
- dma_addr_t dmaphysdest2 = 0;/ M2 r, Q" l! P. z; M2 ]
+ @- T: _9 w- Y j% w% I7 ]- char *dmabufsrc1 = NULL;
& d; u* A h8 a) ^3 S5 K - char *dmabufsrc2 = NULL; s2 z0 g( t& u- j
- char *dmabufdest1 = NULL;
3 B6 A# p {6 |0 z( K7 Q% t - char *dmabufdest2 = NULL;
- y! f6 ~% K" t( p - 2 ]7 Y/ @# Z8 C2 A3 k2 L; m" R
- static int acnt = 512;
6 D: R# f) Q4 S9 ]: l - static int bcnt = 8;
9 T8 }: C1 q, ^- {! p" g) ]$ ^ - static int ccnt = 8;: Y4 O( @7 B) K2 w
- # C' ?& l; ]( L8 s! E4 h9 S2 N) Z
- module_param(acnt, int, S_IRUGO);
" G( e; O" v4 r' v/ w - module_param(bcnt, int, S_IRUGO);
! k* L: D) J/ W8 F0 `3 { - module_param(ccnt, int, S_IRUGO);
复制代码 . W' k4 ~! n- @% H
: ?1 }& J* s- S: y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 I5 z# o: b) {- B. k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* X5 g+ B* _6 P$ O7 ~4 T% Q6 u5 z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* o$ o6 A& ^5 ~$ J; g& f; B1 C0 g
3 E4 q( p. N1 T$ Q3 T$ x& A3 R8 c" R; o
- e# F0 l V6 n! W, Q$ D- l |
|