|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 u- H9 a: @8 _( K- [code]EDMA sample test application
/ K$ G- u9 F. | - /* l* u3 H3 q6 @) E
- * edma_test.c
2 i j; a( M5 w' g. m) Z f5 l - ** e3 O; \( o" ~# J+ E, ~8 G/ ^0 W2 M
- * brief EDMA3 Test Application
7 |' N3 A5 |. |) r! ` - *
8 I2 U. o) W& M) M8 |5 O - * This file contains EDMA3 Test code.
: a5 q" ` ] a - *8 k) g) X) K% j0 ~' v2 P7 H: k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- b' T- {5 }# B! h2 N; v3 `0 L - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ S/ E& F7 b0 e% O
- * TO CHANGE.
+ ~0 w4 T- W% z8 I1 k, r - *4 s" X+ w! t8 ^% k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 C5 E0 ]+ B& j$ a3 ] - *: O7 b7 A8 G' ~5 m- O$ Q
- * This program is free software; you can redistribute it and/or
* d. z: t, r5 `/ s8 v - * modify it under the terms of the GNU General Public License as
; \1 A8 ^4 c) M - * published by the Free Software Foundation version 2.& b2 n2 d: n4 t
- *
' T( o. ~; y& S5 H, l - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& x& Q; D/ C1 w9 l6 I$ W8 W
- * kind, whether express or implied; without even the implied warranty
1 N' c8 E) L$ s" f) E! F, a# V& ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 K3 x$ b1 s% {; r/ D7 R9 t5 i6 u* U
- * GNU General Public License for more details.) b+ U) O/ _0 ~) `
- */8 X- H8 K9 ~1 T7 r
- 4 z0 @* v0 @. c& _4 i' [
- #include <linux/module.h>- ~5 j8 f* `4 c1 z1 P9 T
- #include <linux/init.h>
8 |% j: A2 h6 I* y1 _ - #include <linux/errno.h>) F, y5 C$ u( B+ ?2 Q
- #include <linux/types.h>& A( ~9 x. S1 u( l V5 b; b
- #include <linux/interrupt.h>0 _# p- P$ A' S
- #include <asm/io.h>0 A G" N3 n; Q! I! U. t4 F- b
- #include <linux/moduleparam.h>/ T! y$ `, i7 i! m
- #include <linux/sysctl.h>8 X/ |3 \& a5 g, x/ K
- #include <linux/mm.h>
3 k; w! Y8 M+ c" w - #include <linux/dma-mapping.h>
6 F3 |+ ?. a, ]! E; ]
' d# C# g$ k5 f9 [: M/ r0 K- #include <mach/memory.h>0 S& ]! G6 B# }: j# D i6 I& T8 L
- #include <mach/hardware.h>
0 e+ |- X- N3 f" S& ~ - #include <mach/irqs.h>
* d$ C1 o5 U) L - #include <asm/hardware/edma.h>
. h; ?3 F* m/ l5 G% o4 G2 v3 s
" x9 k% ^, c) u- #undef EDMA3_DEBUG
+ C* ^* a1 K( I7 `, z% Q4 q6 e1 ] - /*#define EDMA3_DEBUG*/
. ^7 s% H) s+ ^
b) ?( ~$ Y8 ` h' a5 r( F- #ifdef EDMA3_DEBUG8 s/ y" F3 P( Y$ @, n) j0 C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" K9 i S+ U9 N- u: l# Z* l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: _. o- ~) I- P( C1 | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# x U8 }: ]/ `% D
- #else
3 K) H0 Z p1 U' K; J - #define DMA_PRINTK( x... )
, Q' P; V5 n7 O4 I" F - #define DMA_FN_IN
) s+ a6 c7 i Q U3 C/ | - #define DMA_FN_OUT. e1 q+ i1 W9 a! L
- #endif
" B" X% s6 }) [9 b0 F9 m - ( a. z" B, {8 l4 a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 z- J5 `1 U2 a- q" Z - #define STATIC_SHIFT 3
( Q' B" |8 g/ p - #define TCINTEN_SHIFT 20
% k3 z9 }" C4 H - #define ITCINTEN_SHIFT 21' y8 L/ B: C! A* h5 y( L
- #define TCCHEN_SHIFT 22! _( d" x9 t" x. i8 {3 C
- #define ITCCHEN_SHIFT 23
# ~8 I: v! @0 m8 }7 L0 a, ]6 D
% I/ V, y# A. J% C7 f8 X2 ^% ]- static volatile int irqraised1 = 0;
8 Z! a, t6 @3 a2 `6 P& s - static volatile int irqraised2 = 0;' ~8 r% U* K/ b" D
- ; P4 H$ B8 g2 Y; @. b2 E y* ]
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: ]9 n0 h1 ]; H2 i) U) q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 x0 L; C. i* V2 c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 Q4 O% b& S) Z* q/ ~
- ( \; Q' l; r. _5 t: r1 A( G9 \+ _5 H( w
- dma_addr_t dmaphyssrc1 = 0;5 r' x& I+ _* D! o3 C0 k9 D
- dma_addr_t dmaphyssrc2 = 0;
* e) b J4 _ R7 j9 H( B+ W5 ]/ |2 Q - dma_addr_t dmaphysdest1 = 0;
1 O& e9 P5 O- y8 H - dma_addr_t dmaphysdest2 = 0; X) \. q* J$ x3 v5 E
- ; e( t7 R- i% o5 i% J# l
- char *dmabufsrc1 = NULL; k3 T5 f7 [9 I
- char *dmabufsrc2 = NULL;
; h" k& h1 M' B. f5 S. k9 U. U - char *dmabufdest1 = NULL;
* L/ B" n* T( \3 Y& D - char *dmabufdest2 = NULL;2 I" F, A' \+ x. \$ ~
- + {0 n( W9 L+ g/ N
- static int acnt = 512;; s; F' n/ `- C# G" I
- static int bcnt = 8;
% \) a4 E7 G; n. w _ - static int ccnt = 8;7 |: G- F. D/ w h& c
6 {+ [% i' U6 Z" U- module_param(acnt, int, S_IRUGO);) f4 p" F9 o$ J: @
- module_param(bcnt, int, S_IRUGO);
+ Z& Z) D# E8 e4 u& O! w - module_param(ccnt, int, S_IRUGO);
复制代码 7 q: c0 I2 s- D, J# @
3 g- o3 T$ C" m4 h. ]. ^. d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 H3 l! b# U0 P3 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 A$ [- X5 }! {; c
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* m- v$ G# }" F& C# y" C( T( p2 i9 G, y( B: u
: O7 r7 j ^) A
|
|