|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' B4 {; x$ k. d) ]& x
- [code]EDMA sample test application, R/ a% q4 u9 [/ M e4 t& H
- /*
( T z, e: A2 R; V - * edma_test.c6 p( E& j5 ]5 d- | A3 K
- *
. ]7 A/ ^+ r [# z5 } - * brief EDMA3 Test Application$ `5 Q- u6 a. P7 \( x0 U# @4 S" w* \ y
- *
) M5 T4 D1 n4 ] - * This file contains EDMA3 Test code.
4 ]2 o9 b: i* v; {2 y. C0 w& u - *
" x, I, c0 o& E5 h5 v6 C( S5 U7 F9 D' ^ Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 c4 v# d# k5 W2 ]* H) W/ b! m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ _- c1 C& {$ z% b0 |! I- ~
- * TO CHANGE., x4 a8 G% w7 l% t+ C
- *
' `4 S# y) x; Z) D$ C' j; x; T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 P8 J! ]8 I# ~. ?
- *
# t. M3 V4 ` L' K- S4 \ - * This program is free software; you can redistribute it and/or
5 j, d, j& C9 B' G8 A+ {5 {5 V - * modify it under the terms of the GNU General Public License as
/ i$ d9 D3 \: V+ ?$ t - * published by the Free Software Foundation version 2.
. S7 t, E; F/ i3 k' p/ S/ f - *
7 K; J7 _- m) R) W8 ^3 | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% Q! A3 z0 u; Z) |. Y3 w+ s
- * kind, whether express or implied; without even the implied warranty
8 I7 O% f/ m; Q; N/ D. X - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* I( P4 }/ d$ Z& M: D* a# n - * GNU General Public License for more details.
. d. j$ Z8 L! ^' P% \ - */+ w( z8 f% u; _, K6 H5 a
9 T! @ @8 D7 R; d- #include <linux/module.h>
- g8 }7 f+ B5 v s - #include <linux/init.h>& e) D d+ B( w& B1 w4 ]
- #include <linux/errno.h>
9 I; W) ], j/ G) d1 s - #include <linux/types.h>
- F8 {; M" G8 \9 h8 f) Q! F, E1 n - #include <linux/interrupt.h>2 }% }) [( t) y2 g
- #include <asm/io.h>
2 C7 o( \9 P) `1 ? - #include <linux/moduleparam.h>
+ v7 y- s* [% y8 d5 Q1 G* ? C4 J+ M/ N - #include <linux/sysctl.h>0 Q+ O" U1 i. Y& Q4 y1 m
- #include <linux/mm.h>" |& n' ?0 n7 u$ ^7 S5 o- N2 R
- #include <linux/dma-mapping.h>
1 a+ e4 k6 v6 ]0 S% I3 w. {6 z$ L* B; w - $ ?! n- `5 B6 h% Y+ ?
- #include <mach/memory.h>
- q* G2 t$ ^. ~7 [9 Q# [8 M) q7 o% @) c - #include <mach/hardware.h>/ }# Y* }& w! V. k2 p( v
- #include <mach/irqs.h>9 |/ Y7 _9 D: Z" ^
- #include <asm/hardware/edma.h># {& N" V2 K. V$ y
9 N H* ]( J% o0 L# `- #undef EDMA3_DEBUG+ N$ D6 O6 l3 V4 j' j( X1 ?- A
- /*#define EDMA3_DEBUG*/
! S8 T v) J, g8 f9 R6 S1 }, ? - ) q( F: Z* L" T: d+ z. I2 j
- #ifdef EDMA3_DEBUG: l: E1 [/ S$ d3 Y' R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 r+ b$ ] c5 ^( H: Y6 c - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( F! [# [6 e2 F1 B1 A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): v& r; t7 f C2 a! D. z C
- #else
3 `$ j: [) D& t4 M3 U& o& m, I - #define DMA_PRINTK( x... )
$ g) v. O. J2 D( h - #define DMA_FN_IN7 m5 a1 ^( X$ W( z
- #define DMA_FN_OUT/ O' X5 V4 c3 N2 x U4 L4 ]
- #endif
% B; O4 R& F2 ^- Q - 3 Q6 U/ [9 o/ M6 S) b# c
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ \* {, t2 M' [ c5 ]' _ - #define STATIC_SHIFT 3
9 R# F* |% N$ |/ |6 ?, T+ _1 l - #define TCINTEN_SHIFT 20% Q8 _: Z& e2 i8 K& C4 F
- #define ITCINTEN_SHIFT 21$ [3 P; W7 p; W1 H- d7 a8 G
- #define TCCHEN_SHIFT 22
9 k. A s! O5 l& |" E3 n - #define ITCCHEN_SHIFT 23' A' m* L) y* z2 c' W' w
- J& u) m( A- k- static volatile int irqraised1 = 0;2 y% m- m; K. s) x. h) l2 v
- static volatile int irqraised2 = 0;2 f" \9 F) [; C3 i* Z3 j
1 |# w$ E& T$ Z5 Y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: j) t8 U$ t2 s6 o8 @7 F - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' f- {7 x' ^. T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- S; l4 P& |: l( W' m/ \% u
" ~. c: M. ?: w7 b, C2 ~' X3 p' F- dma_addr_t dmaphyssrc1 = 0;
0 u* _9 ]1 r N - dma_addr_t dmaphyssrc2 = 0;
+ _7 ?, W [+ o3 V, y, J8 ~" j - dma_addr_t dmaphysdest1 = 0;
, c; p$ p: X+ `0 Q - dma_addr_t dmaphysdest2 = 0; |* ]" x: q3 [( S( t
, y6 N/ }' K, l4 n- h* y- char *dmabufsrc1 = NULL;
9 M$ ~8 e+ x% W7 k, @. a - char *dmabufsrc2 = NULL;1 p- {& q, C& f
- char *dmabufdest1 = NULL;% ]. c; F- J r9 P5 u6 A! {. J
- char *dmabufdest2 = NULL;( [5 `5 o% m! ?1 V# `
# @ D* I; J! }4 a$ q) s. Y- static int acnt = 512;
; i- @ H) b. h7 a# V; a - static int bcnt = 8;
& D5 L8 \4 D+ \/ D - static int ccnt = 8;
( w# A4 f$ ?6 w4 B - / `/ e( D0 k8 s1 M
- module_param(acnt, int, S_IRUGO);) N. [; b a" ^7 e
- module_param(bcnt, int, S_IRUGO);
) W0 m# N0 ?) B/ q# V - module_param(ccnt, int, S_IRUGO);
复制代码
2 W: w3 b3 ]1 A# z5 I
|: n0 q2 h' w, O/ N8 Y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ d6 i9 ~$ w6 V3 l) J. marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 {) w' q5 S4 `) _8 V* t 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 u( _2 f x5 P9 q
0 O3 u/ t' m( N* X! M- j+ ]5 D; o9 T# ?0 p, L2 P( V
|
|