|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 G& h' ^2 z3 k) `" C
- [code]EDMA sample test application+ x: X+ {0 F+ G4 F9 `( L, H* G
- /*
! R% p, S9 U7 F3 U, j7 Y - * edma_test.c
: f; S* P- w! u" K# j) { - *
2 H9 `) h6 V/ E% v - * brief EDMA3 Test Application
- h% v6 \; r- Q! A0 H$ U - *
- h$ {* @/ V& Y! K) n - * This file contains EDMA3 Test code.
# B# Y/ ?- h: }$ r3 I - *
( M3 s9 _3 J4 |' `7 N* \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: Q. j: o- v: O3 w2 v2 r, D3 u& X: ~' r
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 ]+ t2 d( `1 U$ k - * TO CHANGE.7 H. G" }7 S+ g2 |5 m! |) d4 d
- *
/ N# i$ F N) T. J5 c* ` - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ Y2 j9 Q& `' O& q+ V% d
- *
+ j0 U/ s+ i) g - * This program is free software; you can redistribute it and/or$ O$ g& ^% D8 X
- * modify it under the terms of the GNU General Public License as; Y6 Y8 i- m) o5 x
- * published by the Free Software Foundation version 2.2 z4 G6 W# M4 O: o3 o
- *
1 ?7 V3 L; z0 z' d( _ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ ?* p. U" p s. N6 J# ^, n - * kind, whether express or implied; without even the implied warranty
6 G% G( i9 ]/ D& T+ }# r+ { - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 e( P, h$ o7 O- p8 e) {
- * GNU General Public License for more details.
. ?9 v/ E( {- D: x& q( K - */3 Z- D* ?+ ?6 m [5 F( u6 N
- & Z" Y+ e, Y/ I. s6 c$ i
- #include <linux/module.h>
& P5 J9 B& A- y8 V - #include <linux/init.h>, F' M5 G5 m- R+ n% v
- #include <linux/errno.h>
2 d- N0 D& _) n2 G) H0 S( s/ l& { - #include <linux/types.h>2 d3 c, H0 ~* v( f7 F
- #include <linux/interrupt.h>
: j) m! N; `* a0 `6 u - #include <asm/io.h>+ G, k; E& |4 d6 Y
- #include <linux/moduleparam.h>
) S+ X: ~: W6 I6 [" d) i5 L - #include <linux/sysctl.h>
" m( R5 M# ^# F - #include <linux/mm.h>( Y: K' T* l; a! W
- #include <linux/dma-mapping.h>
; E2 Q# u, a7 I9 f4 I - & c9 }' g7 l4 `" p- h- l7 l7 O$ w3 R
- #include <mach/memory.h>
! H4 |; P5 g% F- c% n - #include <mach/hardware.h>2 G, a9 U( b$ ?
- #include <mach/irqs.h>
* O/ H& B% o" X. D; [ - #include <asm/hardware/edma.h>
' {2 P1 o: @& `- ?& ?' `7 C
) b9 x, q& c6 A2 O* \1 K' K2 A% f5 k- #undef EDMA3_DEBUG6 f! T+ T! {8 @& `
- /*#define EDMA3_DEBUG*/
7 G. Q% J% Q$ N0 N0 q
- x1 E v+ l4 ]- #ifdef EDMA3_DEBUG* f- ^# p. N8 i1 C" G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. X2 ?5 S9 i5 V& F8 W - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 o5 d# G( @: I
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 B4 b) x! W4 l9 @. f6 T - #else3 n- {7 }$ k: O, e# ]
- #define DMA_PRINTK( x... )
7 y* ]2 g6 G# I# s$ ` - #define DMA_FN_IN: m, x4 t! {9 R3 }' q. c4 e1 o2 n
- #define DMA_FN_OUT
, k# h! z. I& { - #endif
4 s( w# i! Q! [& ` - * Z. @) ^9 a( e5 l
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- h4 c4 y' r* t" c1 m0 d
- #define STATIC_SHIFT 3# h# Z' D/ Y- |" v; S
- #define TCINTEN_SHIFT 20
2 k9 U7 {' B9 {/ f9 B - #define ITCINTEN_SHIFT 211 r- s; D+ [6 l7 M" t+ R
- #define TCCHEN_SHIFT 22. D+ ? p/ c/ W
- #define ITCCHEN_SHIFT 23
4 ?! D# `$ [) F# C/ o9 P% |: D; i
7 h( H0 z* X0 x9 H- static volatile int irqraised1 = 0;; d" S2 D6 F: W/ C
- static volatile int irqraised2 = 0;
+ S$ @: N: Y r
) W' K; ]. V' F% T/ N2 _5 t- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. R# Y: c' m$ ?, q, A# b) E - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 {9 @6 c; E8 f& {" N5 j4 U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# _( s( I6 F3 ^ g4 ?- F! v4 f
- . x3 e: h7 y5 G% Q m
- dma_addr_t dmaphyssrc1 = 0;
: Y3 o0 m! U5 X( C* Q - dma_addr_t dmaphyssrc2 = 0;
0 @. J, x# r4 B! D K3 f - dma_addr_t dmaphysdest1 = 0;, n# p( b; ~* }1 d
- dma_addr_t dmaphysdest2 = 0;# @; O- y P8 B" t" I
" G& s- l& p" m, }- char *dmabufsrc1 = NULL;
) w/ r( A$ I9 V - char *dmabufsrc2 = NULL;
4 n- [$ M& Y, [- Z" h& L; x. U - char *dmabufdest1 = NULL;
7 }3 ~7 N+ ] b% c1 P( } - char *dmabufdest2 = NULL;
8 @# T+ g, e' i7 H9 \" N( F - , w P* `4 P( z7 j$ K/ x, r. Z, Y
- static int acnt = 512;
% q8 [6 B7 i$ s" N - static int bcnt = 8;
: h# c! r& Q$ C6 w; h" v& h - static int ccnt = 8;
& p1 @$ w) o- f: J2 A2 {. |. d
8 Y$ I7 t4 z* K# ^- module_param(acnt, int, S_IRUGO);
c. s; U1 ^2 ~ - module_param(bcnt, int, S_IRUGO);- c0 [/ I; T9 z: M! O5 T8 M. R
- module_param(ccnt, int, S_IRUGO);
复制代码 ( L$ l- d, S- e
: x9 b! M$ R, G5 r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; h$ [5 `: _! v# [$ c C1 i2 Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) C" N! v9 A# _& G+ H
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( l; Y; @6 z. U- k
) T9 y7 {! d# ]6 t3 n6 y6 U. [8 v4 P! p# f
|
|