|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( H+ @5 e3 o% U% W# ^ z
- [code]EDMA sample test application4 Y1 Z8 N; a* e# {# Z
- /*8 m0 v5 @' W8 k4 h2 i
- * edma_test.c
" B0 y O) b' ?& ~/ J; { - *
3 h7 H# d& R& [/ l$ m' E - * brief EDMA3 Test Application8 |& W ?: Q! C
- *6 C) R6 F9 z9 o4 A a
- * This file contains EDMA3 Test code.: D! M6 `& [ |, m n5 {1 H
- *
" y, I& v; d; T t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 O/ r& V7 n! ^5 E, t% h5 m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 r A- ?$ G# Y; C9 @2 X" D* C - * TO CHANGE.
]7 v4 i- s3 W0 Q$ @# k& I8 j - *0 q: {; D" U+ c" A) v: K& p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" o4 p% J9 U; l7 E
- *
" j9 _/ Y0 K* g1 J# ~) j - * This program is free software; you can redistribute it and/or
( X- R, F% w3 {5 L- J+ v: X% ^* \ Z - * modify it under the terms of the GNU General Public License as' \* M1 q+ {9 B2 E7 N, R5 | ~
- * published by the Free Software Foundation version 2.
2 ~- ?6 j5 y6 Q1 L - *1 L) x% D+ [6 p3 I
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ W9 }6 N9 E8 k; Q- |# J - * kind, whether express or implied; without even the implied warranty
' {9 k' e+ p9 K' L8 o8 u: w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ R* Y6 v3 \3 Q# A* w8 e4 o - * GNU General Public License for more details.$ `( y8 \9 s5 }9 B, D. D& R
- */
; J2 T% m; O4 d$ {9 q. \
. [' E# x" h0 S) L1 e- #include <linux/module.h>; b3 T# p6 l$ ^7 t K$ b
- #include <linux/init.h>
( ]3 i$ m9 |! X& D7 b: e0 `+ x9 t2 g - #include <linux/errno.h>" |' B, m& l+ c) q! q
- #include <linux/types.h>
8 C, X( n. G) |7 `, J - #include <linux/interrupt.h>
/ [7 ?6 v, |8 r" ~& S9 t - #include <asm/io.h>
# z# k+ Y; P/ v1 _5 j - #include <linux/moduleparam.h>
6 |# n$ u6 \8 ~ - #include <linux/sysctl.h>5 L4 l4 D; q% Q* l7 c- M' j
- #include <linux/mm.h>3 {: k+ f5 U0 Q& |8 b1 ~
- #include <linux/dma-mapping.h>
4 t' E, F+ n$ I; B- E - ! g2 u+ W+ y. ?* [/ B3 v
- #include <mach/memory.h>* Z' w) C- e% J, p( ? o) ?
- #include <mach/hardware.h>
5 j+ q3 o2 P3 N- W/ h2 l - #include <mach/irqs.h>
) s$ N5 Q; x* t+ F - #include <asm/hardware/edma.h>" O4 i6 j4 E/ b! p+ A: t
- $ Y( n. _3 w5 ?9 a8 ^
- #undef EDMA3_DEBUG
7 G4 O: X4 W- P - /*#define EDMA3_DEBUG*/: c' e/ H9 ]& L' Z2 F7 S
4 K/ |1 N; p6 e% O4 h7 B- #ifdef EDMA3_DEBUG
' t4 y- ~6 l% P' v* K! @; V; C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ H: }! T5 B( j5 P4 C* Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ t2 U+ }7 N% x) j2 T0 n
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); Q, [8 |, ?: S% G
- #else4 ?; l3 |' B6 u9 w1 M) g
- #define DMA_PRINTK( x... )
; f$ d3 |: i6 b% d) P+ @7 q: L - #define DMA_FN_IN+ R! g2 S" X1 V1 U
- #define DMA_FN_OUT
8 ?8 ]& T2 ~$ p* `$ |" C+ i* c - #endif
# e# ^" Q/ c; b - $ P5 Y/ k" ?: X2 R2 X
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: R8 O" u$ Q' i$ w& q; M - #define STATIC_SHIFT 3
" F/ N0 ]/ i1 N: D1 V( ? w - #define TCINTEN_SHIFT 207 {0 J- ~0 K& X9 a
- #define ITCINTEN_SHIFT 211 n; Q5 O! h6 u, R( h
- #define TCCHEN_SHIFT 223 g _, V s4 Q: V Y# G3 V
- #define ITCCHEN_SHIFT 23
& R1 Q8 J/ l; j6 Z3 b- T( U
5 ^/ A1 e/ H6 F8 }& N- static volatile int irqraised1 = 0;
6 n: V7 u' f% A/ p+ U - static volatile int irqraised2 = 0;
1 d& s! L( O# y9 G' o- x
, W5 n# \5 h [/ q: u$ y3 g- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; {+ M/ G; ~/ W1 T# D! j& S/ f0 Z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
S; e6 z! _4 A& f7 |4 ?4 A4 k) j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ E7 r4 v: U* ^/ V$ z( z
$ {5 M; v% ~) r- w$ j! m- dma_addr_t dmaphyssrc1 = 0;
+ J5 s: T, u0 w/ @, p - dma_addr_t dmaphyssrc2 = 0;
, W' L9 _6 f5 E/ D* w( Y- M3 w - dma_addr_t dmaphysdest1 = 0;& {3 t# F( @, |3 \4 M* u8 u
- dma_addr_t dmaphysdest2 = 0;
0 L; z- r7 v& S |9 J2 |4 \ - . X" B( v1 ^7 o( d# \
- char *dmabufsrc1 = NULL;/ Y: W* G: _* k6 M' S
- char *dmabufsrc2 = NULL;2 h! f# p9 Z5 j, a' d* c! Y) P
- char *dmabufdest1 = NULL;
, q: n( @9 X" Q' K7 ^' A& j+ q( p: j - char *dmabufdest2 = NULL; I1 q0 Q$ k2 a$ }* d( I& N8 I
0 Z- i% ~: J* B$ D s- static int acnt = 512;
9 P$ l5 n$ E1 O: F4 j( g n - static int bcnt = 8;
9 t% X" t# O* B) K; U - static int ccnt = 8;
5 o x2 I5 U r- D, S& R0 | - ) y& I, R& E" n
- module_param(acnt, int, S_IRUGO);$ p9 c6 W9 C/ e) h& k1 c
- module_param(bcnt, int, S_IRUGO);$ Q# U0 z+ ~& K* @' E5 b& o: T
- module_param(ccnt, int, S_IRUGO);
复制代码 ' q) |! ^, u3 X9 ?8 w5 D
7 R! W3 P0 g. ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' O! R, x. b. E4 f! h' |5 o/ sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. ]) o5 @8 `. c3 Y0 o: b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ e; ^7 g, ]( }( x4 T E
. i I/ b* A3 Z* j4 M) m2 |
' b8 {3 S% a. D( G |
|