|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% f' Y) V: Q3 ?1 I; T- [code]EDMA sample test application
" w2 y7 y# O; c/ ~4 u2 W - /*" \/ J- Q4 X$ t/ B% [& l! o9 y* u4 m9 a
- * edma_test.c" Q7 I0 h0 u& q# S0 ?% i9 v
- *) C) V, L& ^1 A) z, N! x
- * brief EDMA3 Test Application) D% `$ X% O' W) |, d
- *
: C! h# n; o8 }5 J$ [' \' a - * This file contains EDMA3 Test code.! K8 l* t* M. a: M2 M( i7 e! r
- *
5 A- o! T4 m2 f; Q9 C6 w; m - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 H! }. k* C w! _* u
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, s6 H1 d7 b4 {+ N) o4 u0 c1 u6 f& b
- * TO CHANGE.1 }/ H, \0 Z. S+ D* z3 G
- *
, ?/ ?8 U! m! ]1 N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// ~/ M" n: t9 x9 R/ W
- *8 L$ c# k7 U) o5 t8 k, z N
- * This program is free software; you can redistribute it and/or
9 N, B2 C b" s8 g* o - * modify it under the terms of the GNU General Public License as( j# z" d& Q( O
- * published by the Free Software Foundation version 2.6 d7 b' K& w, t/ ^
- *
7 i `" c7 C/ F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% m. m$ V6 o; e- Y
- * kind, whether express or implied; without even the implied warranty A6 ]. @ w6 e% t; B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ e8 \# F ^( }; u% C3 l. a- j3 W6 n
- * GNU General Public License for more details.% W" t# H+ c& |
- */
H/ O- o0 e# a, O) O* f' y - 3 |* m+ K2 c% W) i% ]! G* y
- #include <linux/module.h>
; E2 } j: h+ g - #include <linux/init.h>* {7 N7 y [# t* u9 c$ e
- #include <linux/errno.h>1 c/ F& J& [4 Y
- #include <linux/types.h>
5 \* p% j4 c/ @ - #include <linux/interrupt.h>% @; q0 M4 U. b i
- #include <asm/io.h>
T/ T5 q9 A* W. d5 {% [ - #include <linux/moduleparam.h>
8 I8 \3 R4 a! X - #include <linux/sysctl.h>
5 ~% q4 \# v# x& `- l5 r" c! C - #include <linux/mm.h>
! k6 d4 z; D+ ] s: A/ V - #include <linux/dma-mapping.h>6 o8 h# m# {6 ]: K/ p
- 6 T( j4 d/ i0 X4 p, h
- #include <mach/memory.h> a+ w- Q* G% ]6 m5 G" h2 |" u1 q% L
- #include <mach/hardware.h>; L7 F s- H" l7 e5 S
- #include <mach/irqs.h>
b9 p' a* F$ ?- U% E - #include <asm/hardware/edma.h>
. U2 u4 r- ?- I* W; n- P: t% y - 0 G( ?. |# \ T6 z5 @! w
- #undef EDMA3_DEBUG7 u" B7 L! M. k6 u; `6 ^: c
- /*#define EDMA3_DEBUG*/
4 m* E! \! o/ K - 7 ]7 M8 r* S, x- c
- #ifdef EDMA3_DEBUG
7 s" s7 g; o* Q/ G: ?% k* ^ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 _8 |' R4 F, o- d) A
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: q5 E2 b/ u* ^# `9 ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* N. W8 f1 u8 c - #else
& V/ F6 k/ h5 F; i. V1 M- i) W9 A! Y - #define DMA_PRINTK( x... )
; a, x ?) Z6 d4 _7 h* r - #define DMA_FN_IN" J3 _. o; G) V
- #define DMA_FN_OUT# V) A5 L) ^/ b
- #endif
. G$ F: \) c8 C/ {
- u& _0 G6 M& E* {% D/ \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 d0 S9 V+ ~3 {, _. c
- #define STATIC_SHIFT 3* A i, h) q( W1 k
- #define TCINTEN_SHIFT 201 ` H; ^7 R6 N `. S- \% Y, Q
- #define ITCINTEN_SHIFT 21
0 T7 A* r4 o2 l5 q - #define TCCHEN_SHIFT 22# T/ P, u" ?/ R
- #define ITCCHEN_SHIFT 23
; H* q0 n# [; A; f8 r
- [# s8 P7 K0 J: d- static volatile int irqraised1 = 0;) d3 B, \* W* P; l
- static volatile int irqraised2 = 0;4 k6 B4 U. T0 r2 ? t
2 N% g. Q* |+ A: W- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ T, ~* ~6 r+ r7 m* H% V# Q' ^0 y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 Q& i p( x5 H0 o- A7 }2 T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
d+ m3 c P( n5 y- Z0 B - 1 w6 N" A j% o
- dma_addr_t dmaphyssrc1 = 0;" D# D K& N1 H6 D& q
- dma_addr_t dmaphyssrc2 = 0;
" ^* J, X' l: B - dma_addr_t dmaphysdest1 = 0;
) e; @8 l* E6 g: s- z% R- B0 U% S - dma_addr_t dmaphysdest2 = 0;
/ p. p N y9 I( f6 b0 l
2 p' C% A \2 B0 n3 |- char *dmabufsrc1 = NULL;, _7 V9 A$ d) e8 g& q4 M
- char *dmabufsrc2 = NULL;
+ A7 e$ W/ _; R: [' u6 _3 q - char *dmabufdest1 = NULL;& \$ h" c: \$ g2 ], t
- char *dmabufdest2 = NULL;4 o5 j8 m1 ~# K( K! V% Y
+ D% S9 G- G" W$ u" K- t. t5 Y- static int acnt = 512;
+ T0 O7 f! L4 j8 d Q - static int bcnt = 8;
! }$ n I; n; F - static int ccnt = 8;; l+ w8 R6 t7 O0 x7 o$ t
- 3 h$ e8 s, l% g3 [! [
- module_param(acnt, int, S_IRUGO);
" B$ `; d0 H; h, i - module_param(bcnt, int, S_IRUGO);
" Z' G; f; ]3 x; B7 B; J - module_param(ccnt, int, S_IRUGO);
复制代码
* h4 ?; j- j8 ^( b, o
, u# ?) E6 y: U9 G5 s1 Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 H2 @+ O0 u! Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 ]1 p$ Y1 a) x' k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 @4 U2 {* h& s7 \. b9 e
! w2 h: a; A7 A# z7 d4 f2 @
6 r5 a9 A! M( U3 a) D |
|