|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 t ~- }9 n. I
- [code]EDMA sample test application, y; v8 i3 m& b2 _! p# v
- /*- t% {. Y# ?. M i9 j; D
- * edma_test.c
4 M( A2 D/ K7 L8 n f. a5 L - */ m% b3 M" \) C( }' s% ]- F
- * brief EDMA3 Test Application
3 T3 \+ Q4 P) X - *
0 @2 q( B. Y3 Y3 E) _ - * This file contains EDMA3 Test code." X7 P0 T/ n' z0 |4 g' {5 S
- *
$ A" @) w9 R1 H+ C+ g1 n2 G4 } - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ O9 {& d8 G; z( _2 {- I- ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT i' }( ]6 s6 \4 [- k% ?& L
- * TO CHANGE.
: X- a3 ~5 \# v6 \ - *
' [/ a) {2 ^6 Y2 x6 U# H. K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 s. W, [: F" S, s - *
) d! J* R- e8 W6 ~* \9 N - * This program is free software; you can redistribute it and/or) k0 p. c: d9 W) G' U, h5 N8 W, U
- * modify it under the terms of the GNU General Public License as/ a. N* y, U$ [7 C; y' _ p( \
- * published by the Free Software Foundation version 2.
, P6 g" j& n$ I, m - *7 f3 t, g7 Y3 {$ e
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 s0 J- Y' I# h$ a
- * kind, whether express or implied; without even the implied warranty
1 P! ~! T9 }/ N; w& n& \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 g+ @( d" H5 ?5 y6 X - * GNU General Public License for more details.
3 S/ ` x6 W6 b- K- G7 @* E2 \3 h - */$ h3 t9 y) ]. f' f/ G" n
- ! b& b. ]( \+ I b2 B4 O& b
- #include <linux/module.h>) f( @& I# z0 {5 y) l. r9 v
- #include <linux/init.h>
; J4 Y; B2 @; D" F) B) R& a - #include <linux/errno.h># v! v( m: l" y6 Y5 d) W
- #include <linux/types.h>1 b$ K x2 [" X" A; @, k
- #include <linux/interrupt.h>
" j! Y' f9 }- h" Z6 s$ U0 A - #include <asm/io.h>9 K3 a* n4 m$ Q" c$ b
- #include <linux/moduleparam.h>8 C, y: b& H7 W. H, B1 R- g
- #include <linux/sysctl.h>4 p3 Z: Q7 i8 W9 w
- #include <linux/mm.h>& L4 l$ t/ ?( d* @1 C: z
- #include <linux/dma-mapping.h>
. l0 ?3 h, O7 B6 F4 i( b1 a - ' y# O$ V; x1 [4 i. e8 D3 N( b
- #include <mach/memory.h>
- V1 G& f! }1 X4 ^! g; p6 h - #include <mach/hardware.h>" p2 K7 u- x c4 `; A- Q P
- #include <mach/irqs.h>
$ Q. P! R' b: M, H3 n+ s$ f - #include <asm/hardware/edma.h>
& j- S. q: K7 v( A% R2 h6 e2 h0 J: E
1 x% a! C' n, w5 W% A X- #undef EDMA3_DEBUG
# E9 _/ y; i+ I+ U" ?( U - /*#define EDMA3_DEBUG*/
/ X* b! O( N( n
8 C$ _( u Y! n4 t2 m' e- #ifdef EDMA3_DEBUG
# p4 m+ q" j/ @9 V- s - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 f& t8 Y; K9 l3 E ?
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 N2 D" P, N" a% ^* u; O" f
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( ^8 z- o+ W5 z. m4 ~' o' a - #else$ O1 u+ Q, o) ^. q. J
- #define DMA_PRINTK( x... )2 e& |" x; ~- u* K( P1 l4 O9 i9 [
- #define DMA_FN_IN: w9 _6 N' [" V1 M: _ l
- #define DMA_FN_OUT
6 z" H! H3 B- } o8 F' B3 O0 U - #endif/ M- u/ b5 |. a) h' \
* ?, e2 W5 a9 J5 e9 W3 i) A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# }% K4 w1 p& o% ^ G9 z Y1 r
- #define STATIC_SHIFT 3
& G7 u$ ]1 @* V6 z - #define TCINTEN_SHIFT 20& l) F2 G4 E) W$ w
- #define ITCINTEN_SHIFT 21
$ S4 n# _1 f$ g- s" y - #define TCCHEN_SHIFT 22
1 K& O' a' T3 ^0 B" M a1 L# ~! P - #define ITCCHEN_SHIFT 23
9 Q% H- {9 U3 h& U9 Z" m9 o# D
. S' ^# W' a* j- static volatile int irqraised1 = 0;+ U. }: l' q) A# @4 w
- static volatile int irqraised2 = 0;" G) a! g! I! Q! H/ l% { O, p
$ Q! ^6 j% w+ T1 T6 Z7 A' G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) u. n* o9 X9 C - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, V+ c/ V" B. V) X! ~- h2 i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- c- w9 ^* S6 S. D R: A; b8 O
- % n( p! y4 ^, y2 H
- dma_addr_t dmaphyssrc1 = 0;
3 N0 b2 s6 L- K; u* _+ w$ \! E: A& @ - dma_addr_t dmaphyssrc2 = 0;8 b5 o* ~1 N% }' f
- dma_addr_t dmaphysdest1 = 0;- s$ x/ d' G8 ~4 w8 z
- dma_addr_t dmaphysdest2 = 0;
4 O) |8 o$ W7 f" G0 S1 z3 q& m* r
$ x: B. b& R. M7 o" b; U, }* H- char *dmabufsrc1 = NULL;
2 ?% R, C) V# p' d - char *dmabufsrc2 = NULL;! h; ^+ P" `2 ~& U+ i1 W
- char *dmabufdest1 = NULL;
* x6 V- Q; Q; R% w& x8 M' d+ @ - char *dmabufdest2 = NULL;
: L/ V# b- u/ z& ]/ L; U - % [" U# w3 J: k: u, ] h
- static int acnt = 512;
) Q! S2 j0 f S4 R - static int bcnt = 8;
! R% g3 a; r* _8 I z7 G% A - static int ccnt = 8;
. A- }- K& v! Y: u* _7 t
; Q% I$ [# [* T- module_param(acnt, int, S_IRUGO);
, d, }$ ?/ D" h0 C$ J - module_param(bcnt, int, S_IRUGO);
. B. h& ?: ?& j5 E: f2 e6 b - module_param(ccnt, int, S_IRUGO);
复制代码 7 P+ | J/ Z6 [( s0 V
5 z+ g& w. ]- Z/ K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 U- ?" s" j7 harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. R3 i P0 |+ ~- O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( E5 L/ ~- w h' l
) E2 t+ e" P, _5 F1 y8 k- J1 y0 {' a4 ^7 k- |) D7 e6 p; B* Z
|
|