|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * r. J6 W6 N2 [- c% e
- [code]EDMA sample test application* D3 Y! K, a9 b; v( d: A0 _, a
- /*+ W( f9 P8 r5 u4 E) Z8 E# ^8 N2 ^" L- d' Z
- * edma_test.c& G6 _& m0 K, d; q9 G7 {0 h
- *6 ~- j$ \5 i7 F& a! C9 G
- * brief EDMA3 Test Application
( U3 H* c6 h6 \ - *
: R2 Y/ m/ c/ r/ T* w - * This file contains EDMA3 Test code. j/ e. o8 s2 k0 [0 W9 a8 u/ j
- *; _ o7 W* ^6 s4 L1 P
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! j6 L9 D, s+ y, k; _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
j6 ?; C( P8 b; t, [1 [ - * TO CHANGE.
) L. {" l0 N# Z( z: N - * C. p. L* F7 _6 h# C4 y* m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* N9 A. D7 T5 a, G: ] - *
' u5 A5 V7 ^ @9 x) g( O/ W - * This program is free software; you can redistribute it and/or& F, N# ?1 R: s2 h
- * modify it under the terms of the GNU General Public License as* C- A. D: C9 m' K0 q7 r$ b4 S
- * published by the Free Software Foundation version 2.
' _$ A% T& U& k7 z: q4 p: V - *
" _& Z9 b/ k4 m4 i8 o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. x( A; K3 p. |5 e! p: n, G
- * kind, whether express or implied; without even the implied warranty
& P( [7 ?$ Z- Z! u; s( r- J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* N) {6 s0 ^3 A% I: @! _+ Z
- * GNU General Public License for more details.; t- n4 @/ o- f. E g3 B1 ~& \
- */$ l5 k7 T# [. T
- 5 ]3 t3 p1 H7 d! W
- #include <linux/module.h>
5 h% e9 l: @) E; { - #include <linux/init.h>
5 G0 e Z/ l6 C! w5 ~/ G - #include <linux/errno.h>
$ c! H; ^4 k7 i' S8 M$ p: f3 k - #include <linux/types.h>$ V( C; ] O3 `) w* a+ n2 ?" e8 ?' ~
- #include <linux/interrupt.h>
6 G6 s1 ~% Z! E - #include <asm/io.h>4 m# d3 K/ q: |$ ~' N# r$ x( |# D
- #include <linux/moduleparam.h>
! Q( O# ~+ w$ {* Y - #include <linux/sysctl.h>6 O' _8 U: Y1 l0 j
- #include <linux/mm.h>
$ a- c6 J f8 ?; E! G - #include <linux/dma-mapping.h>- W4 n) T" {+ @0 ~$ p `
: j8 V+ p" r( {, d- #include <mach/memory.h>
4 s$ k9 L9 c. x8 z - #include <mach/hardware.h>/ K% }, f8 A. t6 _, ^' C; h5 p: {
- #include <mach/irqs.h>
/ [0 x" ^ b1 a* P. c. t G9 f - #include <asm/hardware/edma.h>+ H3 ^5 Z+ W# ~% Q$ r9 ?2 S- b
- 6 f; T. b) K- T( A, X0 O1 ?$ e" _
- #undef EDMA3_DEBUG
/ l; t5 r0 C. V5 L- N - /*#define EDMA3_DEBUG*/
4 Q& Q0 H" [7 q& k8 k
. ]$ a1 ~; K3 U: X0 b- #ifdef EDMA3_DEBUG! b- ?; ~3 C4 L( G! l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 Q4 H" e. L9 r) h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 q; T$ l a/ ]- p$ c - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* l* u5 t! C: A7 u( ~" j
- #else* X' A9 k; U: v8 ?( i
- #define DMA_PRINTK( x... )# @$ I& G/ B/ q; p j8 X
- #define DMA_FN_IN
: C8 t8 X" U. j - #define DMA_FN_OUT# C( p* O6 \0 d
- #endif$ R# J5 q5 T- V+ {/ k2 l' @
3 I# g( c6 N6 i6 Q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 N0 E% _* s! W8 l: M
- #define STATIC_SHIFT 3) N4 ]' R$ [+ {0 {" T: B
- #define TCINTEN_SHIFT 20
1 S% g" e. P/ f" ~0 v1 H - #define ITCINTEN_SHIFT 21- G, j0 x4 B2 L3 b% j3 L
- #define TCCHEN_SHIFT 22
( x1 C1 E1 ]8 H: x" H i9 P1 q - #define ITCCHEN_SHIFT 23' g$ G I+ H0 \+ F; R0 Z U
' C' p7 M7 E6 i* Y; g- static volatile int irqraised1 = 0;
- ~* x( H& {( ?' }9 `5 {* E - static volatile int irqraised2 = 0;3 N7 B& s6 g8 Z3 g& N7 N
- X% A- i$ S3 w. L' U
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- v4 ?7 K8 J* e( P) r5 E& e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
[2 j6 C2 K7 I5 P* R) V - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. H! D5 H/ F- d2 Q
9 Z# S5 D& h) U: o @- dma_addr_t dmaphyssrc1 = 0;
$ X7 J: i; K! ~1 M. V/ v - dma_addr_t dmaphyssrc2 = 0;% l4 I! I, H: U; o7 h; k/ \1 ?+ u
- dma_addr_t dmaphysdest1 = 0;
1 i: _- A9 n9 |: K% q - dma_addr_t dmaphysdest2 = 0;
" v+ q5 D, w y, c2 X, P' q5 j
# P/ @+ K/ s. L1 {$ t- char *dmabufsrc1 = NULL;
b: K9 o& N F: Y - char *dmabufsrc2 = NULL;
( w/ ]6 l" X7 Y0 \) i - char *dmabufdest1 = NULL;
0 U0 e: }5 X7 l$ O! {- N - char *dmabufdest2 = NULL;
& y0 m& p( W5 q( b1 @* c
8 [ r! a, a: H/ ?, e* Y- static int acnt = 512;* n2 \6 Z+ [: Q9 j" Z1 T, e
- static int bcnt = 8;
^4 S& Z7 e- u- F - static int ccnt = 8;6 a- c. @, m2 G$ M
! ^ h) V: d, i. Q: V7 t- module_param(acnt, int, S_IRUGO);
' {& Y/ h/ c, N - module_param(bcnt, int, S_IRUGO);
( Z% u1 g, Z+ X1 ]5 p6 c - module_param(ccnt, int, S_IRUGO);
复制代码
8 w% F6 `+ i* o3 L4 }6 [( Q1 e; R0 V. ~ G# e2 p8 }8 \
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 k; @: ]0 j# G. z+ p' U) B
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) X8 p0 U! r- v1 u6 _7 A) f) ` I
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ |; r- q. x, v) i
- L' T {( W# X+ L& u! T. ^1 O
|
|