|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( J' @3 h0 H4 o, a: P
- [code]EDMA sample test application
0 E& T# m' ?# j - /*
7 ~9 t3 b, d$ D8 N7 p& U - * edma_test.c
3 J- ~3 H" ]! w5 O - *% r- G% ~" y5 q. ?' I% M* A: g
- * brief EDMA3 Test Application
# Z0 B& G& n' p( V - *
. q7 h1 g( O+ L" W8 M - * This file contains EDMA3 Test code./ V- M+ R' u$ w3 i/ \% q
- *+ h6 Z9 V& f9 G2 t9 ^5 ~3 B6 Z6 q9 z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# C3 L3 P7 `; q+ i+ U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& i8 W2 m8 z0 [( p, i8 k; o - * TO CHANGE.& {* i$ ]1 z6 {: {6 g! u, _
- *3 d3 h$ I. w) i4 q7 k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 Y9 c W1 g$ _1 ]+ C4 ?
- *9 h( y5 T% e2 i+ r
- * This program is free software; you can redistribute it and/or
1 x+ T8 k$ T2 A/ J* \ - * modify it under the terms of the GNU General Public License as; k* G8 D) t: [3 v) ~
- * published by the Free Software Foundation version 2.7 z& n* I1 _+ n/ s k! _
- *
6 ^. c) b9 |& f/ S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 b# }$ o2 e9 _, \8 k! c2 X, Z5 x
- * kind, whether express or implied; without even the implied warranty( R2 K4 u/ P9 h% |7 t1 L5 q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" G( Q) h3 L# x y
- * GNU General Public License for more details.
5 }9 u# `2 z7 m- f4 v( a d" u - */3 H+ k( b- C) A- q, |* l
- : ~, X- v8 ^$ Y/ n
- #include <linux/module.h>* u: O% p* ~% {' z @' C7 }' `# R. W
- #include <linux/init.h>
" H9 X. O e2 p" B. L5 ~ - #include <linux/errno.h>7 d5 q, M* o6 C5 {6 j/ l/ B
- #include <linux/types.h>6 I& `# p1 j/ Q! W2 E2 B# k
- #include <linux/interrupt.h>
5 ]. Z: i6 C, P$ O/ a. X6 I7 u - #include <asm/io.h>
, j- ?! f+ W" n' O - #include <linux/moduleparam.h>
1 I1 \5 a$ M: w2 G - #include <linux/sysctl.h>
9 m6 b5 B. a9 @- m3 X! u1 B$ @ x - #include <linux/mm.h>2 A# L5 m9 H/ N& ~
- #include <linux/dma-mapping.h>8 J* A# g: }. v! k# T X$ q! C) Y
, Y" Q3 a3 s# P, m5 Z- #include <mach/memory.h>
1 {: m) o3 R3 g6 U2 L0 _ ] - #include <mach/hardware.h>
! R* z |0 P* t1 S - #include <mach/irqs.h># K' R; R8 a# G$ p
- #include <asm/hardware/edma.h>1 n9 k- {7 Z6 {/ P9 ]
- & Q5 [3 g O( }6 G% |
- #undef EDMA3_DEBUG6 q" Q9 e: [/ A' E) ~
- /*#define EDMA3_DEBUG*/
& v! F! }8 }% B: k: i. Q2 `$ ?) Z - 7 u( U; N% v5 G3 W4 U
- #ifdef EDMA3_DEBUG$ K! ?8 M+ t% S) X C1 `+ O$ k* _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* ^1 G$ M8 {. t - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% s9 Q% I. \3 _ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- p. g" ]' |: h6 L" m; F8 _: R9 l - #else
+ o" d7 c' d; D# ] - #define DMA_PRINTK( x... )/ s0 ^& T3 l, M% u! |
- #define DMA_FN_IN' D5 z* I" U* C5 A, x, G# M' j
- #define DMA_FN_OUT1 m5 P' `. w: w! O; \
- #endif
; `* |; R" K- w1 Z! a; T# ]; b, S - - w" r m$ S/ h; n+ X: L0 ?9 N
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 E% {" V% C/ n/ ~
- #define STATIC_SHIFT 3
8 |: y( }# D: @7 Y; y - #define TCINTEN_SHIFT 20
& |% n G- [: `; ~4 u$ X - #define ITCINTEN_SHIFT 21
9 e9 X+ @- R5 Y8 @" a - #define TCCHEN_SHIFT 22
* Z3 E( P+ l" I4 \ - #define ITCCHEN_SHIFT 23
1 m4 [5 q; k$ Q* ^: @0 m6 x+ Z) r
$ g. I- R4 Z' g4 c- static volatile int irqraised1 = 0;; T2 ?/ K0 w/ d
- static volatile int irqraised2 = 0;+ _ f) r, |1 L7 h4 A
- : L7 Z7 K9 ]" K4 }/ D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Y9 w% J% P& W! q! h7 Q/ n V( o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. b) C5 B7 U. h: w; K' [0 n
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ i1 }. P8 q% u1 U% ~) E( v, O
# x) K8 [4 l, `8 v; e; K6 a- dma_addr_t dmaphyssrc1 = 0;. q$ Z0 F+ q% a4 R
- dma_addr_t dmaphyssrc2 = 0;
" {: u- ^* \2 \' T6 ^9 ]: k5 L - dma_addr_t dmaphysdest1 = 0;& x7 a+ m; ?# @- F# y8 y8 B. z1 f
- dma_addr_t dmaphysdest2 = 0;+ F" Q: q' `2 ]: D; w
- ' m( ^ v2 a/ p Y' j B$ G
- char *dmabufsrc1 = NULL;% L1 S! d! _* M, p1 g7 T7 H) @1 I
- char *dmabufsrc2 = NULL;
) [% K. \! J- _' _( t - char *dmabufdest1 = NULL;
$ d8 O8 m4 q* U7 B' N- y2 X# x4 U - char *dmabufdest2 = NULL;. A1 J& p/ L( z+ g; F6 |5 T
7 Z8 F8 d/ b _* l S1 X; x- static int acnt = 512;" I& J. S7 u! Q6 m2 z! {$ c
- static int bcnt = 8;3 J9 P# x' p& Q! ]
- static int ccnt = 8;5 T( v: J3 p9 L6 Z! E8 [6 p
# B- H( r: L6 d1 \8 w% a- module_param(acnt, int, S_IRUGO);
6 @1 }: I9 z8 e4 M. t% x - module_param(bcnt, int, S_IRUGO);
l/ C4 [; q* r9 E! o0 ], n# }2 J$ C - module_param(ccnt, int, S_IRUGO);
复制代码 * C$ o7 w7 c z# {4 Z ]5 b: N$ l
0 g" B1 b& a# U5 Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( y& W/ C3 H4 C j5 Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% C' Q5 I3 i+ K3 N/ I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 b. b+ w1 `* W- E& Z3 h0 b ^, k# A! J/ B) @+ D
8 G' h, m3 P8 I3 D6 c
|
|