|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ D# n) v( k5 g' V- [code]EDMA sample test application
2 A4 |( J" i& x) W - /*
* d6 I* P$ I$ f - * edma_test.c) W5 ?3 }( \, G$ {4 d- d
- *) V( _' f% w/ c' J% _$ N
- * brief EDMA3 Test Application
( _3 ?9 b# V: E+ j. { - *) q& R3 D; r( t
- * This file contains EDMA3 Test code.# \' H) u6 ]/ A* ~9 }" g
- *; M. ?) ]# s. H/ R% A, H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. t- u9 e, I; j9 X1 Z) U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 ?/ y* _0 E4 C: j
- * TO CHANGE.
( ^, [- p' [- [# @ - *: l& D1 a+ w1 F- I) o2 [% B
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! z8 ?0 k' z' A. G/ A - *' r& M; d1 s4 t) s% T. g# b
- * This program is free software; you can redistribute it and/or
) o" p6 {0 i S# y( d. C - * modify it under the terms of the GNU General Public License as
0 f: O6 Z; j" ^4 M6 X! g, k - * published by the Free Software Foundation version 2.3 T2 |7 t5 t# G; D2 p& [
- *
5 B" J$ X3 E3 j$ O5 e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 Z0 P+ C% a. j) P1 S$ ^4 K
- * kind, whether express or implied; without even the implied warranty
7 Y& n/ z8 @, X- W$ g# e" J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, ^% ~- K3 O& s W8 q$ e) ^
- * GNU General Public License for more details.
/ J" n- @. v+ x1 A/ Q" L: L - */
/ r w$ s3 p1 H$ U* i$ d% { - 9 J& C! H$ @2 a+ N
- #include <linux/module.h>
: k* c& l: a0 z& p: K$ w - #include <linux/init.h>
0 t$ A8 a1 g: E9 D( C! E - #include <linux/errno.h>
6 ~' b# p# y7 a9 x3 {" r - #include <linux/types.h>- b( x+ B! G5 }' i& U- X2 ~
- #include <linux/interrupt.h>2 A- E0 Q3 ~2 H g, L6 a9 B9 x& w
- #include <asm/io.h>1 b. u$ z8 k/ R- d( x
- #include <linux/moduleparam.h>) q. e, {" H7 j2 l5 f
- #include <linux/sysctl.h>
; Y# k2 J$ |/ D; r3 V - #include <linux/mm.h>
, e, d1 |( }8 \ - #include <linux/dma-mapping.h> Y, {7 f8 L* O0 [& Z! V+ z5 ^
- ) i0 Q) R+ H' R
- #include <mach/memory.h>
; Z6 @0 \; Z1 Z0 \( J9 e( _2 j - #include <mach/hardware.h>
5 F4 X# i8 R* r3 A0 R0 V8 l/ P3 B" N" m+ W - #include <mach/irqs.h>
, k& m) I& B5 C* f! \/ G6 a% `$ f - #include <asm/hardware/edma.h>
8 y+ ]" T9 G1 \& H/ f4 P5 N' h - , [* o1 X! e6 E+ l8 a% |$ z- F- s
- #undef EDMA3_DEBUG
1 f" [. p4 F% { - /*#define EDMA3_DEBUG*/6 _% A6 i, [( L! a @$ v! c: s. o
8 n/ R( g" I) u' c1 C6 d- #ifdef EDMA3_DEBUG& M3 ~+ A+ B) O1 u- P2 R' z! F1 M
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) |1 F6 g; }1 _9 A L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 @- p. h o, j) T. V8 Z- ^2 o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ |7 h: p% X5 t: Z0 o) T- K
- #else1 w! V, Z$ r: Y
- #define DMA_PRINTK( x... )
1 ?, v+ r2 y4 X7 y+ j ^3 s- K' E t - #define DMA_FN_IN
) j8 p' ?: ], r- g - #define DMA_FN_OUT; I' \# C7 |5 J* X
- #endif% g1 Z: |6 X# { V3 }7 R4 Q
0 `5 F1 T9 E& E) y- b- {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 o) O3 O5 K$ L: i8 h# M+ L% h
- #define STATIC_SHIFT 33 g6 _" g2 m0 ?& \( ^& x! ]- ]
- #define TCINTEN_SHIFT 20& y7 J. S1 K J1 n8 h: B/ q
- #define ITCINTEN_SHIFT 21
4 h9 `7 k, F9 T7 v' `, ? - #define TCCHEN_SHIFT 22
/ d8 k8 ~- T7 W( O* ~" f - #define ITCCHEN_SHIFT 236 e) u# K3 e: A3 H1 X- _3 n
, r' q& w# w ^" a) ? E- static volatile int irqraised1 = 0;
2 o: I) }5 i7 n# M6 n) G - static volatile int irqraised2 = 0;. ?: b; N. c; o. h
- & c; Q# X2 Y$ T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 e5 T$ f3 l G# Q% r7 G5 S
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) h; n8 m4 u9 O7 Q: c- R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 S* n% O1 m; a; u. \
4 ^# K" ^9 V3 Z& i: p- dma_addr_t dmaphyssrc1 = 0;
$ z# R4 K+ Z4 W: h - dma_addr_t dmaphyssrc2 = 0;
8 o, g. W0 ^+ b& N7 j8 j, {, I8 X - dma_addr_t dmaphysdest1 = 0;8 L1 Z4 C. K2 w, G7 b; R; q
- dma_addr_t dmaphysdest2 = 0;
7 F+ Q/ s0 d4 j4 l# v; \$ r4 R/ U - 5 m" J" p8 Y' k+ D0 i
- char *dmabufsrc1 = NULL;+ H5 T+ O2 s9 [
- char *dmabufsrc2 = NULL;2 M& j8 t. {5 C% t3 ~
- char *dmabufdest1 = NULL;5 b/ j- K8 T2 y( P0 v5 t4 W! f
- char *dmabufdest2 = NULL;
9 ~1 F, ]+ q4 O- I: _0 s - 1 {# c c6 B( b/ D8 `3 R
- static int acnt = 512;
& z/ M; V3 \5 Y - static int bcnt = 8;
7 H( k; `# B# u0 m4 A2 t - static int ccnt = 8;
3 O7 ?3 @& W8 I- Y) h4 l, F - $ o U2 [( D" f' e# X
- module_param(acnt, int, S_IRUGO);
/ b6 [9 K, Y7 d5 e - module_param(bcnt, int, S_IRUGO);6 l0 C Q" P- R! u
- module_param(ccnt, int, S_IRUGO);
复制代码
9 j5 B' k) v7 ?" `5 T2 x3 G3 c) [
/ i% q6 Z" |8 F 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
n$ I$ p0 e7 H+ yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 x$ d2 Y. N% n5 ]! E
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* G7 u6 B: w: W) F
0 ]# x. O4 L" l; H$ s2 k
; g8 ~/ f; D5 `* n% B' d# J( Y
|
|