|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! Y+ G5 ~8 X U$ A1 I. h. P- [code]EDMA sample test application/ d/ j7 X- [2 i: [% B
- /*
# o5 N/ {- l2 a- }+ m% y+ z+ S - * edma_test.c
2 z* H& `' j6 R% t; r b5 F - *! K0 B6 ]7 n- R3 e2 L* i ?0 P9 v
- * brief EDMA3 Test Application
6 W3 K5 D/ \# n4 A( h4 e$ } - *6 t, g$ w5 r' k5 t
- * This file contains EDMA3 Test code.
7 r2 N+ ]. G0 E, ?% \ - *$ v$ q/ x& X. [0 s( a- `+ H' D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 o7 C% J0 i: {! T# l% q7 B6 h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" c6 Y+ r" `" ]& J6 |( T
- * TO CHANGE.6 x% k+ g/ c# c2 K/ ~: O" y
- *- n5 U$ Q3 [. `% U( s$ U8 K; x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ S0 v( q! [6 C+ k) Y$ p7 g - *
; J. s1 {* U; o$ {$ _9 D' n - * This program is free software; you can redistribute it and/or5 m5 k" C( T8 \2 y
- * modify it under the terms of the GNU General Public License as: a! B s( P4 F9 Q/ x7 @" l
- * published by the Free Software Foundation version 2.
% @) H: }4 P- l- { `# }2 A: U# w - *
! f% c3 r8 R& m! G: y0 w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- C9 s' t0 W. N+ i e3 x: ? - * kind, whether express or implied; without even the implied warranty5 `0 A( z* F% y+ ^. K* w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 {& H" a4 p3 W - * GNU General Public License for more details.
( P' L, D) ~$ k8 s3 R( X# p - */" ]+ l- r5 p2 q) G
- + x" N) c- I* U2 K
- #include <linux/module.h>2 V4 O1 |/ H- B# p6 u/ N
- #include <linux/init.h>' X2 t" }% c5 q% ~5 E" x
- #include <linux/errno.h>
+ k% W9 `6 ]3 h7 @ O - #include <linux/types.h>
+ m: U0 {& G2 M8 {+ `/ g - #include <linux/interrupt.h>
' h9 Q) d$ q$ I7 c - #include <asm/io.h>! Y9 E+ Q% U( @4 L0 q6 J
- #include <linux/moduleparam.h>
% c- i5 `8 \- |+ W - #include <linux/sysctl.h>( x- B& I* S1 Q! R
- #include <linux/mm.h>6 i, Q& K& z0 Z' T9 T. H+ [$ d; c
- #include <linux/dma-mapping.h>
$ f- x3 M" X1 k3 e( b
9 w1 E" ?( E+ x5 U- #include <mach/memory.h>+ k5 a- b+ u+ J: o) y4 U, S# u! s
- #include <mach/hardware.h>
4 E+ s2 ~9 x, K% j" D - #include <mach/irqs.h>* T3 e3 N4 P2 d" q7 \- S
- #include <asm/hardware/edma.h>, k3 Y! R5 n8 a; C
, | j1 K5 {& V* t% K1 @6 [9 q- #undef EDMA3_DEBUG
" C/ b$ L/ J% ~' i - /*#define EDMA3_DEBUG*/
8 J. {3 N4 C2 j6 F; }# T9 A
: p7 \ _* [3 v8 R0 m L. |- #ifdef EDMA3_DEBUG+ Q9 w5 s& J4 p6 h f* p
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 S5 Z& ~5 z3 z8 S
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). j. y& u7 ~/ u9 J) q: C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 k7 S! U' c; J3 l0 p) {4 j
- #else
3 R4 F, F. K) W9 y - #define DMA_PRINTK( x... )5 b9 A8 U( @& n$ E, D9 Z' G' ^
- #define DMA_FN_IN
" e; p, N0 B) h$ B2 l0 a - #define DMA_FN_OUT6 ~& n' n5 Q! z# r
- #endif
' y& j+ l6 E) [' x' U" b - , V4 c) h2 w0 s, [" e" c% Z: b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ a' _) s- p8 [% p0 j2 E5 h9 j Z - #define STATIC_SHIFT 3# C$ u! ^/ ^3 H( H
- #define TCINTEN_SHIFT 20) o/ v R4 q5 z" K/ M' J; p' P5 Q2 d7 x2 l
- #define ITCINTEN_SHIFT 21
) s6 m- p+ V! F2 L# j8 F5 v4 d - #define TCCHEN_SHIFT 227 Q o$ \( O. @+ \" W7 o
- #define ITCCHEN_SHIFT 230 W2 ~7 P; e, T% Z, W
- 3 H3 S+ E, F$ L, b
- static volatile int irqraised1 = 0;
6 o4 S1 y) B( c" y - static volatile int irqraised2 = 0;3 Q% [) ^% s$ F) N' n; x/ k
7 w; E1 b9 k7 g& E$ j: o+ I/ Q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& P& U: u7 C J+ K9 L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 M2 W* J( F; @5 ^# Q5 a8 P - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 p X% {1 ]' d% F
$ x0 v0 ^! r# E- dma_addr_t dmaphyssrc1 = 0;5 R! j% _$ N) A* G7 J2 N9 d. Y+ a, A: k
- dma_addr_t dmaphyssrc2 = 0;
) O4 K2 c6 C( L - dma_addr_t dmaphysdest1 = 0;1 M+ _) S! P) ?. }& G* Q' K
- dma_addr_t dmaphysdest2 = 0;
. A; }8 {, k$ o" Q. G. F
& N4 H/ x7 H# E2 Q( Y# X- char *dmabufsrc1 = NULL;! @6 P- p6 R9 D& Y$ l- t9 n& a! b2 w5 B
- char *dmabufsrc2 = NULL;. j3 `( }9 ?# g- J' ]" Z- `0 t4 W" k# l
- char *dmabufdest1 = NULL;
. N' @$ ^) G& b& S - char *dmabufdest2 = NULL;4 B: |" ]/ u. J* s. A- ^4 a& S% I
- 0 K0 \) B% {; X& W: p
- static int acnt = 512;$ w: \& T/ [( E, D, ?
- static int bcnt = 8;
+ j: l0 i6 ?- t - static int ccnt = 8;
" z+ z6 c& E S1 I5 _. j - - n; l/ j! d0 {, D4 n* ^. k
- module_param(acnt, int, S_IRUGO);
" y$ }2 }; F/ M h8 ]: R# T3 Z - module_param(bcnt, int, S_IRUGO);
7 A8 P/ V V! O9 j - module_param(ccnt, int, S_IRUGO);
复制代码 . Q' \, X U/ [1 u. c
) C% R) ^& D! C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, {" F$ C L; c7 k2 @ F. l# Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& T' Z! l( K, o6 q: D" E' Y- G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 I% X) g$ Z/ r' |/ z0 U% m( X
, _% f. ~- a, u
% r0 a. W5 Y1 T* V- C |
|