|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) r- g7 \/ ?* ?4 k2 ?+ q* E$ P# D- [code]EDMA sample test application. y, B! N/ X$ k& o% |2 q9 Y6 W
- /*3 [: n2 j% x' T5 F; |0 D% n4 T0 {
- * edma_test.c
3 u5 p) q1 V% [ - *+ R6 y6 v: X' d
- * brief EDMA3 Test Application9 S3 E8 E2 U8 `7 N f7 X
- *
# q9 @6 P* R! _) ]% S - * This file contains EDMA3 Test code.
5 Q9 n% B- q" o* y# U% [( Y - *
' H1 w) X! _- i# X4 M, N! E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& Q/ |8 t" K1 P s: L* w - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 y! O5 U. D2 M( [3 a - * TO CHANGE.
" x3 b% }, e% r* ]1 R6 i. [1 p5 e3 a - *1 g6 W; ?) r9 ^/ i ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 |6 q s# T! o' y3 i: t - *
$ C- R, Z: U* v( [3 r - * This program is free software; you can redistribute it and/or( d" t4 ^2 k; F7 u: }4 U; Y$ |. g, H
- * modify it under the terms of the GNU General Public License as
. P5 e' }2 u$ ?* x1 s* [ - * published by the Free Software Foundation version 2.
+ V3 I+ v2 U9 ^+ H - *: ]* t0 D0 B' O$ {8 Q- _6 ? \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" {# y6 u' I6 F+ f1 C
- * kind, whether express or implied; without even the implied warranty
/ g1 a4 `0 m, R# J1 B8 w3 N - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% r% ?. [; A6 H1 ~; f+ h4 W
- * GNU General Public License for more details.
8 Q( e% M# k0 e* D0 ? - */, ` b2 o1 q$ x; i( l& f/ W& \* e
+ N+ M$ p3 j4 m' z- #include <linux/module.h>2 P, U1 i$ a" l" }2 i' i: [/ W2 W. L
- #include <linux/init.h>) X- W9 ]1 B' _; T) }
- #include <linux/errno.h>
' q! {+ A9 r @# n0 Q n - #include <linux/types.h>
! y' g- N7 P2 D! S& Q, [3 ~ - #include <linux/interrupt.h>& @, C' v; h. z+ s6 r( f
- #include <asm/io.h>
# U, F, q5 P/ p% o* @( \0 i - #include <linux/moduleparam.h>
- R9 H2 O; g) @. ^$ Q7 T8 K5 ~7 U1 b - #include <linux/sysctl.h>2 ]" p6 N1 B y3 x5 G
- #include <linux/mm.h>$ V; C1 g# c# ~" a @. u
- #include <linux/dma-mapping.h>5 A$ {- ]5 r7 N( ]. B
. H2 p+ O% S* G6 q0 W2 G' @2 b/ F- #include <mach/memory.h>" Z5 |$ s' `; `% E$ J+ Z
- #include <mach/hardware.h>$ i6 p& z V, e( E$ X2 R
- #include <mach/irqs.h>
8 v9 A0 e6 o1 b) V - #include <asm/hardware/edma.h>5 [: F- s/ d0 H' U
- + _% r" h5 z% w- i2 e9 _
- #undef EDMA3_DEBUG
8 N0 F$ b( I; }" f! H - /*#define EDMA3_DEBUG*/- j0 a( A/ X1 R1 y& R8 t) p
# L, z6 S' r( x' G; [/ [4 D* }0 ~7 N6 p- #ifdef EDMA3_DEBUG' j, e, I }3 n( p$ m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* \, i. Q/ U7 N - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 Z) q% a/ i1 q4 ~( g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ G* V# `* A; K - #else
+ J5 M0 o7 z! O - #define DMA_PRINTK( x... )
8 e5 B4 k- g, O% i - #define DMA_FN_IN
5 v) g+ C$ U5 |* f5 i2 p - #define DMA_FN_OUT$ E$ o3 w+ S4 B: ^: w! A. {( t* \
- #endif$ M7 G( G" G( Y& g: ?
. D2 O+ o8 f i8 q! q, I6 C$ B- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 F, b6 R' p( r' A/ ]- L# g/ T; D5 w - #define STATIC_SHIFT 3( Y- ?8 O/ K+ W
- #define TCINTEN_SHIFT 20! N4 I, ?) ~! `, o) K$ g
- #define ITCINTEN_SHIFT 21+ a G [# S3 ]: H4 C% J
- #define TCCHEN_SHIFT 22/ [9 q, C! t" \$ K5 I5 {' u$ `# I
- #define ITCCHEN_SHIFT 231 u7 H# e! f" V
1 Z h( ~3 D: \$ v [# u% d- static volatile int irqraised1 = 0; W! ]' [1 d* R; e4 ^2 N/ K
- static volatile int irqraised2 = 0;
/ d( y2 }% P' @3 D+ B- ~# g - + k% q c; n1 T7 h8 v# [
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ p; \' M( i8 b; R# D) V! K* \: h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( S; [ m* G; \: [ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ h2 k( }/ v% J; k - ; i6 c4 u6 v, B- P, ^( S# a
- dma_addr_t dmaphyssrc1 = 0;% U. ~, f6 q; Z$ S' z
- dma_addr_t dmaphyssrc2 = 0;5 d5 ^9 ^6 s# Z% H8 Q
- dma_addr_t dmaphysdest1 = 0;! T5 I" L: J7 s G" ^5 T5 [
- dma_addr_t dmaphysdest2 = 0;
, I* O# X: |3 S, k4 K
$ Q3 U: ~2 Q! a: T- char *dmabufsrc1 = NULL;; D, J h5 A1 [; Y
- char *dmabufsrc2 = NULL;7 Q9 c( [1 Y# i" y' g! M1 E& ]
- char *dmabufdest1 = NULL;
/ K3 M# x4 m' \! E* x7 q8 j - char *dmabufdest2 = NULL;
5 }7 P. G/ m! {% _ F9 w
& [4 q' A/ o9 o9 A* ~! R- static int acnt = 512;
$ B; ?# Z, q2 G; y. | - static int bcnt = 8;
; R' t! Q; Q* h H% H. C9 L - static int ccnt = 8;: G' M# n: q+ r
- 7 i4 W3 B) v" `
- module_param(acnt, int, S_IRUGO);6 `+ S$ Y) R4 B5 H2 n" G
- module_param(bcnt, int, S_IRUGO);
; B# F" S7 h7 H! T7 d - module_param(ccnt, int, S_IRUGO);
复制代码
+ _* X$ M! n- e+ v( B- U, q8 O& `: O& m1 [% P
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) @, t" S& ?% [* \ }: {/ }arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 n. D8 y+ }+ z' X
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% C" B% N y. f) D! @. }6 v- k4 `# D0 n6 R8 g' |8 u( Y
r r1 z. E3 C7 z! S" S) `- z/ \
|
|