|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # _7 _: L3 F; O7 c1 b
- [code]EDMA sample test application! e( h9 H: \! A4 W6 v" {" w
- /*
" I' C1 F% ~ a8 {8 X) n$ g7 p - * edma_test.c/ @0 o; O+ ^$ g& `8 a4 X
- *
3 o/ |. L: X- ~0 C( y - * brief EDMA3 Test Application
, j) G( u, T, n! J4 R$ t! _ - *' K' A1 [% E. y. y A- T
- * This file contains EDMA3 Test code.3 h ]& ~' v; w; B4 \+ o
- *
1 \0 g# {# \( P7 [- i. O - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 e1 v0 G! E2 I4 @& `* ? - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* }' b' n- c" ?' k - * TO CHANGE.
h+ y9 }2 B# l5 M4 ~ - *) F8 R* F3 ~/ }% f* C9 f% L. b. X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 Z; x; l) n% y( I9 Z# J2 m4 s3 { - *
) {# M' R; U: x; M7 e - * This program is free software; you can redistribute it and/or
% D2 M( b0 W7 q% [ a& K. r7 U, E1 d - * modify it under the terms of the GNU General Public License as( L4 m5 o) z7 |( q% ?" o' N
- * published by the Free Software Foundation version 2.
1 K1 O% r/ ^0 M4 n - *
! [, s* n% t% T% A: _ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( j& S5 W Z7 T
- * kind, whether express or implied; without even the implied warranty
' b( ~ ~, B1 f+ a P. P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 ]0 I7 D B3 Z: U" y6 @ - * GNU General Public License for more details.
% {( s2 H' `# C - */' W/ s, e2 K) v3 U, [5 x0 p# ]
- f& I2 j8 U" l
- #include <linux/module.h>
# y1 F# l( f* ^. ^! a - #include <linux/init.h>
& J* Y$ y% C* M$ H! v% Z4 P' g - #include <linux/errno.h>; p, S; \* w, A8 J
- #include <linux/types.h>; n# C" }! V- e5 ]+ ~
- #include <linux/interrupt.h>0 W q3 R5 v1 ?" A* T
- #include <asm/io.h>
/ k/ n) M: D# z( u. m: u/ i. W - #include <linux/moduleparam.h>
! t" a/ \0 c5 z1 ^# W7 w7 P - #include <linux/sysctl.h>
; e O0 \# o) R8 Q) g( E: B5 r( S - #include <linux/mm.h>5 ]. O) W; a" [+ U
- #include <linux/dma-mapping.h>
- l3 w# W4 ?( n1 Q9 M( p$ { - ! w; F. U; N3 @! O2 ~
- #include <mach/memory.h>
7 o: j5 T2 \3 c& e8 V' m - #include <mach/hardware.h>
9 u# V( p# Z6 q7 Y4 D4 i - #include <mach/irqs.h>
8 \& p" w3 ^/ D% C - #include <asm/hardware/edma.h>; ~( s: p6 a; z. }2 G; O
/ ^$ x' ^1 y- q( h1 O7 i- #undef EDMA3_DEBUG1 a% R% {' Q) T! c# U
- /*#define EDMA3_DEBUG*/5 |$ W4 T9 A' }/ G+ Z* x( Q& q
- " ]8 V$ i/ n7 }+ r
- #ifdef EDMA3_DEBUG% d5 ~" a5 {# i. @" ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% h3 D0 u, m3 K1 a/ T$ ]$ D) _9 A8 X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 M# V2 o! O; N: ^; z( ~ v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 u! g" @( P/ h
- #else
. X5 F+ Q9 A1 m& l4 B( P" x* \$ k' r - #define DMA_PRINTK( x... )
8 _% p( E3 `) ]( V! w! U - #define DMA_FN_IN' F" A0 x1 e1 v# Y" z& l8 q
- #define DMA_FN_OUT
/ p& p$ N: X" P1 W" a - #endif: z$ Q' H& o& [8 F& L9 N
- ' R6 m U: l' I$ [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; `' ^( n5 O9 z% c - #define STATIC_SHIFT 3
; N7 i( X# L- P" c5 u) g7 o - #define TCINTEN_SHIFT 20
9 p( b0 {/ R6 n* ]! ~ - #define ITCINTEN_SHIFT 219 p2 C: G" z9 Q; O8 l" J% q* B g
- #define TCCHEN_SHIFT 229 K: y. B7 G- h* m2 S% c
- #define ITCCHEN_SHIFT 23
2 S: W/ M! g. ~# d - . O8 o8 [9 {5 d: P9 \
- static volatile int irqraised1 = 0;
/ `! g' @7 J2 Z) y - static volatile int irqraised2 = 0;' s& y8 h# w( u/ @* G
3 J. e5 G1 q$ @/ K- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 R# i e3 d( f( V4 c/ n$ w
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( w, ^& e! m) j7 x: l - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 O$ X1 U1 g" W$ P
- 7 k7 y9 B/ f" w, @+ A% S
- dma_addr_t dmaphyssrc1 = 0;
& D# W; F" S6 L5 W) Q2 r/ j - dma_addr_t dmaphyssrc2 = 0;8 W! k5 ~+ t* H1 v3 Z5 P) k7 V& l; o
- dma_addr_t dmaphysdest1 = 0;" D6 ?: M2 `4 ^& p& d6 g
- dma_addr_t dmaphysdest2 = 0;
; m4 f$ \9 p; `! P, i. \+ t1 d8 |
9 u, O$ m9 e& z4 N* L- char *dmabufsrc1 = NULL;
) p9 l! \4 V4 A' z6 p- W - char *dmabufsrc2 = NULL;& a1 I Z5 S6 g7 W# m( ~0 }% a
- char *dmabufdest1 = NULL;
$ H, ^) _4 R$ H' J# h - char *dmabufdest2 = NULL;# Q+ Z, j& |% m- k! c
- # H* ~1 C1 ^: s6 k8 g. s
- static int acnt = 512;
2 H0 ~$ {# n! o$ F; l+ ` - static int bcnt = 8;
: T2 D% e7 |* y) v- V3 m" V - static int ccnt = 8;
, `2 G4 R9 A. Y3 o& N! @3 M, i - . z9 T' p8 z6 }& P
- module_param(acnt, int, S_IRUGO);
1 k' y5 G9 U+ m! A1 P( U - module_param(bcnt, int, S_IRUGO);5 a% ~( a& F; \! R8 g1 M
- module_param(ccnt, int, S_IRUGO);
复制代码
- z7 |; e1 e9 ]( x0 n5 j- a/ [. P2 W% p6 m# v' s1 l" r0 i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) C1 B) b2 v$ _8 varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 A$ K$ q- |+ v5 u; K% [ m' ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 b$ j) B+ @- m8 {
( R9 V6 }, f' G4 Q* M2 q7 E( x6 _$ h/ E: i! Y) s/ z+ J/ V+ F
|
|