|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * Q5 @$ B8 N+ h! G2 N7 e9 q
- [code]EDMA sample test application4 Y6 O# f; h4 ]" T; u
- /*
( g0 t+ Z. V4 v& N2 s# G - * edma_test.c' X0 L1 Z. j0 h) X6 f- ?, d
- *$ a8 \: ?4 U9 w; l. X4 e
- * brief EDMA3 Test Application* p9 K9 u: j# P( Y5 D
- *
N/ ?; A% |* q% D1 ] - * This file contains EDMA3 Test code.
8 G; a+ |9 D4 w- |3 j$ F, o0 y - *
7 }; ?$ D! A i w; N( c2 P - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 d* d; c7 A9 v v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& I! _2 l' l6 B. `, }" W+ D - * TO CHANGE.
+ p' _1 k( x, B/ @5 t1 @" T. x7 N - *& [2 I" {( u" r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 c2 J; n" S7 S - *
7 W3 ^2 e/ W2 ^! o - * This program is free software; you can redistribute it and/or4 V+ f7 x% {* q! a/ ^0 O b9 e/ ]
- * modify it under the terms of the GNU General Public License as
& }6 {, g3 ^' I% U - * published by the Free Software Foundation version 2.' }# p9 x) b$ j: G
- *
3 G; p! J# L2 D. @5 u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% z. U8 L$ B% a7 U: @* v3 k
- * kind, whether express or implied; without even the implied warranty) p7 y k$ z9 m) n6 ]% U3 t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ O4 q' W. N& _! d; R* C7 z
- * GNU General Public License for more details.6 U; {5 H# d+ E+ Q5 j$ V$ P2 \
- */
# Y0 r: V: G6 v: u; C$ q- R - - J! D; X. u- y( I; L
- #include <linux/module.h>
7 c p, U+ o9 L" K- a9 z6 y - #include <linux/init.h>
+ `+ S$ a" k0 o# x4 f- Y$ B - #include <linux/errno.h>
" [# W; {* p! k( O w - #include <linux/types.h>
0 W z& `1 y5 D2 s5 I4 f& x - #include <linux/interrupt.h>
0 |! V/ j. u' s, E8 i3 `% j. W0 A - #include <asm/io.h>
2 D; U6 Y% N* a - #include <linux/moduleparam.h>/ W+ }( S; k5 C* Q
- #include <linux/sysctl.h>
' p: {2 h! v* N$ j/ z+ ]- | - #include <linux/mm.h>0 n" Q. O0 I# T; I3 D' o
- #include <linux/dma-mapping.h>1 E0 q/ f G, E, ~$ A2 I4 ?! j
* r2 d# @$ o5 j( \& m- #include <mach/memory.h>
" O! n7 Y: Y3 M8 X- g4 L - #include <mach/hardware.h>, ?' {6 C& G1 e$ j& l
- #include <mach/irqs.h>
8 I+ I7 H# b; }6 p, Q2 [$ c - #include <asm/hardware/edma.h>
) k4 T- m d& B7 X
5 A. m2 b* `$ @7 E ?8 N1 O* T- #undef EDMA3_DEBUG$ r6 q8 c6 |2 w2 R8 r
- /*#define EDMA3_DEBUG*/
4 i: |/ c7 S" @' g- t0 n
" K, F w' {( x8 w* p2 c# f i7 u- #ifdef EDMA3_DEBUG
1 I& Y. s7 e5 s( l, r. E* r( S- M - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 M, Z) c$ j0 H1 ~: w% G. i1 n. d: Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& W, ?3 b; W/ n( @
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 O p" n( F/ x( N! A
- #else
+ `+ a3 |- ^/ i, I - #define DMA_PRINTK( x... )
( H/ z7 t* E8 }! Q/ s' ]. D - #define DMA_FN_IN$ O4 O/ ~2 X3 E. s3 l
- #define DMA_FN_OUT
( f1 p% N( M. I- w6 ~ - #endif
( Y6 _- C7 n2 z( H9 X' d# I - 9 T% @- |! w' Z" r, @/ d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 W5 M! G: N* l5 l3 S; `& @
- #define STATIC_SHIFT 3
" ~* U9 t; M: e3 y+ I - #define TCINTEN_SHIFT 20* h+ }6 y/ B4 t) ]- x' E2 W
- #define ITCINTEN_SHIFT 21! \( i. `; x9 ^" X) e( \# `
- #define TCCHEN_SHIFT 22% X& B L0 r& y: i7 ]2 a
- #define ITCCHEN_SHIFT 23# r0 r; p0 ~/ ~0 t3 B. F* \3 @
4 ]# u' M; {5 a4 O- static volatile int irqraised1 = 0;
1 C# U% `) A/ X! H- W& g0 e - static volatile int irqraised2 = 0;3 O, M# u; S1 s# I+ C9 ?5 x; _6 H3 r- \
* {4 l' z: j/ K- L7 I- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; p6 _/ Y9 T! \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 ^4 j+ P( f; O: ^+ A/ t ~2 B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 q% X3 F4 w4 `& E8 I; K' C - & O( M: _2 [" K: s W% a5 P
- dma_addr_t dmaphyssrc1 = 0;. l) V& W. `; T; M" H# G# {
- dma_addr_t dmaphyssrc2 = 0;
; O" W, a8 X7 z4 Y8 h' q - dma_addr_t dmaphysdest1 = 0;
+ W' x2 K7 c8 N5 z A; V9 d - dma_addr_t dmaphysdest2 = 0;4 {1 u3 p5 O4 Q* J& X% B8 t
- O; L( B$ T+ B% \" t- char *dmabufsrc1 = NULL; v2 C, o, N8 o6 X- l. ?8 f3 p
- char *dmabufsrc2 = NULL;7 y# Y2 L0 d3 J& l$ Z: X) E
- char *dmabufdest1 = NULL;
; C& Z3 m* @; k% F5 X' G7 ` - char *dmabufdest2 = NULL; A1 D$ ]# t* o q
- 5 Q) a6 s6 f) P1 D
- static int acnt = 512;/ r% T5 Y/ z( _) }$ o& ]
- static int bcnt = 8;- J8 p) ~/ V: T( M! I: v
- static int ccnt = 8;" |7 Z4 k0 @' l; {: ?4 o& k0 {) S
: g6 G$ h& x* c( ?' E7 A- f4 l- module_param(acnt, int, S_IRUGO);
+ a0 I! a& J0 L - module_param(bcnt, int, S_IRUGO);1 T' [& a5 |) g: p' Y3 X) ?
- module_param(ccnt, int, S_IRUGO);
复制代码
: y- l9 g$ n" t6 ?0 H f% r8 X3 ]# k- w) }
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 n& o0 W( k4 u# \ Q j2 y( Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 m* b9 b# X2 ]1 W$ P- a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. h+ M& K) e9 X6 \6 o8 ~
! S1 E1 j# _' L, Z& s
/ ~. {4 i# Q: Q+ {% m |
|