|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 R# L- s7 U1 V3 W! }( c/ m/ I
- [code]EDMA sample test application
' s' @9 C: _" w6 L$ a$ s - /*
$ w0 d; _6 Z, |1 s - * edma_test.c
% D$ X F+ r) P& E4 a: I( D* P5 T# o - *4 g0 S' S4 I' H3 q m! k0 u4 l9 s
- * brief EDMA3 Test Application% d$ y: {8 A8 m9 M! q
- *7 p3 ~3 i5 j9 c: S6 O* {; }
- * This file contains EDMA3 Test code.
M' G' M2 T% ~- U- G - *
* C2 `1 j3 V/ r ^% Q# B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: n* z. t/ g( ]7 G. N' o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ [0 b* U0 \! N. Q5 X2 X
- * TO CHANGE.
4 p5 Z+ T; y# h9 H - *
; x6 G _: Z% e% G& G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ V6 u W1 k$ Z% |$ i# Q) x* P( t3 K - ** Y& o5 w% f& G3 p+ z
- * This program is free software; you can redistribute it and/or
' s) o! d1 y8 O/ S - * modify it under the terms of the GNU General Public License as
; q: o+ ~ C) u1 P$ W - * published by the Free Software Foundation version 2.( x, l' e* f! L
- *" H: C# n/ B% N2 |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( k* ~5 l2 o: H1 g# N. \! S* v
- * kind, whether express or implied; without even the implied warranty
% r3 C1 g( ?( h. B( E - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 h: F9 L4 C2 A3 D, S - * GNU General Public License for more details.
4 F5 ]) h7 \ ]# J/ x2 y/ J( e - */
3 @! P; Z- q& S# M2 j% Z; k - , Y2 G& U9 i0 E/ n0 A$ H
- #include <linux/module.h>
- ~( o; t5 g+ C* p. f - #include <linux/init.h>8 L* m- p! E9 b3 |6 w l. P
- #include <linux/errno.h>
' U5 e4 ^8 S# @1 _ - #include <linux/types.h>
6 i6 F* B" J: G - #include <linux/interrupt.h>
% h. h* y; O* W - #include <asm/io.h>
2 d& a& g( E+ a, P! W$ k e - #include <linux/moduleparam.h># Y; M: W9 O& `2 c r; q! F
- #include <linux/sysctl.h>
' J g; x- ?" M- _5 W! F) j/ p3 | - #include <linux/mm.h>& {, X! O0 G! I# f- `
- #include <linux/dma-mapping.h>
9 f# `' I7 j) ]; j) v+ u - 8 O0 u9 j( E- c$ Z9 W" n$ A5 `) Q
- #include <mach/memory.h>
2 a/ {* h; V/ I0 g9 D - #include <mach/hardware.h>
/ Y* I7 F+ s1 h, q0 a - #include <mach/irqs.h>) h+ N; ^( Y4 M$ I# }. D! S! b7 ?
- #include <asm/hardware/edma.h>. u2 y8 y; h! C3 {
) J# n: c. }% C% z8 }: y5 Q! b- U- #undef EDMA3_DEBUG
, u. Y4 N' h/ V2 l' Q5 O - /*#define EDMA3_DEBUG*/
6 a4 Q& M' G2 V0 I* M) { - 8 Z p" _9 |$ ]4 E+ F0 O
- #ifdef EDMA3_DEBUG
& U3 B" `' ?# q; o4 i - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& z4 k: x0 I: _7 j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 ^. P! C3 K6 O4 A4 i
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* u# h$ i3 G( v: {4 t - #else8 E+ C5 c8 B- A+ J1 h& Y+ o8 ^, [
- #define DMA_PRINTK( x... )) }: l% d; | g1 ]: x( C
- #define DMA_FN_IN! V! y E3 c* b$ ^
- #define DMA_FN_OUT) N: p1 m+ S" R# C2 w* `
- #endif
4 M2 \, t1 p* X; r, i - 8 \; L* J. I8 a- b* l$ S7 `$ D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 D7 n2 W1 X# r+ \4 {7 G - #define STATIC_SHIFT 3/ G7 O# |! B& T
- #define TCINTEN_SHIFT 205 H) ] }& Q0 B9 S! l. A2 N4 w
- #define ITCINTEN_SHIFT 21
$ [1 T$ W/ X q8 R B! t! z - #define TCCHEN_SHIFT 22" D0 W$ K' M) a, n& i8 s2 p
- #define ITCCHEN_SHIFT 23
* j; ` O5 `4 k+ x$ ~3 v5 _/ q! A - 0 K; `: Z8 P; ~* c
- static volatile int irqraised1 = 0;
: k0 e. T7 P' m' d8 K3 } - static volatile int irqraised2 = 0;0 [2 W0 m- ~) b6 P7 X+ L% a
7 W! H1 }3 N+ j+ e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: E% z+ W, Q/ z) z9 D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! U1 k! d7 `- Y0 s9 g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# y% @8 u6 B; C: ?. e. m i, U1 L" l
) K% R( F: e6 ~1 @( Q K- dma_addr_t dmaphyssrc1 = 0;0 Y, r. x5 Q, |1 E8 _- T! @
- dma_addr_t dmaphyssrc2 = 0;, A# K) J9 L A# C# ]2 N2 {
- dma_addr_t dmaphysdest1 = 0;
/ R& ?" a6 P, I6 x: R( q( z9 Y - dma_addr_t dmaphysdest2 = 0;
2 Q z" a5 C* m/ R2 X2 _ - . B [4 I y: I* C0 M
- char *dmabufsrc1 = NULL;
; m) ~* }# K) Z6 `3 ] - char *dmabufsrc2 = NULL;
0 `3 [, t5 d6 U H4 j: m( f - char *dmabufdest1 = NULL;
" g; A9 ~3 h; l - char *dmabufdest2 = NULL;
0 _' n' w& x5 ^4 p0 K' w0 L8 d' H
4 B+ f# e% `2 Z8 f7 S7 s- static int acnt = 512;
3 o, x7 x2 _3 S' a S4 H - static int bcnt = 8;
x( T9 T" `9 [3 _/ u/ o4 O6 Y3 n' ~ - static int ccnt = 8;- T$ ?* y4 z9 p" f! a1 y! u9 s7 U
- ( z* y$ c& ~8 T3 |- I1 _; i. O
- module_param(acnt, int, S_IRUGO);! F) C5 B' h" |8 V4 J! c1 q
- module_param(bcnt, int, S_IRUGO);$ v; r: \" a' D# K3 S) L8 `
- module_param(ccnt, int, S_IRUGO);
复制代码 " n8 u# f+ H6 t, i$ W( T& Y
% O7 \" s% m& F% v, S& d" q0 a% E) F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) ?: `7 a6 S. g! Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 J; [5 T6 Q+ ^' g9 E z' H3 p! x7 D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" R( h W2 s+ p0 P( ~* T5 Z& w
8 [# K4 ^1 ~& _2 f+ x9 M" t y |
|