|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 r, T( B9 _5 V) i- [code]EDMA sample test application1 ?) {% q& u6 e: I1 h, L9 |
- /*
8 P! E* y8 i, r2 X( @* Z% x - * edma_test.c& W# f5 h; u) G+ c8 f
- *
/ }9 G' \- [, O( V+ h9 v - * brief EDMA3 Test Application
2 c6 W3 Y. r# X, J: W# x - *9 F' W& A- `$ M3 S
- * This file contains EDMA3 Test code.
2 b: f6 h# |% E9 L" w' c! H - *4 o- Y( f2 ?9 Q! a' S: G4 `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. R: d! P/ N. D9 K - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 u) h) f) ~0 d; E; Y
- * TO CHANGE.
+ n2 T$ t; g6 W5 w) n7 t; y8 i; [7 w - *. M* l% ^% P% i. j& Y1 A& n# r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 ]( D1 S. k0 c - *
, ?: m, @1 o6 U6 c4 K - * This program is free software; you can redistribute it and/or
u9 A) K1 g6 `% H - * modify it under the terms of the GNU General Public License as
# a. \' h! R- X# K1 L# x" A - * published by the Free Software Foundation version 2.
& k8 u6 S+ Y$ L# W2 t - *
* B6 a& n& L$ T$ L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& w. M# E; F0 ?( A# p8 A' o - * kind, whether express or implied; without even the implied warranty2 S) Y8 b1 [: e& h' g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' h% j# @; n0 I5 s
- * GNU General Public License for more details.
1 J/ X, B9 [+ m: m0 R0 V1 v - */$ Z( O/ P+ Q9 `! ]' R
- D( u% r) u( S: o
- #include <linux/module.h>0 [5 F% x. ?: H2 U
- #include <linux/init.h>. J& D5 G. d( c" S' O; f1 X @
- #include <linux/errno.h>9 |1 P0 u1 r2 C8 E1 B( h; b2 ?
- #include <linux/types.h>$ u! O. g2 ^+ G }4 ~
- #include <linux/interrupt.h>6 v0 @' P# A+ ]$ n5 _
- #include <asm/io.h>
# s1 D7 p5 O6 _- G) G - #include <linux/moduleparam.h>
& k2 ]# U. C" ] - #include <linux/sysctl.h>5 t9 L" x! `% M0 o, Y3 k* z( q. M
- #include <linux/mm.h>
4 `% c% D6 L; h' I- V( }8 H - #include <linux/dma-mapping.h>3 h ?; D( e+ L' u; M' }5 _
- * k. z: W( P8 q' Y' l: R& b1 x
- #include <mach/memory.h>7 Y5 X% S/ X* B! C0 s/ {
- #include <mach/hardware.h>
: `* a3 i# h& V. T - #include <mach/irqs.h>" B& g' H+ ?* l, n( \$ T: x
- #include <asm/hardware/edma.h>5 R: k) }7 G! ?$ q: ?% q! W
- $ p( m6 C2 q6 D
- #undef EDMA3_DEBUG
( l4 @3 L0 i3 Z; P5 J& _ - /*#define EDMA3_DEBUG*/
+ A8 l1 j+ |9 D1 k& r, i
; p1 S, f% h G0 d- #ifdef EDMA3_DEBUG/ k: z" q3 x6 v* L: i' W9 I* D" L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ T+ P7 A; V1 m+ [ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- a& z! [; m+ S/ }- F- h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ F7 J' T O' T4 z& K - #else# f/ H6 |0 r I; P1 V
- #define DMA_PRINTK( x... )
& D ~7 }# J: o3 S - #define DMA_FN_IN
' R. {! @: q5 @7 U9 T" ] - #define DMA_FN_OUT
7 T4 b1 O4 v# V; O+ ~' F# { - #endif ^0 F& L0 q# J$ C
3 U2 f) t6 a+ O, s! t/ f5 k5 W- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% \( F' G8 e. Q( k - #define STATIC_SHIFT 3
7 S; \) d \ Y" g - #define TCINTEN_SHIFT 205 v8 T$ E3 ~9 z7 h8 ?0 m' N
- #define ITCINTEN_SHIFT 21
% A4 n) z g4 e) H: h$ [ - #define TCCHEN_SHIFT 22
8 T0 y0 d6 h+ F - #define ITCCHEN_SHIFT 23
5 t2 g- ~1 m6 J2 L# g0 O* Y/ G5 P - , g/ R& L6 C* T, ?) x! s, Z
- static volatile int irqraised1 = 0;
! C/ r( T* d3 [" d0 i - static volatile int irqraised2 = 0;: x" }8 d! c! C
- , f& t* S* K. v* L$ W1 {: Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* N& L, ~' @9 P" q$ `1 f
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ j( Z# f5 |7 t& h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. }, E/ o5 C3 q; K - ( L) ~. \/ G. f2 Q K# u% t% e
- dma_addr_t dmaphyssrc1 = 0;
6 p: e6 G& u1 A, u8 L - dma_addr_t dmaphyssrc2 = 0;# w5 j( n/ [3 F8 A, g$ @
- dma_addr_t dmaphysdest1 = 0;
- w9 K" F2 M( v# p l) O - dma_addr_t dmaphysdest2 = 0;3 ^8 e+ k7 u9 [7 R. R Y: z1 {
- ' T# o; p! p% j. h r) q
- char *dmabufsrc1 = NULL;
; j+ ]# s1 R4 K5 [0 C# p - char *dmabufsrc2 = NULL;
# b. M# f$ a" ?7 B5 e - char *dmabufdest1 = NULL;& S9 K( \. Z5 ]9 j% D
- char *dmabufdest2 = NULL;8 L- g% P$ x( e( L, K
- & Z1 { Z/ z* i; j8 j
- static int acnt = 512;" j9 ^( Q/ Q, s* @# s
- static int bcnt = 8;
' a/ P% M' d- e - static int ccnt = 8;* v8 e8 Q* K3 p0 i
- 5 m6 ~6 u$ r: ^7 \& O: K- _$ T
- module_param(acnt, int, S_IRUGO);9 F' I$ G3 t$ w u7 P+ }
- module_param(bcnt, int, S_IRUGO);
& u* P. _. B7 K% f! ~5 ?0 @$ R - module_param(ccnt, int, S_IRUGO);
复制代码
! Y. M3 O! |1 v/ G. j$ u7 D* l( q# Z7 a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& [4 s% Z4 Z/ F( f& A; z# x( Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 d" h7 O$ f& B6 ^2 ? 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# @: W8 _9 O" k1 b9 m
! f7 a, i m. @: Z" Q1 ^
7 I/ S. d; w4 N! Q3 i
|
|