|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ R9 S8 p1 S$ v. f8 L7 @- [code]EDMA sample test application' A7 Q4 \( S: M0 M% Y% X
- /*
( C: K+ m$ M' L - * edma_test.c* G' f; [5 ?0 N' ?- I7 R0 N
- *
( I' W* [- ] n; ]6 P' x6 w; p# H - * brief EDMA3 Test Application
3 G- v a, K% A - *: L. I8 H. i5 e+ C- W2 }! [! D( o
- * This file contains EDMA3 Test code.
9 `- h: ]7 g+ Y9 \' Z& i7 R K - *- S3 O4 z$ q4 k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. ]9 G, ` [6 c$ r7 u0 N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ y5 _6 N3 M& W* k) e4 { R# W - * TO CHANGE.! g4 \1 N/ X; H; z
- *
+ J) @6 e8 R' u6 K2 r; Z7 i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* B1 H @% D. M5 L - *- l: _( S+ w1 f5 H2 {& M$ L
- * This program is free software; you can redistribute it and/or% d: |2 v8 ]# `: A7 b+ c5 ~
- * modify it under the terms of the GNU General Public License as( P7 y# b% \+ g5 V2 Q% C( W
- * published by the Free Software Foundation version 2.
7 U. s7 ~8 T, h2 e9 u( b - *. L8 l- @% e' E3 h: `0 D
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: e- ?* E5 x5 M# P4 N3 b
- * kind, whether express or implied; without even the implied warranty
+ H8 ]- p# v6 |1 P) w, _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- B: Y2 h4 s* A" \( v0 P - * GNU General Public License for more details.
( H7 Z, x3 x" s" h$ X - */
% _: A: r# N/ \% N/ S* ~ - ) X1 l2 @& d% ]* K. u! J
- #include <linux/module.h>
Z7 R5 a; G/ T2 T - #include <linux/init.h>6 h! J: r4 c6 m5 u6 Y$ ?
- #include <linux/errno.h>7 t2 @" ^, @1 o$ x* W! g% ]& ~
- #include <linux/types.h>
3 M6 r9 B: d0 ]. q( w' t, b' D; D4 A - #include <linux/interrupt.h>
! h* O2 u. m z+ ?0 c - #include <asm/io.h>
5 }/ M( z6 e+ e5 n) s8 D: L, y - #include <linux/moduleparam.h>
( s, v* A0 @. t7 Q& ~1 w& j6 ~ - #include <linux/sysctl.h>" t4 Z! Y) K: U0 P- J# k$ v
- #include <linux/mm.h>
, o7 e7 I" d& g3 H( g; o( y - #include <linux/dma-mapping.h>( z: J% h; n' V# `# d) O9 u
- " N) I9 M1 u8 _( c% k
- #include <mach/memory.h>, R% X# p7 P+ s: j
- #include <mach/hardware.h>
. S$ m) K# a" b& [* p - #include <mach/irqs.h>
4 b3 b ]4 X! d& k - #include <asm/hardware/edma.h>2 c2 Z }, r+ s: A; X
& i# h6 v+ j: `% ]- #undef EDMA3_DEBUG/ }% K& I5 X! D, ]! ~
- /*#define EDMA3_DEBUG*/
* B6 d7 U1 @8 s8 b" T
. \) x/ Q& t3 Y1 _! P- #ifdef EDMA3_DEBUG
+ f* W3 ^+ M7 W+ J6 p - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' i7 i+ H# r7 O- Z8 O% |# H/ L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), T0 Q6 y" Q; c# c; q b6 r& U- ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. Z1 S+ U: P! `0 C2 y0 I - #else
+ A0 G- {3 v+ P2 P8 b$ A - #define DMA_PRINTK( x... ). Q; n* H4 A7 G6 L1 {( t8 o
- #define DMA_FN_IN
( k' s3 e$ ~7 B4 g" i2 N) ? - #define DMA_FN_OUT2 e: c9 ~" g6 h$ w. S2 r q6 W, V( N
- #endif
8 J% O4 R/ S. q
* B8 j5 L* E0 k0 O# g1 B8 W" s- #define MAX_DMA_TRANSFER_IN_BYTES (32768). h5 W4 A; `7 t; I
- #define STATIC_SHIFT 3
. Y( R/ ]" S4 Q# A! b3 \" ? - #define TCINTEN_SHIFT 20) K- t) F- _0 a3 }! \: [; h: w
- #define ITCINTEN_SHIFT 21, u0 m7 d) Z) @( k7 |& R" z
- #define TCCHEN_SHIFT 22! Z/ d0 x( [ z0 C
- #define ITCCHEN_SHIFT 23/ K8 e/ F' P0 M! j
4 x) ~ ?# h# Y- static volatile int irqraised1 = 0;3 X. f. |2 V1 u l
- static volatile int irqraised2 = 0;8 E, b4 B) Y' O* }3 p
- e8 E0 b6 u+ u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 q; Y, V3 N+ G" }, y7 U' ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 u+ B( X0 X7 \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ k; d4 Q+ I3 E, x" Y3 o8 d7 [/ V
% K. {; l T+ ?, v: Y; Z- dma_addr_t dmaphyssrc1 = 0;! }: {* A3 N+ c$ _ U
- dma_addr_t dmaphyssrc2 = 0;$ `. ^/ q/ f3 M& U5 X: O7 a; c8 I! Y
- dma_addr_t dmaphysdest1 = 0;
" K; R5 d5 |" Q4 v) \7 o - dma_addr_t dmaphysdest2 = 0;
2 r( m, E2 q( X. O. w
6 t0 ^- j G) Q8 Y' ]: N- char *dmabufsrc1 = NULL;
* M1 @1 x$ i( s3 e2 `' x$ I& i - char *dmabufsrc2 = NULL;' |. R% w7 f: m. H% q
- char *dmabufdest1 = NULL;' m" ]$ e) A' \3 y+ ~- ~* G
- char *dmabufdest2 = NULL;" a+ D$ E* E+ j; t" W
- 4 }# |! I9 _% P+ |3 i
- static int acnt = 512; x( H& I" f @# r6 H
- static int bcnt = 8;
4 u- B. I$ R: K+ B - static int ccnt = 8;, l2 a+ J6 c8 S5 W& p
- 5 N0 e! b8 X- q
- module_param(acnt, int, S_IRUGO);: [7 b/ {) [' `6 D) A) c7 _+ g5 C
- module_param(bcnt, int, S_IRUGO);/ M% u! o7 t& h8 T' C
- module_param(ccnt, int, S_IRUGO);
复制代码
' M+ H. S _5 [5 A. I- p$ k/ l6 ?* g6 y5 ?4 b: _
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: Q' b1 p' h8 @$ ]/ d; G narm-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* O# ^2 }0 D7 n 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 u3 p: z8 Q( K( p$ r, [0 \$ L
" z2 X- t( ~' `+ i+ R3 F; r3 m
+ j s# s5 p, p+ h" j |
|