|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 V/ X3 d5 h' ?0 V9 Y' D0 c
- [code]EDMA sample test application( ?6 Y# o; H7 K4 y* j" o& _+ ]
- /*
7 e5 W8 q! J( e6 R3 i, z - * edma_test.c0 t1 Z& `* j( l- {, G0 K% \
- *+ S! Z6 i+ c. f2 X2 x
- * brief EDMA3 Test Application7 N# v4 Y0 h" J% U3 o
- *
2 y! l2 F3 g( u* ]# ] - * This file contains EDMA3 Test code.; l: A) c9 @# \1 H8 R- U+ i! `
- *; l' ^. V; a) S$ @% n# _$ g2 H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! L9 }. R5 w3 i4 r
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 b! m4 G& P! K: _ - * TO CHANGE.
/ \+ z& M( m j - *
3 c. J. u9 Y( ^2 z1 p+ h+ w0 u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 Y" J8 Q" o' T
- *
- x; j- y9 i& ? w# ?/ R - * This program is free software; you can redistribute it and/or1 [* N$ B2 W( F, A7 F9 A7 t' ~1 B
- * modify it under the terms of the GNU General Public License as! @3 L$ A! m2 m$ ]1 m
- * published by the Free Software Foundation version 2.% }- z! f# H9 |/ s: A* n- t. c
- *4 R. H" t! O0 D8 @/ g& F) W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any a# N) g% c- }& X
- * kind, whether express or implied; without even the implied warranty, s/ L( X j* S( p* H3 |/ W
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: `$ G w8 L( T! i; \6 k - * GNU General Public License for more details.
9 i" g1 D) Y7 v' I1 Y - */
w$ ]# ^, R0 z& J3 R
8 S$ z# J+ ?5 p0 A% ]- #include <linux/module.h>- p3 n6 a7 u% ~" c3 `% F( v- C
- #include <linux/init.h>
# q+ _, W9 l. W& H9 q0 k - #include <linux/errno.h>5 r6 d" a2 p# |
- #include <linux/types.h>
x! C! v7 ^1 B - #include <linux/interrupt.h>
& S+ y% l8 ~5 ?3 i( | - #include <asm/io.h>9 d" T. G J1 B8 ~
- #include <linux/moduleparam.h>. t! S" P' t+ E
- #include <linux/sysctl.h>
. e9 L% L2 G" ~" U& | - #include <linux/mm.h>
& a( Y$ d) O" K1 B: y5 Y - #include <linux/dma-mapping.h>
1 |: F5 O) T! |: Z" Q. c - " y. C ~% m3 Z6 {" R0 Z
- #include <mach/memory.h>
& }; O e7 ^$ [+ |* \% ` - #include <mach/hardware.h>
5 W" N* Q6 I9 Y! A7 A7 y, R - #include <mach/irqs.h>
6 g# m+ K. o w ^ - #include <asm/hardware/edma.h>
# o/ x! p" u f x) n V" v
5 C( N" `. [1 A9 z F- #undef EDMA3_DEBUG
1 L+ o4 h M" @$ d" k - /*#define EDMA3_DEBUG*/
& C: g/ M$ ^6 B: H# A' m0 P2 D2 k! C' ?7 J - : F$ \) y2 H8 \3 @) k6 m
- #ifdef EDMA3_DEBUG; K! }, w5 ~; W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# Q% Q; ^0 T' c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 Q3 c5 {5 r. O# v - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 ?0 Z; l6 }) R" Q; ~ - #else
! @8 ]+ N9 W! L7 Z: c0 m( g& H - #define DMA_PRINTK( x... )
& {9 S3 |6 l9 z/ B( Q0 g$ V - #define DMA_FN_IN
$ s @! k2 P# N - #define DMA_FN_OUT* y0 v8 ?5 m% w, J5 a6 V F; H% D
- #endif
# u9 }# }. J0 y ~ - + [+ d' ], v( _. F- c& o" f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 D. I9 |, S( R2 f6 H - #define STATIC_SHIFT 39 `* i1 z6 |1 o1 V5 J
- #define TCINTEN_SHIFT 20
b% J1 f: P( M8 p - #define ITCINTEN_SHIFT 21
, h6 ]3 ?2 ^- O4 D - #define TCCHEN_SHIFT 22. q/ O" r' k( y A# n" i) T6 f- P% R3 [
- #define ITCCHEN_SHIFT 23- X! Z' F( I& @ h) d
9 E7 `; x3 c$ k1 k- static volatile int irqraised1 = 0;
% R6 s: V. m+ \% R, L - static volatile int irqraised2 = 0;
; |5 W' |7 I7 N. g3 K/ Y1 l - + t" S) {* N9 }7 b" G
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ S& I1 S( C d; I3 e8 | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ ~- T! E& n) z. g8 O - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( W: u! {. S$ y6 H, t* ^0 k; j
' [. e. l1 B& v7 X" b# x) W- dma_addr_t dmaphyssrc1 = 0;! i, o1 A/ H6 T
- dma_addr_t dmaphyssrc2 = 0;
/ y/ |9 e9 p1 c [ - dma_addr_t dmaphysdest1 = 0;0 O1 { ]1 u* f) A- N, U
- dma_addr_t dmaphysdest2 = 0;% F( z) S d3 d& Z- V; D0 J
' i5 f: `3 g, c3 s3 L- char *dmabufsrc1 = NULL;4 ^, u4 O q$ S( S
- char *dmabufsrc2 = NULL;" C1 I# k u9 J) j, M
- char *dmabufdest1 = NULL;
4 D. c9 h. `7 z6 J# k. ? - char *dmabufdest2 = NULL;
' M) M8 m7 _3 @9 B2 G! h
5 h$ v; a- A* r- static int acnt = 512;$ G- R: N3 e, X) o
- static int bcnt = 8;
1 L# W# k) [# G# \% G _: Z1 m - static int ccnt = 8;
' i, b& y6 R* c& _4 R" q - # D6 S; g. x1 \4 Y4 D
- module_param(acnt, int, S_IRUGO); e# C0 x3 a' d/ M' f# q
- module_param(bcnt, int, S_IRUGO);" f7 m0 L, u: j0 e! w
- module_param(ccnt, int, S_IRUGO);
复制代码 ! V+ e5 j* G- i( p' E
# L D0 w& M- V" a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# z/ g! x: h: X$ ^$ n2 r @% [* v+ \$ Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; J6 n9 w. S& u7 D! T1 S* u% M& K 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% P5 G4 }% V1 n# `; U/ I* y
b |( V& Z& Q3 b3 X% [# d" O4 t. M+ w5 F/ m% B
|
|