|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - t6 {) x3 l, |) L/ N7 u/ s
- [code]EDMA sample test application5 C% b/ t6 x+ h, X9 ]
- /*( k0 v2 _6 O! y+ W
- * edma_test.c! v( J; ?* [. c0 N7 a9 e
- *
% K: @, ~ C8 F& j: q _) o" r - * brief EDMA3 Test Application6 J \9 \$ e p- w G9 A: Q* c
- *
3 [2 [2 m q+ L6 S - * This file contains EDMA3 Test code.
( _7 G! j# o$ V& K9 z - *& U' E8 M! V9 ~) Y+ |3 r4 w G+ H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 D& \$ I9 d5 Z0 n% J" w k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- C2 c {- W9 `: Q \
- * TO CHANGE.$ d/ \! g8 }) |% H7 D
- *
' k5 N% @* T3 U# Z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% k8 x! J6 m5 i7 S! t - *7 ~. s% [: a- n9 {7 s
- * This program is free software; you can redistribute it and/or ~+ g h$ T# W" v4 C3 v
- * modify it under the terms of the GNU General Public License as
, n' T! V6 `- c& q) { - * published by the Free Software Foundation version 2.
$ k! e' f; B) ^; g; A$ [* @/ g9 D' C - *
% ?+ Z& e9 v: `$ f& f - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ _0 A& u8 Z4 P% d( B
- * kind, whether express or implied; without even the implied warranty
}, j+ o \; W - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 R- p- ~3 @$ y) a4 A
- * GNU General Public License for more details.( z2 S3 a( I _# f- M
- */
4 ?& N5 P$ W$ n" H
, [) O+ n+ O- Z; j4 h% m- #include <linux/module.h>$ R. N9 U' @3 k b
- #include <linux/init.h>
( q, }. q% X" m$ U - #include <linux/errno.h>5 U# X! ?; U3 T: k$ C$ S7 T9 S7 T
- #include <linux/types.h>
1 F0 [6 z4 @( s& z F" u - #include <linux/interrupt.h>, r! I1 s% h& `8 j
- #include <asm/io.h>6 y" ]6 `& p. h4 m; M; a( l4 q
- #include <linux/moduleparam.h>
/ k+ E; n( z6 F, X. A8 Q - #include <linux/sysctl.h>& |* v' g$ Q, L! y. m# `
- #include <linux/mm.h>: Q0 C! _; K9 ?# q/ C- q7 S
- #include <linux/dma-mapping.h>
- Q$ T; R& U1 R0 @
# w' l0 }6 w" R1 s) r! L- #include <mach/memory.h>/ c2 H) ]* d+ ?1 s- d! [9 ^! O: P
- #include <mach/hardware.h>
6 p6 x/ i# w, }7 C# H8 u4 I - #include <mach/irqs.h>
3 C0 K3 ^* f" ? - #include <asm/hardware/edma.h>
" i5 e" V; q8 H8 c: B, @ - 6 [& s3 R" x4 ^
- #undef EDMA3_DEBUG! e- u( r* W( o5 J5 ~
- /*#define EDMA3_DEBUG*/# e. k* A: L' W/ l- b
- * q( Y. z$ K2 i5 c9 o8 P
- #ifdef EDMA3_DEBUG
+ o- S, {8 P% V) a$ O8 W; z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 k& t5 x! @9 {+ ~: ~7 @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 H* [% ~5 a" V- p- W1 R( l- L/ r2 M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 j0 G- f' a( G4 O, y$ a$ I3 Y
- #else
9 S+ z) U. v q2 H - #define DMA_PRINTK( x... )0 V5 ^2 _( C1 E8 ]. |6 T( f# w
- #define DMA_FN_IN9 F) l1 r" e0 _/ B1 H0 [
- #define DMA_FN_OUT
' D: {2 Z% t y" Z0 W - #endif) i# f3 [5 N6 o! X
- . ^8 J1 K4 i# `* M' B9 u7 i+ ^
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 E: Z n& g9 B; s/ ~0 D0 V - #define STATIC_SHIFT 3
1 N7 ~% Q& e2 b5 u& [" t! v - #define TCINTEN_SHIFT 20- C* M! d- u( p6 B4 d/ _' _. D: z- a
- #define ITCINTEN_SHIFT 21
/ l) E8 q; W) E - #define TCCHEN_SHIFT 222 C# T$ S. o* p3 K( ?5 ~, q
- #define ITCCHEN_SHIFT 23! E- {$ h) O% x. M6 m
- 3 v$ U) o( L3 y# [
- static volatile int irqraised1 = 0;
' O" j# x5 C) [7 F, |4 M1 i - static volatile int irqraised2 = 0;
8 n3 X; T+ d8 s$ s+ Q3 w
7 E6 y3 S( E( R, k- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& B }. Q/ d& A$ P, q* w o; d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 s# ~( O9 L. S
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 H. s- k0 d! o6 b( ?; w( x
- ( Z0 [ t" s/ b |% v& G$ g) M7 g
- dma_addr_t dmaphyssrc1 = 0;
1 ]1 f3 M4 R4 z9 Q- F9 Y - dma_addr_t dmaphyssrc2 = 0;, {4 |/ f- L4 @" Y0 I1 p
- dma_addr_t dmaphysdest1 = 0;
, a5 z& ]1 n! _8 ^, s+ v, ` - dma_addr_t dmaphysdest2 = 0;
. q4 u/ [$ A, ]2 t! o z- c! Y) l - 5 K. F. q- C/ l! q7 A3 v/ c
- char *dmabufsrc1 = NULL;
5 y& ], R9 T) g: O5 T2 q - char *dmabufsrc2 = NULL;- K/ g1 d2 ]+ |# I" y' P
- char *dmabufdest1 = NULL;
7 y- ?. v$ ?/ J! J' p3 f% n, A4 S' v - char *dmabufdest2 = NULL;! z2 |7 [9 z H) i+ ?' S
- 8 x/ j9 T% h) Y5 C1 l1 X0 w! e
- static int acnt = 512;& o3 o( {; E6 |
- static int bcnt = 8;
, E6 S3 d; d& j1 Q5 a# ~ - static int ccnt = 8;
: o0 b; Q2 f4 \7 {" f- q: q" n; R: D - 8 `) j8 ^, n1 O5 L0 I
- module_param(acnt, int, S_IRUGO);
$ {; D; I' k: s7 C - module_param(bcnt, int, S_IRUGO);( U& e+ o% k( `; n# u6 }
- module_param(ccnt, int, S_IRUGO);
复制代码
) R+ K% Q, M1 Q! p6 a
' j( k7 X( x# S% M" u! j 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ [1 h9 L6 |: g3 Z; q4 F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ d( G) z- G6 o+ I8 l 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* J! n2 {) X+ R r# d6 C a- r& @ J/ U' r( I3 h6 n
* K7 ^, O, h, S, V" h* p |
|