|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 i9 @/ u/ w3 {* R
- [code]EDMA sample test application
: P4 ~5 J' L6 ? - /*, R6 j, x3 D% n; U* |2 H
- * edma_test.c( ~: J4 b# [" z) P, a
- */ l3 ~" Q' b. i# y" R, x
- * brief EDMA3 Test Application
U+ S8 x N- j1 y8 Q - *
9 a. |* ?# u# s9 i. w3 H3 x - * This file contains EDMA3 Test code.
9 J! @) R- S% l5 U - *3 g+ [1 w# U1 o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' V- |# v" N" e, Y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& J7 Z9 N% h" R* b$ K - * TO CHANGE.
1 q7 U+ S7 S3 |; B4 X1 J w9 k - *" }# v0 O; n* j, s0 y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: {" R2 M3 e, B - *
* I! w8 B: c* A! }6 @( B; } - * This program is free software; you can redistribute it and/or
6 F5 N2 ~ l' I6 n* d- ~$ o# H - * modify it under the terms of the GNU General Public License as# m. Y8 F: j5 T% X/ O# e1 [
- * published by the Free Software Foundation version 2.9 d2 A5 ^5 i- d
- *
) K! q1 o2 [. o, @ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 b; x* `. A3 J3 H f
- * kind, whether express or implied; without even the implied warranty* d9 m4 q5 |# E% |# ?
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 M: F$ ^+ j5 d+ X% E - * GNU General Public License for more details.. Z$ M: e# R: ~; k
- */8 ?. s: I' U) ~- Z" `# ]/ B
4 |% W/ e" Z, `8 Y- m7 E4 F- #include <linux/module.h>
# ?6 O! _: ~; v% |: [% v - #include <linux/init.h>- z' f3 N4 k h1 T, Y4 {) z3 D& T
- #include <linux/errno.h>4 k1 I" A/ d5 {7 e9 m
- #include <linux/types.h>. v6 W; S, l; q3 _5 J
- #include <linux/interrupt.h>
3 F" r0 Y$ X8 b- a$ t, f - #include <asm/io.h>$ M# ?8 A( D/ V" c
- #include <linux/moduleparam.h>
% f8 Q% y) d+ T( { - #include <linux/sysctl.h>
3 B$ i8 J2 s6 V2 F - #include <linux/mm.h>, @; ~ Q+ g% J) Q/ Y8 X# @7 l0 S
- #include <linux/dma-mapping.h>
" ~4 @1 ]4 A1 b- \" g% N" ^ - 4 {3 Y9 I1 U* j0 C
- #include <mach/memory.h>
3 u' J K# b, W# d/ J - #include <mach/hardware.h>7 w3 G9 M, e* L" k4 {
- #include <mach/irqs.h>2 d( l' H2 w8 E6 r- u# m
- #include <asm/hardware/edma.h>
9 d" F8 |4 d! ~% }, V* |3 Y - $ y5 |! J2 V3 r! [
- #undef EDMA3_DEBUG6 }1 K% W n1 A/ A# u' E3 c
- /*#define EDMA3_DEBUG*/
/ o" G$ {5 V: V! g2 N) `3 y
8 |- H |! {/ j6 O- #ifdef EDMA3_DEBUG7 ^) f' B' U3 `4 R& ]. O5 c
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 b x2 _% f. n0 U - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 A# d' N4 U/ }& w/ X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 m: E) i' ]! h" h& Y - #else, [8 u+ F( v) B6 |1 l* L
- #define DMA_PRINTK( x... )3 [6 Y, I/ V' O+ ^- h: I
- #define DMA_FN_IN1 l; {) P* ?8 L
- #define DMA_FN_OUT4 F( Y5 O& [# E6 `1 r, [* a: a
- #endif. X2 D4 w; E8 c5 C; F
- ; J4 m( a* i$ }- T$ }' x! Y4 y2 _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 ]0 |6 K0 b3 p/ ` - #define STATIC_SHIFT 3
: M+ d& t5 l. Z5 L8 m+ e9 j6 A - #define TCINTEN_SHIFT 207 r. `! Y7 Z7 ]; A9 x I0 |
- #define ITCINTEN_SHIFT 21
0 N5 {3 C7 {% x9 y0 M - #define TCCHEN_SHIFT 22
- i: X* h7 E" |' F+ M$ C - #define ITCCHEN_SHIFT 23
/ r6 }% h3 _& `1 m - " G. D3 w& F( Y1 f) k1 _! @5 i* \
- static volatile int irqraised1 = 0;% c# z' S& O; L( S$ l2 g5 j
- static volatile int irqraised2 = 0;
0 {& o: t9 T e' ^4 J8 J( D( n - : d+ Q+ }+ w% K# g7 H) d. f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 L3 o) |- x9 ], ]7 m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ Q, I& z' f3 F) F+ H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ ~: Z7 }& b7 A4 Q# e5 i - * d! u2 _# y0 k; f b
- dma_addr_t dmaphyssrc1 = 0;
0 |& G7 D/ U/ |$ s& s- t5 m* } - dma_addr_t dmaphyssrc2 = 0;
5 j% w! |( W1 ~' r; _* F7 o& z9 x - dma_addr_t dmaphysdest1 = 0;7 ~6 R( o: [ q8 T
- dma_addr_t dmaphysdest2 = 0;& S! t7 O' t& [3 I( R5 S
- 4 V1 i6 M2 _% N: S: X* Z
- char *dmabufsrc1 = NULL;
& q6 \6 S& n9 `4 e - char *dmabufsrc2 = NULL;
2 `! E" t2 i3 e# U( X' |, N - char *dmabufdest1 = NULL;
; _' r# `0 ~: b7 I. B8 N! R: P - char *dmabufdest2 = NULL;
L; x" v( u2 {5 r
- `% q0 P! r7 j0 L% q- static int acnt = 512;
. H P6 L2 L3 r. m( A - static int bcnt = 8;
; w* {8 |2 c f' H9 ? D - static int ccnt = 8; |: k% T& t9 r: b8 r. @
- 4 i% S0 X$ F. m9 [ E
- module_param(acnt, int, S_IRUGO);: j [" [6 o3 D- S& B% j
- module_param(bcnt, int, S_IRUGO);7 |, g- [* X) D8 T0 b* x5 [3 S
- module_param(ccnt, int, S_IRUGO);
复制代码 2 `4 `8 Z$ D7 R7 R" c
3 @: _1 t2 J& v; k5 R. Y- i( l
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 b, M. U, Z( w1 Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 m0 F8 W5 n- C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) R4 {. m4 O* h, M; w
5 m% L+ F/ J" K1 c1 k7 q& X
* {0 ^' d+ V5 g, b" o. S |
|