|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; j" Y' }2 ]! }! }, @- [code]EDMA sample test application2 B2 L& N8 w- `; p& T
- /*# `& F6 c! s! N; G0 H& I K7 f! e' F
- * edma_test.c
/ p9 A k4 B! e' j - *
F) {8 b& M9 f9 e$ p2 d - * brief EDMA3 Test Application4 _2 j( N# j7 G5 A
- *
$ m: S9 I3 e* ] - * This file contains EDMA3 Test code.
1 F6 x2 o1 S6 U( B - *2 C Q8 u9 o- x7 D- m7 q& Z' n' v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 S/ p' B9 w5 H9 }# @ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& d4 i: C* O: u6 z2 i - * TO CHANGE.
/ z0 h# M) M" {4 `7 v' ?; ] - *! u8 e. l% g2 t' [% j2 o
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ A1 k# ]: \5 {: {" [, v - *
7 \' L# \- h$ v4 Q3 j) @& B/ _ - * This program is free software; you can redistribute it and/or& ~9 c- C/ _: W& z) a% S
- * modify it under the terms of the GNU General Public License as
6 E7 ]) ?- i! R+ d3 y$ n$ U; {& Z - * published by the Free Software Foundation version 2./ Z( E9 L Q8 x
- *
6 S6 L3 V0 m8 _# ?6 O - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 y# ]* |. c5 }; K - * kind, whether express or implied; without even the implied warranty
. S5 w5 s, g+ t1 [ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' b" E4 T- e! E7 G - * GNU General Public License for more details.: I7 \: h) N+ c! w1 Z
- */
8 C! N& j5 R& A$ h! t7 ]3 H7 d
4 p6 Q( J! j- l% [" ]4 P- #include <linux/module.h>
# N0 R, t5 C9 t - #include <linux/init.h>. k3 d L, i1 w+ ?
- #include <linux/errno.h>
' z4 B, K; d/ w6 U, A - #include <linux/types.h>; N% s" x, a/ I9 M3 W
- #include <linux/interrupt.h>; j% t; R) s3 ]9 p% c' }0 {
- #include <asm/io.h>
$ t% N. D" g7 [0 j3 p - #include <linux/moduleparam.h>
/ ^# d7 i3 c/ b5 _ - #include <linux/sysctl.h>3 W- }: x3 P0 [- S- x
- #include <linux/mm.h>. N6 s- R s/ m# a2 y0 B9 ^0 w
- #include <linux/dma-mapping.h>9 Y' }" p6 E* ^; ^
- h0 ~, w# `, N9 U4 n* i$ t' Z$ o* Y
- #include <mach/memory.h>+ g7 ]2 v4 a0 S$ }8 u
- #include <mach/hardware.h>
. \, X+ @9 H4 N4 s - #include <mach/irqs.h>
# x3 F) {6 J) e+ ?( s - #include <asm/hardware/edma.h>
0 n* d0 a, q" h/ @ - 2 @2 p2 v) J, o
- #undef EDMA3_DEBUG; T- w' H/ x/ j' ]6 f8 w+ X7 A* L
- /*#define EDMA3_DEBUG*/% Z/ o+ ]9 w5 b9 x5 o
/ D- [+ p( {3 \3 {& W$ W9 [- #ifdef EDMA3_DEBUG
* `& c7 `5 q$ z+ Q" d0 E - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, [# k/ J6 L! L: } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: I+ E9 X a4 V- Z5 } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# f) I) B8 T/ H6 {0 z! B
- #else
$ b+ z; w* _2 I1 B" m - #define DMA_PRINTK( x... )" G6 Z) \: L0 h5 M& P! v: Q
- #define DMA_FN_IN
5 f* R) K m" y3 k% |8 l - #define DMA_FN_OUT8 R) F7 [' N$ y3 H
- #endif$ ^& D0 R! ?5 p9 V
- " v# ^2 L" d# b7 U, W7 P: Y# {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ G- D" c3 Q ]
- #define STATIC_SHIFT 3
4 K& L0 I8 \% N- {- @0 J7 [7 w4 } Y - #define TCINTEN_SHIFT 20
& y6 z6 @! Y! ^$ H - #define ITCINTEN_SHIFT 21
9 N2 l7 T' b1 \ - #define TCCHEN_SHIFT 22
' d( W4 m) k% A) M: p/ ^ - #define ITCCHEN_SHIFT 23
, q1 q5 I! D; A& B4 s5 A
9 s5 Z$ N8 d% @; |" E9 x! c- static volatile int irqraised1 = 0;' O1 ~1 G/ C4 j( K+ A! J
- static volatile int irqraised2 = 0;
$ _8 f4 Q9 H# e! }, j
1 p' V7 a8 c3 A8 B) a( W; h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 Q/ s$ _; M ]4 {
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: v8 Z* N1 F) m6 C, s7 d/ f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; s" Z" T6 V u; M( K4 B8 A - . I" U0 }7 E1 Y. ]( c( Q, x9 @6 Z0 W- E
- dma_addr_t dmaphyssrc1 = 0;
3 Y7 j, m6 _, W8 i4 v1 u0 ] - dma_addr_t dmaphyssrc2 = 0;
; z# r( Y9 v0 k' }" q8 w - dma_addr_t dmaphysdest1 = 0;
1 _- ]: S* ^( |1 ~4 [ - dma_addr_t dmaphysdest2 = 0;0 E) P7 i8 f: w( T7 A3 w/ F
( |. j* ?; I6 T8 p- G- char *dmabufsrc1 = NULL;
. t5 G/ ?/ S4 D! [ - char *dmabufsrc2 = NULL;
1 p( Y9 e. U( } - char *dmabufdest1 = NULL;
# y9 S2 B9 R. Y O - char *dmabufdest2 = NULL;* ?( F# b: s; {) N
- ' l" q4 D: A: L0 V9 G& W" s
- static int acnt = 512;1 L; s3 Z4 b% {# N6 a/ o0 C: W
- static int bcnt = 8;
0 M2 L, T8 N6 l% @0 { - static int ccnt = 8;& I& C1 F g. Y7 {8 z0 W
& P, F3 ~' L4 Q) }' T- module_param(acnt, int, S_IRUGO);$ E* Z/ e0 ~' A7 W
- module_param(bcnt, int, S_IRUGO);! ?7 ?8 U) @7 | U
- module_param(ccnt, int, S_IRUGO);
复制代码 6 h1 K8 ]3 L$ q; I) r9 L
" `, [2 a2 e/ {* p. D) g6 o
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' o. G0 L5 M# {8 Q" f$ f' u1 Darm-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 k, l" H; ~+ w& d. w" I. D1 h6 n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 r7 R. L* m5 M7 ?8 X
5 }9 w+ \8 O r2 N
7 r+ z4 Y' B1 L* y2 d1 {; V' u
|
|