|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % L6 l t* [( m5 w0 R
- [code]EDMA sample test application* C' a. d/ u; T3 e# J6 N8 L
- /*
$ `3 u8 i# q z - * edma_test.c
7 g+ F0 d: l# A - *
: C/ A4 K( R) |2 y. C4 j, O: c - * brief EDMA3 Test Application6 m5 x, u5 D9 u1 l5 L* x
- *4 j" M5 I U0 o! Y
- * This file contains EDMA3 Test code.8 [9 O) R* \ m4 |
- *
' @. T5 I5 n- ~, X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* c' e5 D/ T0 A. o3 ` - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, [2 e5 N+ f( i% d# G' X+ i
- * TO CHANGE.
. ~* B6 ?* K0 |2 n5 [ - *
: x' b. H' y: N% D4 i9 l1 l - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% A* z/ T4 _' v8 U2 v - *
2 h. N/ _0 I4 _. W5 C - * This program is free software; you can redistribute it and/or* z$ a' V: S( @$ `1 c# J
- * modify it under the terms of the GNU General Public License as
$ H" i E; F% \4 @ - * published by the Free Software Foundation version 2.8 x8 c; J/ o# U" F
- *5 \2 F9 V2 E! E0 a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 u7 }: P' ?2 O9 J - * kind, whether express or implied; without even the implied warranty5 A6 y. P9 W" E! X. Y2 m$ p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 z0 W: [- l. E) c1 p5 W- n
- * GNU General Public License for more details.4 k6 [7 K0 b' @
- */
q, b6 q2 p" Z; [* i - 7 j2 R5 M+ C& x5 r
- #include <linux/module.h>
( b& k$ z9 P, d4 v6 N - #include <linux/init.h>0 P* S9 _4 b; p( E0 U( S0 B
- #include <linux/errno.h>' N6 p* \% ?+ c- s- ?& G, u
- #include <linux/types.h>
- v# |8 Y5 p3 O. h8 i# K1 R - #include <linux/interrupt.h>
5 e! t. H: ^; L - #include <asm/io.h>
3 L# _4 E# r* V$ F - #include <linux/moduleparam.h>
. u6 m! q/ i% Z9 w2 M+ G - #include <linux/sysctl.h>0 z7 S) ]: A$ _) `" E2 g
- #include <linux/mm.h>
8 l* m0 O5 Q% p6 m2 ? p$ S - #include <linux/dma-mapping.h>
4 D" _! z% P1 C - 3 X* J- c; Y& d: a! f! t- y
- #include <mach/memory.h>
1 P. h+ l' m+ Y0 c - #include <mach/hardware.h>
: \; n" N r/ H. m$ W - #include <mach/irqs.h>1 `$ K+ i# c) s$ Z9 T- Y% U
- #include <asm/hardware/edma.h>
; d: [0 Q& C4 g6 B* Z$ d4 l
- v! |7 t9 \- X* N- #undef EDMA3_DEBUG
: i. ]7 B y% }" e: ]8 p. T+ G, S - /*#define EDMA3_DEBUG*/
" M7 h% ~/ G) X/ j' w' p8 C
" B/ {; q- O- A8 U2 ~5 o- #ifdef EDMA3_DEBUG5 ^2 S/ s9 x+ B' o: a" ~! ^/ u
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: k3 T- t7 y( W2 M/ i3 `1 ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* t% ?; }4 ~( |. A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); {5 d ^! G6 ?- ?( O$ o" p
- #else
) A& b) z4 I3 [) S2 D, A - #define DMA_PRINTK( x... ); [/ y, _# O/ v
- #define DMA_FN_IN+ Q& _' L! M: g) I" g
- #define DMA_FN_OUT
. }( X+ n" |- ~, m, H% L4 L% _ - #endif. B: Z( W. j% V
- 0 X4 Z0 R$ P) [6 q- D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 L5 s1 o$ ]3 ]# B
- #define STATIC_SHIFT 3" {3 J, u9 g5 {6 y0 T; [! M
- #define TCINTEN_SHIFT 20) l9 l9 X4 n3 |. N# f
- #define ITCINTEN_SHIFT 21
* q5 l. D X4 P# Y( ^ - #define TCCHEN_SHIFT 22; T5 ?" M! h% W
- #define ITCCHEN_SHIFT 23
: I$ s& |1 r ?# E - 3 j+ j9 H2 V' R: R% r' p1 `& A
- static volatile int irqraised1 = 0;
8 W$ Z1 n8 L: n8 A - static volatile int irqraised2 = 0;; A8 L& [: D$ ?! I6 f0 n' V
- : A* \6 h) d' n& h
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- u$ w/ t3 g2 J% s# k/ F8 C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 i: S/ f/ N# |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 v# V, f7 x9 Y' h
- 2 z8 Y9 ?. T: ^
- dma_addr_t dmaphyssrc1 = 0;
: ]0 Q; x" p/ ~8 p' J$ W" g6 B - dma_addr_t dmaphyssrc2 = 0;" S& T+ i! g: j% n2 [/ k
- dma_addr_t dmaphysdest1 = 0;' N" ] i+ }9 T5 I0 t" O
- dma_addr_t dmaphysdest2 = 0;
" S1 V" E. O0 {- z0 K
1 O# o$ D9 Z' C7 I) x+ C- char *dmabufsrc1 = NULL;
' t- S6 n. s8 W - char *dmabufsrc2 = NULL;: } M0 f, l% i# u5 m4 l- f+ ?
- char *dmabufdest1 = NULL;
9 t z D; e2 m3 o n - char *dmabufdest2 = NULL;' I6 o$ ]. _/ F/ p
- 3 e/ J2 v! B9 D$ ]
- static int acnt = 512;9 M9 n7 g: T2 g% ^& N
- static int bcnt = 8;
0 ?5 m* l8 x3 x - static int ccnt = 8;
. F- O6 u, R# a2 b) l& R6 O - * f5 C3 p: {: q! P
- module_param(acnt, int, S_IRUGO);1 _3 f, g0 p- h- M: b
- module_param(bcnt, int, S_IRUGO);! r8 Z* o2 D B8 A
- module_param(ccnt, int, S_IRUGO);
复制代码 : \( v! y6 T& X( h' u( I. V
" p+ ?8 C4 Z3 o$ N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. g h9 f6 w3 D# v! N7 X2 k& Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 b0 i& F: s. r# `
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 M- Z; }2 E# F7 G5 W
# g2 \3 x6 T6 u3 r# e* D. w+ D( p5 t7 Y, G# L2 B9 \4 A
|
|