|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' I: R# z2 L3 v( ~0 {+ k- [code]EDMA sample test application
: a3 {$ R7 r Q, I5 e - /*
+ \- j" V6 X4 }" W q v' Y- _ - * edma_test.c6 i+ [& t* }, k0 Y
- *6 ^% |- y; d/ ]! Y9 A( F& g
- * brief EDMA3 Test Application
2 M9 P/ Z1 c, x! u9 _ - *' ~2 X4 d0 ~7 J. G$ `+ ^
- * This file contains EDMA3 Test code.
, L) E/ Z0 i" N% { - *
& Q J; N5 W) x7 X. e; l. q& Y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# ~! X: a/ {8 [, |9 e - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" ~# g8 A0 G4 M8 U5 ] - * TO CHANGE.
3 K V$ X% S+ ?4 A! ?4 B- [" A$ h, W - *4 b2 n, G2 _- v" ~7 X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, q0 n7 K2 {" Q$ Q6 b - *
* L% X5 x1 M& B/ x - * This program is free software; you can redistribute it and/or/ J% s% `# @# m: X$ h5 H# \
- * modify it under the terms of the GNU General Public License as. _4 w: K5 f& Y3 [" [
- * published by the Free Software Foundation version 2.
% }( e- e; h, N0 S* B: T4 t& y" z" i - */ o0 h5 G! x/ _' w- P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. u1 J! w; Z5 S: Z7 @) G% Y+ s
- * kind, whether express or implied; without even the implied warranty! W" t/ a* a* e; E, x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 H# S: V( R$ f5 i1 J! ~" G8 s - * GNU General Public License for more details.7 j! t) a- n7 F" U6 U. x" n9 d
- */
. p0 R B# c3 Z0 H - 6 R- p, r% e6 |) D, x* R* W
- #include <linux/module.h>
& e2 I7 S1 g0 D5 c, ` - #include <linux/init.h>
; x: j7 t# B# W! }! N8 I; i - #include <linux/errno.h>
# a p4 D) N \0 [; i3 { - #include <linux/types.h>
( V7 b8 r6 h4 r - #include <linux/interrupt.h>; Z+ t" h! v3 p: x- N
- #include <asm/io.h>" ~) W; t% C0 V. c- @# j
- #include <linux/moduleparam.h>
, Q E3 z$ o7 ~ - #include <linux/sysctl.h>8 }* v0 \ }& ]) L
- #include <linux/mm.h>
. N; o, T9 l1 e+ E - #include <linux/dma-mapping.h>
2 x1 T( T7 l- ]4 f
' L9 ^0 A. O R- Z0 G- F- #include <mach/memory.h> h9 c: p k9 _
- #include <mach/hardware.h>
# p" X; y7 b: X3 m3 p - #include <mach/irqs.h>
$ P. r* H$ C# o$ E - #include <asm/hardware/edma.h>
) ~/ _/ F, |* U- ^ - # p; E' ?$ d: \0 |
- #undef EDMA3_DEBUG
/ `& {1 h* A Z. C4 B) f - /*#define EDMA3_DEBUG*/+ @+ @+ d9 J; Q( R5 J0 V+ M1 ~
- ' o& Q' S+ e1 b# _6 u/ w
- #ifdef EDMA3_DEBUG
4 n" `2 ]3 D4 d4 P( ] - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; A8 u! V' e3 [- \& h) `( `. b4 b! h2 S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& M: Q0 E' Q* z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 u6 r1 B8 V" w& Q; S6 K; }% d
- #else, F; l* H+ y$ E1 [8 P, ^2 l* e
- #define DMA_PRINTK( x... )
& ?; i s6 k$ t$ { - #define DMA_FN_IN
( L$ R4 h* Y% o( W9 y - #define DMA_FN_OUT2 c4 q- x- q, R" p7 h- P
- #endif
- Q' W) k E: D6 \( v9 q
2 z( t8 M+ p# y* u1 f- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# W- \- ]8 Z% |4 X2 t - #define STATIC_SHIFT 3
# Q! U* \7 e: C/ W - #define TCINTEN_SHIFT 20
. o) ^; X; J# b @( T4 [ - #define ITCINTEN_SHIFT 21
$ n; x) k6 D1 R - #define TCCHEN_SHIFT 22$ l$ w8 x$ v0 b' A6 L' C
- #define ITCCHEN_SHIFT 23
' L- E$ I% N/ s2 e
5 M A* S J: w! Q1 D) `) ^9 V- static volatile int irqraised1 = 0;$ N2 W' D' @3 W+ i3 r
- static volatile int irqraised2 = 0;
1 A. A0 a7 ^7 F4 R( `( C
( G d6 f5 K# a" F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* L5 D1 e+ t( N9 \1 U - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ C+ J* m( [" V' C& g4 Z% I# h) ?4 a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( o9 }6 M3 U; s. U
- 5 `) F1 ~9 E$ e0 k2 I- a. S
- dma_addr_t dmaphyssrc1 = 0;/ j& N+ Z, x: r
- dma_addr_t dmaphyssrc2 = 0;
2 J4 X8 B0 v+ ~- C - dma_addr_t dmaphysdest1 = 0; j: n8 S' |+ u! K4 I; Y
- dma_addr_t dmaphysdest2 = 0;
) G9 B1 h6 d5 i# }: V
6 O* d3 i* p1 r1 x" k% v! C- char *dmabufsrc1 = NULL;$ y( k0 `8 x0 i# Z, H# v0 W( l
- char *dmabufsrc2 = NULL;9 F5 t; F" u0 J, b$ K
- char *dmabufdest1 = NULL;+ ^* }; G3 l7 j. N% p) F+ a
- char *dmabufdest2 = NULL;
6 H% c# b+ @- A- k8 s0 R2 F
: h" ~' ~, o# d" ^6 z8 R1 K; C- static int acnt = 512;+ G5 J! h' S. G, z) v6 B0 ~/ y
- static int bcnt = 8;
( V2 s1 D, c: B1 T4 e - static int ccnt = 8;6 j5 v* l. S: ~$ f. w7 ]
- 3 w4 z( T# `6 c$ Q: r" x( j* L
- module_param(acnt, int, S_IRUGO);
/ m5 R T: W6 _, b; N j2 v - module_param(bcnt, int, S_IRUGO);
7 w$ d4 z8 i% P: w+ y8 n! W' P9 l - module_param(ccnt, int, S_IRUGO);
复制代码 + f y' B3 r7 Q7 J) V0 X
2 |( K9 c- A8 e- |+ M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- L w7 d G2 ^* Z$ I, Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* g: |& m6 r+ {' U) k, V; S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: j! J. N+ |$ B
& c- z) x( v6 |6 A6 g
5 o2 r. C* D/ n& b! ^2 j4 o |
|