|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) Z* h* D7 s3 }- h' q- [code]EDMA sample test application- }% ?9 {7 |$ `' @% S
- /*
0 o, L4 {. w* ^5 r! k - * edma_test.c, M5 c, e+ m( |/ X' w/ D
- *1 i. C9 @0 [9 X, G" _; Q; P! m
- * brief EDMA3 Test Application+ q! B- Y' D9 a. r2 ^
- *4 H; ^4 ]& t' k; l
- * This file contains EDMA3 Test code.4 X9 s! A- `& l
- *
i2 D/ Y* `8 @3 s/ H' Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ ?* N3 ~! V9 f" c7 N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 `! ^! t8 W4 c. f# X T
- * TO CHANGE.1 {- L7 }- I- ^: V' B$ B
- *1 R! U! H3 j( ^9 |% I* \
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 Z" c) ^3 S, x& G
- *
- d$ f$ J+ C4 M3 }" M - * This program is free software; you can redistribute it and/or
7 w. i5 q! U& E' L! @/ p$ Q- O - * modify it under the terms of the GNU General Public License as
% A; I& Z! N# z* B f - * published by the Free Software Foundation version 2.. d8 h+ T0 N/ x$ b* T' m
- *
- p6 W2 f9 x- k$ F2 `7 z, X - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- j9 `- v4 h' t4 X8 D7 z; l/ { - * kind, whether express or implied; without even the implied warranty
* e( }3 z, n+ k# S9 C* R$ _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ w1 q I* v1 h1 N4 K/ @' J. J - * GNU General Public License for more details.3 q1 \! m" w- v/ `3 p
- */
+ j/ j3 ` i; }1 h
5 ]! f, o6 b: I9 `! ?# |$ G" o- #include <linux/module.h>
& _* Y$ h' w& Z - #include <linux/init.h>" ~( L @6 w) y! y& M3 _9 t
- #include <linux/errno.h>; r$ i, T0 c5 r
- #include <linux/types.h>
/ b1 k' X5 ~" P7 F* Q: Z - #include <linux/interrupt.h>
$ i' c' R, k v# g$ Q: } - #include <asm/io.h>
( q7 N* j2 ~9 _8 q* D S$ y9 x - #include <linux/moduleparam.h>
, j& H( z6 c* ` - #include <linux/sysctl.h>
/ B" K3 U U6 I7 N0 D5 i - #include <linux/mm.h>
1 S9 A0 h5 \7 N. W7 w; D - #include <linux/dma-mapping.h>
; P, U3 a; m4 J4 h4 S! G
& G' Q7 Q/ M! F0 v$ q& h* k- #include <mach/memory.h>! H7 @& C# ~! g8 G/ b Q$ H8 }
- #include <mach/hardware.h>$ e% |! u# a# c+ T
- #include <mach/irqs.h>* U# c# `' {. W2 X' |$ g9 h* w9 _5 D
- #include <asm/hardware/edma.h>
) Y: f/ H; Y' N. w x6 T - `. z% |% \' j1 F9 |' Z' a x
- #undef EDMA3_DEBUG$ B( o* e A3 b' w) `( f: a* X
- /*#define EDMA3_DEBUG*/: n" B% ?1 C3 C4 ?. q
- ! f/ a7 V' p; M2 B
- #ifdef EDMA3_DEBUG
: }. X% S8 J4 Q, j8 r - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 I! \% B; ~- |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ ]( ^6 O2 O* |4 t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ I$ V% u) w& X: k ]0 r - #else
- U' o8 O' Y5 o! ]) L* }6 J - #define DMA_PRINTK( x... )
4 e8 j) B+ w! l# Z: T8 I; Y e - #define DMA_FN_IN2 m6 {$ R2 s. N
- #define DMA_FN_OUT5 e1 ^; d, c `1 |) N) O S: W
- #endif
8 E& c! u3 ?, n& _ m$ S - % O6 z6 V7 _1 A& a- ~8 R4 Y8 B
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 q5 S2 g5 s6 o, z - #define STATIC_SHIFT 32 t$ S: u2 m" x: p, p
- #define TCINTEN_SHIFT 202 o1 o$ @" k' q- [/ e; L* ~! y
- #define ITCINTEN_SHIFT 21; G' p4 r. a/ \; @' e/ d( s
- #define TCCHEN_SHIFT 22
; Z: g( {; i' v( s - #define ITCCHEN_SHIFT 23" O% W! F; w( J- |) C
- & B4 S8 G w: U( X
- static volatile int irqraised1 = 0;
: J8 T" r O9 X9 ]$ d - static volatile int irqraised2 = 0;
, B; X# L* K( ?( h3 k
0 j! l5 j4 W' w! h8 `2 }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. M. h" x7 s( ^: J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ V. m: X8 A) ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 e' `. J% T0 F
; c) z9 {3 n! A) @5 a2 N' B7 C- dma_addr_t dmaphyssrc1 = 0;
I0 Q" x3 v" _2 ^9 [9 p/ p# U1 t - dma_addr_t dmaphyssrc2 = 0;
0 F1 k! W: Q9 U2 _ - dma_addr_t dmaphysdest1 = 0;: k, E' u# p7 n* I! z h
- dma_addr_t dmaphysdest2 = 0;8 q8 @9 `3 N. @; s' V6 U5 V( U1 W4 ]
5 }- |# E( L9 k. a, M: X- char *dmabufsrc1 = NULL;
7 e9 i0 P9 @6 l: W. g - char *dmabufsrc2 = NULL;
: V0 `3 n9 T. u. g - char *dmabufdest1 = NULL;
" D1 H6 h' O7 O% H% K, z9 h0 @1 | - char *dmabufdest2 = NULL;% B( f! A/ c$ t7 ?
- 0 _5 H9 y! P8 ^ ^, F6 _" U
- static int acnt = 512;2 q1 o7 a8 g' D) j9 D# S
- static int bcnt = 8;
& A% R. b% V! M: G - static int ccnt = 8;
1 S8 d9 M1 C7 ^: ?: I
2 M% g2 z2 x9 w0 k& e- module_param(acnt, int, S_IRUGO);
: T1 Z* [/ F# G$ E6 q - module_param(bcnt, int, S_IRUGO);
/ l, a1 B9 W1 [- Y - module_param(ccnt, int, S_IRUGO);
复制代码 $ h& U; |5 D) S0 ~! J5 R' b. F
& q S, y# f3 @& ]/ Q8 A, P% @# b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
{7 O% Q8 F. t n7 Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ P; e" Y! W- w8 ~& R; O9 ~. z4 O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# e- \& P2 z- |; b2 r9 ]
2 Z3 h7 i, z7 k; l9 a
, n6 E/ r' M5 \9 T |
|