|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' K8 {& d. h& v' N) j0 w
- [code]EDMA sample test application/ t# k2 q) ~; S( I- g1 m
- /*; Q7 L* m* Z) v2 z
- * edma_test.c4 C* F4 p5 X/ G0 `+ G2 H% h [ n
- *
3 W! p! r0 b0 I, m6 {) F$ ]2 L - * brief EDMA3 Test Application3 W% C+ M2 l& w4 I: ~5 ~
- ** [9 a2 [; W( m. w
- * This file contains EDMA3 Test code.4 ?3 [* \) y" l# v
- *$ |/ t) X. F, \- ^1 w. b: h( S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 Y' N9 {) H3 B" d1 R/ F' c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" A4 {2 S5 V. M5 P - * TO CHANGE.
8 l# G1 K: ?- c; C: ^( Y - *
& i7 T. X$ b4 o% s, x1 E - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; v3 K: R% m( x7 U- r7 o - *
* x% X+ t7 u/ @5 i6 \ - * This program is free software; you can redistribute it and/or
# L9 }9 x' I# R/ |5 [ - * modify it under the terms of the GNU General Public License as2 T8 l$ z3 t) ~( V3 V
- * published by the Free Software Foundation version 2.
: w6 \' \5 b7 ]5 f8 K5 q: U - *
. L- v+ n6 Z p, O" ~/ f - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 r/ G, `9 B' a% F3 R7 ~- } - * kind, whether express or implied; without even the implied warranty
2 U5 P& v3 h- h1 x- g, C# ^" Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- h" t o! l; M% Z$ c - * GNU General Public License for more details.
. O$ I0 D% `8 v - */" ]4 y* z& ]9 r/ b
- + x7 e" B8 s7 V* N4 |6 d, }
- #include <linux/module.h>* O% J4 p$ B4 t" V
- #include <linux/init.h>( T" d" A. ]1 l2 d
- #include <linux/errno.h>
2 X2 H: I* w3 y# r1 v9 I o0 ]$ y5 t1 d - #include <linux/types.h>
d3 v0 |6 z' X' y, R: o' H& j - #include <linux/interrupt.h>
2 H& r: ^: h) y9 a* I; t: a d - #include <asm/io.h>* U5 [6 ]% R0 ]. k m
- #include <linux/moduleparam.h>3 G: \4 s4 H( @: ^3 S: B6 ~
- #include <linux/sysctl.h>
1 J5 s' X$ J6 F/ G - #include <linux/mm.h>4 n$ e. p) T6 O
- #include <linux/dma-mapping.h>! s3 N2 e2 \5 L; `
9 c" a. ^4 |; p& g, T- #include <mach/memory.h>8 [6 C) P! y# p+ R: u" x% J
- #include <mach/hardware.h>; _' K* o* v" O3 A0 }, Y6 w
- #include <mach/irqs.h>
2 p& u: u% X9 I - #include <asm/hardware/edma.h>
+ q( ]7 `0 b6 N
* e9 r- f3 a! m B3 {- #undef EDMA3_DEBUG" z9 @6 f& { \2 D7 X
- /*#define EDMA3_DEBUG*/8 R- S1 y `, |* D
" p v- Y1 k$ d- #ifdef EDMA3_DEBUG3 X2 ~' i! {* o8 l! r
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 ]) c" P; H/ `/ D+ [8 e9 q' |) H1 p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. ?' ? F" X+ R- d1 Z2 o* B, y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 m; u( e( w- D! z! q) ?2 p
- #else
. E c3 G' K2 a+ j4 ? s" d - #define DMA_PRINTK( x... )/ r( z/ z) @. E1 ` N# z$ O
- #define DMA_FN_IN8 q% H4 a3 Y3 y% E* C
- #define DMA_FN_OUT
* J t$ o- W! W$ u: ` - #endif
3 p! @/ t) f, D) p0 P$ \- r# N
- B* ?$ h0 @0 i- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 `6 S; c0 G8 a* D0 R - #define STATIC_SHIFT 3- z+ l" S; U p$ `% z/ S
- #define TCINTEN_SHIFT 20 ]& T# u6 v/ Q) U5 i
- #define ITCINTEN_SHIFT 212 R4 z S3 Z1 F( g: L2 l5 S, k
- #define TCCHEN_SHIFT 22 C4 }# k3 b1 I, Q
- #define ITCCHEN_SHIFT 236 c. f" Y: d* E) R
- ' {9 B7 J `' f! t
- static volatile int irqraised1 = 0;- Q* {, m% L- h
- static volatile int irqraised2 = 0;1 l9 d/ m1 M1 }4 l! U1 T
- 3 M& j, M( W- D% p5 F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ i# C' W0 A( h5 r9 m
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 I' b' v; q+ _7 k1 z. H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% g9 r* q" t" A9 j' N5 f+ J# E - - u5 Q2 I' m, u: k, R" z! _
- dma_addr_t dmaphyssrc1 = 0;
: f( z, s/ w6 A9 \( W - dma_addr_t dmaphyssrc2 = 0;, r1 X1 ?& r1 z0 F) B$ Q; Z
- dma_addr_t dmaphysdest1 = 0;9 ]( ~6 V2 Z5 F& U
- dma_addr_t dmaphysdest2 = 0;
* L" U0 N4 a; @$ a5 m8 c5 @, q - 9 a4 F- I* v$ i- \6 p
- char *dmabufsrc1 = NULL;
8 D: G( z) d R1 M( D: a8 x8 V - char *dmabufsrc2 = NULL;. ]9 |2 x1 P K6 A6 e
- char *dmabufdest1 = NULL;
' i, O) V* T! l o$ S - char *dmabufdest2 = NULL;' t& L6 l2 R# w0 I" y% L: Y
. ]# M3 G4 L# S/ D y$ j- static int acnt = 512;
0 ]+ a- y) i: ~7 O) H - static int bcnt = 8;
2 Z N( }8 E0 I6 _/ J6 @$ s" s - static int ccnt = 8;
' X2 V \: R3 f6 ~ - + D' S0 m/ T# @* J
- module_param(acnt, int, S_IRUGO);
; J' o2 O2 m# R6 T: S+ ^2 Y - module_param(bcnt, int, S_IRUGO);
% _# z, c, m$ G2 M2 O6 [8 s - module_param(ccnt, int, S_IRUGO);
复制代码 3 l7 I W1 {6 Q* b* @
# e f) Q* g5 ^- d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 h6 @5 p# n# O+ q2 o: [3 O E) varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 Y; F1 V$ L$ j 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 B" d5 Q4 J% @# Y! V' F2 F
Y, e# k; o- h6 h2 y' [0 T% _- ~/ r7 p' P& m K
|
|