|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; Z' w; V8 g: g; K2 g% z# b
- [code]EDMA sample test application* R) e _* J% i3 C# U
- /*3 {& ?+ E- L5 k, _3 h
- * edma_test.c
6 F$ A9 v& h4 { - *
$ k9 o8 c7 w3 j - * brief EDMA3 Test Application
2 b- c/ }. @) ^- ]- d - *( D! Y* q3 _2 _8 X5 ?3 o
- * This file contains EDMA3 Test code.
: R7 t* L9 s4 H8 f1 D0 } - *1 U1 W- M) m: V& b- ?
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( P8 j" q% K0 N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 P! }+ I" O- D F+ D0 K, t+ D+ n - * TO CHANGE.
, d* j$ [6 Z) K* Q# i - *) F% a, s! R6 B4 W0 U3 v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# j9 Y. Z' W2 G
- *! h" C3 D, u1 n# W
- * This program is free software; you can redistribute it and/or7 x% r/ t9 K% s2 H- ~0 H; w7 e
- * modify it under the terms of the GNU General Public License as
) ?, G8 Y2 O( |+ o* d - * published by the Free Software Foundation version 2.
3 m0 \) r/ o( p+ b9 {% T - *
4 c3 I# s" G, I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 C& x4 V3 }: l: c4 D9 B
- * kind, whether express or implied; without even the implied warranty
% g, r X& n; V$ j3 D% E: D i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# i) ]( R/ w9 k8 {
- * GNU General Public License for more details.
2 n8 M9 ^4 M1 F - */. |# g0 y2 r7 u& P" d
8 [; k- U0 r4 }5 h5 x% Y4 h3 w- #include <linux/module.h>* D. u$ c0 X) G" V4 z
- #include <linux/init.h>' I7 V* k. F& Z8 H* y1 E
- #include <linux/errno.h>7 {" ^6 t! m! o, y4 B
- #include <linux/types.h>
3 V0 q9 C3 {" Y+ Z5 R3 J! k1 p - #include <linux/interrupt.h>0 y, v/ H% [/ b: |/ p
- #include <asm/io.h>
- u3 \ Q8 g. [( B$ o/ O2 n - #include <linux/moduleparam.h>0 S3 a5 f% ^7 l+ h/ {; V0 W# m
- #include <linux/sysctl.h>8 w X/ C9 s6 D/ a2 W M
- #include <linux/mm.h>
- \ v- x1 t. ]3 M' ] - #include <linux/dma-mapping.h>) c3 p+ O: U5 y0 R: H" R
8 |* z `: ~% E5 H2 d% ]" d- #include <mach/memory.h>
/ L, i6 Y( `3 G - #include <mach/hardware.h>
1 t2 a) ?, \# I! ?# H5 ]) x+ U - #include <mach/irqs.h>1 G: `. T$ V7 }* e6 U8 X
- #include <asm/hardware/edma.h>2 u8 |" S& M% ]* k# p2 c6 r5 b# x
+ H" I$ J. E4 d( @/ p9 X- #undef EDMA3_DEBUG
4 {) Q3 h' ?6 ]" n) a' V - /*#define EDMA3_DEBUG*/% P3 a* ~2 b4 J7 ~& ~) d
$ ^% x' h+ F0 H% M( `- #ifdef EDMA3_DEBUG/ Y- ?% Q' z3 i$ n6 W( x
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 @# }& A4 [, C( `$ l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( X( q3 w9 ^* j+ T3 C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 D7 \* z! ^' C8 c" S( M$ @ - #else
3 R! v/ Y/ X+ c8 v; L/ z3 A# M - #define DMA_PRINTK( x... )
$ J+ T) d9 \6 \ X+ F - #define DMA_FN_IN
6 K X0 ^2 l+ e - #define DMA_FN_OUT$ C7 w: a6 w i; L0 r: E
- #endif3 j* h# {1 g& A( N( ?' _7 p" n
- $ U" X, q2 O' l/ u: [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 M1 r# ?) V1 o+ Z5 Z - #define STATIC_SHIFT 3
D& [- Y# H1 I" l! k - #define TCINTEN_SHIFT 20 p, Z4 @& ^" d( G' S
- #define ITCINTEN_SHIFT 21
4 @. y) G3 ]' q - #define TCCHEN_SHIFT 22
9 g2 X# @- }9 Z - #define ITCCHEN_SHIFT 23
- ^* @# |. d, w s3 s" T- ] - 9 X0 o) D5 ~( Q+ X
- static volatile int irqraised1 = 0;
0 {; t* a6 w/ t) i: ? [& X - static volatile int irqraised2 = 0;
; a9 K* t- z( u" Y3 [
& i2 w, y. f9 Y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 d; G$ N! C, u' H& y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. A9 U; [/ q- k6 P2 K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* _& x1 d1 d* D0 |8 C4 j1 e! H
. c+ D& ?1 V" U' Y `- dma_addr_t dmaphyssrc1 = 0;% b5 @+ i" e* l+ T. Z
- dma_addr_t dmaphyssrc2 = 0;
& X/ u! \ h+ k - dma_addr_t dmaphysdest1 = 0;
2 J) J; B9 g, d$ m/ u' n- v4 c - dma_addr_t dmaphysdest2 = 0;
! h7 }" \! [5 h0 ~9 d- @5 y& L - 3 {- N2 `% g% v5 h, M G
- char *dmabufsrc1 = NULL;
6 {% b5 u' E3 V" Y4 \$ D - char *dmabufsrc2 = NULL;: {/ J- ?4 h: K4 K Y
- char *dmabufdest1 = NULL;
5 R9 R* b& a6 E4 M( O: A - char *dmabufdest2 = NULL; l$ @9 s# i: [- b5 t3 J
8 u0 W% x, N) ?+ t+ F- static int acnt = 512;: C8 ]. {5 \( a6 R) F& i
- static int bcnt = 8;7 [9 N1 W" M, d3 J6 d, r4 D
- static int ccnt = 8;
; N2 N5 @1 b, T2 G) P+ d1 t - ' ?; C8 R3 R1 x$ Q" f5 M+ z2 l
- module_param(acnt, int, S_IRUGO);
9 S/ D4 q/ x: ?/ ^( C1 k8 t [ - module_param(bcnt, int, S_IRUGO);
$ ^) M8 D' L5 d8 n; }$ z* y - module_param(ccnt, int, S_IRUGO);
复制代码 - V' M$ D. W0 E: v
: [. e! O) ^8 Z7 K6 r: E; B1 Y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 q/ C: y8 _& r% ?9 E- P9 ]% v& r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ A6 A5 T1 s/ \$ G9 A
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' L5 \# e3 Q4 ~
$ l( o% V. @& R5 W$ w- T: O! u$ j( H2 ]7 e2 t
|
|