|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , i0 v; p e( i; {3 h$ E. o) C
- [code]EDMA sample test application9 w$ I& k2 F: e
- /* ]$ O/ e& w" K8 z c# U$ G
- * edma_test.c* [& T3 p6 |4 k# n& c
- *
: q$ H3 M1 Y2 y& u - * brief EDMA3 Test Application$ a6 \% O( r, i
- */ d. w- i: c/ P0 i
- * This file contains EDMA3 Test code.- T |6 L9 z% ?" I9 R4 z
- *3 A3 d1 m# q3 f8 U# J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 k6 S% h; Z- Z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 r) d: G! X# L# H( x, j8 {
- * TO CHANGE.
: R! e! h& H2 ]. l - *
. B: s9 w8 i6 ^# e3 a9 \* y9 f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( p8 E x: d5 M; ]4 P - *2 O/ g5 z+ ~+ u$ f# `+ J4 m+ Z/ M) ]
- * This program is free software; you can redistribute it and/or
3 |5 m+ A; v$ {) K2 [* f9 ] - * modify it under the terms of the GNU General Public License as
2 N7 h) V% ?7 i' y - * published by the Free Software Foundation version 2.
! L" v1 l3 \+ E' r+ [* @ - *9 `2 V/ d( w' Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 @& y% G, u( ~: V$ `; |6 v - * kind, whether express or implied; without even the implied warranty& r2 u" o/ }( h) a% m' _1 W
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, N1 Q. K+ e5 P+ A3 V
- * GNU General Public License for more details.' i, ?% I! h; a4 q1 Z1 z
- */; L7 V; H9 u. p3 x% j
+ |- s, O) `, }- #include <linux/module.h>5 i5 |! U3 _3 }% H5 g( ^9 x
- #include <linux/init.h>
8 P- r, N7 c( v - #include <linux/errno.h>
" w6 H4 Y l+ b7 o - #include <linux/types.h>. c. P; C: l' F) `
- #include <linux/interrupt.h>
5 U3 D0 `; c9 E! Q - #include <asm/io.h>& K$ i5 l4 u/ i' Y
- #include <linux/moduleparam.h>, m6 o+ e( }" J7 _2 w+ _1 A# l7 j
- #include <linux/sysctl.h>
; F* m' S2 m$ L# V - #include <linux/mm.h>: m6 R/ N& h) Z: U# f- s
- #include <linux/dma-mapping.h>
P5 d- G2 P4 f( a- I. g' q - ) X! L9 v# b4 A7 x1 Z
- #include <mach/memory.h>
7 F. {. k& y7 G, B, @ - #include <mach/hardware.h>: R8 G6 {) X: P8 R6 m
- #include <mach/irqs.h>% O! s o$ R; U1 @9 h- @. t" h6 H5 V
- #include <asm/hardware/edma.h>
! y# f% q r: I! z - ( ^/ E; |; ^) O" |+ \
- #undef EDMA3_DEBUG
: b( b$ v2 ]( b0 E - /*#define EDMA3_DEBUG*/
6 P: j" T5 \% a
! z: f- u% I3 p- C1 G- #ifdef EDMA3_DEBUG) H7 s9 m$ H5 q0 F. a3 `8 a$ ~7 P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 r* J+ ^6 s% K! ]$ e
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 |1 e6 | ]# T7 C7 i3 K - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 y6 h$ m. H$ O' V9 t+ D( Y9 x2 l2 x
- #else I( j7 H! R# B/ E6 c
- #define DMA_PRINTK( x... )
' X M6 F2 B+ Q$ k* V( V - #define DMA_FN_IN. q# m! A8 D: }2 Y
- #define DMA_FN_OUT# n1 W8 X: F. T& F$ U
- #endif- |( v8 l6 g# N- B1 n2 p" @
- " q$ P; c) u" r. s! Q1 A+ w
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; b; D# \7 G4 B7 \ - #define STATIC_SHIFT 3
5 U' |0 ?: l3 Y - #define TCINTEN_SHIFT 20- R6 j# j: o+ G
- #define ITCINTEN_SHIFT 21
9 a" b! n! E# s/ `8 p% k( o9 E* t4 T. P - #define TCCHEN_SHIFT 22* a m, @; u9 Q- u
- #define ITCCHEN_SHIFT 23) Q, P9 E) M+ m
7 m0 Z) A2 |( a( {1 j8 J" i' j; }- static volatile int irqraised1 = 0;. ?) r' |& i, D* \0 s, Z
- static volatile int irqraised2 = 0;
& I X5 Y" ?3 I% i% b$ n. P - - Q% G1 H$ D+ s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. N2 x# T4 d+ f - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 X$ X7 q' M. x5 |/ } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' z; f. q# C. f3 D3 B d. U
1 q6 }8 P* e% @- dma_addr_t dmaphyssrc1 = 0;
4 l0 v/ T' p4 F- u0 W+ L - dma_addr_t dmaphyssrc2 = 0;
- i, q \4 z7 @5 w2 w - dma_addr_t dmaphysdest1 = 0;
3 W5 c! b s. ]) Q& K - dma_addr_t dmaphysdest2 = 0;
6 o. b8 Q( _/ p, M% ]4 C' v
/ n0 q% s9 ~! q- char *dmabufsrc1 = NULL;! a! d1 D5 q5 Z# D- Z
- char *dmabufsrc2 = NULL;$ H2 ^( a) j- j: X5 p; [; @
- char *dmabufdest1 = NULL;
- ~5 K# R' y/ H. i) V; g" r, D - char *dmabufdest2 = NULL;
" H$ C8 v5 v- K1 f9 I8 L" z6 Y! v - 2 A" V/ e* o# [- n" \0 Y9 b' n4 ~
- static int acnt = 512;1 L# E+ C. k- z; V6 n
- static int bcnt = 8;
9 e/ P2 }9 W, k* }- L - static int ccnt = 8;
' O$ V; L" K( \4 K, [5 S5 \
, [; S: o8 }" Y9 k& Q, l- module_param(acnt, int, S_IRUGO);0 i- R9 B4 R. y6 |& K
- module_param(bcnt, int, S_IRUGO);! r9 a& `) ?$ v
- module_param(ccnt, int, S_IRUGO);
复制代码
2 _8 o o- t9 D! R/ l; Z5 y0 _# `9 e* K- q2 c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 e1 e# h) T+ L+ j+ x0 zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 j$ j+ w. u& H( Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 e$ c2 k, X# a
0 u1 T6 Q4 h& X. f5 f; O$ W
* c/ `* M% y) g0 X
|
|