|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% ]# _! p- ?3 O: K- [code]EDMA sample test application; h! C# r: W& x2 b
- /*
( N, V' N! }; h% o7 f2 t+ o - * edma_test.c
% U: g7 s, d3 C( Y3 u- u - *. K& {/ u! A3 t; Z8 F- S9 T
- * brief EDMA3 Test Application2 H9 E. A) V2 L7 {1 w" j7 r! T
- *
( H% g; t) {3 U- P6 Z - * This file contains EDMA3 Test code.# s4 C9 L* G# O; z2 }
- *$ z9 D7 A: X+ W$ P! r2 U' y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ I0 V& L9 e+ ? - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 L+ V' W* V+ v+ _, D - * TO CHANGE.* z; j; ] I/ |, M. X* ?, M
- *$ N: I" Y( M9 {% @8 q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 s# @( E9 p0 \/ H/ H
- *4 _8 f+ \" q! A
- * This program is free software; you can redistribute it and/or
' o4 {) h" u6 d$ }! l: o* } - * modify it under the terms of the GNU General Public License as ?4 h% q4 j: i0 [8 a+ {
- * published by the Free Software Foundation version 2.
8 C0 p; B$ v7 i& V0 D9 X" A - *
$ u) ^/ t. q# j. ~2 r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, ~, Q9 E: E4 u
- * kind, whether express or implied; without even the implied warranty! u0 @2 ]0 z0 s$ D4 F5 I U
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 j) U1 E/ d6 l5 n- ? - * GNU General Public License for more details.
8 S% V5 X4 t+ f# L - */8 e6 h& Q# T) P- g) U
, s) i' U* z1 h+ s+ z" G- #include <linux/module.h>
, A8 [" m) h/ l* H1 m3 l# ` - #include <linux/init.h>5 {1 |7 r1 ]1 S- W+ a2 F
- #include <linux/errno.h>1 ~% Z Y" R& g9 ^/ V- c5 `
- #include <linux/types.h>
! E* ]! V- ^8 `- z - #include <linux/interrupt.h>$ ^, [# T4 k2 o1 _' H
- #include <asm/io.h>( l$ R" j) r+ K' T3 H
- #include <linux/moduleparam.h>
6 w8 K4 {/ i( q) j6 N9 v - #include <linux/sysctl.h>
. ^6 r1 s2 f z# Z2 {0 Q - #include <linux/mm.h>/ ?7 ?: ?* D* S" P: T: R5 d
- #include <linux/dma-mapping.h>* P6 m3 x$ L- i8 R4 @. Q/ f3 K
2 g7 R2 V1 Z0 ]6 K, c- ` R5 n2 U- #include <mach/memory.h>6 ?' d( [9 h" I5 ~$ J- ~
- #include <mach/hardware.h>2 ?% r5 m0 V7 \* c
- #include <mach/irqs.h>
1 M9 _+ l1 k' S: Y2 Y8 Q - #include <asm/hardware/edma.h>8 I2 Z0 S7 u% \, M" f( ^
- 4 \6 {, n$ u$ ~
- #undef EDMA3_DEBUG
6 v/ H$ {$ V: e! J4 F- f7 O Q - /*#define EDMA3_DEBUG*/
E& | g' Y3 `# O6 o7 x0 e3 d - ! d" C& }% H4 w) o; C( m4 ]- y
- #ifdef EDMA3_DEBUG
* I3 O, w+ S) `! B) Q" f9 A3 T - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* C2 i5 `. M" D; d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) L! ?: _' q8 @1 H2 k2 s+ ] - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' C7 e. I% B) z- x$ e0 @ - #else8 v* d& F. r6 L% z1 [
- #define DMA_PRINTK( x... )
( {' d* c2 u# {, l% N9 l - #define DMA_FN_IN" h3 J9 H. F- q: g: d
- #define DMA_FN_OUT, k+ U5 y0 r" g- g3 v1 E
- #endif
6 N, ?/ C2 n* \ - 2 H+ F% _7 [: M8 ^6 m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& [8 d G6 L d! D" q0 S$ y7 N, X - #define STATIC_SHIFT 35 @+ l0 e& ` E2 Q+ f
- #define TCINTEN_SHIFT 20
7 a! y' e3 p$ q$ V - #define ITCINTEN_SHIFT 21
& Q& L! V s" c8 C4 H% e1 N! q - #define TCCHEN_SHIFT 22/ X& x9 h) E0 j! }1 @! d
- #define ITCCHEN_SHIFT 23
" O+ n% f7 ~! Y0 [( Z
& \4 x% \$ |; j/ m) L- static volatile int irqraised1 = 0;
; |3 l7 w- a& z9 H - static volatile int irqraised2 = 0;
l# Y4 M. P; y. i - ; c \6 Q }5 _9 L8 M
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 |; o7 b" @2 s, x- P( D; a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 C: \0 J- m1 c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 v& b7 T5 b6 A: Q, s9 x5 ]' t
" y( d7 C* w$ C; U8 ?6 X# |- dma_addr_t dmaphyssrc1 = 0;% j, I+ n& V3 G; S, b
- dma_addr_t dmaphyssrc2 = 0;
1 t; z! d- ]- U7 _+ r - dma_addr_t dmaphysdest1 = 0;
7 Y% Z8 `! x0 p1 S - dma_addr_t dmaphysdest2 = 0;
* w% z4 q* S5 q+ a - 4 k. @1 A8 ]6 b1 Z
- char *dmabufsrc1 = NULL;# S$ J) v3 n2 {
- char *dmabufsrc2 = NULL;& n2 ?0 I* r- y8 B9 a0 f T
- char *dmabufdest1 = NULL;
0 {4 d5 N9 h4 U; P9 k) X - char *dmabufdest2 = NULL;
/ S! ^7 v9 ?+ i3 A1 O8 A5 M
& F. P5 F2 R0 k' w, b8 v0 W4 _0 f. L# f- static int acnt = 512;. m7 G! Z8 Y( r0 ~
- static int bcnt = 8;
% \6 z6 Q/ V1 S" U - static int ccnt = 8;
; L( Q( _4 A% g9 W; @, t Y' b4 q& s
2 A2 K+ v. d/ U- module_param(acnt, int, S_IRUGO);
8 L9 M! z8 N3 K* }7 Y - module_param(bcnt, int, S_IRUGO);
: W4 a5 L, }8 ] - module_param(ccnt, int, S_IRUGO);
复制代码 7 T0 F+ q9 p, o, r* N
! w# e' l ^" |" C3 a4 q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' _3 \# ~/ Z; P& y4 ?2 j" Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 w& K- ^; N/ u3 J/ ?7 i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 V l6 M5 r5 o
, w8 f* A D: c* d" F! G& B# |2 i% w' D6 U+ z
|
|