|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 A1 B: j3 s" X9 |3 A
- [code]EDMA sample test application
3 j, K1 I0 r: K2 O - /* v. t& p0 Q3 j6 T/ G; s; z! h1 U
- * edma_test.c
% j9 ?* N/ s# J - *, n2 N8 `* q9 r0 t, p3 ^
- * brief EDMA3 Test Application
' p7 r$ g9 ^ e' L - *
0 B9 p& k, o; C - * This file contains EDMA3 Test code.
( x# U& M k5 ?1 b2 B' e - *9 ]* ^- ^- c/ x& v1 \% ` [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! d6 ], z1 ` e0 @- i ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 ]1 s" i& ?. `' _, Q( r: t - * TO CHANGE.. [/ r3 m$ T" T+ d
- *
% h% z! D" v, f6 X9 e. ~ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( x- d2 t- X! K0 i
- *
! y5 b, D- E4 W5 _ - * This program is free software; you can redistribute it and/or
" X b$ s+ [$ T) X7 ] - * modify it under the terms of the GNU General Public License as
! m4 W3 \! m" }$ S n8 D/ n( g - * published by the Free Software Foundation version 2.
. y1 r& j }- r+ U$ g9 F - *
- I: [( j: f& q8 J2 l% l - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. i6 R' S) J2 B7 a/ X
- * kind, whether express or implied; without even the implied warranty
5 M) b3 O+ @8 h: {4 ~, q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" S+ \& ^ T. g1 g$ R
- * GNU General Public License for more details.6 h3 a$ t2 d( H0 P
- */1 d! z- e! S$ X2 f" H" A! k
- s8 {! E0 O# B8 p5 E) _- #include <linux/module.h>
/ H# ]! Y8 ~: e8 M/ J& H - #include <linux/init.h>
# ] \% i5 `( Y8 a4 [6 G: S - #include <linux/errno.h>
& C+ `$ ~8 y3 u& ? - #include <linux/types.h>/ l$ Q' y# J3 o# ~* k- d- a
- #include <linux/interrupt.h>! ?8 g8 T; d, C
- #include <asm/io.h>
, t# t2 B. ?: W' H! U9 X - #include <linux/moduleparam.h>
4 p. v" K' \# F2 Y - #include <linux/sysctl.h>
, T4 i. a6 x; T: c- I - #include <linux/mm.h>! _" T4 d) q/ U& O: C
- #include <linux/dma-mapping.h>; a0 F. ?2 _0 u: G3 }! R
- ; C4 `: T6 L/ _. k# ^
- #include <mach/memory.h>: R! \, a7 _, q" D( m* V: R+ X- H) b
- #include <mach/hardware.h>
3 A" g" j, K3 _% e- x* y$ { - #include <mach/irqs.h>/ K$ y$ x2 Y, R
- #include <asm/hardware/edma.h>* B6 n# v6 P, F+ F% h, y
- * L8 q! f. h4 b4 c5 s' X* X# c+ f Q; f
- #undef EDMA3_DEBUG3 d; f/ N: w. ]' A- u p/ o
- /*#define EDMA3_DEBUG*/# |1 G; L3 w! ?# \. F* m
- 6 u0 g( k1 K0 p
- #ifdef EDMA3_DEBUG4 ~! ?* \9 G3 w9 W* `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 q i6 V1 y$ \" @# o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 T5 P, T/ Y$ r4 g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. [ ?+ i! s) q- V6 ?) B5 M/ } - #else
2 {0 e* [9 A7 y; L3 B) p& n- Z' ? - #define DMA_PRINTK( x... )
1 L5 L0 X. D, w8 ~, V6 I2 }/ w - #define DMA_FN_IN2 e& r- f5 m+ y" f* ^
- #define DMA_FN_OUT
+ b/ U# c3 G5 F* X; X7 Q - #endif
( n& D# g; O' x3 D' r- w9 } - 0 X* I4 d% S: k4 ?: t( |/ l1 ]3 c/ }$ z. h
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( A7 k' W0 K: I3 [ - #define STATIC_SHIFT 36 l" Q6 i) R Q
- #define TCINTEN_SHIFT 20; M1 s, O5 b8 a' Z- l
- #define ITCINTEN_SHIFT 21# R/ T( u$ _% m: E% i1 d
- #define TCCHEN_SHIFT 22
! b% J- j( A& o' W( O - #define ITCCHEN_SHIFT 23
. a5 p$ T. C& G0 |4 @5 a/ J - ) W, u5 d9 [8 k
- static volatile int irqraised1 = 0;* i' _8 l* h. ~
- static volatile int irqraised2 = 0;, ]; B. ] e' O& Z
9 }. |3 t% H6 N3 o& Q5 l; l% ^- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# O; g7 Y( T0 V2 Z' d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& J5 Z' e9 s- ?* N, C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: `: g) \, u& p7 Z: e& V
& K6 {: J$ W- B5 o2 B# y/ z+ L% K- dma_addr_t dmaphyssrc1 = 0;
& }; g* [2 D1 N0 u) B1 }) |+ O: M - dma_addr_t dmaphyssrc2 = 0;
" s8 N0 j* M/ K* l* h( F - dma_addr_t dmaphysdest1 = 0;# {+ d( b. \2 ]: ]5 J
- dma_addr_t dmaphysdest2 = 0;
4 G, J- Y( w1 s6 v* |' i
0 Q8 q f' S. L3 r* p( K- char *dmabufsrc1 = NULL;
7 g" F! L8 H8 A, x - char *dmabufsrc2 = NULL;
" b+ @" I) B/ L9 A - char *dmabufdest1 = NULL;
" ?, e2 p) c7 o: I& o - char *dmabufdest2 = NULL;
- D6 c+ p0 P. P& M3 U
$ J) j1 b7 [& ?& P- static int acnt = 512;
3 g0 E9 [: L0 n1 g+ N - static int bcnt = 8;
# q! C" r6 [3 b$ @ N3 q - static int ccnt = 8;( a& A! ?9 \. G: s' U
- I. Z! _4 b- _; j8 Q
- module_param(acnt, int, S_IRUGO);0 f' v7 X! _: j7 y
- module_param(bcnt, int, S_IRUGO);; H. _" P2 C0 c1 [
- module_param(ccnt, int, S_IRUGO);
复制代码 3 a/ K2 f+ e1 [& W1 {; N# |
Y" g/ ` f; S* l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% Y j0 Y: j7 W& V9 v& }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. B) t" I% p7 W7 \" G1 _5 R2 r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 S4 N( z& L4 R) @9 n( N8 C
* F6 m \2 G/ O5 @2 W- q& n3 c' p" m4 L/ j5 @ i' K9 `2 K, S7 ^
|
|