|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 t: t% `3 V8 o+ I2 w
- [code]EDMA sample test application
; L& ^1 }/ V" P: u5 `7 p7 E: V - /*
9 d. D& p! t4 p! l$ S; o. |; r% } - * edma_test.c& K, t/ X+ y3 G
- *
" F3 \ p; ?9 i% _$ a' A - * brief EDMA3 Test Application
+ e* s! z8 Q9 S9 E7 J" J - *, q1 R6 {2 ]" w0 V* V
- * This file contains EDMA3 Test code.
( ]" h% T# @+ d. H - *
6 v, z7 @/ N" B2 ] - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ Q$ Z1 i0 |+ L: p( a - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 q8 J; M+ |+ D0 \: q& r
- * TO CHANGE.6 Z& c4 b ~% O, ^0 Y2 M# C9 r
- *3 X, a L# ?& `1 B) P5 I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; M/ w- a2 H( I+ F" T& t+ y' z
- *
$ l& O8 x8 @' t$ _8 o) t - * This program is free software; you can redistribute it and/or
$ c$ ^! C8 w8 X, c - * modify it under the terms of the GNU General Public License as* s' Y9 N0 J; F. P( U4 [9 \
- * published by the Free Software Foundation version 2.- }) t9 v/ s6 G6 v; p: r
- *( y& v1 u) f, g/ h( m2 g
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 J! ]9 T3 r1 |; o+ m: x2 j1 ]
- * kind, whether express or implied; without even the implied warranty
$ _4 a# W/ S$ d: G# t* N - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 z: {) b+ ^( k" T
- * GNU General Public License for more details.2 n" [. J% ^' N
- */
0 P9 C" ]9 ^4 x; `/ M - r' L; \2 j& K {& p
- #include <linux/module.h>7 {1 {! E: Q2 j: c) @
- #include <linux/init.h>9 H* {$ b7 [2 H7 n- V7 x
- #include <linux/errno.h>/ L) F9 _+ ?. Q+ }9 r; H
- #include <linux/types.h>
5 x- N9 P/ W9 `( J7 T - #include <linux/interrupt.h>/ H" y- w# j4 U& H
- #include <asm/io.h>
/ n* p" a# v6 [6 f - #include <linux/moduleparam.h>/ E0 V/ c3 J( f3 u8 i
- #include <linux/sysctl.h>1 f- W1 w$ Q. p' Z- ], s
- #include <linux/mm.h> @. v/ I: z$ G" F W
- #include <linux/dma-mapping.h>
% H/ j' j9 ~ \ - 9 }& \+ |$ T2 t, K o
- #include <mach/memory.h>2 H5 c; }" i: y2 X6 ?! A m1 F# c$ O e
- #include <mach/hardware.h>7 W8 M' k3 e6 z5 t4 l
- #include <mach/irqs.h>% O; M* F, i/ [8 e" C4 }* A7 ~- o
- #include <asm/hardware/edma.h>2 }1 m: q2 ]; @+ p' y
- * _$ g: v4 h) N; F
- #undef EDMA3_DEBUG: y$ }8 @9 ?- i3 ?
- /*#define EDMA3_DEBUG*/
) T1 }5 |. G- V; z( S: z5 G
0 _. O& y8 p# p& g# `7 `- #ifdef EDMA3_DEBUG
& z1 v( ~2 n6 ~1 F8 {! R% \+ r - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ k0 J7 y( L0 ]' B B" T3 L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 r& F3 w2 K/ U7 s" d! C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 f& J7 n! S- z& v! f4 q* f/ W - #else
) ]) P9 F. A* G+ L( J4 V2 p* j - #define DMA_PRINTK( x... ) Q; F/ U @# J2 G D7 P
- #define DMA_FN_IN* w0 \& W; c P( j7 U/ X5 a
- #define DMA_FN_OUT
* I. Y. \$ s, u. y - #endif
9 R6 L: @' I# E- F& v: b: k - ) A* f6 l. N4 f* G1 H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# q! ?$ B' y; {6 Q - #define STATIC_SHIFT 3
% Y" T6 L3 S+ e2 [: W# S n* V - #define TCINTEN_SHIFT 201 }- W) W/ e! M, d( ^# g
- #define ITCINTEN_SHIFT 21
# ?* ?# p; y( y9 Y6 j+ V' } - #define TCCHEN_SHIFT 22 b+ @ Z U o4 a9 L- A
- #define ITCCHEN_SHIFT 23
; O- b# j; e$ R2 ` - : N4 J* u0 @% u% e. E" }3 x
- static volatile int irqraised1 = 0;
0 @4 \$ J: _1 d1 l! h - static volatile int irqraised2 = 0;
+ ~: l% G) l* u9 h: r z" I3 v& o- O - 7 s6 a2 E- y1 x% Q: t8 X) q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 I2 k3 b w6 \* t" Q/ q2 M6 @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 d" T# }- _( ]7 W0 d9 o6 j5 ^
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( K$ x$ L% ?4 Q/ i$ o
8 F+ I" f+ S& L0 a: I* W- dma_addr_t dmaphyssrc1 = 0;
+ P" S, a; G/ l0 L! S - dma_addr_t dmaphyssrc2 = 0;
. H) @( s, w5 Z/ q# T - dma_addr_t dmaphysdest1 = 0;
9 u3 R! i* s7 i - dma_addr_t dmaphysdest2 = 0;
% U) t7 C J/ f" e ?
5 _. S% L/ F e( a- char *dmabufsrc1 = NULL;# ]' H D" x' D o
- char *dmabufsrc2 = NULL;
2 i) Y/ E0 j+ e" y* x& u - char *dmabufdest1 = NULL;8 ~& ^; Z( ^7 n4 T
- char *dmabufdest2 = NULL;
; W1 |7 I) N! S3 _ - ; k$ g- _1 s7 C& k+ z* l ^* B9 ^1 i" d; }
- static int acnt = 512;
" p7 d5 {4 S9 x4 S4 A - static int bcnt = 8; k6 m/ u3 d9 K/ ~3 S3 k
- static int ccnt = 8;
/ @8 U1 J6 y- O
; \/ S! P3 A5 g* B" {3 `: d- module_param(acnt, int, S_IRUGO);
: W6 W3 `% \# O0 U5 L3 w - module_param(bcnt, int, S_IRUGO);
1 g2 X3 c+ `, ~ - module_param(ccnt, int, S_IRUGO);
复制代码
3 k3 ?% J: r" G. _1 O9 O# s5 }1 ~3 a+ w* u. k! U0 ~! W
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. D3 V( s& O+ l: earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 y8 K+ ]: ]- v1 \2 ^) p3 c
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. s- Z+ Z+ L% l4 I
6 T3 M+ [* h, `6 E7 W4 J3 Y; [6 J; A6 C% c
|
|