|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% u% e! L! J5 q- |, {& o% ~* `- [code]EDMA sample test application
; `, V) D8 Z1 D3 e - /*+ U0 l( o8 J5 z1 J8 K8 o
- * edma_test.c
) u6 X, a$ M t. O9 w - *% q0 D! x0 t8 c8 K0 _
- * brief EDMA3 Test Application( y; J6 P) V: S6 r! `& }; m8 H
- *
& Q8 W$ p* t6 V( Z$ a; q - * This file contains EDMA3 Test code.2 D7 Y8 q9 M: x5 R* V0 Q* W
- *1 L$ D% T! @# D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% |. F4 P+ o2 J" u# u& G& S6 I
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
M( G* _' Q6 _0 D, T+ Q - * TO CHANGE.
4 m5 L4 ~( {! q1 ^ - *' d* Y2 L* U$ a0 B$ S2 v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 A3 d# z1 D8 O
- *
) T5 e( l _, [' {; @' R" V# C1 a - * This program is free software; you can redistribute it and/or
. N" E: ~0 M$ \$ p - * modify it under the terms of the GNU General Public License as
. [" E1 n0 M; i+ ? - * published by the Free Software Foundation version 2.( }* \" c1 e2 T m* o) P v- O
- *4 M. A$ W' ] [9 r+ l# O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any' i1 i7 n6 k7 K E: _6 H& x% N
- * kind, whether express or implied; without even the implied warranty
5 O; C6 o: J8 l1 R% T+ B8 }1 M0 b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 c" o2 h( Z! Y# w+ R }: a - * GNU General Public License for more details.
/ X9 L: V; L) g, ^3 ^! h - */
0 e8 H0 F# A# Z& N2 |
$ |' d5 r+ u9 @& Y1 k: P" {- #include <linux/module.h>
$ D) ^0 z+ F9 V/ f0 ?; M - #include <linux/init.h>
0 |* X; x& S' U) p: | - #include <linux/errno.h>
+ ^6 u5 \9 J5 p3 I4 t0 N - #include <linux/types.h>6 ^& y. J7 J8 H% A' ?$ O% ?
- #include <linux/interrupt.h>
5 Q) h9 o. F( s3 e2 L q2 c3 N - #include <asm/io.h>
) V% N6 J6 a7 a7 ~. q - #include <linux/moduleparam.h>
2 k0 x6 [3 p1 G& S - #include <linux/sysctl.h>& ]3 D" S$ b6 j) d# K1 S
- #include <linux/mm.h># x9 a3 [1 R4 J) b( z8 u/ b. w
- #include <linux/dma-mapping.h>
/ J% S* H% r& n& ]& Y1 z - " i1 ?6 B- r9 P! E5 O$ z' Y
- #include <mach/memory.h>+ Q" ?; W2 P" f1 X; z
- #include <mach/hardware.h>+ Y; v6 k. T0 V; e7 @
- #include <mach/irqs.h># o8 }: Z+ h& Q6 R
- #include <asm/hardware/edma.h>
* |# R. j. c0 q - 9 V$ d) o* ]: m+ Y" n- S
- #undef EDMA3_DEBUG1 r/ \. g" {; s8 Y9 ^
- /*#define EDMA3_DEBUG*/0 o- b/ d& C8 s8 E6 r& }5 h
6 e6 z( |0 d9 e7 M- #ifdef EDMA3_DEBUG4 r9 ~2 p# B* X, L# V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): A. |7 ]7 o. x+ {8 ^: u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
q5 R/ \% N0 F2 a G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 g5 ?. }6 l) ?% j' R6 X
- #else
: ~! Q, W: N, e7 Z& Q4 O - #define DMA_PRINTK( x... )$ [( w- J+ I5 |" J
- #define DMA_FN_IN0 R; a/ w& N* z: {' Y) A, i
- #define DMA_FN_OUT- E: \/ M U$ }6 G# b' l: k
- #endif
6 ^3 m3 p7 @: B
3 F$ e2 q4 D3 H* M1 L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& n: O1 v5 p3 r# b1 A6 q - #define STATIC_SHIFT 3
. F& X3 [* K, p- D3 d - #define TCINTEN_SHIFT 203 ?& f+ A# K, d/ ]# P
- #define ITCINTEN_SHIFT 21
7 Z4 f2 w) a) m0 Q% O9 G - #define TCCHEN_SHIFT 22) i6 r. p' A" {1 ~
- #define ITCCHEN_SHIFT 23
9 F+ I, p; I) g& j9 D& Z) p - # D" x+ ]' V. G B8 x9 f
- static volatile int irqraised1 = 0;
( O5 Z( |/ d$ `- x - static volatile int irqraised2 = 0;
( C# p4 B! D ~# l - # i6 p4 f& n6 f* _7 ~7 f5 }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- D5 U9 C+ A2 g7 M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( W, U4 j1 _7 ^3 `- e5 c( v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 z1 F9 z; ^) V9 z( f/ E+ ?/ l Q
$ A- C/ c8 z. r- {0 m9 B q- dma_addr_t dmaphyssrc1 = 0;
5 D, C" K F0 N6 z" e - dma_addr_t dmaphyssrc2 = 0;" G; L# |" d3 [( F. K
- dma_addr_t dmaphysdest1 = 0;
+ ~- s" H7 M- A/ A: V; h C - dma_addr_t dmaphysdest2 = 0;
/ q6 K8 ?; t9 G% B% @9 }9 G
& N1 \5 @3 Q! s J$ x1 |- char *dmabufsrc1 = NULL;
& K4 i6 l3 {( a' k8 c - char *dmabufsrc2 = NULL;4 d+ S1 F0 z% I
- char *dmabufdest1 = NULL; J* f; s4 z, |8 i" G
- char *dmabufdest2 = NULL;3 P5 B' s2 F' U+ J; s& p' x) g
- ) O( H' x7 m: z; Q# }& s0 }
- static int acnt = 512;2 C- n( `& i0 R
- static int bcnt = 8;% L4 G A k5 P, U) L$ q
- static int ccnt = 8;* I0 o! y( x5 k" a8 U; K- @# t
- 2 H. U# p. J. T4 ?- N/ b. s& c3 C, A) U
- module_param(acnt, int, S_IRUGO);+ r3 J4 @8 | M% _- g* S
- module_param(bcnt, int, S_IRUGO);
6 Y6 S/ b+ D- [# g+ Y+ | - module_param(ccnt, int, S_IRUGO);
复制代码
) Z* q9 a$ {% T% d, y; m# D# F% G0 O9 }& H3 L4 O5 Z# G# Y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* `* k( G$ X' m) c* a' @" Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 Q) W5 T" H# H5 f/ y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 n* `, O; H) b7 N, R8 _) n* B% _, ~) N: f1 T3 c4 V/ U
) s/ R, x F! A( z+ s/ w; K
|
|