|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! [% ?/ S% L" ~* v& o- [code]EDMA sample test application; Z+ ]7 _" o1 _1 z/ V$ {: j( o
- /*0 d0 }$ g+ P8 a# P$ c7 @
- * edma_test.c. `& }6 z7 C2 D
- *
+ q3 _* I: E5 m) A7 e% l% G9 V - * brief EDMA3 Test Application |+ X$ M; L3 h
- *
4 ]2 d" e; Z7 K1 l; P; J1 a, F% | - * This file contains EDMA3 Test code.8 N8 a- D8 @0 V" q& e
- *
) O& U0 c7 y& E8 |# O4 o7 @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ Y8 _4 [! |' M! C7 J
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 t2 q/ g. o# k* X - * TO CHANGE.
3 Z* `4 {5 I7 V - *
# R: E0 G: [( g4 N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ E3 j4 k; ?5 U
- *
# `2 g, W( b5 G5 L+ ? - * This program is free software; you can redistribute it and/or
* z& {( C# y) ]) ^- E9 A - * modify it under the terms of the GNU General Public License as
1 d; P- t5 ]) D; X6 m9 }& b - * published by the Free Software Foundation version 2./ c' k0 R) S* }3 t. B i
- *
9 z* K* c4 Y- Z; w: l4 p - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) Z( m* z7 ]1 _' F5 y5 b1 \6 I - * kind, whether express or implied; without even the implied warranty
1 g1 M+ C3 B7 E, M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 q# {' X! ?# l+ y - * GNU General Public License for more details.; e) U! J! ~( n0 p9 O( B8 O
- */% k6 o% D, N( `! l
- 5 l1 u! U8 e' |0 L- k; e& ?' X3 w
- #include <linux/module.h>8 h& L0 O; i( y
- #include <linux/init.h>6 E# a$ G% l/ R' F
- #include <linux/errno.h>
+ e8 ?! ]0 Z4 ~* U& Z1 F" Y" @ - #include <linux/types.h>
5 S+ N+ F# w& D1 I- x' X$ r& O - #include <linux/interrupt.h> i" r4 @$ i- F8 ^9 q1 S6 W
- #include <asm/io.h>9 K2 u6 Y1 U. c: O3 ^ @
- #include <linux/moduleparam.h>
7 Q* @: ? q2 v - #include <linux/sysctl.h>
# s' w4 ?; P- X$ k% ]# G5 N4 T( Y - #include <linux/mm.h>
! X+ l& f* G2 U) Y) z9 _ - #include <linux/dma-mapping.h>
4 J- q( {8 D- |
8 s. C; {# I0 K5 P- #include <mach/memory.h>/ ?1 h* b% i: a# X9 o: H
- #include <mach/hardware.h>7 {9 e9 x& U0 }
- #include <mach/irqs.h>
~ K9 ^+ w- C0 s7 D - #include <asm/hardware/edma.h>* b5 F6 c0 M I7 a* ~% g
- ! P6 K7 e( J* k' f; ]) U" f
- #undef EDMA3_DEBUG9 P* R- F8 \; p
- /*#define EDMA3_DEBUG*/
9 [1 C# J4 {2 y& ~5 s - f7 d6 ~# D9 _4 ^* F
- #ifdef EDMA3_DEBUG- ^4 m, \- G$ b; D6 H8 m- C4 [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' H2 \& p; y" c9 P5 {" l; r# Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 }" u2 z% Y; F. _) T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 i% U0 I5 ?8 }6 n1 l" D2 ~" f - #else4 P# U: i# o+ ^$ w: K5 |5 D/ X
- #define DMA_PRINTK( x... ): y0 W7 [* r$ W# E9 `0 ~
- #define DMA_FN_IN2 W* E& K1 H, g3 ?4 _6 i: I" `
- #define DMA_FN_OUT+ r- `* a( x) c
- #endif5 U7 \+ n# c4 \' o+ W8 e6 S* {
" {; ^/ v# L. G; M- #define MAX_DMA_TRANSFER_IN_BYTES (32768); V6 W0 }) ]: [: a; w# u& S$ ]
- #define STATIC_SHIFT 3
$ h' p3 z/ G5 j7 T* r3 i1 t6 s - #define TCINTEN_SHIFT 20
( c/ d& P {- ^9 A! M6 y# h - #define ITCINTEN_SHIFT 21* _* I1 C! P6 E( v/ i
- #define TCCHEN_SHIFT 22
- E+ t* [$ l, H/ p6 S - #define ITCCHEN_SHIFT 23* R; N- P, O$ J# u
- 9 ~0 Z6 z; P4 R6 V) g9 p
- static volatile int irqraised1 = 0;
2 K' x! t, r! n! d4 ?' X2 f - static volatile int irqraised2 = 0;
# A1 z, i8 h2 e, K
. R9 B" I! d" O! Y8 w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' U- H' b$ Z! \8 q) Z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. b% S# x3 {' T; C; G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! z+ b# C3 R" H c! Z2 h
+ r, U2 W+ I+ M1 d1 T- dma_addr_t dmaphyssrc1 = 0;
7 a4 a( q. o. Y5 E7 c( L C0 m4 t3 @ - dma_addr_t dmaphyssrc2 = 0;) z, m! ` q0 W2 _# Z' |+ R
- dma_addr_t dmaphysdest1 = 0;
# p, \! T" k. U" N - dma_addr_t dmaphysdest2 = 0;
/ X j# D+ u/ Y+ L% ? - 6 B# `# }; b8 [0 |
- char *dmabufsrc1 = NULL;
# V( p, L& @( U% u - char *dmabufsrc2 = NULL;
# b' {2 c! b0 ?' g+ }( Z- t& [ - char *dmabufdest1 = NULL;, [$ w" ?) ^! X: b& ~8 N
- char *dmabufdest2 = NULL;
) U6 x' H& ~8 H - $ h/ r6 K7 o6 g8 k ]: ^; x) L
- static int acnt = 512;
" x$ A' q- Z0 N: B+ I3 N; F7 T" y0 F - static int bcnt = 8; ~$ ?7 k E* h; j. i
- static int ccnt = 8;4 z8 b' o, ^, g: v
- 5 |& \6 }" L( q. h; z/ w# P
- module_param(acnt, int, S_IRUGO);( {' K9 d: U z# A7 T# S2 P
- module_param(bcnt, int, S_IRUGO);
7 G' }8 ?9 K2 K: m) [# ^# e" e - module_param(ccnt, int, S_IRUGO);
复制代码 & [4 G5 Y [. g0 J u. v! s& ]
. n! Q+ s/ k4 }+ q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 `( [# W2 [+ u k3 o5 B- h* }( L! 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' b0 ^& O- \; t( N7 q3 U! [ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 \+ {/ w& S% }& j* i4 y2 P. a" n& I K; M# h- |; y
3 t" c' Y3 S8 C
|
|