|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, Z: b7 g: D1 t- [code]EDMA sample test application/ e9 _ v, G; F9 T% H4 l
- /*
# K* c' g) E6 l. e, D( w - * edma_test.c U, E& M- c' @; R) Q. d1 y
- *" _8 {, n5 T( f: u3 m4 T
- * brief EDMA3 Test Application5 B0 b& j% n1 q. G
- *+ [5 [. d/ o! ~4 y% k: S/ \( ~
- * This file contains EDMA3 Test code.6 s g1 K. k& {. [% V" s! s$ y: s
- *
- t& A5 M$ B6 |# |, L% ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 m3 E; U% i1 ?" d9 ]1 T! f+ { - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 O, k- b1 C- q9 i0 j# | - * TO CHANGE.) a9 H( M1 e L& \$ q7 G$ C
- *' F7 }3 _ y! v* V8 d4 V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# I9 F/ x6 c2 K( } - *
! A' x$ S; \+ Q% T* `& { - * This program is free software; you can redistribute it and/or8 @9 W0 s A8 m
- * modify it under the terms of the GNU General Public License as
( R- r3 y1 @! ^4 N+ [+ Q - * published by the Free Software Foundation version 2.7 ~* b1 H; W8 I& a4 S* b% @
- *- d+ C' K* i* G! i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 q+ ]( m# _0 D! A# g% G8 z - * kind, whether express or implied; without even the implied warranty# l4 C& B/ e+ {5 f6 C$ \, b
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 O7 _4 z1 x+ \
- * GNU General Public License for more details., `4 `: G6 E( E+ Q1 [$ u) v
- */" N( E: M7 n2 P0 k0 l9 c: w
# J( ^: A. L" X- #include <linux/module.h>" J" E" d$ w: e* O0 @( j+ D2 q
- #include <linux/init.h>
7 p* \5 J: E2 ]8 D% G7 N2 m - #include <linux/errno.h>
6 A. Q* o, H# `& y* F" p' P - #include <linux/types.h>6 H# ^ ^1 n8 N6 K2 B9 ?# M3 A) o
- #include <linux/interrupt.h>
( ?. I/ a, X# q' O$ m' M0 y: { - #include <asm/io.h>; S8 N9 `1 R, S* A% D( O4 J
- #include <linux/moduleparam.h>% a% v' l: _" E: J" `5 y
- #include <linux/sysctl.h>
5 x3 d( H3 X- r7 f6 y7 N3 V3 ~9 { - #include <linux/mm.h>3 J: h; C, R& `! O: r: y& g. q
- #include <linux/dma-mapping.h># F9 E7 M1 m2 ]* K* k% i* p+ c
* p. N" M q1 U# J- #include <mach/memory.h>
8 ~1 b2 w. ~8 D! z( f# r% x5 V1 a - #include <mach/hardware.h>; x6 l4 _- C( j
- #include <mach/irqs.h>
' x3 B5 B( _4 ?3 l0 j8 W - #include <asm/hardware/edma.h>
- l0 ~2 Z3 k% f( w7 l
) {- d& J" f8 J3 h" y- #undef EDMA3_DEBUG9 A. ]7 q7 ^4 G$ @7 \
- /*#define EDMA3_DEBUG*/6 b& I) ? {, Z3 x
- 4 K4 {; w, w- e& Z) M
- #ifdef EDMA3_DEBUG
4 H7 T5 h/ |4 e2 a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) _7 Z+ y5 S8 n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 v7 z! e) b6 m# ]8 i9 b' D
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ R8 [" }3 I2 R - #else C/ x0 \6 k" J1 _7 _& R2 c
- #define DMA_PRINTK( x... )
f) h3 G$ J9 x4 [& y' e - #define DMA_FN_IN3 T5 v7 M% F B; W
- #define DMA_FN_OUT
, {; b6 Y& s [, N1 U' F - #endif9 V7 H, R! k5 ~' R" G/ ^: S/ C* N
) N% [4 G# W, K( `- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- X' a) F6 Y' C
- #define STATIC_SHIFT 37 e( x0 n+ v6 _! W
- #define TCINTEN_SHIFT 203 C( i W% P) b! O r3 l4 c. d
- #define ITCINTEN_SHIFT 218 h8 M3 }$ h% l& F" J' f3 K; @
- #define TCCHEN_SHIFT 22
( e/ W2 p4 g- U9 @. O. ?! S5 r/ Y - #define ITCCHEN_SHIFT 23+ _0 q7 }8 N$ ?( n) C
- 7 C$ m1 ~8 v+ \/ R. S+ p
- static volatile int irqraised1 = 0;
6 k; Y, v; ~* L0 c - static volatile int irqraised2 = 0;& L" {8 _/ X: ^5 d
8 F" a4 {# J) A* C$ P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- O/ G0 k, J% w1 i' Z- B1 y( Z( ]9 B - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
s6 Y7 K! B0 ~" v$ B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 H; W6 j1 ? X- ^2 E9 ] - # [8 ?& V( G/ K" l( j$ t
- dma_addr_t dmaphyssrc1 = 0;
% A7 P6 V O. T0 B2 f7 x' O - dma_addr_t dmaphyssrc2 = 0;) D1 r! H$ x7 g2 ~ _" T) q
- dma_addr_t dmaphysdest1 = 0;
7 N1 I4 N- d2 _7 g( ^; }! u - dma_addr_t dmaphysdest2 = 0;' l7 @8 r6 O) P1 |) k
: G8 n, ]1 n6 m5 O' {0 I: U, x) p- char *dmabufsrc1 = NULL;4 l9 \8 h5 H* ?- R( ^; X) w
- char *dmabufsrc2 = NULL;% ^% l9 M' j! I8 E
- char *dmabufdest1 = NULL;
% `5 h' Q1 f& W4 h$ l; s - char *dmabufdest2 = NULL;. u+ n9 c* B. x* {. B0 C) X
- 4 \3 K6 }# v+ l8 |4 O: q+ y
- static int acnt = 512;
% {! }- R, s3 k# |9 q - static int bcnt = 8;9 V" l E4 S, d: D9 C
- static int ccnt = 8;
+ O1 f" X; l5 U+ p
; l! X5 p- J% G+ w( _7 ?- module_param(acnt, int, S_IRUGO);
3 V! Q- X; _5 x# h1 B, a z- W( u8 m' b - module_param(bcnt, int, S_IRUGO);1 }; V+ }$ x9 }" k3 O- F* v3 t$ G
- module_param(ccnt, int, S_IRUGO);
复制代码 4 G6 C1 a# r2 p# V" b
* Z: A! H/ ^" `' Y. l$ N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 u, |, o& p+ @( r% w' ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ X y3 H9 T7 X4 m/ k. @. W7 a 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 u; L% U+ G+ R& f3 K
( L9 p- J& W/ s( j- h/ e. V. o0 ^( ]
Y' c* D |# D2 }8 u
|
|