|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; v3 K: S- Z; k
- [code]EDMA sample test application% V4 O- r. m, k& W1 U8 E/ o
- /*) q- ]# B1 b7 h# Z3 x
- * edma_test.c
3 J h N; O7 w0 S. C - *
, e6 _& n7 G) u. l9 F& q7 G, [ - * brief EDMA3 Test Application. R6 H% y' J- {9 v; K! m- u
- *
9 b" x* Q. e4 `! ^6 L - * This file contains EDMA3 Test code.6 M0 E9 L3 U3 `% C+ [1 @2 M9 a
- *& W0 s& ^8 k$ M9 z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' M2 s/ C3 F4 k/ \/ r1 x7 a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ d# {5 T. P0 F. c4 N0 {
- * TO CHANGE.7 {0 K( Y9 b1 I8 o8 T
- *7 i& g, I' c! w2 i* U! J/ N! d
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& G, b5 P5 E3 f7 ]9 ~5 v
- *
, e* ~1 d' D1 c. z- l - * This program is free software; you can redistribute it and/or* G) Q4 c" @4 r9 i
- * modify it under the terms of the GNU General Public License as+ U6 E1 m2 J1 y _/ y' d3 A
- * published by the Free Software Foundation version 2.; G/ S. P2 w- w Z
- *
) U, \2 ?0 A( b - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" E1 K, z7 y7 J: Q - * kind, whether express or implied; without even the implied warranty9 {% t9 g4 k5 j4 q$ t& o3 C4 z1 r+ q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, C! i4 f. L: [$ K5 G. K% t/ Z
- * GNU General Public License for more details.. _3 x: [, X/ s3 Y. |# x
- */0 ^ \+ F' U0 ~' Y
- ! g# B( Q& ?; C6 ^
- #include <linux/module.h>! L) D# ~4 K9 w5 D# [$ Y
- #include <linux/init.h>
+ k' T' P) M2 z- S - #include <linux/errno.h> D9 ~" r) ^8 t% M; B4 N- Q! W
- #include <linux/types.h>
_0 H2 I; I+ n' @. t' H - #include <linux/interrupt.h>
& B' n5 D' \1 X: a; Y' `% y+ N( Z! c/ q - #include <asm/io.h>5 j) Z3 Z3 ]% k5 _% k- j k4 r
- #include <linux/moduleparam.h>
% o. r, \ k$ V! h - #include <linux/sysctl.h>
( y t) @' v1 a K. j2 ]: C - #include <linux/mm.h>2 H) y" L3 R# I6 }7 b0 p
- #include <linux/dma-mapping.h>
7 S" b* t# A1 v4 G' N2 D6 F
6 u( ^4 c+ v5 e8 s" b- #include <mach/memory.h>
3 Q. M7 n" s5 T: J' [# J - #include <mach/hardware.h># k1 M8 v4 w8 _
- #include <mach/irqs.h>$ R) `. m( j( o: Z
- #include <asm/hardware/edma.h>
J* |' N X, w( x) i- _ - ' Q: o/ E8 Z& W% T2 G1 `: ?/ m& w) Y
- #undef EDMA3_DEBUG
/ f8 m/ u7 [9 g3 ~4 |0 H - /*#define EDMA3_DEBUG*/, Y- Z" x& H2 k; y
& f6 t$ v, N8 B4 R! `- #ifdef EDMA3_DEBUG2 t5 ?2 `: ?7 }; K& |( c
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) P8 V% g' e! a( t, R: t* A( b4 ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
\% j9 D9 K$ c2 \% J1 a/ W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 H6 x7 h2 r& C" C. p. j! r/ c# H, [ - #else1 r+ L) U% ]- T. p- G K; g
- #define DMA_PRINTK( x... )
! O/ o9 ^/ K; ^ - #define DMA_FN_IN5 }' k! L" ?3 o0 \
- #define DMA_FN_OUT& r! B# W* T" l- G
- #endif
4 U3 k6 f4 v* ]8 n2 L/ J" s - * |2 X( y) S6 G9 U+ K9 @# N1 ~
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ V4 U/ j9 i0 o6 H9 O1 a+ j% K$ J. `
- #define STATIC_SHIFT 3
5 P' z% h6 E5 G. @; u - #define TCINTEN_SHIFT 203 t& r* e: X) z+ k3 k/ t2 F
- #define ITCINTEN_SHIFT 21
$ u% M" N% k8 J3 D1 W' F. x* ]- g! i - #define TCCHEN_SHIFT 22* q6 @0 o# n$ r/ P' V7 b! m
- #define ITCCHEN_SHIFT 23) r% p7 n* W" a2 p
- " R) m: R8 d" ^# D0 a
- static volatile int irqraised1 = 0;) S: p+ Y) |. d& ^4 Y
- static volatile int irqraised2 = 0;
) K) ]7 q" `4 {6 _6 S1 B - 3 N- T2 j& E( Q9 a p
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' e+ g: |& y! U - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* I. c9 U5 ?; @0 A/ s* r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 f9 f$ E2 g+ U; a- j# I. i
- ( j4 P$ L( `: Y2 R2 b% ?2 M
- dma_addr_t dmaphyssrc1 = 0;* Y; h+ x' h9 z% G+ O8 n
- dma_addr_t dmaphyssrc2 = 0;( X" S( u9 M; ]( S. J
- dma_addr_t dmaphysdest1 = 0;4 L' ?/ F3 D% g1 b7 J
- dma_addr_t dmaphysdest2 = 0;! H9 I0 |6 l# A7 |9 F# W7 T4 d+ p+ l
- 8 }7 l: Q1 s& Q5 d5 ?" R" {. Y
- char *dmabufsrc1 = NULL;
' f2 A/ w' U( r# v/ i( z1 T3 K/ ^ - char *dmabufsrc2 = NULL;
4 p* ^" M0 H$ b) G4 G9 p7 x - char *dmabufdest1 = NULL;( a% h4 l" |) K9 w1 O5 f. b
- char *dmabufdest2 = NULL;1 \% d; A+ f; D/ g, ]
- 2 S2 q8 B) N. T" Y1 ^1 y' E& Q
- static int acnt = 512;
6 N5 {7 D% `4 v' U0 V3 U/ t2 T - static int bcnt = 8;
* Z- W: R7 N+ K4 |. { - static int ccnt = 8;2 N* Y5 v r1 b$ [8 t
' x7 u/ x* H" `/ z. X- module_param(acnt, int, S_IRUGO);1 `9 F a/ m9 Q! g1 K w4 Y3 A& @
- module_param(bcnt, int, S_IRUGO);
1 W) |. E7 R0 ], y$ ~+ n/ W0 o, i - module_param(ccnt, int, S_IRUGO);
复制代码
3 j5 I" v2 U& Y+ o1 T* f4 Q% [( ^* F" ]% J( \- `2 G! F6 D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: y( C" n, `" I' w, |% E8 Z( 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 v2 H# i1 \( i: j
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& Q7 }& e+ Z# }/ y% E6 t
! b- s! h, v# L
) f$ T6 s9 u' K i' T) ~' W" q) b |
|