|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 r. p# B _' b1 E# K1 Y
- [code]EDMA sample test application
* d) K/ F$ x6 p, Q: F - /*! I6 j* I4 R! S$ [5 w7 B' {
- * edma_test.c% s" z4 O j: A
- *. N6 |3 f$ R9 k+ K# }6 h% c, q9 H
- * brief EDMA3 Test Application* ?! m. }5 k; p4 b8 |+ s
- *& W3 A9 D/ n$ x7 K
- * This file contains EDMA3 Test code.0 E1 X7 ~& X$ W) B6 C7 h% F
- *3 Y$ D+ Y1 a" ^8 ]8 e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ Z, ]! L% T& \8 ~& N1 h3 D# M. C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; R4 t2 l5 H. j% n! a u3 j. B
- * TO CHANGE.
1 ~, O( x# w; W) p: E2 K7 s9 Z$ c - *
3 y. z, b6 t* l) J6 L" E9 C- B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ a4 k/ F+ g) A2 k: J- v
- *' b$ q2 }, e5 w* @" F, C% ]
- * This program is free software; you can redistribute it and/or
& N- v' F& c4 T" T. G+ k* z+ b1 E - * modify it under the terms of the GNU General Public License as1 Q( l" m* b. T% c6 J3 E0 l
- * published by the Free Software Foundation version 2.+ A1 w. b# Y; [" {5 G9 R: S7 A
- *
: W; D0 ~" O9 b - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( w% c5 w; E) r6 p
- * kind, whether express or implied; without even the implied warranty' o2 V z( X* Y0 l) v4 R, c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 V3 t1 T( O& ~" G' T ^ - * GNU General Public License for more details.4 a0 |+ f! A- }. T( k, R
- */4 D& p' g* J; E# B+ n
- : a6 q- z; J; j+ Q
- #include <linux/module.h>* ]4 K: r. Z4 x, {" j
- #include <linux/init.h>
k5 R/ U) U$ @8 W: i, T* u - #include <linux/errno.h>
. a0 A0 x. ?/ a - #include <linux/types.h>
H* b7 t9 f, ~4 o1 ?4 r& t7 B; c - #include <linux/interrupt.h>1 S! V- `2 x6 f9 p/ q X
- #include <asm/io.h>3 }! F1 n9 }. E+ E' z6 q; G
- #include <linux/moduleparam.h>2 V# b" q2 P. p4 D2 T
- #include <linux/sysctl.h>& ^% ~: }$ T7 s: O+ Z
- #include <linux/mm.h>
% k; l9 ], d) |) @. V ~+ w' R - #include <linux/dma-mapping.h>
; ?1 F; C$ {0 V* q& y - 3 q" O, {# Q N9 \# N" S% J
- #include <mach/memory.h>6 q1 |+ S0 D- `0 J+ k( O$ Y4 o
- #include <mach/hardware.h>
2 W, Y3 m: ?: h) J# y - #include <mach/irqs.h>
) {6 U6 ^, l2 T+ @ - #include <asm/hardware/edma.h>
, b8 }- X4 t' Q" w o( F; P2 k3 t
/ }" y! F$ c& l1 P" U- #undef EDMA3_DEBUG, r2 p' r- u. W* W) n! }* Y. s
- /*#define EDMA3_DEBUG*/
0 \7 M8 N* _& u2 N7 |; B/ U
6 E/ D8 ?: D& \! ?/ ^1 i- #ifdef EDMA3_DEBUG
% p5 n& M+ m1 n3 o4 `; z2 ~ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, W9 N$ j7 A. t$ K/ l: Q' { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) v! \$ Q9 p5 R, S# g) W5 p- q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 ]% B- ^. E7 i6 |
- #else% E9 D: r) c# w+ w
- #define DMA_PRINTK( x... )
& p2 g8 a0 ^% N9 o7 X. J - #define DMA_FN_IN8 [/ P) Z% N, Y# a
- #define DMA_FN_OUT
( D& k$ a' o1 K9 n7 T$ M: x; b - #endif: B( Q7 w: H0 l7 Q
- 1 _1 z- z. G! o/ A9 A3 D' Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ H. E3 P" }7 |1 P4 x7 \ - #define STATIC_SHIFT 3( i6 \ j2 p9 G
- #define TCINTEN_SHIFT 20
- W$ p& w1 ]: Z8 d+ @ - #define ITCINTEN_SHIFT 210 J7 O6 R3 t2 T% O( e# u1 T& t
- #define TCCHEN_SHIFT 227 E1 o1 ~, ]( H" R' r
- #define ITCCHEN_SHIFT 234 z, \2 ^4 K% H0 R( r
- - \! y# O* [6 [0 s6 r# ?; N$ Z
- static volatile int irqraised1 = 0;
2 n7 q* g2 g7 Z# z, O- }3 b - static volatile int irqraised2 = 0;
2 d8 M5 Z8 ] h7 F- d; _' ~ - & _+ o3 T7 A% X9 V2 S
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( J. e* f* p9 m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! X D/ @# H* y, y$ p3 P - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 ^7 K' u0 _7 s7 g8 c. d - 3 _% I# |& T' x) x! @! {2 _* u
- dma_addr_t dmaphyssrc1 = 0;7 s( f9 H7 f2 z: f* Y: b
- dma_addr_t dmaphyssrc2 = 0;
$ R0 g" w _; j5 g9 j1 | - dma_addr_t dmaphysdest1 = 0;
. V2 m- |* t7 p. u - dma_addr_t dmaphysdest2 = 0;
3 ` a) I' c [* T; L
5 ~6 [$ R9 V# d5 G7 p- char *dmabufsrc1 = NULL;
3 A9 s. K. s- z) _8 u - char *dmabufsrc2 = NULL;: W2 j+ P/ F) \3 `
- char *dmabufdest1 = NULL;
+ o8 [; K$ c8 B - char *dmabufdest2 = NULL;
; }/ w3 N; X' y' M8 a% M
8 I8 Z {/ t. i3 d4 m2 s' ^& G( y- static int acnt = 512;8 S+ B( H5 j" ~
- static int bcnt = 8;% d* b1 t+ v! r8 s
- static int ccnt = 8;
9 `3 f3 B) V i' w7 V+ |
( ]& p( A+ a6 u2 v: J: A- module_param(acnt, int, S_IRUGO);! i0 p: w3 m8 r! J" s( l, ?
- module_param(bcnt, int, S_IRUGO);0 Q, @7 ?9 h6 x1 |+ D, c! T H* {
- module_param(ccnt, int, S_IRUGO);
复制代码 / Q* B4 O" g, k7 E7 \1 L
! o/ @& A8 z4 j8 f) L6 Z0 c/ B
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 a0 L3 @# v: X" q( l earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 H+ e4 ]3 u0 J- U! I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ g/ {4 l/ Z8 h1 E4 \9 h3 J p
/ f! L; p* p% _
0 ]. @5 j2 j( F. i |
|