|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( i6 a6 q5 M6 h: _- [code]EDMA sample test application
5 t* o q& M) A% v1 \; d( p5 W - /*
+ E2 r7 S9 `8 n% e6 q) z, ? - * edma_test.c2 R' v1 d6 Z O' u' N: B/ e
- *. \9 M! c7 [: W+ j" r
- * brief EDMA3 Test Application6 b6 C; ?% Y' O( q* O9 v$ I/ ~6 i$ q
- *
B0 \) d) U& Q8 q. @ - * This file contains EDMA3 Test code.
- M# J* [% \- G - *+ \) p5 ^7 K7 ^. @! n3 M& W
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 h, k4 M( Y& g+ L: q1 J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' o! Z* I, K8 g0 X8 U& m$ s5 m' L
- * TO CHANGE.* H# W6 F% ~- o& g e
- *
8 q' I" _0 C6 h' j - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 R* X7 [/ A7 j `, X - *
6 R+ a/ ^4 n& {9 }) l' O - * This program is free software; you can redistribute it and/or
3 |" y6 v6 Q/ Z# H - * modify it under the terms of the GNU General Public License as" s1 p4 [9 H/ m0 ?* {2 ~% ]' g6 _
- * published by the Free Software Foundation version 2.) @+ @3 P, @$ G/ `; \3 k
- *, i2 r% W0 h5 l" ~* P7 E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) O/ ?/ R! M0 u9 p6 K& a4 I1 y - * kind, whether express or implied; without even the implied warranty" D* ^. Q% d ^, M, c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 K: I6 Z8 |0 O( R2 y( A! ~. D/ q
- * GNU General Public License for more details., J9 [4 C5 N' q
- */1 a. |2 L5 c, J' c5 h
: d4 H) M8 u0 r- P% C% v/ @- #include <linux/module.h>. s$ q0 t; s! y6 b1 l4 f
- #include <linux/init.h>/ [5 M% A( K; f4 |. J
- #include <linux/errno.h>
9 S' Q( M t2 d" f5 v* l - #include <linux/types.h>: D# e! y' @) A2 N
- #include <linux/interrupt.h>
/ w, H1 T, {2 R6 k" f - #include <asm/io.h>2 w' K; P4 H% k" M& t' p
- #include <linux/moduleparam.h>
- a7 |% H0 u* _% Q* l - #include <linux/sysctl.h>6 z0 ^$ ]0 M6 a' T
- #include <linux/mm.h>4 F# z }+ b4 f- x' }" o
- #include <linux/dma-mapping.h>- E" M2 ?3 {' T% |, M- p
3 F+ [& L( `& c5 J4 G9 f- #include <mach/memory.h>, b/ X' c) j$ P3 Z
- #include <mach/hardware.h>
, ]' q0 y& |; V" m5 T; Q8 N# k - #include <mach/irqs.h>5 ~# S& e3 \% x5 B( w
- #include <asm/hardware/edma.h>
" t7 _1 N; g/ d' D6 x; R; I* V
* y3 e, y+ l. P* r- #undef EDMA3_DEBUG
- q9 t3 @# J0 u: E0 k - /*#define EDMA3_DEBUG*/8 S. z5 [3 ?+ a+ \: b Q3 ]
/ n% z7 h0 {+ n' x- #ifdef EDMA3_DEBUG+ k0 j' Y% l7 A8 s/ ^1 t+ ~9 P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, ^( |& u+ |% o$ j2 X - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% K- [, U% {7 j. d6 S6 G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ \1 Z% n7 y# h3 x
- #else
. |* J2 ]. L$ O+ M1 D$ f: j - #define DMA_PRINTK( x... )
F+ m! {. C( d$ d" r - #define DMA_FN_IN8 f1 r' h+ d; g( Q
- #define DMA_FN_OUT
' p- o( v0 u) d- i; { - #endif/ H" C% m9 V8 h/ o
. \: M! W+ b& p- #define MAX_DMA_TRANSFER_IN_BYTES (32768). k5 O2 m- g; s8 z% M
- #define STATIC_SHIFT 36 h& ]* r7 H+ k+ y3 e7 o
- #define TCINTEN_SHIFT 200 K; {8 e+ i+ x1 Z6 }! W
- #define ITCINTEN_SHIFT 21
! @8 [; H, \6 s: D( v - #define TCCHEN_SHIFT 22, k+ T7 Z$ N, A1 d! o
- #define ITCCHEN_SHIFT 23
; v+ I! l4 v5 l2 I' n: z! ~
, G0 g+ u& z# ~# ^* i8 R, }- static volatile int irqraised1 = 0;+ R6 x J9 w: ^ w6 T. Y! Z# `# f4 X
- static volatile int irqraised2 = 0;
( R! V" e7 z% A% e5 F
3 p8 X2 V+ n: r7 N: ?3 f t- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 @4 Q$ ?8 L2 k# v# v, R - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* r8 o; q$ ^5 n: V- g0 `! ] - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: o; A k' _( C" x7 C- [ - % O" n# e; q& \. Z( s& g$ v7 ]( N
- dma_addr_t dmaphyssrc1 = 0;
1 O* g& W" ]2 H1 t/ x2 \$ o - dma_addr_t dmaphyssrc2 = 0;# L6 L5 U, Z+ {" n7 [$ g
- dma_addr_t dmaphysdest1 = 0;
9 @! U# K) i% x( ~1 i - dma_addr_t dmaphysdest2 = 0;7 s! N7 s7 m4 L- l- F+ H) u6 U
- 2 k( [, v# w9 v- K4 p a
- char *dmabufsrc1 = NULL;' V: S/ n) R) s3 M: W
- char *dmabufsrc2 = NULL;
1 a3 S* w: t/ K7 Z5 {' U - char *dmabufdest1 = NULL;
! w. k0 \3 u$ i5 r9 r( y - char *dmabufdest2 = NULL;; f, S; V- u, M) K1 u/ b# {- ^0 U
* W* a1 g+ [2 m5 ]0 t- static int acnt = 512;5 B. G. p- |8 b
- static int bcnt = 8;
% Q5 G8 q% Y6 F! M - static int ccnt = 8;
- c; v" N( \; S% Z
( \" A$ r- \, V2 W2 n. n- module_param(acnt, int, S_IRUGO);
. A/ E, `% n( i( N" F - module_param(bcnt, int, S_IRUGO);
4 P ?+ K4 D0 s& Q! g - module_param(ccnt, int, S_IRUGO);
复制代码
* a% S+ K8 z: I2 n, U+ |9 _* y1 S% k6 c. \4 \: j( Y h
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ ~% r% p& F, P' r3 {4 Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. s7 z7 y" F0 m4 U/ [+ w; s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 h8 H& s5 z7 a! Y. r& G* M. z
& E; I5 l6 O6 N6 M. |3 o
+ a4 ^( R9 y: b
|
|