|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : x5 `. K2 R3 I, L6 a/ _. o& D
- [code]EDMA sample test application2 `4 a0 c1 e+ p
- /*3 v. g5 L0 {8 |. E# M3 Z
- * edma_test.c
* o" f: p M9 V. ~+ n1 x - *
3 M `: @5 I3 [8 k5 L& q* f - * brief EDMA3 Test Application a8 \( D( ^# I, O. a
- *& W- L2 r9 J5 l1 m ?0 b9 T1 ^
- * This file contains EDMA3 Test code.( v6 X$ _) r8 o8 K
- *
" n. a8 ^0 u/ m" { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- U8 C+ B! A+ h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- K7 a d* S0 e, Z. b, c$ t# A
- * TO CHANGE.( S/ ^$ ^9 c1 x/ \/ [0 F: j
- *
) g" }8 y: Y8 a! F* H# w0 H' W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& v' @' ^. N# b' j - *6 L. [1 K+ Z5 y
- * This program is free software; you can redistribute it and/or' V0 _" P6 p8 g9 N
- * modify it under the terms of the GNU General Public License as ^+ M% W" k7 G6 B8 b0 B" S
- * published by the Free Software Foundation version 2.
/ m2 c6 ?: N* v- M' z2 ` - *! p7 Z: d! S1 h6 C
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 F( N% V* K; ?- T ?* m
- * kind, whether express or implied; without even the implied warranty
* Y$ j( d" O" }8 t4 q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) j" _- b1 {1 s! K
- * GNU General Public License for more details.
% o5 u8 K+ r# v) _ - */, \: }) M1 I7 T$ \& c
- ' P8 z, ^$ D4 Y
- #include <linux/module.h>: k4 U. g3 H# {7 ~ g! r
- #include <linux/init.h>
( n% M5 B% s( X7 M. ~ - #include <linux/errno.h>
- l7 }9 x. X: q* R4 a {+ w - #include <linux/types.h>
# J4 E- P7 n8 H( A - #include <linux/interrupt.h>
2 c8 @* D* b& a2 c4 b$ j# T - #include <asm/io.h>
4 P) H" a, [) i6 v - #include <linux/moduleparam.h>( _" T# ~' e5 H& p
- #include <linux/sysctl.h>' E# Y3 C9 a+ W& l7 V
- #include <linux/mm.h>
6 y2 G9 o' V+ d7 p) W1 Q E - #include <linux/dma-mapping.h>, W! i4 w' h1 s+ R0 |8 D
- 3 V# B5 B7 i i" I; u! d( f
- #include <mach/memory.h>
1 ~& D, T# b/ L% r- X2 L/ f - #include <mach/hardware.h>5 h; q* m& a) J, _9 b
- #include <mach/irqs.h># ?/ a( z& I/ c6 }9 \8 N L
- #include <asm/hardware/edma.h>* z; Q5 C0 }2 ~, v' ~$ ^
- ; _+ i+ P' c+ u7 x0 j
- #undef EDMA3_DEBUG6 r4 S, _8 A/ e) y
- /*#define EDMA3_DEBUG*/# P: l4 h, V8 i: L! i# Z- ^+ v
- 9 Q0 S: J7 ?! U. q
- #ifdef EDMA3_DEBUG
2 K# Q0 I r$ E/ p$ o) j! O# _! Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 p- | V4 Z* ]4 ~- b/ c* {
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! o# ?8 Q* ?& i9 l2 W. K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) j i) s. N. x- A: ? s9 H2 Z
- #else
. |8 |/ \0 F, g3 p: J - #define DMA_PRINTK( x... )# _) M5 e/ R- C
- #define DMA_FN_IN
0 X, |- Q2 O3 e4 w5 ]" i8 |6 X; H - #define DMA_FN_OUT
! q! u9 Q; ], X - #endif
, u$ q- Q- Q u* \ - ) Z" f9 p) _0 t: G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! t' A# p" B. T8 W - #define STATIC_SHIFT 3
, v+ A; n( f! N& W5 d! K - #define TCINTEN_SHIFT 20
. [' Y" o) C( l" ~ - #define ITCINTEN_SHIFT 21
$ b# T$ X( o# {% Q - #define TCCHEN_SHIFT 229 H- Q( P% T0 G9 R
- #define ITCCHEN_SHIFT 23
% W% k( M9 f+ e+ p; U8 w
! Q; _" Z/ A4 T- z( \8 q- static volatile int irqraised1 = 0;! o, d) u! L) y" k
- static volatile int irqraised2 = 0;
: o! D8 M- z% ~, H4 s" Y/ X
; B! x8 s: U0 s. @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% N& k. T. q5 O, `' d; V
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. `% s/ Y* W) x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 _' M; g* I1 i
4 `8 O2 M3 b" C' h) F& |* r0 @. d- dma_addr_t dmaphyssrc1 = 0;
- N: x3 C" X$ k# y H6 ]1 a - dma_addr_t dmaphyssrc2 = 0;( r4 x- o* D" O' b9 `$ {7 d
- dma_addr_t dmaphysdest1 = 0;2 C+ H, G d8 E/ i& i9 O# _' l
- dma_addr_t dmaphysdest2 = 0;, [. h8 G8 V$ l2 V. M$ o& b
- ! X8 A" i1 d* a3 l% M/ f
- char *dmabufsrc1 = NULL;
' q/ j' e) O( Z) v - char *dmabufsrc2 = NULL;
% e% u( G2 }$ W- w8 n* B - char *dmabufdest1 = NULL;
t9 G; n d3 O- L. g - char *dmabufdest2 = NULL;8 h) R% e, C; t" ]
% Z/ ~1 D# U+ S' ~) A) ^- static int acnt = 512;
* H# Q7 _4 _0 ~0 L) F9 g3 U - static int bcnt = 8;
5 `/ s2 l: S, o" h# r" A: g - static int ccnt = 8;8 n4 W+ T! _" x' R. D0 Q- O+ T
$ Y. E& W) o4 L, T" V" n% g- module_param(acnt, int, S_IRUGO);1 s9 g. N* Q8 k$ }$ _
- module_param(bcnt, int, S_IRUGO);5 G- R+ q" v, Z7 c% q- [2 P
- module_param(ccnt, int, S_IRUGO);
复制代码 ; G; D% X% N) d& W3 h6 C$ }) `" r
* z$ e8 v4 G- z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' k# s$ t; P% y( A! y( q2 | E0 k! b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. F* H0 L' C5 g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# p4 m c- ?8 o3 @3 o
) G0 ~7 n2 [6 C; |6 O; E1 B/ T3 }' x$ r$ s, Y+ A( m9 M
|
|