|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ S: H# p8 R2 y# l0 O9 E1 S- [code]EDMA sample test application
% }9 x; T2 _7 t) d( t- e6 r - /*2 w6 R! l1 D5 E6 o6 D
- * edma_test.c* S4 |. {: O3 j9 j
- *+ R/ |4 }6 f# C+ Z7 H5 p/ d2 N' |
- * brief EDMA3 Test Application5 c) O3 C! q+ o& d7 Q
- *
/ _/ E" Z% u; j4 h - * This file contains EDMA3 Test code.5 D) r& H/ {1 l# x9 T" A
- *
! G# T# R: Q3 W g0 f - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, A7 g6 K! C) \/ p, H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- v9 f! a+ e' Y( d5 f' ] - * TO CHANGE.* h# M2 @ U- I
- *% ?, v% F+ F% R
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. ]- p- X" I( c1 b( u - *
6 U& X$ o- r3 Z O, A [ - * This program is free software; you can redistribute it and/or
( }/ F8 ~" u. H. f. }+ F7 o: A: H4 S - * modify it under the terms of the GNU General Public License as
* Q- a e L4 _+ ^2 B - * published by the Free Software Foundation version 2., \& X3 h t& x; Q4 J3 B( h. |
- *) ]* w% o8 d) E: ^8 K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 O' a" X/ H2 Z - * kind, whether express or implied; without even the implied warranty6 T S1 H; T; t* I- }+ l# ]9 K& W" J( [1 ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" h6 G( N# O5 C1 N2 s% U; Q - * GNU General Public License for more details.
: ]; N: k8 b" y+ {* l, d7 N - */8 W+ i/ {- o. e5 g$ G
, p$ ]* J7 u) o, M- #include <linux/module.h>8 }9 N( F3 ~: u2 k
- #include <linux/init.h> ?% V3 ~2 U4 g( [. t0 N# z, Z! x2 H
- #include <linux/errno.h>
+ _3 U! a' H" |0 ?+ z, E: C - #include <linux/types.h>
) d/ L' t9 t9 ]2 R - #include <linux/interrupt.h>( E- ^, p. E$ [, n+ z. c8 r
- #include <asm/io.h>* k: M# E7 S3 [ X# s% B
- #include <linux/moduleparam.h>* e0 A2 E# t/ _& T1 Z7 I$ l
- #include <linux/sysctl.h>
* }; A3 I# o) l) X! ` - #include <linux/mm.h>3 y) v. Z# A( l p
- #include <linux/dma-mapping.h>
/ V3 U- o' J% J; _ T0 S0 P - 9 v1 m/ r2 m7 t4 {8 P7 P; K/ p
- #include <mach/memory.h>
. ~% K* P' ?6 D( w0 g. n$ e: y - #include <mach/hardware.h># o, Z- j; S9 d- |; s/ v% S
- #include <mach/irqs.h>5 X& x$ l) N5 W# B& G
- #include <asm/hardware/edma.h>- H: d& l# ~3 t# M; N$ U4 X+ C$ _
3 O5 o( D/ y. F. m/ C7 Z- #undef EDMA3_DEBUG J: r! Q# z6 i2 N, ]* w
- /*#define EDMA3_DEBUG*/
- X0 y) U1 z0 I3 N- F4 ^
4 G* m/ Q% f/ [/ i- #ifdef EDMA3_DEBUG, n: t" b0 J S) ?# J8 r
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" V m; \9 m% T - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 ?: `& B' s; @) S! a: I" u$ p - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ l8 i4 O" @* f5 r) b& X
- #else0 e5 K/ f1 G5 y: ?
- #define DMA_PRINTK( x... )* Y9 r3 b+ {- r* V# P3 o* ?
- #define DMA_FN_IN* _/ t$ J+ H$ K3 o
- #define DMA_FN_OUT7 f4 ^3 u5 a3 e5 ^" k
- #endif
" S7 D! O6 G1 M. ]+ j
* `( h. [/ x- q c3 p6 y9 S- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- n* D: r2 q2 h: U3 x - #define STATIC_SHIFT 3
/ w% c q3 c9 m6 |& p: ?7 T* [ - #define TCINTEN_SHIFT 200 j% t2 N8 X& g9 b
- #define ITCINTEN_SHIFT 21
# g' t$ y6 B4 | G( L - #define TCCHEN_SHIFT 229 \9 R2 k* L% p7 n9 A0 p
- #define ITCCHEN_SHIFT 23
& x1 S3 M: k- ? - 9 @9 W* \ K$ t N( ?3 a2 i1 G0 F
- static volatile int irqraised1 = 0;
/ k; k Y4 b% x - static volatile int irqraised2 = 0;5 m* `. \% W, J- V5 P T1 H7 Q& j
- " ]3 }' L1 b% O% w
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" r/ y, W7 y) a, b4 [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* v7 x6 z% d; a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# u& m; _- u% X9 V2 q6 F
% L/ f- T1 L1 W$ C9 L+ D/ _- dma_addr_t dmaphyssrc1 = 0;
5 i6 u: D/ l/ s" z c8 n0 U m - dma_addr_t dmaphyssrc2 = 0;) I8 \8 m6 p/ m# q6 S/ u
- dma_addr_t dmaphysdest1 = 0;( e! T/ |- f% n: F( h8 _8 ^
- dma_addr_t dmaphysdest2 = 0;
0 M0 U1 R* F/ b7 c- k" z
6 W$ f/ @/ m9 Z- char *dmabufsrc1 = NULL;; b: a2 n a4 U, E2 {
- char *dmabufsrc2 = NULL;
: d$ Y/ z- j9 d/ y1 a: l2 \8 W% U - char *dmabufdest1 = NULL;
, I5 @, P0 `0 N4 \% F2 o$ r+ s - char *dmabufdest2 = NULL;- k0 m L$ a+ U1 s
" s5 O$ W2 E# k2 H- static int acnt = 512;
) u) y4 N& {! e% o' A - static int bcnt = 8;
, }4 V" @6 P8 l- E, I - static int ccnt = 8;
* q5 B8 W) J' @8 {3 i
* u' \. d( \5 S2 X" _! k" k, n% n- module_param(acnt, int, S_IRUGO);
" Q; t) f/ [3 _, w, e2 ?; ?2 q - module_param(bcnt, int, S_IRUGO);0 _! A# x* |! H- h& l- P
- module_param(ccnt, int, S_IRUGO);
复制代码 : @/ O. a& p' ?/ C- N3 D
& |2 Q/ B' _- d9 q+ s! _% `
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 b5 G3 p; h7 k% Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
Z' i5 b5 n0 q' g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 E/ v6 x( x% Q: c& ?& u* q" k
5 @) ^% s. Q. p) n' r7 H9 K R
1 \4 \: G; i: u, Q: e6 z7 g) j
|
|