|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 E6 U% V( l$ X9 }/ I5 n( L5 e
- [code]EDMA sample test application
+ W; n! o; h: R6 k& p' I" ~ - /*
; G; s: l" z: O - * edma_test.c
' N3 B8 C! m* {( Z$ }, O( M - ** N# F5 q: `+ `3 N! ]
- * brief EDMA3 Test Application! w4 `4 {+ u1 ]7 _) h" j S( u
- *
1 b' M Q6 b z6 e% t$ J9 }) ` - * This file contains EDMA3 Test code.
# b) W! N- M5 p! ? - *
( l; y8 V3 T6 r6 {% ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 Z" v4 P7 v4 `: w& H# u - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
S* ]5 I0 q2 r2 ~ - * TO CHANGE.
: L+ T& y( J5 o - *
" t+ _2 }" ?8 c6 {- | - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 q0 `1 _* M3 w2 _4 H& ? - *
4 e5 ~5 C& O- x4 A5 R - * This program is free software; you can redistribute it and/or
$ K3 `' D6 Q& [6 H - * modify it under the terms of the GNU General Public License as
7 |, `* O s1 m4 d - * published by the Free Software Foundation version 2.5 `) L) }" z6 w1 l6 c
- *
5 r" ^' t4 r& T3 k$ v% q) {# }" X1 v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; t) h& m8 L. Y: q - * kind, whether express or implied; without even the implied warranty
+ k" v# @) c+ b) S' ^- M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 H! g2 n% c$ q6 u$ N* `6 ]
- * GNU General Public License for more details.
. I0 P# X% o+ N7 z9 l4 K - */
' Z0 \+ v1 y$ }& X+ c0 z. z - ' R& c8 I5 f8 u0 A
- #include <linux/module.h>+ ]9 l4 G1 v0 z4 ?) n! ^" z: b5 ]3 f
- #include <linux/init.h>4 v1 i" g1 C$ B; A; G
- #include <linux/errno.h>
1 i1 H9 L2 h x - #include <linux/types.h>
& O; R. L1 P) b - #include <linux/interrupt.h>
" ~( i5 E$ O- L! h. {, A; \& }9 w% ~/ M - #include <asm/io.h>
4 ]' @5 g3 Q8 m0 t) ] - #include <linux/moduleparam.h>$ Z* k& l, I# P# i- i; [3 x
- #include <linux/sysctl.h>" J8 _! |# l4 }
- #include <linux/mm.h>
0 C* ^8 {: T% S% C* n/ u - #include <linux/dma-mapping.h>8 f- ~, {* h& T6 a" P
+ K) @; X6 F+ s# z& h. V- #include <mach/memory.h>( _) n3 J8 F) g8 |1 \
- #include <mach/hardware.h>6 E: F' C4 h* A
- #include <mach/irqs.h>
7 d( w. Y- P* B- K - #include <asm/hardware/edma.h>5 w! O- ?; j4 B
- 2 n0 |* |/ V/ v% ^
- #undef EDMA3_DEBUG
/ P) N; m# c0 {6 ] - /*#define EDMA3_DEBUG*/
$ {# {+ K" Y# C8 p1 K5 v6 ?7 K - % E: M4 }) b" H9 n* _# Z
- #ifdef EDMA3_DEBUG
+ ^4 R1 [1 z" z V0 K; k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& r3 N: P! l# I4 b( f2 q; S
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) d0 [; _: o# K8 g0 ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
b8 ~. l3 D- x1 o/ l - #else
) F" S6 y1 F ]% P' m, W& [ - #define DMA_PRINTK( x... )
; P: S* Y; c, y5 f; V( O - #define DMA_FN_IN
# C$ q1 w2 F. V m2 g - #define DMA_FN_OUT$ q6 J9 h% u- ]; X( n( M( j; m
- #endif1 D$ r1 `& g, {( ], F/ Q6 {5 D
( U# h0 F8 g2 H; B6 z# g- l, Y4 L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 z% r6 b8 T y( j' f7 e1 k& @
- #define STATIC_SHIFT 3# o4 j/ p, h: @0 Q' M' t: P
- #define TCINTEN_SHIFT 20
$ D( ?5 u5 F5 v: N7 c+ N - #define ITCINTEN_SHIFT 21# L3 V8 L Q' r% @) I' a
- #define TCCHEN_SHIFT 22
4 ^% C) S4 k3 _5 E e - #define ITCCHEN_SHIFT 23" H4 m; p# ~+ g B9 `
- ) s" f4 Z- e1 M8 D% b, J. U/ N
- static volatile int irqraised1 = 0;
]: I2 \7 f5 E# u7 W4 O t3 v - static volatile int irqraised2 = 0;0 p* M! c9 u, ~0 j, k; n! V
% o; U" M3 s4 K- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 {% d/ Z( q j - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, O' _* ?, x: {) {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; s- d% F$ g# f; p/ z, m
& ~# \9 U2 q% ~6 B1 f' O. }- dma_addr_t dmaphyssrc1 = 0;5 c2 M2 i5 u2 J3 O: r* }
- dma_addr_t dmaphyssrc2 = 0;
' o; `$ V$ C; e& ^. F) { - dma_addr_t dmaphysdest1 = 0;' b# _6 I3 j' ?/ t+ f
- dma_addr_t dmaphysdest2 = 0;
8 ^0 i5 k9 ]" \+ v1 ~& r
9 i7 i2 z: [+ y. I4 d. R) Q) c* d- char *dmabufsrc1 = NULL;7 e3 ?( Y6 X. \( {' {+ ?* b% ?
- char *dmabufsrc2 = NULL;
5 X; T. V4 E! t0 e - char *dmabufdest1 = NULL;
/ [ \8 b {6 K; O - char *dmabufdest2 = NULL;
! l$ B7 p' S$ P* h - + r1 k2 T% |& z' @0 r% P
- static int acnt = 512;- d: z; K& q& ?) g
- static int bcnt = 8;. u) a3 r Z f5 @
- static int ccnt = 8;
' S8 P6 Y1 V" c/ c; r, B% G! u - # K3 w: z/ a4 g+ i4 i$ I z; M
- module_param(acnt, int, S_IRUGO);
# e+ ^! X' Y& x! D2 { - module_param(bcnt, int, S_IRUGO);( z0 Z& H; i7 o7 A9 U8 t( Z8 i
- module_param(ccnt, int, S_IRUGO);
复制代码 ; {% E4 [7 ^: B# G$ A& ~7 N' H
2 k% j% ^* o& |. w3 f( c$ U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 d8 W# _0 b$ g1 z9 v3 aarm-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 L" T$ C9 N' ?; r6 l5 J9 [ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 R4 j- ?2 z# T) g8 I
* A' h4 o% i7 F4 d% O
* d- _4 O2 ^" K M |
|