|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 @5 S b" R2 H2 S
- [code]EDMA sample test application0 I0 f$ s2 }, p' G7 A3 @
- /*
8 c/ r- c& r8 }' P4 D - * edma_test.c5 U' o- C* y2 U
- *
* @% M6 m4 e. c0 x - * brief EDMA3 Test Application
& l9 X6 U }5 `; x- i - *. ?% Y D. w6 x3 i4 t$ M( l
- * This file contains EDMA3 Test code.
' u& p& b# x; _1 I7 _9 n - *" B" L k4 x3 N3 G/ @
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; p+ j# c" @; p
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- Y# I) y0 B; [ - * TO CHANGE.
8 t* Y$ K# K1 n3 J6 j. x) L - *
0 Q. ?) E b. R* D4 J8 z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# h& z0 [. l& W a8 T6 m
- *
: w) e$ ~2 V: f9 C - * This program is free software; you can redistribute it and/or
3 n- ]6 p. c4 z4 L1 G8 I - * modify it under the terms of the GNU General Public License as+ n6 e. I' ` Q+ A, s2 m& V
- * published by the Free Software Foundation version 2. h* W H) U/ U% E& L# k
- *5 N6 i& I- ?# @# I6 Q! v
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% z2 t& d' G& i1 O- a - * kind, whether express or implied; without even the implied warranty+ f+ `1 e- _: c' E: R! W
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 g; P5 ~2 [. |# b: F - * GNU General Public License for more details./ w) t0 P% ]9 }; U0 J& r3 V
- */9 m, D; J9 w2 o4 D0 S
- * M( D3 F' a3 ? e5 {. d$ W! d
- #include <linux/module.h>6 n* Q1 _& y& Q2 g9 X7 T% v. y
- #include <linux/init.h>5 h" A h; Y+ v$ D
- #include <linux/errno.h>1 |# {5 h; @, S% v) }$ p9 o0 B- p( K1 @
- #include <linux/types.h>
/ F% C! i5 R5 i: ?/ Z% H# U0 r9 U# @ - #include <linux/interrupt.h>
" j/ k+ ~1 ^, E: D/ p& Q+ X - #include <asm/io.h>: a, O G' p, [
- #include <linux/moduleparam.h>* @$ s9 }' N- n% O. n, {+ p
- #include <linux/sysctl.h>
6 X2 K$ B; y2 t! C - #include <linux/mm.h>
1 |& x6 t" p; K - #include <linux/dma-mapping.h>" _; F& [% Z, W9 x
- * X) U! Y1 a5 A9 p( l& ?+ V
- #include <mach/memory.h>- D5 S$ Y: Z3 f; N" W, K9 u$ t
- #include <mach/hardware.h>! b8 @/ H( y( ^3 Y' k, O
- #include <mach/irqs.h>4 P' B" ^0 \: j4 P1 d" b/ s
- #include <asm/hardware/edma.h>
0 A* u( X# c' X- S' ]3 b& O$ {
6 r/ [4 X$ }/ J- u L9 j1 r- #undef EDMA3_DEBUG+ E" C3 H. P1 x
- /*#define EDMA3_DEBUG*/
% q' F6 u8 G* S+ j - 3 r- Y/ U U& o2 b* ^
- #ifdef EDMA3_DEBUG
2 I' _# U' Q* e5 M( [) x - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ e/ z% a& y S) K" U l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 P# T* o$ ?* e0 p
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& @! H# t: w7 S. l
- #else
. c. ]5 n' D7 _1 S) j5 E - #define DMA_PRINTK( x... )5 N; l: s3 [, m) V
- #define DMA_FN_IN
% ^( ?& ^1 ~2 b/ v - #define DMA_FN_OUT$ M: z& ?& [% `+ M% @
- #endif4 h h2 B( D" s" J7 t2 ]
- $ f2 n2 z/ G% F, _! y; K7 q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 p+ w& w" c- l& U) k8 n5 [. G - #define STATIC_SHIFT 37 C+ S* v$ e' k% G2 i/ p0 {6 R
- #define TCINTEN_SHIFT 20# W% R/ b" i0 i" [- c
- #define ITCINTEN_SHIFT 21
3 g; Y* T0 C; o5 r# ] - #define TCCHEN_SHIFT 22
/ }' i W$ U% k" S' \ - #define ITCCHEN_SHIFT 23
, n: V$ x w' j. H3 p* N7 Y
, w8 X/ F$ U- U8 v7 ?3 N- ]- static volatile int irqraised1 = 0;
3 m" \# Y5 Y7 p b) G8 |" o - static volatile int irqraised2 = 0;
: j) L, g5 Q$ d3 W4 Z3 c& x - " R7 L( G: Y) J" O0 H
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% d7 l: }9 m, i s3 N) e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 |. @/ i9 L! \7 {2 ^# }4 B7 K - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* C5 T* V; z: B
# t+ c Q8 } P, j- dma_addr_t dmaphyssrc1 = 0;
) u. m. \/ a8 |1 V - dma_addr_t dmaphyssrc2 = 0;2 \! \, b. x8 V) E6 G# e* b* y
- dma_addr_t dmaphysdest1 = 0;
7 h! r5 [. j' u! N6 |" o& H6 ~% B - dma_addr_t dmaphysdest2 = 0;
$ N" c S1 `) P) F - ( S5 Z1 }( n" I2 s6 W
- char *dmabufsrc1 = NULL;
! ^7 n0 j) |+ i8 A7 |8 ? - char *dmabufsrc2 = NULL;
* f# W2 q& C" ]4 w J - char *dmabufdest1 = NULL;
/ R, R% I6 W' M9 K8 `; t2 S4 O8 ^5 k - char *dmabufdest2 = NULL;
, N. d m" W ~. t - 6 r: d b# c0 T% ^- m+ S2 _$ u; }
- static int acnt = 512;
N6 w, }& n: F& ?8 q- C; Y2 J% j - static int bcnt = 8;1 u( }% Q5 a$ y# l ?" Y5 Z! X
- static int ccnt = 8;
2 M# w, o, i; E, x6 u# R3 C5 a
- a, u7 q) d) L$ j$ S. G- module_param(acnt, int, S_IRUGO);; ]) v" C4 [3 j/ o1 _
- module_param(bcnt, int, S_IRUGO);
. t$ M: b6 \, @3 m - module_param(ccnt, int, S_IRUGO);
复制代码
* O- ^$ Z: ^. h# H% F; Q* R( E. a7 V( f# q" Z- j! ]
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ W5 Z" m# ?4 I+ Y# w9 r# [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 I8 |3 }) V' N: v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 ?) `8 E+ ]; y5 j9 D! j, X
! P# ~* ?" r4 n5 K! p
* f' W! H3 z4 ]/ B. [, j |
|