|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* w9 w1 P2 `$ f. u5 Z( B- [code]EDMA sample test application$ m5 \9 R. i/ d1 M2 S# I* f
- /*$ F9 \/ c1 z7 q7 V" v b- r, k
- * edma_test.c4 V$ p+ k; J4 E9 z. G
- *
/ M2 }$ C0 f. m! g$ Z u - * brief EDMA3 Test Application
& U2 \# F, f+ z9 X D" H, ` - *
3 m5 e/ Z* Y. q; O' l - * This file contains EDMA3 Test code.
, o, B. ^2 ^! ]) j - *! W- I# j% W0 ~: I5 M6 B5 ?
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 S: L0 h6 A( Z% B5 H" V: W1 P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' I2 V- ]$ A, z, x# x7 m/ t
- * TO CHANGE.2 c6 h8 ]8 |% }2 \
- *0 i% m0 T4 }1 C# I! T6 k; V; B! Q2 B
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% v2 a% a8 P% L3 ~4 g - *
# o" h7 r6 x& J& M4 D4 _) C9 J% N - * This program is free software; you can redistribute it and/or
9 a' o' z# }; a) M" U5 u- B - * modify it under the terms of the GNU General Public License as+ e0 w, M5 r z7 K1 A6 B
- * published by the Free Software Foundation version 2.8 Q3 P `& O3 g8 {( d1 U8 K$ l9 d
- *
9 G1 |2 x7 f' @0 O+ S! }6 ?$ ^, T - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% V% c: r R) Y0 L' @ - * kind, whether express or implied; without even the implied warranty
) D9 i. Z a1 Z2 a$ R9 W+ L. { - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. _8 a* n1 d0 d% W: o
- * GNU General Public License for more details.6 T$ m6 V) c y+ t2 B
- */
; F6 L$ h9 F+ N; T
7 A0 R; P$ N9 Q( j- #include <linux/module.h>
8 T7 ^9 \4 X, o8 I - #include <linux/init.h>
6 q6 z- Q6 ?& _4 g1 k9 T; k( O - #include <linux/errno.h>8 K9 a. R+ j' `: V) ]; c! \/ y
- #include <linux/types.h>% {9 \- p& l7 m; [- j/ }9 b
- #include <linux/interrupt.h>
$ e7 C# |% D' e! T, ]5 l5 ` - #include <asm/io.h>1 o- c- N/ ?9 m3 M0 h
- #include <linux/moduleparam.h>
! f7 ~) i( E1 a+ m/ h - #include <linux/sysctl.h>2 ~' x5 u" J, Z8 d. Q9 B' @% w0 E
- #include <linux/mm.h>& H. J0 v' b+ G1 y- t% E! b
- #include <linux/dma-mapping.h>3 m S# T' l2 w& {
- 2 q# U4 f3 U5 t6 g: _' L& }) f. J: q
- #include <mach/memory.h>
4 F S8 o: P3 g$ i9 B5 \ - #include <mach/hardware.h>5 V8 `5 q" R( e! Q
- #include <mach/irqs.h>/ ?$ _9 t1 M! R/ O- _6 ?
- #include <asm/hardware/edma.h>
% O! A* @: q/ Y, H% v
! r' ^- h* O0 f% C& z- #undef EDMA3_DEBUG9 c+ I0 s9 i" j) U) ^$ H5 W& I
- /*#define EDMA3_DEBUG*/
/ b- @, {* [* z% T/ w
( _2 Z0 R, `- N6 r/ g- #ifdef EDMA3_DEBUG3 d z. E" J& z8 L5 ]4 y0 e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: Q! [, o3 D+ p4 P7 } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 y+ f5 E5 _' C3 r
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* P& j% m) _1 Y$ y2 L - #else
) y6 x& I! e' i) o" N O - #define DMA_PRINTK( x... )) V4 ^7 A0 N: r; ^. T2 q' H
- #define DMA_FN_IN1 n4 C3 H: a- r; ~: Q5 F$ k1 M
- #define DMA_FN_OUT2 A5 O n* b9 Y/ w* `4 \
- #endif% z7 R: T# y. r3 }! d
- ; l- t1 d1 K/ [' h6 M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): B5 {% B/ A7 n: Y5 ]) i
- #define STATIC_SHIFT 3; y1 O3 ?1 q! d0 E' M
- #define TCINTEN_SHIFT 20' F# p& Z$ B( K* `+ V9 H
- #define ITCINTEN_SHIFT 216 i6 p3 M' E: g7 g0 E
- #define TCCHEN_SHIFT 22
" ?% n* ~5 T$ e - #define ITCCHEN_SHIFT 23
0 g+ _# K+ }8 V0 X* j
% g4 U- L& K; O1 ^+ l- static volatile int irqraised1 = 0;5 Q& |+ E8 C# _# W" \) x
- static volatile int irqraised2 = 0;6 r2 x0 M2 w. o# ]0 l. {
- % U7 |- B' A' A7 c* D/ H
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 k0 s9 |: Z4 C+ c: j; p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' }5 E! S. i5 K4 y- S4 M# I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* J* j( W- R9 \/ E" Z& X - ' N; s, V# @9 _+ K* b* N
- dma_addr_t dmaphyssrc1 = 0;0 q0 r! W, }) C3 M$ q- T5 ?
- dma_addr_t dmaphyssrc2 = 0;) S3 c1 {( U2 |& N$ l: C
- dma_addr_t dmaphysdest1 = 0;
+ ~# Z) j1 |$ v% F - dma_addr_t dmaphysdest2 = 0;
' w) c! j/ W. Q6 z6 D0 r2 _
( y3 [7 A, j; r) q% o- S+ H- char *dmabufsrc1 = NULL;) i7 I- Y. V* ^0 @9 q
- char *dmabufsrc2 = NULL;" ]+ W* Y( O) ^' }7 w6 x' t! a
- char *dmabufdest1 = NULL;
6 R8 n4 l9 x. l" q - char *dmabufdest2 = NULL;: c. _" h4 g k
* o4 n A+ n: W% j/ ~& E% B& \- static int acnt = 512;
j3 |) D) h" i3 N z6 V7 u - static int bcnt = 8;
9 n+ b8 I* i8 @" m1 ? - static int ccnt = 8;
& n# O) | w, J3 q; r3 ? - ' }7 ]$ m9 ~# L5 ^2 O! M
- module_param(acnt, int, S_IRUGO);
' Y8 M9 K; O1 | - module_param(bcnt, int, S_IRUGO);
; s. K' C6 k! m5 T - module_param(ccnt, int, S_IRUGO);
复制代码 6 c3 m3 ^/ N$ h3 |/ n! R( z; O
/ ] K( z% ]* ?9 V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 G. Z) ^% D& ]+ \* D$ W3 ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- o5 @7 R8 E8 z$ z4 v4 ?# c4 q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 t/ r5 h" q" v# K3 x' @" M" }1 n6 `7 h/ o u- y: n3 N7 z6 S& p
+ j9 C8 p$ T1 t5 Z) P
|
|