|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 d& W+ s* F: u9 \
- [code]EDMA sample test application
( C# l6 }* [; t; |* W - /** N5 X/ `1 ]4 M" m' c' w
- * edma_test.c
: X% C7 ^2 b' G0 P6 D0 ~8 o - *
9 z! Y$ g0 ~( l; V( a+ Y4 O - * brief EDMA3 Test Application- j- ?! k1 ^' Z. B: W
- *
/ T' w0 g( h. i! O& C% r- k - * This file contains EDMA3 Test code.
+ ^" [% z" C4 q0 I8 s, r3 M1 _ - *
7 ]3 t; I) n6 E$ I4 U8 N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! ^, i0 d! T9 O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% M/ `& L& V1 n* \( d
- * TO CHANGE.
, R6 \' A! o+ Z) Q% b. ~ - *& n/ k" L l) U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% U# {8 C" N' l u - *: z, y" B/ t! u
- * This program is free software; you can redistribute it and/or
: L J- G5 r4 i1 T+ K - * modify it under the terms of the GNU General Public License as) r0 F. J; M5 D L
- * published by the Free Software Foundation version 2.
& i" @) m/ F8 ^( x - *
' F& h! s/ H5 Q' @1 e: ?$ c0 _5 ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. h% Z) ~9 P* R
- * kind, whether express or implied; without even the implied warranty
+ ]8 s- ~4 g6 X. Z4 ]' w) c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: j5 v- u# S% t1 F; J# x
- * GNU General Public License for more details.
6 w; F, ]6 B4 c3 L3 o - */! J" J5 P8 V; I3 y& u% ~
- , _) L. R7 a4 M& A1 R5 g
- #include <linux/module.h>
3 k- Q# R! B0 I% g( e8 D V- u, d - #include <linux/init.h>
( d" n( K- f1 T: ~ - #include <linux/errno.h>4 U8 E* ~2 L! i: K. I8 u/ T
- #include <linux/types.h>
3 }6 ~. ]. m B& B, b$ T( ~: Q - #include <linux/interrupt.h>
/ }6 j0 F& _4 |! ?4 B7 S0 a - #include <asm/io.h>) @5 m# N; j% k2 m; m
- #include <linux/moduleparam.h>* j4 ]* P1 h( _% x! W
- #include <linux/sysctl.h>
& W- ? P5 D( ]1 C- {* W - #include <linux/mm.h>
$ W/ p6 V4 A3 v; z: G - #include <linux/dma-mapping.h>
# r0 ^* f0 }- p+ b9 }
* [" y: x$ a! m$ S! N, f% N2 u- #include <mach/memory.h>
% Q( M! ]! u( g - #include <mach/hardware.h>+ F2 |8 B h. g1 V" f0 g
- #include <mach/irqs.h>
# h+ ^; h3 ]7 G - #include <asm/hardware/edma.h>8 V" F: z# t6 F; S# a/ J
- 5 I6 g" J9 y Z
- #undef EDMA3_DEBUG h2 z% t j' Z1 _8 [% \
- /*#define EDMA3_DEBUG*/+ ?% A- y; E$ T$ p5 h/ M
- 6 f6 W0 d# l" n1 T
- #ifdef EDMA3_DEBUG) G" W7 H+ |4 _$ L" _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 p, X7 L( X/ T - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& u# g/ u8 N; S. J; W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* |+ |2 y$ v& g1 q# S: n - #else7 p; A; t3 o: f$ L
- #define DMA_PRINTK( x... )
. e, o* y, E) m3 Y8 O8 y - #define DMA_FN_IN
, E$ N8 x0 `9 Z - #define DMA_FN_OUT
: c) U& i; {/ o8 U% k7 g% e - #endif/ E4 \/ D- d% G9 ]
" h9 y" E4 _* a) F. ~- Z7 ]2 y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 ^ Q( P) g& f3 \3 K
- #define STATIC_SHIFT 3& R9 U1 Z( i5 W* r- Y6 V, C) c' T
- #define TCINTEN_SHIFT 20
, M0 O6 p& @3 U7 a, B7 ` - #define ITCINTEN_SHIFT 21
! m$ {& H+ o) g4 l8 w" h X+ ] - #define TCCHEN_SHIFT 22
9 z6 A/ [0 c: q6 K - #define ITCCHEN_SHIFT 23
7 F+ N8 w' |# L; m: d - # y0 c6 l1 c l% I" {" p9 j$ O3 h
- static volatile int irqraised1 = 0;
8 O1 y4 ]/ V; ]7 r - static volatile int irqraised2 = 0;' h4 y& I! s$ D: Y
+ ]. ]0 K7 R9 y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* t3 v( I1 p/ k' Q% X7 ^$ y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& @* R7 e( C1 U/ {1 q, _. m+ q% O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 K* |; k$ F2 @% A9 s3 D
7 h% V, ~% _% `- dma_addr_t dmaphyssrc1 = 0;
" U. `8 H% s- k - dma_addr_t dmaphyssrc2 = 0;1 @/ p. @& r$ b4 [$ o
- dma_addr_t dmaphysdest1 = 0;7 ^$ @. E; O+ u/ W, ?
- dma_addr_t dmaphysdest2 = 0;
) K t; h0 h: W4 W' @; R
2 A& H) Y( v+ H- char *dmabufsrc1 = NULL;
) M3 A$ r& S( A - char *dmabufsrc2 = NULL;
2 B2 l* O. Z3 _" F- B - char *dmabufdest1 = NULL;
) h, p8 e% {' h( ~/ c& B5 t - char *dmabufdest2 = NULL;
\) q; _' R0 G A
6 q4 d, F p" a3 r# ]7 m% Z/ ~- static int acnt = 512;
0 E6 f: z4 S. h - static int bcnt = 8;
! H" v, h ?9 u9 E - static int ccnt = 8;
1 p& T* `; M+ l( u4 {
! s) m) }) [& y6 q0 g1 L7 M+ Y$ H, h- module_param(acnt, int, S_IRUGO);
/ W# J& ~7 B# A2 _/ C - module_param(bcnt, int, S_IRUGO);
& x6 j: b9 s* [: T e) B - module_param(ccnt, int, S_IRUGO);
复制代码
1 q% E- ?" _+ J1 E
& p) [2 B1 S2 w; I4 D) _ v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 N. a# b% m) o4 f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& Z, W/ F4 u7 c% J1 M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' A0 ^' S: T% k/ K
1 `. e4 X% s( o0 f
4 H% y C3 M& ^1 \1 g( w D |
|