|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - n: \9 p! p3 k7 b! z! B6 k& B
- [code]EDMA sample test application' o* E* W+ Z# Y/ p; W
- /*% l/ ~) B% ?2 c4 f
- * edma_test.c5 ?' m+ H* B: }
- *
! O/ Z3 p" w0 x& U0 c - * brief EDMA3 Test Application/ N2 a( R! J% f0 p6 P" ]; Z6 i) \
- *
$ u8 |# }3 m3 S' m; I - * This file contains EDMA3 Test code.
/ w4 A6 c ~: L - *7 u$ a, o! w- a& W# `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& @1 t/ G9 `5 p" ^; s1 y, b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 |& k1 F& c7 W0 G
- * TO CHANGE.
$ q: U" D. n7 p) Z - *
! y' U. k- y/ Z3 V p. S: O& p7 o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 w( j# d8 M5 y7 S' q
- *3 O6 Z9 G g# C9 O7 I( z
- * This program is free software; you can redistribute it and/or
! `( `8 Q6 v* Q6 t - * modify it under the terms of the GNU General Public License as
8 H4 k% L7 l! c3 j - * published by the Free Software Foundation version 2.
) ^' h2 B d4 k. g - *
3 j4 {2 A) z6 h, m - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* ]" n6 I- ]+ N* s - * kind, whether express or implied; without even the implied warranty. I, n, U y6 z/ k
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 u" J6 H* U& T' ~4 U' C/ w
- * GNU General Public License for more details.
% [0 y5 t, X1 t - */
8 \3 s: L. ?$ t. F8 \. V - , S3 o1 _& M6 G, O" m
- #include <linux/module.h>
* \1 `0 u# b+ c5 t% i5 n* E - #include <linux/init.h>
0 C' c! a5 o6 G, `- v( D - #include <linux/errno.h> }2 o; P* V& I, v/ Y" \5 A
- #include <linux/types.h>
4 z/ V0 N$ [ o: l% W5 {' Y - #include <linux/interrupt.h>
) [: g: R9 P0 v& `8 E% [' y3 O' a - #include <asm/io.h>5 A0 [8 z: i% e( B$ k- Z4 {' r& }
- #include <linux/moduleparam.h>
- o6 J6 I# r! y. Y% @, d; k - #include <linux/sysctl.h>1 F) P3 [7 |: |- q% T1 l! y5 U
- #include <linux/mm.h>% S; q$ I* a6 p. @7 ~
- #include <linux/dma-mapping.h>4 }) _. ` N7 h
- 4 ^8 U7 C1 Z) H& ~6 `7 b2 p
- #include <mach/memory.h>" O4 b- p5 C7 W3 f \
- #include <mach/hardware.h>/ E2 G- X8 K+ ?( Q0 [
- #include <mach/irqs.h>3 m2 ]5 T2 r, Q1 W4 e# i& V
- #include <asm/hardware/edma.h>
) O- c% U+ n6 z) B5 T& o
) |/ A* g7 A2 o4 ] o; Q; K- #undef EDMA3_DEBUG# b; i, V( T8 E
- /*#define EDMA3_DEBUG*/: D. c L$ {; U3 Z9 j3 r& @% L
9 s& S. w0 K" d" E) b7 f9 U1 y; M- #ifdef EDMA3_DEBUG
: h5 [# G9 d3 C3 N8 X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 V& S; @6 g. [3 S- t5 X - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' G2 H, A7 ~7 R2 _: i6 O
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; w6 }" |1 ^% |5 H2 Q: |: v0 \/ C - #else2 A/ q; h9 l+ X1 e+ S
- #define DMA_PRINTK( x... )7 W0 x5 L! M& k. D" M: u
- #define DMA_FN_IN
0 x3 Q. ~) c. M0 |) P' M - #define DMA_FN_OUT
+ P8 n% {7 L( {" X7 B7 v - #endif, t: N5 G& }$ R4 J
- 4 t1 `7 E3 L- P) l
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& W3 R3 Y( m% P3 r - #define STATIC_SHIFT 39 ?5 ~0 {& f/ J" X" E+ ~% L
- #define TCINTEN_SHIFT 20
; b& Z& T/ Y6 o3 z: T - #define ITCINTEN_SHIFT 21
" L; B' K$ Q( q - #define TCCHEN_SHIFT 225 x( A& c0 O, v# j1 K3 t, Q) \ [
- #define ITCCHEN_SHIFT 23" G3 h; L3 y" E4 x+ |
1 b6 C6 ^8 g4 Z# o, g8 L# G& m- static volatile int irqraised1 = 0;2 Z* P6 @0 t; V# U1 i/ h' h5 k& O
- static volatile int irqraised2 = 0;6 K! ?* n. ?. x9 E# X: e/ |
- # A! p* s: T" d
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' M: D& U) O. @- ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- V- Q) p/ V& a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ h$ G" r7 Q; f7 G
- 9 q/ {( N, t5 V v
- dma_addr_t dmaphyssrc1 = 0;, u' s& i# y+ n+ l ]+ N
- dma_addr_t dmaphyssrc2 = 0;
; f+ n' u: z7 I* E. F3 B3 U3 i - dma_addr_t dmaphysdest1 = 0;3 I' P6 x8 @, [
- dma_addr_t dmaphysdest2 = 0;
/ O7 H+ V( E8 u& o0 T6 b' S
" ]! Y( w! D" o( H8 I! t0 ~4 X& I- char *dmabufsrc1 = NULL;* S5 e. ^ y0 M' @% \
- char *dmabufsrc2 = NULL;
0 |' S F* ?) m5 ] - char *dmabufdest1 = NULL;7 c% j: Q* T, @" b: V' n. z$ s
- char *dmabufdest2 = NULL;) d' P4 B: | _* R% G1 ^
- + l$ q" {7 y& d* a4 g9 [1 u
- static int acnt = 512;
4 J) C9 Y p8 C R9 B; P7 X8 [ I - static int bcnt = 8;
- F m2 s: X+ ]5 n& D - static int ccnt = 8;
! B) w! Y5 l9 E& B: g" ?; h5 a
0 V' L5 I" [) Y- w2 `, M- module_param(acnt, int, S_IRUGO);5 J& E& z5 F; B# D: Z
- module_param(bcnt, int, S_IRUGO);! ]2 E4 J1 F8 o; v ]
- module_param(ccnt, int, S_IRUGO);
复制代码
* O. U9 a, b" M7 a' q) @" C4 y' ]2 h: x l8 J7 u8 @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 Y8 a! X; q1 V1 n, s9 L0 Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( k8 ?4 ~5 P/ l# ]6 N( A5 p/ |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" l; F9 j: b3 G- ?! X O
+ I9 v; c, z2 [: D/ ]( Y6 n1 O3 f3 c- Z) S
|
|