|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * o9 T8 j2 k6 l0 b9 \2 V
- [code]EDMA sample test application( }% X' S% a5 {) g
- /*# M3 o" u; b+ z
- * edma_test.c% j) w5 e2 l" o- C" j }$ R7 s
- *
" t/ j' o! b3 n& J$ ^. p& ` - * brief EDMA3 Test Application
/ _ k" |# w4 @( l - *
9 W$ u9 E! [& s' B) f9 _ - * This file contains EDMA3 Test code.4 L4 x9 n; N3 o) b" H
- *) \4 P% Z w# [, ?, a* W
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) @( W0 d, y' J$ Z3 ]! m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 U- {0 i4 M. d3 J5 P - * TO CHANGE.& g$ D8 c% G1 W+ @
- *: _4 T/ X) c% {$ G7 M1 |0 O1 U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 y! U3 B. Y0 X - *5 V( d6 t+ g! q5 k. x
- * This program is free software; you can redistribute it and/or! |) K0 V" k; u% W e
- * modify it under the terms of the GNU General Public License as
( V$ T. H `% t9 m - * published by the Free Software Foundation version 2.
7 ^+ ]! j( A- E - *
* y' l. m8 F( K4 N9 O" | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 t- L1 {& ~- x9 ?& \5 V - * kind, whether express or implied; without even the implied warranty
" r4 Z+ J0 {8 x: { - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) \8 b6 i( n: M9 q' e3 M - * GNU General Public License for more details.- d& N) g# b" ]' i0 M; |
- */6 t6 H7 y! @+ M4 r. v
/ `% H. C# V- x- #include <linux/module.h>
; i( U8 X4 X% m3 m0 ~1 C' c - #include <linux/init.h>
) s0 d d# I* B - #include <linux/errno.h>% l! y ~4 E8 T) Y1 |
- #include <linux/types.h>
9 Z7 j) j5 r/ l' }9 O1 v - #include <linux/interrupt.h> f3 d6 f3 w/ i* }) [5 ~2 u) f
- #include <asm/io.h>
+ S7 O. k; ]9 P( G5 p- o - #include <linux/moduleparam.h>
8 m. {- o) u( V0 v - #include <linux/sysctl.h>
0 k' P4 x# Y/ I% I& o% I( \ - #include <linux/mm.h>
* Q9 p0 ~0 V8 q% U. h - #include <linux/dma-mapping.h>" j2 \- f" B8 v6 R3 r; |! A2 W
. x3 o: j. o7 m' v: ? o0 }/ @- #include <mach/memory.h>
* o5 I, I$ o" M4 Z2 Q( t7 @9 c - #include <mach/hardware.h>7 b9 n5 N5 ?8 x+ x
- #include <mach/irqs.h>
- F4 Y: v! U: {" v. G) U - #include <asm/hardware/edma.h>* _" P& H9 I/ ?, x# @- p |. q
- 5 S3 L; ~8 Y7 b8 N
- #undef EDMA3_DEBUG9 y Z J. R: ?' T& y
- /*#define EDMA3_DEBUG*/; m$ x6 G( z5 V+ B X" k) j
! ]2 [4 p' Z% J3 C8 Z- #ifdef EDMA3_DEBUG: ^$ j6 `. c( r3 ?' w S% e7 i
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 B" U/ j+ N. M1 S, D$ V- b
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) w# k4 ~. Z: x: A* @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ p( S& Z' y$ H0 t" `1 ]: J - #else, {2 C* L% ]1 k2 L" M) \' }& @
- #define DMA_PRINTK( x... )8 y& I' o% q5 }/ u
- #define DMA_FN_IN
. H' Z% S. }9 R# r ], W - #define DMA_FN_OUT) A9 [# f3 J8 j' P7 X& a w
- #endif
) r+ x# t) L& |5 A9 P! X0 \7 w
" I2 _3 n; P t) a8 Q% \4 K- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; Q: _& P$ \+ h+ B - #define STATIC_SHIFT 3
! r: O. M6 \! ~ - #define TCINTEN_SHIFT 202 a9 G$ h9 B6 B9 E& C! V
- #define ITCINTEN_SHIFT 21( H. q3 ?6 h+ U
- #define TCCHEN_SHIFT 226 ~, L# B: z$ `4 j. w" b Z
- #define ITCCHEN_SHIFT 23
$ c6 H$ u" I6 y- W1 j! n
& d" @4 d/ ?9 \: l- static volatile int irqraised1 = 0;
4 ~- z" B; M+ r - static volatile int irqraised2 = 0;1 r; B" G! d- e6 g/ n4 y' T: l
* V$ ~' w. W* ?. y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' G& B$ [) g/ ^/ r5 A, p. p3 ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% ?9 @+ Z8 X. @+ ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ g7 o" S; `0 ~+ K# T - " h# x& C; J# f- `! ]; |/ ]+ x
- dma_addr_t dmaphyssrc1 = 0;
: A! f/ T1 u3 V4 R' _( x$ v - dma_addr_t dmaphyssrc2 = 0;0 ?3 r" B; q9 f# Y
- dma_addr_t dmaphysdest1 = 0;
$ O1 U) `% i' Y8 ` A* @* ^ - dma_addr_t dmaphysdest2 = 0;* |. _5 O& v6 n' |; K/ Y1 i
/ h1 V- G; G( A! H/ R8 g- char *dmabufsrc1 = NULL;
4 L/ {* S6 b! r7 S# W( @ - char *dmabufsrc2 = NULL;
) Q0 _) a$ s: y% [& a+ K. m6 U( Y! f - char *dmabufdest1 = NULL;
" j; w$ L* b+ H5 o - char *dmabufdest2 = NULL;
' h' a. u- D1 m9 b( K
6 h9 w1 z! G1 u: q8 E( S& H( z- static int acnt = 512;
0 X8 R- \5 { C0 }. V5 f/ A - static int bcnt = 8;, {+ J$ H/ G1 Y* E2 @
- static int ccnt = 8;
7 }. G. Z9 U' q5 I7 S4 J( u - ) h6 F% n$ ^7 |* y2 Z) D) U
- module_param(acnt, int, S_IRUGO);
0 ~& Z: H( E2 R1 \ A0 s1 C - module_param(bcnt, int, S_IRUGO);/ t. I0 ^7 W3 _8 C8 c/ Q) P }. `; B
- module_param(ccnt, int, S_IRUGO);
复制代码 # f+ s! |' b1 ]6 Z4 r
$ n& Z, p, F7 j( n- O% f) d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( A4 T5 q0 w1 T X# u1 garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& Q8 W+ X5 p/ I1 H) ~1 A! b) s6 H& p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, t6 s, z$ W4 L5 L+ ^
, B& o2 q0 w& g& b. e0 {# `( j% z9 u, ~- A* n7 b5 k; T
|
|