|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* b! P4 Y; I) U4 J$ i7 W3 R; b- [code]EDMA sample test application
1 N8 x8 ~1 v" f. C - /*
, N* Z1 V7 `4 Z% ^2 I# {0 ] - * edma_test.c% X2 i- x- P% {# E7 C1 D
- *$ K' S: y3 @ Q. a# Y
- * brief EDMA3 Test Application& C: R3 `" u- S7 R! W
- *% V: _9 {+ r1 |5 F2 z
- * This file contains EDMA3 Test code.
/ N Q' I% ]4 E, S5 A - *& u! i- Z: E" r3 g7 E4 F
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 i: O7 Z% V6 ~, f$ A, W, }- C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 K7 G, L% x/ e* L& ^7 g
- * TO CHANGE.
5 D7 ]( S' `8 w) l. x K( C - *6 A0 T1 [" {% j6 C
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 P1 [+ A* a! R# s' O0 d - *5 y; X8 f7 v D2 t# O1 E
- * This program is free software; you can redistribute it and/or- M1 O O. a: D$ A
- * modify it under the terms of the GNU General Public License as
; {; g) c+ u4 i - * published by the Free Software Foundation version 2.# F! y6 ?5 l. x3 P" y( T+ T
- *5 f4 r% ^0 G. o+ e
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. v6 k+ Y8 F/ q% z P
- * kind, whether express or implied; without even the implied warranty
+ p6 s7 ] }( H3 S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 K8 l& u% b9 q8 U0 g- R C$ h; T+ i
- * GNU General Public License for more details.
- o+ w( S: \: r! x7 f - */% _$ c, ^2 X3 M |' G% H0 q
- 7 @! U+ }! S, O# X
- #include <linux/module.h>
) d0 e3 c7 B; ~ - #include <linux/init.h>
" W" {% v* b9 x' M" t+ { - #include <linux/errno.h>% S/ V+ [6 H% B G. C' x# a7 I
- #include <linux/types.h>
6 t5 z! H9 @& }7 d% | - #include <linux/interrupt.h>3 u* K% v* K, f- H" q) }4 a
- #include <asm/io.h>1 Q$ \+ ?0 c2 B' Q% X3 A
- #include <linux/moduleparam.h>! h$ P/ }) r# u6 [
- #include <linux/sysctl.h>+ }1 g+ W! H U; B
- #include <linux/mm.h>6 }8 f0 I( U3 P: \' R
- #include <linux/dma-mapping.h>
4 ^" o/ h% c0 e: c0 l* g) f
7 u0 f7 o0 n( L% F, L+ m, t- #include <mach/memory.h>7 r2 C( E) y e) n
- #include <mach/hardware.h>
, L( k9 @: H8 n/ ~8 j: D$ { - #include <mach/irqs.h>7 k0 K, |" I8 c, l
- #include <asm/hardware/edma.h>: E3 A0 B$ E# y8 E. C7 \
- , @& r! \1 q$ N# o
- #undef EDMA3_DEBUG6 P2 ?( @1 Q* w% e
- /*#define EDMA3_DEBUG*/
2 t! n5 \" ]9 j5 N* I N$ s
: ~4 U0 O, N2 F3 ]; k k2 N- #ifdef EDMA3_DEBUG
7 ?+ t2 \8 T# Z [7 G - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" O' c2 R- X. F8 Z1 Y; a- q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ _) S$ R2 V$ Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 ^; \# m7 N; z - #else7 W; N- j4 g3 y g
- #define DMA_PRINTK( x... )
. i- C' B9 j1 Z: ~ - #define DMA_FN_IN
( \- b6 P2 @. {* F2 q, C8 ^5 F - #define DMA_FN_OUT7 ~# I" B. H9 B0 Q
- #endif# _- N/ B t2 E# S. E
- * H# C. Y; D# ~" d8 O8 U
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. R3 p9 d& t- k7 e& H1 | - #define STATIC_SHIFT 3
2 l1 ?5 P" D! C! e5 S - #define TCINTEN_SHIFT 202 d2 f: [: q' h6 `& y6 \
- #define ITCINTEN_SHIFT 21
8 c. f! N' f5 i* ~ - #define TCCHEN_SHIFT 22
0 E8 ]' o/ @' b3 C a+ u6 L& Z6 @ - #define ITCCHEN_SHIFT 23
+ L8 K3 Q j, e5 s& Q$ [2 {! }
; K: U4 P& A h7 I- static volatile int irqraised1 = 0;9 v) M6 m1 W) q* Q9 `: c( j. @5 d
- static volatile int irqraised2 = 0;
6 q0 [- F4 \4 z6 H$ z - + H8 x" V) h( F" x5 C2 ^
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 H$ B* R7 s. u) l) t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( I, O0 L* ~6 A/ ~0 b) x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 y1 b! K8 P' }1 x6 ~) m/ i - . N3 ^: V: w; ^/ F6 p
- dma_addr_t dmaphyssrc1 = 0;
7 m' a6 G0 V: `0 N) c- I( z - dma_addr_t dmaphyssrc2 = 0;
& W) F \8 K" c, k0 b! o/ f2 X - dma_addr_t dmaphysdest1 = 0;
) X4 _- v' p* a - dma_addr_t dmaphysdest2 = 0;
8 c' H! C9 r u* }7 b: i6 h) @ - ( p0 j! s# J- J6 h6 v- V( n. g! ]* q
- char *dmabufsrc1 = NULL;$ h6 I: _. Z7 |" ?# ]+ @: M+ s
- char *dmabufsrc2 = NULL;5 f/ \: p- o: ]( C6 S
- char *dmabufdest1 = NULL;- v/ E- b$ D8 M' J
- char *dmabufdest2 = NULL;
7 S+ U. ^ R, J9 l, S
- M7 D9 k5 w- C- static int acnt = 512;
; e( z: G. u3 V$ W9 z- c0 l6 R - static int bcnt = 8;: R6 X+ [' W+ w* }) z& b% v
- static int ccnt = 8;2 s3 G& s- I0 K4 W- b4 @/ q# l
- 5 Z. a% h0 r9 n
- module_param(acnt, int, S_IRUGO);
. q9 s: U, \, _5 j - module_param(bcnt, int, S_IRUGO);& \3 [/ v! Q0 u- K* S7 \
- module_param(ccnt, int, S_IRUGO);
复制代码
! ^( t0 p% f2 `4 t) k$ w. N
) w3 s% x6 @2 X1 p8 i& |6 b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! U! L ]0 b3 N+ g- M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 C9 @4 l1 J. Y! b1 u* P
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 i6 E: A( T: ?! @( H2 p" H
4 J1 [+ m+ W; y0 H! b& |2 c& k/ c+ f9 v
# H: b5 e# }' f6 {. e |
|