|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! b9 m% T7 ~+ T( v
- [code]EDMA sample test application' J* T) W; z O5 A/ X
- /*6 U3 m+ o% f4 l F7 |
- * edma_test.c
3 N% t; ~$ \! m0 \' \7 d& Y - *0 p8 C4 A" b- ~2 o
- * brief EDMA3 Test Application# W* t3 _! k& y' h4 c1 J8 F
- *0 y, ^1 \/ [ e0 \; s% V
- * This file contains EDMA3 Test code.9 s* V2 v- e* I0 B3 X
- *+ f$ w* G) k% |7 i" }
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( m2 O- C6 h: f3 s, v& g& Z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% @* R! l% E2 L: h( _( |
- * TO CHANGE.) q( e' c+ I* r0 X9 C I$ Q! }
- *
( u' |4 x: l* i! f N0 \% P7 A9 Y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! J2 ]$ [- e0 x - *
/ j& O7 _: c, _% {6 b, s: x) Y; @ - * This program is free software; you can redistribute it and/or
8 a1 a4 G. Q% C5 k% ? - * modify it under the terms of the GNU General Public License as
. {( o. n" i3 M - * published by the Free Software Foundation version 2.
3 J" T+ e1 E, q2 B& l' @ - *" f% O- q0 {0 K8 v) a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. {6 `& d2 l7 G$ r l - * kind, whether express or implied; without even the implied warranty
3 L. J* X/ @2 P# [. H! C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- Z' W5 T9 h& d1 _7 `; k3 |, d - * GNU General Public License for more details.6 m) \) Z. z0 P/ k0 d
- */
; P, u9 N4 n+ }& [* J3 M - 4 X, f; T( h% c6 p2 c8 ^
- #include <linux/module.h>3 L" {# {% }: P. v
- #include <linux/init.h>+ ^4 `7 E3 {/ W6 b" Q, h% L
- #include <linux/errno.h>
, L* w8 z/ R( V! F, k - #include <linux/types.h>. g0 ~& D# W: `! ?+ Q
- #include <linux/interrupt.h>7 w9 c( l) R% r
- #include <asm/io.h>
W6 o3 l$ e0 p3 m1 `1 g - #include <linux/moduleparam.h>
" G( G- r+ E" J - #include <linux/sysctl.h>
. C. s$ q4 A; ]: d# V! y# x - #include <linux/mm.h>! H5 I |3 j5 v" Z' l) T8 C
- #include <linux/dma-mapping.h>. b. C# I! H5 G* B- ~6 ~ W. J
- 2 P t u; d) \4 E7 p4 y
- #include <mach/memory.h>3 j5 M- U' c' A& R# M- V! O
- #include <mach/hardware.h>
0 @4 l( d3 G! j8 I4 K* v! e - #include <mach/irqs.h>
+ b4 e% P2 T" G/ p4 n/ N - #include <asm/hardware/edma.h>. R8 |0 c! W; j3 M2 C
& n C: Z/ e8 W- #undef EDMA3_DEBUG
) Z0 i8 h9 A' Q0 ]$ h - /*#define EDMA3_DEBUG*/
: ^; [& v v" j I
# ^1 f0 N* R9 r/ M6 ~# w- #ifdef EDMA3_DEBUG* Z# ~; G3 B2 l( _6 L5 A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 E; J3 U e& w7 C0 a' N" G$ p( j$ d. Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ ~! L3 D3 y/ L5 W9 G3 s. z; ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 R6 J+ \# _" F! }% p! J3 D - #else9 C/ m- D2 G2 W N* O
- #define DMA_PRINTK( x... )/ N& p2 A: q+ f. V( n& O* a& l
- #define DMA_FN_IN; D4 V, |( `# g! o
- #define DMA_FN_OUT3 m# T. h5 K- I
- #endif
/ [- h9 N! i* Z/ z$ o6 i$ ]
2 v# O/ v: H" }5 T. @9 `5 Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768), v' b$ z1 e' t* n$ B/ Y
- #define STATIC_SHIFT 3
- l1 S! f6 G- T- q - #define TCINTEN_SHIFT 200 ]( k0 @9 p; q8 c3 k+ w7 C
- #define ITCINTEN_SHIFT 21
& w* S3 k/ z/ F* n$ Q - #define TCCHEN_SHIFT 22 L5 H; U7 J! K
- #define ITCCHEN_SHIFT 23! E- v8 z/ a! h3 o3 C$ R
- ' W$ L \! `: f
- static volatile int irqraised1 = 0;
2 `3 K, H/ |$ V' V, B - static volatile int irqraised2 = 0;
# u4 y& x0 X; D - + L: r9 c( [2 e( ~8 r4 B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ \- O* A& r4 D2 p$ J* F) y' P- l. i
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 \/ x+ I7 o3 L+ w" }% l1 U+ M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. Y2 n7 v- R4 \+ G+ L; O
- & N5 t o( N- _/ o! H9 C4 M: j6 Z
- dma_addr_t dmaphyssrc1 = 0;
3 l! j8 v' P5 o - dma_addr_t dmaphyssrc2 = 0;5 O( U/ Z9 w9 v5 t
- dma_addr_t dmaphysdest1 = 0;5 l; e- Z( G h: L+ F4 k& J
- dma_addr_t dmaphysdest2 = 0;
( F4 W+ ~# i0 D6 F8 }4 h - 7 f, g6 o1 X- f$ v
- char *dmabufsrc1 = NULL;7 M! \7 ?, D0 k( S x
- char *dmabufsrc2 = NULL;% u+ j9 ~* s( N( O7 L2 Y6 s" r% W }9 u
- char *dmabufdest1 = NULL;- _ Z- t3 E5 M" w
- char *dmabufdest2 = NULL;
6 E- J8 y* H. [4 l1 f - . }0 M2 A. ~6 z4 C3 s
- static int acnt = 512;% ~; {; Z# W( v" M. o. E; E; q
- static int bcnt = 8;
! G+ n3 F6 c7 W/ } - static int ccnt = 8;$ z i4 j0 b! x% O! N
- 7 z7 z% W) E9 \; z
- module_param(acnt, int, S_IRUGO);
( P$ Q# v! h$ l( B( s" ` - module_param(bcnt, int, S_IRUGO);
0 H: z3 D- d* o* E& y3 H! w/ @ - module_param(ccnt, int, S_IRUGO);
复制代码 . ?$ t( p7 e. m) f* y- t/ D$ f6 d
, O! n/ U3 w# W' n 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" R( b6 v; }6 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& K; q2 g+ V! @/ t+ U* c' { 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; v) c: {) a8 K1 H6 J
; @4 m3 [1 `+ i" c8 ]! z
- u0 X& Y1 g! N) O |
|