|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 J; S4 @: M0 ^7 ?- [code]EDMA sample test application
f' w1 m, ]- a! G% [- a6 Z9 } - /*
% o9 e1 h' M6 `8 w - * edma_test.c4 o: J) S; |3 u3 h
- *
$ G2 g0 ?& I3 M6 Y: _- F- Z4 l - * brief EDMA3 Test Application1 n! @$ E1 d) y9 @: b0 j
- *
8 y8 ~9 d! j' R" m/ Z+ A( t$ ~ - * This file contains EDMA3 Test code.
8 ]% `# E. g( o0 z9 C - *
% o8 J" P4 I1 @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. l2 o" t2 f! u8 c
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& n2 [* V0 U( P" a( U% l% c7 d x - * TO CHANGE.+ {# T. b+ Q5 ?9 y/ z& S5 U7 U
- *0 p( k4 E& j/ S& e; t4 H8 P R
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# g. l& H$ k7 e C/ H2 c
- *
$ D6 n5 e- m: Q - * This program is free software; you can redistribute it and/or4 A' L- k* l# y* E2 E+ X1 G
- * modify it under the terms of the GNU General Public License as, L$ ]1 Y2 ?3 j
- * published by the Free Software Foundation version 2.
) d3 u- _/ S/ Z# R2 ?# W& } - *
4 z8 m3 S9 q5 M# D5 m - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 x q( U5 \* T- U+ h - * kind, whether express or implied; without even the implied warranty6 k( x* x! Y9 r x& g. X! `" c+ g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& I; e6 x# W3 A& W: [ - * GNU General Public License for more details.
0 D1 e5 ^! A0 y" U2 e - */# u) z7 f& {, C
4 |0 a: ^/ r; X; p6 C, G- #include <linux/module.h>
) `1 |9 J0 }( v' J - #include <linux/init.h>9 B) B7 W9 {/ y9 @% Q$ Y" I# b2 }
- #include <linux/errno.h>5 M$ p3 h9 {: Y8 p n9 h' G
- #include <linux/types.h>& z; L8 d1 x/ @& n, ]9 s* o
- #include <linux/interrupt.h>
6 q" \( E" G0 `* q9 {* Z - #include <asm/io.h>
, J/ H& Q) S, j I' v5 j - #include <linux/moduleparam.h>4 K8 N# i3 g6 m% Y
- #include <linux/sysctl.h>3 U0 ~) d# z- \2 b' G5 t
- #include <linux/mm.h>: F5 T2 ~9 L. C
- #include <linux/dma-mapping.h>8 v9 C1 n f, ^1 n
3 S5 j7 _" G) K! @4 f1 g8 y: K- #include <mach/memory.h>
0 C9 z. a3 M) f$ g3 W3 U! E - #include <mach/hardware.h>
' _( J, O$ W$ v5 d - #include <mach/irqs.h>; B, c; {3 J% y
- #include <asm/hardware/edma.h>
/ J- P- n+ a$ w2 |: i
- f; T& L7 }3 n/ r- #undef EDMA3_DEBUG5 ~4 ]& a. S5 o9 ^
- /*#define EDMA3_DEBUG*/4 [$ E7 j4 O$ o( Y
+ M& J. H: F4 `+ G( M0 l7 w* ]) \- #ifdef EDMA3_DEBUG
# g) o j4 b, t! B: ] - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, X' y0 T1 F: Q' H4 H/ i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 R1 ?4 s- H4 P% B/ y* { - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( S7 {- L6 G# w2 x5 ~$ J: M. R - #else
) N. F. j6 y. W# Z - #define DMA_PRINTK( x... )9 f9 `1 Z9 ]) ~; t1 s X: e& \- {5 T
- #define DMA_FN_IN
# E+ i. ^& L& M. p - #define DMA_FN_OUT# u. [$ L& v; U' c; Z
- #endif
+ h: S+ x; s* ?* Y% m; M
K8 B9 R. ^6 _* b- #define MAX_DMA_TRANSFER_IN_BYTES (32768), z; K( ~5 y# M6 |: I
- #define STATIC_SHIFT 31 t: ]1 N" B8 q* n( ]6 p
- #define TCINTEN_SHIFT 20
- F* ?9 S/ @2 A" ] F- r7 M - #define ITCINTEN_SHIFT 21
: v. u! ]0 f2 _8 F3 W+ s - #define TCCHEN_SHIFT 22$ h8 h: Z) b6 m5 r, i5 g
- #define ITCCHEN_SHIFT 23
; m1 T' L* I3 h' }# d - 8 R1 z0 P- ?" A0 h
- static volatile int irqraised1 = 0;
. e/ J; E9 V1 B( j2 M# U - static volatile int irqraised2 = 0;) U9 V$ c' ^; ~2 S0 m5 z. c! V
- ) Q8 l D' O. H5 P, R, |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& o8 C: e. E4 Y4 b$ H
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; a7 r9 K9 e M! M# x- E' [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) W5 e/ K$ h$ O' c
- G- H" s! m0 W& g9 j
- dma_addr_t dmaphyssrc1 = 0; c) k# k& e% P: l
- dma_addr_t dmaphyssrc2 = 0;
R' ~% e; E0 H( Q8 s - dma_addr_t dmaphysdest1 = 0;. w, P2 m W: `: @8 M
- dma_addr_t dmaphysdest2 = 0;
@5 `* A% _) z3 V) I/ a
- f. Z K4 x, ^" H! n! H6 C7 t- char *dmabufsrc1 = NULL;2 \* w7 U- h; h1 e5 {% f; u
- char *dmabufsrc2 = NULL;- |, n6 H/ l4 h8 x( v, s
- char *dmabufdest1 = NULL; r6 _4 a% Y1 ?+ m9 V: W
- char *dmabufdest2 = NULL;1 m2 d. {" I o
: U! Z9 E; v# B0 R& u9 h- static int acnt = 512;
1 B' ^/ Q, o6 h0 R# L - static int bcnt = 8;# t9 l& i. J$ T; j$ k5 t
- static int ccnt = 8;
- ^ y' m$ E# v - # M" q6 b6 L; q; ~ D
- module_param(acnt, int, S_IRUGO);, Y# g- O$ {8 @' a
- module_param(bcnt, int, S_IRUGO);/ D) l7 W4 M+ L# S, A! w
- module_param(ccnt, int, S_IRUGO);
复制代码
' G6 R$ U6 J) h6 I. Y
1 ^1 w( \# l1 D2 j! Q' ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 s# u* p8 s! V$ j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( x+ A- [, f/ [0 D) ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% s$ {" ~0 }: j" _% @- a) ?. T( s; A, ]) j( z7 O! s& t; D
% i. Q1 |- m1 g* i |
|