|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* }! w% D) \" G7 U0 [& m- [code]EDMA sample test application5 \% s2 ^2 J3 I& \. D$ P
- /*
: _4 m' @% x& U! d4 v5 ~ - * edma_test.c
# j3 ^3 v6 Y, F# i: P - *
, f8 |! ~- p, K4 R" ? - * brief EDMA3 Test Application5 |8 x. G7 i t1 c/ |* x7 P
- *0 x- _& J4 c4 B! x& H3 E6 E8 I8 w9 G
- * This file contains EDMA3 Test code.
- l; ^+ B* H/ C" ~7 d# F" @9 d - *
' s) c; Q* |- v9 p. J - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# t2 E1 v4 ^ ^/ S# g8 { - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" L# Y; d D5 h. W' ?
- * TO CHANGE.: B9 R- L3 k0 v: s& c' O. y
- *
S. p7 d# }& A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 b, h5 J7 o: p/ t
- *( E9 g( C' @5 C4 i$ M9 J
- * This program is free software; you can redistribute it and/or# C: Y+ i2 F6 ^6 N6 R
- * modify it under the terms of the GNU General Public License as% U( p9 H$ D8 V' p% Z6 \( W H
- * published by the Free Software Foundation version 2.
3 j& i* m% ]' c6 W - *
+ `$ {& K- D( m( @ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% p+ s- H R3 q1 t2 u# _
- * kind, whether express or implied; without even the implied warranty9 O/ A! s' H; Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' a; S' a$ s( e& [. B, J2 N% i
- * GNU General Public License for more details.) c/ |7 q- ?% g
- */
) v/ Y: }, ]/ j7 B, K - $ ]& \" j0 o9 f; B, v6 [9 ~
- #include <linux/module.h>) k2 S/ X) U# B: s: W4 |
- #include <linux/init.h>
) H& ~, C/ J8 g% O; { - #include <linux/errno.h>8 D: z. E9 v8 r y* s$ }% ~+ R
- #include <linux/types.h>
5 r! e9 d8 ]; M% l+ ~/ `! ^ - #include <linux/interrupt.h>' w, a. j0 V0 ^1 i( i: Q6 ]
- #include <asm/io.h>
9 P' Y2 F( v; ]+ b( b1 u/ z; z) l2 g - #include <linux/moduleparam.h>9 O9 u# t" x9 C, I% o# H
- #include <linux/sysctl.h>+ r7 L: | H1 a7 c* G% m" E# X6 I
- #include <linux/mm.h>
9 o8 i! x5 c# s# |1 v4 e - #include <linux/dma-mapping.h>
8 W$ Q; w6 U# p; R, X u - 0 S, q$ B. S) l1 U. i
- #include <mach/memory.h>+ Y; m0 a- c( n" O* h: q
- #include <mach/hardware.h>
; I7 r5 y& {% G0 _) u - #include <mach/irqs.h> E* Z9 P( {6 c/ D
- #include <asm/hardware/edma.h>0 E! g% d6 _8 L" W. L
" a1 H, G* A/ c- #undef EDMA3_DEBUG
% C8 k! s4 r9 T6 v - /*#define EDMA3_DEBUG*/
* T- { g1 o T
, Q: C. h5 V" l; ^! q G- #ifdef EDMA3_DEBUG$ k% }1 y* ?- ^4 j6 S' g( [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" @; J1 l: K" E) s8 | - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 A$ z$ \; i: |0 L* R( l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 }% O" @# `4 `* v" b4 a* r - #else
' F1 @0 D: V( D+ v% K - #define DMA_PRINTK( x... )' `0 ^7 A$ K8 `$ O& \+ |! c* |
- #define DMA_FN_IN
6 ]: l( j+ v5 G' q' J9 q( G3 n - #define DMA_FN_OUT
# W, O; @3 n2 I- W! Z- p - #endif* O: I- r* S$ C4 ~ B L: x
/ p0 s6 Z) ~! [! d; w# k+ T+ `7 P- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 ^9 e: t3 _& f5 U/ N7 L7 }
- #define STATIC_SHIFT 3
7 g, r3 b/ {; u8 |3 v* i - #define TCINTEN_SHIFT 20
b! `6 p5 ?7 _& R" \; g - #define ITCINTEN_SHIFT 21! s6 y. s/ v! I$ a w$ y8 W# W/ l
- #define TCCHEN_SHIFT 22- A# x5 K, A! F3 b; S# v- N
- #define ITCCHEN_SHIFT 23) o! N x' ?9 \
) M8 q7 f3 n/ D$ G- static volatile int irqraised1 = 0;# j& ]2 {, t6 N# }3 c" I+ ]/ z
- static volatile int irqraised2 = 0;9 Y% e7 g! N+ p: c- L: o$ a k
- 0 A/ H( w% ?) U
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 |7 `" \% l9 p9 Q$ j7 W9 s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 f! J# R2 U0 o2 o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 h1 G7 e: I% r# p+ z
1 _1 _* O- s8 O. b1 i' p; I- dma_addr_t dmaphyssrc1 = 0;$ ]+ [2 J. ]5 S- _) S# t; G& r
- dma_addr_t dmaphyssrc2 = 0;
! q& E3 j1 O, t - dma_addr_t dmaphysdest1 = 0;1 q; y7 r2 ?9 Y% X' Y: k
- dma_addr_t dmaphysdest2 = 0;
/ k$ c+ e: t( S' } - 3 L# x3 a% @7 @: \" s
- char *dmabufsrc1 = NULL;
2 R4 r+ ~2 [: h$ o5 G" V2 Q - char *dmabufsrc2 = NULL;
3 Z7 a ?# E7 j6 F8 b% |* h - char *dmabufdest1 = NULL;
3 h" V- V* [. E' r+ A0 Q - char *dmabufdest2 = NULL;
7 x% J( b% c0 T4 O, v3 D- ?0 M' \
: j2 P) y. {8 B: F, a- M+ V2 t5 \- static int acnt = 512;
. z0 D. @4 Q) S; j0 j - static int bcnt = 8;
/ D, z3 m, ]# J9 }$ z9 B - static int ccnt = 8;
$ D+ Q+ k N( @+ B9 w* o - . l" U* S/ ^4 L b4 X
- module_param(acnt, int, S_IRUGO);
) i9 G8 p" P1 y; E/ u7 A - module_param(bcnt, int, S_IRUGO);( E4 v! J1 e" T5 l1 V
- module_param(ccnt, int, S_IRUGO);
复制代码 % M0 F& B9 }4 w/ o* E6 A/ m
: U2 P4 S) S; n- o& ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ g$ d9 d! m9 X% p1 s! g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- y& M2 H; W1 ^, R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- b! |5 b" A: r6 y
/ G/ l. q2 U' r* h( P( Y% a% H- _, T$ C3 Y0 M( P9 t! c* H
|
|