|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : t; p% V/ N |7 V N
- [code]EDMA sample test application
; e; X6 l7 t& O1 b8 d" K - /*+ ~4 x6 Y# E) p& c; J" P5 k/ s
- * edma_test.c
4 H; }) u$ ~5 `; q - *
* ^& E# m) I) v - * brief EDMA3 Test Application1 h, {/ B+ P4 k% [
- *
$ J+ f2 }% Q2 l; X! i- M+ g - * This file contains EDMA3 Test code.1 ~ ~* R( v( U6 u3 L6 o
- *. x8 Q! ^1 [6 ]4 L% \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
n; \. X. b/ y1 V0 u) S+ y- w - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: ?3 D: o; p- }" h - * TO CHANGE.
" k8 e f* K0 `) l - *2 B X4 Y7 v8 b5 P9 h) R! X- R n
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! C6 j% e* H$ E; O) ^7 [ - *
9 f+ M) H/ d/ C5 h - * This program is free software; you can redistribute it and/or( I+ S. o# B% c4 s( k2 B5 r
- * modify it under the terms of the GNU General Public License as: i# f) {( z6 `7 H& L9 N( X
- * published by the Free Software Foundation version 2./ r% C1 z( N; M2 }0 [, U6 V
- *
" n; _$ x4 S! p9 I6 l - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 G4 Z4 b) i6 q# g G) R1 i* m
- * kind, whether express or implied; without even the implied warranty
5 `7 h: [) h! e/ g p& ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 s. P+ g" ^ G( X - * GNU General Public License for more details.
& c- s" |/ t# @& c& X) M& Q/ Y$ F - */
& u/ e! Y k* q+ T3 S# _
7 y' Q3 O) P/ k. P- J+ y- #include <linux/module.h>
; j# }2 l, c9 U) Y! U0 m' p0 K - #include <linux/init.h>6 {9 z0 {, J1 ?* q2 X
- #include <linux/errno.h>
+ R4 Z0 N5 P5 u - #include <linux/types.h>9 S5 X& G* j8 [4 C
- #include <linux/interrupt.h>
2 C0 `) B1 T% _0 o3 d - #include <asm/io.h>
# V( Y. d8 }$ X6 V, P - #include <linux/moduleparam.h>/ Z5 R C7 S: l, R4 j D
- #include <linux/sysctl.h>& e' q. V+ X2 O2 o) J
- #include <linux/mm.h>: d- I1 k8 k" ]7 |
- #include <linux/dma-mapping.h>
; e1 P0 x7 M1 A% k
4 {6 @ C$ R5 x- #include <mach/memory.h># o0 `0 P! b7 J$ f* v. Y6 a( c
- #include <mach/hardware.h>8 T. r2 _1 B$ n6 ~: b2 j
- #include <mach/irqs.h>3 l- `# r7 y$ j( A
- #include <asm/hardware/edma.h>2 `/ F/ ]# T6 [- P' j4 T" F3 k
- : G: \8 d. K" ^( W9 B+ _
- #undef EDMA3_DEBUG
; K: _. R- }" A& H8 e C7 r8 H - /*#define EDMA3_DEBUG*/
" b7 x, p+ s( E/ k+ Y - 9 n/ i9 u: b$ O# b8 v: O
- #ifdef EDMA3_DEBUG
' R# R6 w% y3 P' g& h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 M/ g# _: F% c y$ w - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, _( A p! V# T: j2 j - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& e- e6 T+ }$ u
- #else: e' I$ b$ G; G1 e- Q- T2 F( M
- #define DMA_PRINTK( x... ): F' O! j7 ?- S# X5 c! X/ @
- #define DMA_FN_IN
( U& L( E7 p7 k' |9 J# e( Z - #define DMA_FN_OUT
; i8 D" p' f* Y. `4 l7 ` - #endif1 @7 ^9 W" D& @/ z9 y4 F( M
- ; }$ @+ y2 [. ^; U1 w
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* I6 r3 d5 v$ z" O% f
- #define STATIC_SHIFT 3
: i& I& P$ p( R. ~+ s - #define TCINTEN_SHIFT 20
! y0 e: Q8 @* N1 U0 u* [# e3 i - #define ITCINTEN_SHIFT 210 V& } Z$ C) P" D
- #define TCCHEN_SHIFT 221 D' Z. i. B& N( X$ f( @# d6 I+ U: r
- #define ITCCHEN_SHIFT 23# T3 H, c c" q/ i) z, p& E5 W
6 d6 P: [1 t. U: o$ M- static volatile int irqraised1 = 0;
) J# s& R" m; X+ w& [. n; x - static volatile int irqraised2 = 0;
: B" ?$ ~' Z k! n4 y
d5 d1 d7 F$ g6 |( n1 c, J4 D- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 F) Q+ [# N/ E ?; U; r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, p4 X$ s" Y5 g4 i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: i) _1 t; F: I1 X0 j, }8 O* _ - - V" b3 u( ]. e; d7 b- H. M
- dma_addr_t dmaphyssrc1 = 0;" x! T4 \/ |* \0 ]8 h
- dma_addr_t dmaphyssrc2 = 0;! R1 q! [) }% ^( T- ~' b
- dma_addr_t dmaphysdest1 = 0;8 p- q; Y" K# N2 ^6 {4 V
- dma_addr_t dmaphysdest2 = 0;
* w7 }: w" P+ L0 l/ x1 p - ; G" {- Q& p2 W1 H. e$ R7 r8 q
- char *dmabufsrc1 = NULL; X4 A* T x/ h$ V( ~# l
- char *dmabufsrc2 = NULL;
* J. G5 T* [7 r! \& ^ - char *dmabufdest1 = NULL;3 K" ~8 f0 |. F G$ B! s
- char *dmabufdest2 = NULL;
) o @, D4 d- h7 C. x+ e9 P - ( v0 p7 J" s: ^
- static int acnt = 512;
6 { I; q* y" C* \7 ?6 A - static int bcnt = 8;
! G4 |1 y" V3 F# r8 B) L - static int ccnt = 8;* U8 u3 Z4 Q) u5 u7 f) k- U0 [
7 \; S) e, |' W8 k. b6 G# B- module_param(acnt, int, S_IRUGO);/ ^/ z7 E6 t9 c! X
- module_param(bcnt, int, S_IRUGO);! C! J8 X: C# _4 K3 m* E
- module_param(ccnt, int, S_IRUGO);
复制代码
" Z! U2 g$ t8 k. H! a7 a
* ^* k6 `- I/ c* h2 b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; v1 B5 [9 N$ ^: {! v/ ~9 Q! r* [" c/ z
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ e, J5 ]; W9 M# S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! c" I3 K4 C* f
( X% {! m7 q. t K+ g( l
8 g) G5 Y, B4 x% I |
|