|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
}; `3 [% W* a- V, ^/ ~8 i- [code]EDMA sample test application6 E3 R f* C l) ^- _ q# z+ G
- /*4 v4 Z2 M' r8 P0 l0 ^7 j; Z- R
- * edma_test.c) B% Z2 j1 T* i) ~/ T
- *
* w. k( {3 R, z' \& f/ R$ Y, j; { - * brief EDMA3 Test Application7 ~. v/ I. b* m1 |- {8 j$ @
- *
8 J0 l0 W: l/ f6 F( N& k5 n - * This file contains EDMA3 Test code.& C7 V/ p8 }/ s) Q
- *
$ ~1 Z; l0 B7 V3 | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, M1 E) \) D( {9 C# P) \
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ G0 a; Z, a# A# ^% m. f - * TO CHANGE.
$ j2 W* L2 N% J: p1 A1 ` - *( b" E% T( {3 i- E/ m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 A3 Z( y$ g M0 G2 K8 T! m p - *
. q+ p5 @7 |9 G6 f3 W - * This program is free software; you can redistribute it and/or: D: V2 H/ c: z& U
- * modify it under the terms of the GNU General Public License as( ^, [8 A. G* A' o4 g/ Z: f
- * published by the Free Software Foundation version 2.
G4 ~+ C% Q- i) O/ R+ ~ - *
. Y7 Z+ T6 ~# y7 s% I! D2 @ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any: W8 P) z! R/ N q4 o5 ]
- * kind, whether express or implied; without even the implied warranty3 E/ k2 E% r9 C! q/ X& L' |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 X5 i1 A# O3 a5 s$ T3 r9 S - * GNU General Public License for more details.
6 D& ^6 U) }) Q4 _( F2 f7 T6 e - */
; T Q0 U8 y& D- Z! T - + k2 m* y/ u" a9 x
- #include <linux/module.h>" C$ X4 ~- v9 K: {- `. l" O
- #include <linux/init.h>
# \6 z7 k" s- X1 C2 | - #include <linux/errno.h>
0 u4 x$ v0 y8 R } - #include <linux/types.h>2 a) E8 R3 B4 X6 K6 D( ~7 o
- #include <linux/interrupt.h>- D" A# y2 K7 c, R) o
- #include <asm/io.h>8 n* w* u2 t1 E C9 ?' ?' E
- #include <linux/moduleparam.h>3 G( g6 u& X* e' S: i7 Z6 l: W
- #include <linux/sysctl.h>
# y: T) H! p& x2 I - #include <linux/mm.h>
1 @+ f" g3 F9 r1 j% i1 U+ T - #include <linux/dma-mapping.h>7 i4 w7 @. v3 A
- ! ^; W& t; `4 p7 L, I- J, [+ d& }, [
- #include <mach/memory.h>/ j- h1 t. `3 J+ f/ N& e) B
- #include <mach/hardware.h>
6 Q& r; D7 y1 s& ? - #include <mach/irqs.h>$ G2 b! z1 F$ g% h7 B9 D
- #include <asm/hardware/edma.h>
1 [; k9 M t* m# o; J - 2 G# E1 x! C9 B6 f
- #undef EDMA3_DEBUG
, N5 e" e, q8 b0 d+ m. l - /*#define EDMA3_DEBUG*/
1 N% B% o: o5 H9 N
: Y$ s" V, Q2 _: c# j- #ifdef EDMA3_DEBUG# _3 d! W$ J' I, ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' i$ h- y, v' k0 |+ W - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) a/ z2 w H5 y8 C) J; I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), K9 _+ h7 X( h3 q B" ^
- #else
$ H! r/ b9 k6 y/ { - #define DMA_PRINTK( x... ); v5 D6 n: l" m, p! b0 z+ ?( E; H( L
- #define DMA_FN_IN' K( E6 T( a. z! w: w& Q- e
- #define DMA_FN_OUT* c8 Y' s' g* Y4 y
- #endif
3 V1 W4 O$ Z# v
( I, r9 s' v( K! h; ~- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 E4 }5 b& l1 |9 z" _3 I% @ - #define STATIC_SHIFT 3
/ i/ }/ h% u e4 |% X1 j$ n' [2 _4 Y - #define TCINTEN_SHIFT 20
* [3 l, m' h4 J3 Y9 b. j/ p: t - #define ITCINTEN_SHIFT 21
/ X. p+ n! P' `2 b. J$ M5 h2 Y: A - #define TCCHEN_SHIFT 22
& I9 R- G$ u7 n9 Y - #define ITCCHEN_SHIFT 23! ]' n2 w6 ?; R) o/ V# ^) ^) `+ {
- 3 K' H: X0 {3 A2 o8 b) I
- static volatile int irqraised1 = 0;
# H n# ~5 t4 t, j4 A - static volatile int irqraised2 = 0;
) h; d$ i8 a7 a0 s0 t0 P
5 q! @( z0 X& o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) ~, b7 {, ?' T" m3 B - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 R6 c: o' @, @# y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ n# f0 M, G3 O, S5 u, ]
4 ~* F% x+ V; P* I& n# j+ c- dma_addr_t dmaphyssrc1 = 0;
3 L9 T) D9 Z8 c' ? `4 G p. r - dma_addr_t dmaphyssrc2 = 0;
% C o* U; @1 R) ] - dma_addr_t dmaphysdest1 = 0;
2 U& }- u V0 Y2 X& m8 v4 e - dma_addr_t dmaphysdest2 = 0;" f2 C. O! i( H7 u2 `
K9 P# P% ~- E( I2 b( W- char *dmabufsrc1 = NULL;# F- `& y' n- u- Q9 j/ ^
- char *dmabufsrc2 = NULL;
$ l V1 L) M3 v/ L - char *dmabufdest1 = NULL;
% Y! ?; d$ Y9 Q/ a3 P - char *dmabufdest2 = NULL;' M. I+ i8 t# l6 x" G' B0 y
- & W: k9 _( Z- Z: ]" a
- static int acnt = 512;
8 T2 u, T! S! x- O - static int bcnt = 8;
9 B9 W# \/ x' I+ B, Z: H! V+ z - static int ccnt = 8;1 f' m) a% g3 |5 d+ V' n
1 \: M. R3 w* m4 a- module_param(acnt, int, S_IRUGO);% ^2 s9 a% S$ {' E
- module_param(bcnt, int, S_IRUGO);; W2 d& Y* W* l9 T n: B9 A. D
- module_param(ccnt, int, S_IRUGO);
复制代码
1 P R: x2 K8 s1 Q0 y2 i
/ ]( Q7 h, K/ v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: M! a. P& b. C# ?* F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 A$ C1 v# L! k5 I3 M3 D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 K+ L! L9 w9 ^+ I# u
2 J# g; }( N# V# k. e$ p; H& w! n* j0 q* F$ o q
|
|