|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' U" G" N& K0 q: ^& w$ h6 l
- [code]EDMA sample test application& W' S7 @# q: D! Q; Z! b
- /** b4 z5 `; Q+ L, n. G
- * edma_test.c7 P8 ~" e, y$ m. _) F
- *+ a, D( S1 _# G
- * brief EDMA3 Test Application+ z& V* }+ H+ Q0 R. x- w
- *. h$ F: B, j; F. n2 s
- * This file contains EDMA3 Test code.1 i" K# {" {! X! b4 I
- *4 W E! Q" q- G+ S+ U) h( e/ D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 R+ h& E' c* P } - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( R$ ~8 M- D: H3 O7 Q4 r5 O9 R
- * TO CHANGE.# }- I" E6 }* x3 ~/ ~; F) Q
- *" P8 V4 r3 T+ ~+ ]* ~
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' p* y; U/ Q# t* @9 l
- *, T( l/ {7 p3 Y- t. G( j5 R3 [
- * This program is free software; you can redistribute it and/or) p! {$ S8 |1 E* |9 C0 N
- * modify it under the terms of the GNU General Public License as1 p! m+ p X. w# n1 u
- * published by the Free Software Foundation version 2.# v* W# ?) X* A s0 T
- */ U8 Z" F6 `8 J) j. X8 h; ?; ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, p4 ? [, O0 u# `: p; f - * kind, whether express or implied; without even the implied warranty
' M- Z: Y) y0 Q+ b' G( \/ M1 b+ r& D - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% K$ V1 K* i- x4 R7 [$ h
- * GNU General Public License for more details.
0 D0 E- M6 t/ b0 S. g - */) U5 }( P, O: C0 u* `
- % @. b$ R+ E, r' m) E
- #include <linux/module.h>( d& _: Y B# C, }; t) z
- #include <linux/init.h>' N- x! |6 g8 l2 `, A: h$ I
- #include <linux/errno.h>
' `& c0 E* q, M* ~ E: \: R; Y - #include <linux/types.h>
3 e! K9 V1 V4 t! D - #include <linux/interrupt.h>
1 N1 \; m- K* X- x - #include <asm/io.h>
- h9 k7 T" P9 r M8 Y0 p6 v - #include <linux/moduleparam.h>
$ m3 s9 { D0 \9 b, [8 S1 [/ O& w - #include <linux/sysctl.h>
8 \ k H0 c& k9 l - #include <linux/mm.h>
, }+ E8 R# q/ s8 S" p7 ?3 S - #include <linux/dma-mapping.h>
2 J0 Q6 {1 A, B& F3 F( q { - 0 b( N1 i% |& V* ?" i4 e
- #include <mach/memory.h>
( \8 K( c* V. R9 d - #include <mach/hardware.h>
' T$ |5 l. v$ N - #include <mach/irqs.h>3 x2 F8 [3 n; A( \! o
- #include <asm/hardware/edma.h>
: t' I2 V l7 X6 x. ]9 E - ; P0 ^8 l9 d+ F* t9 p8 N
- #undef EDMA3_DEBUG) T! ~& n! w1 Z0 Y
- /*#define EDMA3_DEBUG*/9 v6 Y6 B* `2 q+ b a8 w$ g6 k: N; a
" b( d4 _' z& C/ Y5 u- #ifdef EDMA3_DEBUG9 I9 Z) k+ t, x M, n9 Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* D8 I0 u4 Q- d% J& O& ^ |3 ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ v& ^9 }: N) I3 A$ [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- G7 V1 h/ w' U+ ]' b: U
- #else
$ f0 T0 x1 d5 \6 O- I# U/ p4 u - #define DMA_PRINTK( x... )1 Z0 Z4 N, d9 y$ b4 e
- #define DMA_FN_IN1 }3 m! w9 u& A! o" Q: ^6 d& d& m
- #define DMA_FN_OUT* P: a5 M$ t/ V6 I
- #endif
w9 X! ]* w, T
2 J% I' z9 j8 Y4 {& U& \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 |1 ?% O% K. \! I" u* V- o - #define STATIC_SHIFT 3- e. x1 y+ B3 G3 k7 O+ L6 \' Q
- #define TCINTEN_SHIFT 20
/ a' i3 [! \1 c e$ H - #define ITCINTEN_SHIFT 21
7 _8 t3 Q2 f3 n9 | - #define TCCHEN_SHIFT 221 \- W* k( j: E0 Z) y5 L
- #define ITCCHEN_SHIFT 23, F/ s( I/ t8 I: {
- . I* s5 r- J0 C5 \# e# d
- static volatile int irqraised1 = 0;; l* t; @" d/ ~0 s: @+ n" K
- static volatile int irqraised2 = 0;
" y! c, b' y! t3 X# P0 D q
1 H# Q L% Z2 C7 i" S- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# d% U1 s3 U% {1 L. T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 k) ]$ l% p0 H% }% U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' y- R" F! H: x* k8 n; c; @7 Q
- - t9 }) b9 o- i6 C. ~: m
- dma_addr_t dmaphyssrc1 = 0;7 @7 g# m5 v$ x5 s9 z
- dma_addr_t dmaphyssrc2 = 0;2 N9 T0 V- i: |! F m! V
- dma_addr_t dmaphysdest1 = 0;& |& p V9 E. s
- dma_addr_t dmaphysdest2 = 0; H" M3 V$ N! n
+ S! U( W$ D' ~* H7 X3 ]0 c1 t- char *dmabufsrc1 = NULL;
3 [! b0 D$ E* ~ - char *dmabufsrc2 = NULL;
- R9 H3 ^! U# C) J" O: A - char *dmabufdest1 = NULL;
4 R/ N! z8 V4 ] _8 ?. g - char *dmabufdest2 = NULL;5 m3 C7 ^) a, s% O4 y& n
- ! n* P$ U6 g- M" c; U) B* c
- static int acnt = 512;5 T, t( w# G( N
- static int bcnt = 8;
8 l2 r) U5 C7 f- m, G - static int ccnt = 8;. v5 ?7 {1 f/ T" N
* N; `3 N$ ]8 |2 ^% b3 f- }$ r- module_param(acnt, int, S_IRUGO);
, H" z- F3 m* _! p - module_param(bcnt, int, S_IRUGO);
# a* [# j' l- q! E5 L - module_param(ccnt, int, S_IRUGO);
复制代码 2 t9 o0 a3 r( L% {4 h
! y% \; [4 Y( V1 h
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& {5 N; d- @# Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, O2 m2 v; A$ N 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: a& t# l2 E; R* C+ j! a3 E
% A- v" p4 ~/ C. S" y$ I2 ?: N5 @' a# i
$ A* U& a) U! ]$ V
|
|