|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( X- i% X9 B# j5 }( y# y) D8 A
- [code]EDMA sample test application
" Q# ]5 @' t$ S7 w. C - /*" Y2 \. P, w( y0 V7 o0 n9 m/ E5 q6 h* }
- * edma_test.c
& g9 m) k b" y4 v* U - *! {) }6 r, @- ?+ Z/ S
- * brief EDMA3 Test Application3 p) t& _7 _$ d8 B; y! Y+ E
- *
$ y& t. h* g& x- j - * This file contains EDMA3 Test code.
5 D; y* J/ @4 G5 r4 U) H# {8 K - ** U( r, p: r6 Q- o. Z' V4 I' z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& E+ S! R; F/ k% i/ G: Q+ D5 _; ]" y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 m2 v, C( x) ~+ |! t* \ - * TO CHANGE.$ d& l' Q/ i2 l0 \5 e
- *0 \& L: a- g: z* j; F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 F/ o4 n! ?: i% Z) M* Z0 Z+ M - *$ a' M" c. w; s4 {8 } \" z% h5 y
- * This program is free software; you can redistribute it and/or2 F# Y( _& F& b( v8 m$ j" H8 ^9 i
- * modify it under the terms of the GNU General Public License as2 p& @/ o- S8 f4 o m0 J# v
- * published by the Free Software Foundation version 2.
8 X$ X6 L' o6 q: ~8 a( L - *. K' t" v/ r. F9 t2 }/ F, H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# ^. u0 H' g& d; o+ |( a' ~: @( E - * kind, whether express or implied; without even the implied warranty) P S7 J/ V" ~# S2 }
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ i" W/ g6 u( \) h& u. k - * GNU General Public License for more details.
2 Z B; Q' U1 J' c' K, U: r - */
( f& w7 I$ M! w' y - 7 I' @! m& K5 `3 D
- #include <linux/module.h>' F4 l1 z5 j5 F( I Q2 a: F
- #include <linux/init.h>4 h7 X/ e" l3 G' Y: N1 x' @
- #include <linux/errno.h>" W- k& T1 O# `
- #include <linux/types.h>
' c/ ~' H# l) j" ] - #include <linux/interrupt.h>, Q/ M8 x4 z1 G" k: e
- #include <asm/io.h>4 J: C w( R: U4 q, v9 W
- #include <linux/moduleparam.h>3 `9 I4 m. l: Y- u3 v
- #include <linux/sysctl.h>
1 |: l& O1 p8 ]6 { - #include <linux/mm.h> ~$ }8 l5 `# s; S
- #include <linux/dma-mapping.h>
8 B; _7 j* Y. o) v" d - ) m7 a5 ^# n2 H$ F( `, t
- #include <mach/memory.h>4 N% I) Z2 M( t' M9 J- s) C
- #include <mach/hardware.h>
7 d& M$ M, U1 Y' J6 p - #include <mach/irqs.h>
1 ~/ s, u4 ?' ?* g - #include <asm/hardware/edma.h>& T3 T6 `: K5 S8 V: J
1 k" [* Z% F; O" _5 y- #undef EDMA3_DEBUG. A, V+ n E0 e' x
- /*#define EDMA3_DEBUG*/, _. _. G) S, g2 {
- $ j8 H _( H! H! R: {5 r6 F
- #ifdef EDMA3_DEBUG% B- e8 m% I4 [1 R6 X7 l; M2 R) O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. Y4 U2 X' A" X8 D/ E, O2 J- k w - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 z9 `) v6 m3 o( d9 R3 X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 d% H8 W% k( S3 R
- #else
4 y# }3 A" Q1 d8 {3 j5 ]. M% h& p - #define DMA_PRINTK( x... )4 t. Z3 Z# c% G0 S9 J
- #define DMA_FN_IN
; G+ s/ s- c- Y - #define DMA_FN_OUT
1 E2 n+ s; S6 Q9 ^" e/ v2 V1 O! G" x - #endif$ j( P) y5 M- M( e
- * Z4 @* b2 ^+ R; H+ @3 c
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); H$ A% ]5 v1 k
- #define STATIC_SHIFT 3
; E% ^. B6 a; R - #define TCINTEN_SHIFT 20
$ T, h3 c- h, o - #define ITCINTEN_SHIFT 21
# o3 a* k+ k- r: e3 o - #define TCCHEN_SHIFT 22- _" |: L8 Z/ @* h
- #define ITCCHEN_SHIFT 23! M3 ], N% P4 N( ]1 Q3 p
- * U$ g8 j2 c% `7 H
- static volatile int irqraised1 = 0;3 l/ ]- |' e9 O, Q$ ^; I
- static volatile int irqraised2 = 0;
y4 O2 [& G9 `/ N/ I1 _
0 s Z/ O5 e, \2 O- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 \5 H/ F+ k% K2 f) w/ s) q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 A+ A! {6 k3 a6 w X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 i. S, Y; n* t/ o7 Y" K - " Y9 e8 U8 q( m5 K4 I) G
- dma_addr_t dmaphyssrc1 = 0;( T1 o1 O5 Y" J3 G& x$ s: V
- dma_addr_t dmaphyssrc2 = 0;) n$ Y2 W. \ i; R5 @
- dma_addr_t dmaphysdest1 = 0;9 u6 T6 h5 R9 Z3 O% W( N! y
- dma_addr_t dmaphysdest2 = 0;* Y; p0 X5 F; A+ w1 o; V. ]
2 z* I/ z1 z$ T* Z" F- char *dmabufsrc1 = NULL;
0 x- i( l7 A) [. u+ w# m - char *dmabufsrc2 = NULL;3 d1 b9 p! d i& N
- char *dmabufdest1 = NULL;; r, C9 ^$ f7 S
- char *dmabufdest2 = NULL;
) {' y, C' k: ?* f - ; p3 S6 d5 G7 h5 w" l' T' _
- static int acnt = 512;& b- Q5 L/ m4 a' U9 Y& c( R
- static int bcnt = 8;
6 R; R+ G# ?4 b' p - static int ccnt = 8;3 J' N4 W) G- x' j+ N: d$ R: d* ^
- % V. H9 X; g- T6 ~9 H2 ]6 N
- module_param(acnt, int, S_IRUGO);
( M d# z: ~2 \% S - module_param(bcnt, int, S_IRUGO);, O- G: B, _% V2 f( t$ }
- module_param(ccnt, int, S_IRUGO);
复制代码 6 J# y7 F+ @; K3 c% Q+ a$ x/ Q
$ {& I5 w% k1 v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 X$ X8 }% B/ r: m( o! O# farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ T9 ^3 P, Q4 z2 O+ y, o+ C# o 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 [) L5 ~6 W' e, m/ Z
1 U$ u9 R! L- S9 q4 }0 X7 s' G2 I9 b% M2 L0 ^
|
|