|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . d% A) f/ h% s% U
- [code]EDMA sample test application
8 E" I; e5 ]9 { - /*
0 {. I- D/ F# l- o - * edma_test.c* r3 Y& ]' R( l, ?5 `. {5 d" O
- *7 ~) F0 H: S2 `4 O% R) E! q
- * brief EDMA3 Test Application
9 Y8 s( z# ?9 G2 E7 w - *' w( Q3 k1 I* c1 {
- * This file contains EDMA3 Test code.
3 v& _' R3 T/ C5 |. o K/ s - *
. v J8 @ x/ P) I# \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) w2 R& D8 e0 K# _# } - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! G( v8 E. h# i6 g/ D* w. E2 A
- * TO CHANGE.
$ k8 x& D5 F! r0 }" g5 p4 `$ U - *4 H2 U% R0 z% r: S a: H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ C/ E3 U- Z$ G7 q8 `9 A - *5 e$ h2 Y: E" ]4 I7 G# \1 T4 ^
- * This program is free software; you can redistribute it and/or
8 y- R$ N1 u/ t - * modify it under the terms of the GNU General Public License as
4 s. w9 I3 t0 a& b - * published by the Free Software Foundation version 2.
* h# i1 k" b% e0 E. P - *
7 s# e7 `" L* g0 n - * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 y8 S8 L! M, O V' U! Z
- * kind, whether express or implied; without even the implied warranty& t8 ]- [$ R7 P) [. g6 E4 y# G4 N
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& I) g7 c' }& a" q% I; D - * GNU General Public License for more details.
' _' v6 O/ J. d% r: Q5 V - */! R$ n5 R( I, P# G! _7 Z! O- s
- 4 D: s$ R' Q! _0 r
- #include <linux/module.h>
3 Z+ ~" D) o. X$ W1 t9 U, W - #include <linux/init.h>8 U5 I* e1 }& `. @5 \( C* m
- #include <linux/errno.h>' Z5 o$ P1 r |' G
- #include <linux/types.h>$ ~+ N8 C4 F1 u! y P4 r% K( Y" E
- #include <linux/interrupt.h>
; Z- k- C" `8 Q( p [$ h, b# q - #include <asm/io.h>1 p/ h4 o Y& w6 n p8 d U ^; r
- #include <linux/moduleparam.h>
* L5 r) f) G. o4 U8 Q# H, M - #include <linux/sysctl.h>
t/ k+ [1 {; n - #include <linux/mm.h>
" m+ V. R$ A, O4 X - #include <linux/dma-mapping.h>
$ }- r5 B a7 g; I1 j
$ F! O: ~, f6 g- #include <mach/memory.h>" x! h4 T# |2 o* F
- #include <mach/hardware.h>
- i/ W) \; N! I4 t. i - #include <mach/irqs.h>
r t9 X- `! `/ F, [4 x" S - #include <asm/hardware/edma.h>4 U6 F% W* s$ H! o
- + @2 h# ?% @; }6 A: B8 N
- #undef EDMA3_DEBUG
/ t; ~8 _, u' H0 @% j2 f5 a - /*#define EDMA3_DEBUG*/
. O. H' S: F9 ~- I. e! w
' p. S0 r( Z: Y% W+ o- #ifdef EDMA3_DEBUG
0 C8 }" e% ^* z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 ?' ?$ C, A. u6 a& Q& `3 C! } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 A: h3 k# l! A; M& f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: b c; ~/ y" N( x- w/ Z - #else4 X, K- g* t7 l" ]' [
- #define DMA_PRINTK( x... )9 R& L; \) G4 u6 W r0 Z' F+ S7 h
- #define DMA_FN_IN- P/ J* p/ p0 J& Y4 o" g9 o
- #define DMA_FN_OUT
; q) k$ I9 C7 {* w& E0 a; D+ ?. M$ I - #endif
6 \' q4 S* D$ C - 7 l/ V. k% J3 Y) K; v+ V* {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* u) A' `0 P: B+ X - #define STATIC_SHIFT 31 F, z2 k5 [9 O
- #define TCINTEN_SHIFT 20
/ z6 J3 E( v9 p0 v9 S* R& ]5 H2 Y - #define ITCINTEN_SHIFT 21$ p; O2 c7 B3 A7 I- J, c
- #define TCCHEN_SHIFT 22
) F% ~8 @. h" `+ n, l - #define ITCCHEN_SHIFT 23% `6 Z$ y: l+ P6 q {, h
- 0 \% W" A/ U h7 o& l$ z- E
- static volatile int irqraised1 = 0;
% ?! ]1 }- f h5 S - static volatile int irqraised2 = 0;7 s' q% R7 i1 {) L* X/ x' |
9 ]7 @1 @7 L2 L' e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
w }3 X7 A/ [7 p+ f8 Q7 T! i! i- Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! ?6 c" g/ R8 p1 E% u' j. g" q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% V' R) @( i6 [$ N) f2 R
* D+ Y1 o; y+ B* L- dma_addr_t dmaphyssrc1 = 0;
- p+ B; v9 W0 P - dma_addr_t dmaphyssrc2 = 0;
/ V; a0 W% M$ D! Z3 y - dma_addr_t dmaphysdest1 = 0;
$ i3 z& a1 L; n6 L# q - dma_addr_t dmaphysdest2 = 0;/ u N* _! d& c& }/ Z
! O; k* M, h5 \4 f0 |& K- char *dmabufsrc1 = NULL;, U7 m3 ^# X3 b/ t5 n
- char *dmabufsrc2 = NULL;
( I/ F! n3 B+ z+ m% v# S - char *dmabufdest1 = NULL;
! y5 W. c1 `7 `; D+ w' C - char *dmabufdest2 = NULL;
! i0 G* A- l' J) X
2 C8 p3 g! [+ }+ }$ h' I: L$ d- static int acnt = 512;
. v0 Q, l# L5 z - static int bcnt = 8;
2 h: F( F: c5 p) Y# b - static int ccnt = 8;
* f& I* C \3 o; ~9 [
H- \1 R5 D5 l0 l( {- module_param(acnt, int, S_IRUGO);8 b9 Q: O; W) u$ B. s0 J
- module_param(bcnt, int, S_IRUGO);3 u0 c+ e; v- P" Z$ [0 \) }; n
- module_param(ccnt, int, S_IRUGO);
复制代码
: a5 R3 `/ m- N/ t* J8 h: P; J8 c: ~ c; s
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 d; X- P! E5 C: [# c% e6 Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 U# {. n" W. z8 @2 h' R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ g& I; N6 u8 k# E& U( O
K" q+ N+ [& t/ q" A# t- E# `
: @( t9 v( g/ P8 L$ W o
|
|