|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " P1 d l4 p; @
- [code]EDMA sample test application( \1 |, g1 I; u; E2 h% ?/ D, {
- /*
; n' o% j9 C7 b - * edma_test.c
3 k1 q2 t( o! B k& v- T6 W - *
$ G3 O9 {& I/ n. Y1 E - * brief EDMA3 Test Application; P/ h5 x1 ~# N
- *3 d/ `( B( }' N8 ~1 _' m
- * This file contains EDMA3 Test code.
( |( H# A5 ]$ m9 l: r7 Y - *
) N% ] b, m j! \# Q" I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 o& {6 C m9 U$ F5 U4 T6 @' Y( f
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ g- P3 C: S Y9 a! v" d
- * TO CHANGE.8 P E: S* v n3 k8 N! S
- *9 O* t3 p) T. B8 Y5 \) R% ]9 s- S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 j* H# d h, }( T
- *
+ D. t) e Z- Q7 j) @ - * This program is free software; you can redistribute it and/or0 e- m+ V/ E# |* j& f/ H" S
- * modify it under the terms of the GNU General Public License as
; |. M' S1 H* \) N6 {. s - * published by the Free Software Foundation version 2.
7 W* O2 E% f" q! x. h - *# U; ~) q6 S1 a* x- c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 q! R* L+ |3 Z - * kind, whether express or implied; without even the implied warranty! Q' K+ |3 Q E' `/ Z9 H- _0 @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 ]3 @$ d# e! O4 _' r n - * GNU General Public License for more details.& U* D/ n( s# l5 @* x& y
- */
% C3 C4 l$ f7 V" H6 v+ ]. f5 M
( c6 ~) j; X$ H' _9 p0 G: G- #include <linux/module.h>" b- u: s. ?, i3 S
- #include <linux/init.h>+ @$ ~7 Y0 l9 W+ E, P% s0 m
- #include <linux/errno.h>
& u3 z7 U0 B, i' O0 y7 Z - #include <linux/types.h>. v4 I4 f3 z8 B& j8 V
- #include <linux/interrupt.h>
. L) M6 i, M$ Q9 Z6 V - #include <asm/io.h>- m7 K& V1 j: M5 N$ Z
- #include <linux/moduleparam.h>
) n' j, ^2 L1 _% [# G$ A a# P - #include <linux/sysctl.h>
' \4 O& B* y3 Y' P! D! N. C - #include <linux/mm.h>
* y& N: i5 E" z. W - #include <linux/dma-mapping.h>
! ^3 |) Z% \' n; R
& p: w0 V$ t8 a: Q! j: ~5 W- #include <mach/memory.h>0 @8 p9 d6 e8 a
- #include <mach/hardware.h>, C1 Z3 u: l+ w$ |
- #include <mach/irqs.h>+ g; g) r8 l5 a$ w' D
- #include <asm/hardware/edma.h>
6 D4 p: P @! ^ \& a4 p - 9 s1 H3 a- J3 @5 v- O
- #undef EDMA3_DEBUG
, q; ]7 H+ I/ T4 _5 [* Q5 v - /*#define EDMA3_DEBUG*/! H5 g% Y7 s8 _& a2 }* R% U$ u
- ' t0 e) x1 ]/ B! L
- #ifdef EDMA3_DEBUG$ f, g% F" a' o' ^$ W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& `! N& r: d6 g7 K# V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. Y8 d: n7 n2 g. _% ?( F7 ` - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 n( R+ M! d( J6 j4 a
- #else* n) K/ y5 b7 u3 i# U) S
- #define DMA_PRINTK( x... )# d8 ?9 S9 h; ]: |
- #define DMA_FN_IN" p: r8 ?0 }7 t4 N* |/ P5 G
- #define DMA_FN_OUT
1 X9 X. V) X: U" C - #endif& K. n3 {! `. ]' d& s: q8 i- H
- # e i ` k, b9 X% n+ b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): a; d( l/ {& O7 z
- #define STATIC_SHIFT 3
$ r$ c$ Z3 z: B3 |1 P - #define TCINTEN_SHIFT 20
; V8 v# f/ T# \9 f4 k5 j* A7 j - #define ITCINTEN_SHIFT 21 E$ b! y! K" [
- #define TCCHEN_SHIFT 22& s" O/ G' j/ e0 N+ o4 N
- #define ITCCHEN_SHIFT 23
& p- j$ Z4 k/ b9 r
% \) A7 Y% L9 W* _1 a' j7 F- static volatile int irqraised1 = 0;
" Q p! j O3 J( a% [ - static volatile int irqraised2 = 0;* X" m4 K1 l: D/ }9 b+ H. p
0 E: u$ Z9 K4 o8 i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. p- b* v3 w @. z9 H2 J, O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 n8 ]1 [8 Q. q3 [9 a4 J
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# j) R. [( U0 H% q9 L% Q - + q' A) A5 e" W$ S
- dma_addr_t dmaphyssrc1 = 0;1 o2 `. [# [8 f4 T0 Z' [
- dma_addr_t dmaphyssrc2 = 0;* F) l6 m6 u% f: v* p1 r! ?
- dma_addr_t dmaphysdest1 = 0;; p# N* \% \! v) q; \" V2 m
- dma_addr_t dmaphysdest2 = 0;8 Y1 J' a/ y4 l6 [
+ K! _7 a2 T4 K$ p- char *dmabufsrc1 = NULL;
& E3 \5 ~/ T$ n/ |0 \ - char *dmabufsrc2 = NULL;
. g+ n/ T, C: v/ R - char *dmabufdest1 = NULL;
) C, _6 [( K- R J - char *dmabufdest2 = NULL;$ n6 J1 Y+ Q! j b. ^! ~' Q
- + |( Q; e* Z6 n
- static int acnt = 512;! c0 ]. N; h Y& q7 v A. J
- static int bcnt = 8;- @( L) ]; y( o+ x! I
- static int ccnt = 8;+ W/ e1 j! U' f' Q
- 8 e2 q- c1 }% f+ {* P* k6 g
- module_param(acnt, int, S_IRUGO);
% r5 M+ ?8 c- s - module_param(bcnt, int, S_IRUGO);
& e% Z1 R9 q7 a- I) ^ - module_param(ccnt, int, S_IRUGO);
复制代码 3 m7 V: j) K2 X, a- V, L
& }& l6 B' F4 R1 `! h
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( S- z5 x2 ~% c5 e& Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, m6 S$ k5 S# c6 n) V+ N
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; e* v+ _5 P4 Z
( w6 \* d2 @5 w
: }6 m. H& B0 Q$ e# X
|
|