|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 n1 X T0 L) h" ]% `. ]$ W
- [code]EDMA sample test application
; K4 [8 ^$ V4 b; _& F6 ] - /*2 @7 n5 [/ N/ ~
- * edma_test.c
( J1 t. S% A. I1 n8 z - *
9 _" V4 G* _* M5 o8 C - * brief EDMA3 Test Application
, T# }: r. w+ y) V+ a# G" D - *3 @0 K: l9 u* P4 E& j
- * This file contains EDMA3 Test code./ e0 a& v, h5 _( ^' o% X
- *+ c8 e8 n- W0 p y6 T1 \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ |: f' s+ V" |$ w& |8 [- E - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 P2 K- p6 o$ q" h0 i6 h
- * TO CHANGE.4 Q) I9 N$ j- t' t9 @+ F
- *. v' ]6 ?2 \, z$ V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 u+ K% [$ J5 v: H/ |' u - *
0 u9 \- c/ d0 c! w, \: p - * This program is free software; you can redistribute it and/or6 v% ?- D* Z$ N
- * modify it under the terms of the GNU General Public License as
& E1 W7 E, B! z% o. l& q* \% s1 | - * published by the Free Software Foundation version 2.
# B9 E1 u/ q8 K6 ~' U+ s - *: I4 l5 {: `2 H/ a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% U+ y+ V# p( [# P7 l' ]
- * kind, whether express or implied; without even the implied warranty& }* ~( ^, b4 Q5 P* z7 N4 |5 D. _
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 }3 c" V* W$ T+ R
- * GNU General Public License for more details.
5 Z3 D) o9 Y# m - */* E# V$ Z, A* m4 _9 p7 T5 }- p2 ~
- 2 `; D. m. s: t+ N
- #include <linux/module.h>
6 \ M7 K. x7 `! {+ |" P$ V - #include <linux/init.h>
/ W% ]8 S9 A4 |& Y/ F" e( T5 h# ^ - #include <linux/errno.h>1 ^: X( [, k% M
- #include <linux/types.h>3 Z1 T; {* e* N+ N* l
- #include <linux/interrupt.h>
) U9 o% e" u1 H8 B& i- a - #include <asm/io.h>
$ L, R3 K4 e' c2 _ - #include <linux/moduleparam.h>
5 H/ C; A8 V0 y2 C( F1 }0 T* a - #include <linux/sysctl.h>: q$ J) f% i4 t' y/ `
- #include <linux/mm.h>& _" S) Z# Q4 K* v6 f$ x& f& w
- #include <linux/dma-mapping.h>; B' v. T! S. x: t& Z' h5 o
( t/ L( V3 `: m! G0 y- #include <mach/memory.h>5 @5 Y" C" J+ w! J: w
- #include <mach/hardware.h>
" y! s( a' }, i2 R5 b! y - #include <mach/irqs.h>$ M( }! y9 l( K! S" L
- #include <asm/hardware/edma.h>
. K4 ^2 j* s8 Z, Q3 F
9 U6 v c0 b! x ^* p3 f' S- #undef EDMA3_DEBUG
$ b0 ~! i; \, r0 c5 K# o' E+ v - /*#define EDMA3_DEBUG*/
1 L4 y& X' ]& P* j5 |
, U5 _' H2 z7 z1 s: E$ H V& {- #ifdef EDMA3_DEBUG$ V: C& }. }/ P! S; `+ J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 x4 S8 ?& Q& s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 U2 e; w; J6 j6 t, h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); u5 Q6 M0 u) l
- #else' O9 H+ h* I! H$ w( C& E0 ?: x
- #define DMA_PRINTK( x... )6 s% P0 O# \6 T# f9 L
- #define DMA_FN_IN
. z' t8 H# c. [2 ^ - #define DMA_FN_OUT
; }9 P& C& ~4 N% ] [5 g' j8 k$ [ - #endif
6 F, ~+ |0 [: x1 R& L4 Q
) _4 B8 U4 O j- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# Z2 M6 l8 l7 o# }4 k; U - #define STATIC_SHIFT 3
3 J: W; ~! L+ T. c2 |! N - #define TCINTEN_SHIFT 20
0 o: G6 {4 m' @3 q E& e - #define ITCINTEN_SHIFT 21
" Z) m4 a$ F* b% ^& o - #define TCCHEN_SHIFT 220 r; o0 p/ q3 r4 B$ F* ~4 Z
- #define ITCCHEN_SHIFT 23
4 u( l0 G2 H0 n3 ^3 T" Y; L - # e% Z, W; a& ~4 Z+ I- b9 D1 V6 Y
- static volatile int irqraised1 = 0; m% |. }" T m% K0 k2 W
- static volatile int irqraised2 = 0;
; w9 P# E+ |: F
5 O! v. Y; H" y' D( J0 W0 @; K4 d- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* N$ t3 T+ A* e1 u& m8 k
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. @ M. M, z0 M' i5 R e. c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ g5 F# o" m, J! Z
- & b0 J4 E5 y5 H7 k" V5 `8 j
- dma_addr_t dmaphyssrc1 = 0;
% \+ N3 v( t) E# X% Y - dma_addr_t dmaphyssrc2 = 0;) a& a, q W4 d& ]
- dma_addr_t dmaphysdest1 = 0;! p: V9 ^: p# k9 d$ c, X
- dma_addr_t dmaphysdest2 = 0;4 }" M& r; {7 D1 K
- 5 r; v0 g8 W/ h, `" L; W: [$ i( ?6 `
- char *dmabufsrc1 = NULL;2 F5 l% S3 \) x5 ?
- char *dmabufsrc2 = NULL;
! z' G' v" P- x; c; h/ R d: O4 M0 I - char *dmabufdest1 = NULL;
& N) U' M0 W8 `- P C, @# E" v' w" Y% P - char *dmabufdest2 = NULL;
) [8 [4 C3 }% ^0 Z- s9 _8 `' b - , v! \9 `+ b" H3 C
- static int acnt = 512;3 y% w/ H8 \& x# Z9 C" y
- static int bcnt = 8;4 k) b# `2 f8 C/ w
- static int ccnt = 8;
o& @% k$ o+ P
* B7 S" e) |9 k; W$ \1 h3 [: _% |- module_param(acnt, int, S_IRUGO);9 ~2 [/ H1 Z" a1 x8 h7 h
- module_param(bcnt, int, S_IRUGO);
! `# R% Q# P' l' @9 S- l# i - module_param(ccnt, int, S_IRUGO);
复制代码
1 a* A' Y0 x! k- m7 L. z" B2 V+ I) Y G2 `) U! l
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; x2 U; |+ [2 P0 N) S& T# yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* m: X x2 o, c6 k! b0 r* I# y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" Y6 S# E, ]+ f, S' F; R( f
, ?2 K1 z- O1 @- K G6 s i
+ r7 ]7 D. p7 e |
|