|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 r1 m% N* D1 d, g+ x& G
- [code]EDMA sample test application1 f+ K$ }9 s) ~; ?& j9 r
- /*
8 q5 F: G. P' ^5 j5 L; N* d/ S* _/ b5 v - * edma_test.c R" W' F8 A8 r0 T% o* I- E3 M" }
- *
$ t3 U5 X7 Y( z6 i1 L$ p$ } - * brief EDMA3 Test Application' n b9 D; D1 j2 `7 }' T m
- *
) e# P* D* G! A - * This file contains EDMA3 Test code.
- }# [' E b/ y# v5 z: H - *9 [8 c3 z9 c" e+ }
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 b/ d7 X( u- p$ ]! w8 m7 a - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ N: R; @0 Q9 V* B6 U) {( M8 _. \ - * TO CHANGE.
0 d' O3 f, b8 A. C5 B9 [ - *7 f/ n E4 u" C, I' x9 e5 f$ I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 w7 `0 }4 g @3 j( q - *
& |5 p3 {4 c; y; j! _' _* Q7 m - * This program is free software; you can redistribute it and/or9 B$ }3 U/ ]- X+ e* J
- * modify it under the terms of the GNU General Public License as3 D3 s( Z3 W4 A0 V! [4 U6 K+ y+ \
- * published by the Free Software Foundation version 2.
: z& z+ O' e; S; ^+ B. z - *) _ a9 W7 ]* Q! y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( n" A6 o+ Z7 h" M) I$ \
- * kind, whether express or implied; without even the implied warranty
% W; ?( Z7 J, H% \6 X" B A - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 m' `/ w* n( ~! K0 j
- * GNU General Public License for more details.
+ p, u; |- r: G$ a9 n- \2 Y. T - */
0 | \" q$ Y( \ J. t( T* U* ] - : q) q$ D. ~1 A7 o
- #include <linux/module.h>
1 F- z9 g6 s+ p2 \ - #include <linux/init.h>$ W1 s( T3 l* f2 y0 ]
- #include <linux/errno.h>2 d" x0 x q: S* x( o
- #include <linux/types.h>, J+ Y2 H% `9 y' _. \. J" R b
- #include <linux/interrupt.h>
2 w- J! N; o; C1 b$ m! N - #include <asm/io.h>) c( g) @2 g4 m2 v) B
- #include <linux/moduleparam.h>
( ?0 P& n# x, T( z# y, |* {; q - #include <linux/sysctl.h>
\* i8 [2 G6 Q7 r - #include <linux/mm.h>8 F |" H* I& b8 U. U
- #include <linux/dma-mapping.h>
+ r' b8 P5 l4 g2 X( V - ' n; ~2 M+ k- Z v# N
- #include <mach/memory.h>* o( V i- q5 `
- #include <mach/hardware.h>
9 q9 l% Y$ @ C& G9 d0 x - #include <mach/irqs.h>
6 i- X ]4 O m7 C" p2 K- q - #include <asm/hardware/edma.h>
' d$ y1 Y7 z7 r - # R( _2 I" R" u, v1 d5 a D, d: b
- #undef EDMA3_DEBUG7 N0 Z2 N3 s' q4 O7 v( E
- /*#define EDMA3_DEBUG*/+ x( v, ?- u% f0 b P
- * y- K4 B% g: I! f+ P, @
- #ifdef EDMA3_DEBUG
5 e) a8 H( A8 q" B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 A# [- a" @3 k; P1 c" W; e% r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ w4 l2 x# m4 z$ ?. V( ~% C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); e! P* ^- r+ \7 o
- #else
* Q& c* E( @3 U" ~ - #define DMA_PRINTK( x... )
- G3 c/ Y$ @5 }8 t - #define DMA_FN_IN
~/ x K; @4 ]. a - #define DMA_FN_OUT
# Z! v) W+ A( k3 T; ~4 ] - #endif! |+ f+ f8 ?. Q2 U: E2 h
; e2 v+ w8 A1 l/ }( x- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 Q+ A* F4 ~9 f+ I" F% x5 V* e
- #define STATIC_SHIFT 3
. H1 c! k8 `. s0 o& Z7 X( X0 a. e* v& W' ~ - #define TCINTEN_SHIFT 20
8 X7 d3 D; H' d& X1 h [* ` _8 P' g - #define ITCINTEN_SHIFT 21
8 `( V* i3 R4 P4 N" s3 ~ - #define TCCHEN_SHIFT 22+ o# `+ s- ?8 D% T
- #define ITCCHEN_SHIFT 23
- z/ u) _6 F7 W/ T8 b8 o5 ` P
' Z, v- p% n' m' x+ V: x- static volatile int irqraised1 = 0;( F( M; W/ e2 d3 V* ?) _# H7 C8 Q# o
- static volatile int irqraised2 = 0;
& _' a5 o8 E5 j" l
7 ~9 D) G2 f7 D$ |* P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; X2 N! }) v6 B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) T) G6 n1 }+ @" a5 c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ z/ o3 e, e1 K& m
d9 ^, f. e3 E( |: c. N' t: l' d- dma_addr_t dmaphyssrc1 = 0;
9 T8 B& P$ C: N$ \8 @0 }% g - dma_addr_t dmaphyssrc2 = 0;0 G1 R; z9 u4 @ M' o- e2 T: Q
- dma_addr_t dmaphysdest1 = 0;: v4 \2 b$ @: r$ D% f# a
- dma_addr_t dmaphysdest2 = 0;
1 B6 v& T& t9 e7 z0 u8 h
3 _+ O8 P5 ^- F4 V- char *dmabufsrc1 = NULL;
1 U/ `( v! n" ^2 y; F8 Y8 M; B: ~ - char *dmabufsrc2 = NULL;
# R% w/ r9 `' w; [0 @ V; R5 @7 T - char *dmabufdest1 = NULL;% i$ C6 Q } y+ p6 z
- char *dmabufdest2 = NULL;
4 Y ], U, @! K
" n/ F2 k# q( _9 s0 u4 q: o- static int acnt = 512;! A" R( q2 }5 k: S
- static int bcnt = 8;, k! M# Z E3 L. \
- static int ccnt = 8;
7 k9 s" I X! i - 1 Z9 _! W* {- A3 a- w
- module_param(acnt, int, S_IRUGO);4 o) T6 A" W& ]: V( w: N
- module_param(bcnt, int, S_IRUGO);
' u3 C N- G+ N* \) l w0 @% u - module_param(ccnt, int, S_IRUGO);
复制代码
6 o3 }: i7 V. S+ @) F. B
) V ]4 @" ~1 a, T% m5 T5 x7 z, N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! d# {" y% W& f8 K- L0 w
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" f4 X* j8 l( b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" ^1 M+ Q* f x* @7 C& }( ~: J3 ^' D3 ]8 O; \% c
6 H; i+ ^# p: e4 K9 t, ?
|
|