|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 G+ w2 s2 J, ~/ Q) i- [code]EDMA sample test application7 j" Z- Y7 I* w/ t" }3 Y1 L
- /*+ u! q G. Z7 n0 {8 w
- * edma_test.c/ m1 s. ?, o& R" \3 C
- *
: }7 `3 C3 x) u0 \ - * brief EDMA3 Test Application3 s5 h5 ^+ Y6 O( Z
- *
7 e& n* C5 D% f4 I* Q - * This file contains EDMA3 Test code.
: \9 I8 I& |: h, w - *+ E5 v ?+ v0 s2 v4 g; n1 O5 W1 L
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: o+ w7 d% I1 k* [% M1 ^, f- p
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 o0 l4 O$ W% g/ b# D4 R% P! O - * TO CHANGE.
) X5 G+ R( g" C. N$ e0 f# v, s - *% }6 `, ^$ e ~9 O* _9 U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 q: z; K' y8 e& a
- *
1 U* @+ K, G y( m/ k) }& @ - * This program is free software; you can redistribute it and/or+ d" c" |2 m+ f7 r4 \/ g0 e8 ?% s
- * modify it under the terms of the GNU General Public License as' n9 {! z$ ^; w5 p4 s
- * published by the Free Software Foundation version 2.2 A: _4 o8 l" @! g0 p5 K9 q- i
- *
. a) _* C( b* }2 q! m - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* w% \* L" `% A9 m+ }8 w - * kind, whether express or implied; without even the implied warranty+ v7 T8 _& C3 [" @. R k1 @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% ^7 Q- H; I. G7 E
- * GNU General Public License for more details.- @/ Y: u% u* j7 U4 k! ~4 C
- */
. v: x& Z& W$ W5 l - / R( ~4 ^& W; Q9 Y
- #include <linux/module.h>$ R7 B8 L( K- J0 M
- #include <linux/init.h>' a6 i. u; H* g; \
- #include <linux/errno.h>
8 @7 w* l% G# Z$ E- y7 c6 [ - #include <linux/types.h>
8 c# [3 Z5 [) |$ O1 w$ O- C) e J - #include <linux/interrupt.h>% T4 p8 [ r+ g6 I
- #include <asm/io.h>
( {8 `5 q% e7 B/ _) P$ k: W/ \ - #include <linux/moduleparam.h>0 `- z0 C( t' u S3 o6 ]/ j
- #include <linux/sysctl.h>$ K, t' v* c) p( k/ n! J
- #include <linux/mm.h>
1 I+ \3 R9 ~4 o8 Y& ~$ `& O9 W- M - #include <linux/dma-mapping.h>
* Y1 X5 e: W% w( D8 J' S7 m3 n8 Q - 6 X1 Z9 r% u0 d& I0 ^
- #include <mach/memory.h>+ ?1 H, d% V8 L) \- M
- #include <mach/hardware.h>
' l$ `* z5 t6 m. k& H8 w+ } - #include <mach/irqs.h>
. T" x9 |, ~& O2 x* `/ A - #include <asm/hardware/edma.h>
; P9 Z. F! \; @9 C/ t- k3 W
, q' l1 L F' c" f9 _. j- #undef EDMA3_DEBUG1 c1 r6 x. s) b( {, l
- /*#define EDMA3_DEBUG*/7 T7 w) u4 k4 F
3 D: e( t$ B+ ?0 |7 K- #ifdef EDMA3_DEBUG
, v! X- p7 Y( L$ @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ q# ~+ F0 s t/ a) W" f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 z8 c6 P, K1 J/ k
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 l$ x2 D( j3 x! U1 X5 n - #else+ A" L# t$ @: H* Q! \
- #define DMA_PRINTK( x... )
8 C$ B: D2 n" Z' @) B. R; U$ G. q - #define DMA_FN_IN4 B$ N" B# H/ q
- #define DMA_FN_OUT
7 k9 V: P* [* x; {: F - #endif4 g7 Q6 G# U! ^ r" w0 F1 @
- - r4 O1 p+ {0 y& \# i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); G, N% @; r2 h! x
- #define STATIC_SHIFT 33 l* Z6 J( B* Y, B
- #define TCINTEN_SHIFT 20. g7 ^7 e8 g* g* h( _$ X8 ~1 u. Q
- #define ITCINTEN_SHIFT 21
' M; i3 y; E0 O$ N4 P4 z - #define TCCHEN_SHIFT 22, S/ a. ?# |0 ~9 Q5 A2 Y
- #define ITCCHEN_SHIFT 23
2 ^! X5 G) Q, V* z' t - ) h6 b/ I3 h9 y% z6 J' j
- static volatile int irqraised1 = 0;7 h7 W/ m; L1 F7 n9 R* _* ^+ A
- static volatile int irqraised2 = 0;
, }. S+ q) K* i - }9 [' f6 a. j2 l4 v' s+ A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); w4 x$ i& S: z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& I! }: i1 i4 d0 R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" k0 i1 h1 t: Z2 P; |% O# h
. z* p. T' K3 J- dma_addr_t dmaphyssrc1 = 0;5 M$ c& l9 j( Z
- dma_addr_t dmaphyssrc2 = 0;+ S! S8 L6 M' j
- dma_addr_t dmaphysdest1 = 0;$ g& q$ ?1 s2 n/ ]5 x& L) ]
- dma_addr_t dmaphysdest2 = 0;6 `3 z3 j. o& d
- K% o. O$ T# J$ f; f1 L: h
- char *dmabufsrc1 = NULL;9 B9 `& e% q- P
- char *dmabufsrc2 = NULL;1 N( a; Y- P7 i1 ]" I1 c
- char *dmabufdest1 = NULL;
( I8 I& R* U" ], |% p) `3 `3 P" ~1 U - char *dmabufdest2 = NULL;) i4 l0 u' h [$ x# P' M5 e
! X% X2 `: L+ p- static int acnt = 512;( _* ]1 \ F4 E3 U! J* ~# |* u
- static int bcnt = 8;/ C" \: L& x2 ^$ }
- static int ccnt = 8;3 V4 L; o# R# f8 m6 w* @
- 3 C; m0 A( | ]5 Y
- module_param(acnt, int, S_IRUGO);
9 o$ H$ v6 N% b% G1 A - module_param(bcnt, int, S_IRUGO);
. C U9 y( _7 e" g$ f6 R - module_param(ccnt, int, S_IRUGO);
复制代码 2 k. j- e* y* h' b- e: q
; m! c! ?" N5 T 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, m& b. _, S# V' Jarm-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' Y- a7 Z; B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 ?" Q. {" z9 v5 \: V
2 f+ I" o0 \) ?" n' Z, T+ S+ L
/ W* Q) x. J2 t9 v* Z7 ]2 e
|
|