|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# M8 d' z2 Z; e; s) I. i- [code]EDMA sample test application% V2 t- l; `. I1 S1 G
- /*
' ~% h7 t6 L0 }3 F - * edma_test.c
" ]0 z3 O* w' L - *7 v, r" d7 Q& N) s+ p/ L
- * brief EDMA3 Test Application
4 m$ u5 x, S$ _1 a/ v( Q0 x: E - *
" M5 } O, ^+ q. ^4 I - * This file contains EDMA3 Test code.
; c! U$ V, k9 ^! l4 _+ H* c - *( ~, l9 y# J8 @2 @
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 i- S) _+ w% U+ g; n4 ^1 O/ n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. S* t, [9 B1 I - * TO CHANGE.
. Y& J( n2 O/ Q# } ]7 C - *, t! X! ?5 J" C `* P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! _! I6 P, Y+ d. w
- *- w% c2 }/ j7 n b
- * This program is free software; you can redistribute it and/or
" B+ Q" k6 Q( B2 Z - * modify it under the terms of the GNU General Public License as% M6 L& D; S+ l* }% G6 T
- * published by the Free Software Foundation version 2.+ S: `( j5 W& a' n' S7 @
- ** d! o- T2 p3 I) x$ ~7 y( k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ V' v3 L4 h: I
- * kind, whether express or implied; without even the implied warranty
' C# ~0 W, x& ^6 r! e% w6 A - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" S r0 `$ X; ^. d1 {* ? - * GNU General Public License for more details.
& A9 R3 s1 ]; @ s* V' H - */( z* \$ q. P& K' N6 D7 g6 @. }
& L6 h N! }0 J- #include <linux/module.h>
9 L0 J/ u7 u. e. O: n; B - #include <linux/init.h>
. F7 a8 Y" {7 L* h5 S - #include <linux/errno.h>
9 f6 C: \8 Z7 R0 H. |/ N$ b - #include <linux/types.h>
" t1 L! m" O; z& Q - #include <linux/interrupt.h>) c+ n5 j- ?) I: n
- #include <asm/io.h>7 v+ e) o; i6 O
- #include <linux/moduleparam.h>2 Y2 I/ E/ ~ Z) I
- #include <linux/sysctl.h># ?6 Y: B4 B! j" [; K3 C
- #include <linux/mm.h>
3 F1 g; K# I% b. c1 a/ v6 g: Y - #include <linux/dma-mapping.h>& f6 Z* u# B( p5 x4 }$ v
- : e) C A& h7 M, @
- #include <mach/memory.h>5 Z( y4 ?9 q& w( k0 P
- #include <mach/hardware.h>+ l* e$ S1 Z3 H# ^" `& W+ p' J
- #include <mach/irqs.h>
s7 B, ?8 a+ _ - #include <asm/hardware/edma.h>
# n. x; [: ~$ U M - 9 o6 w- V& K; [! H/ a
- #undef EDMA3_DEBUG
3 f) E3 W% @" d - /*#define EDMA3_DEBUG*/1 m4 k9 u0 A$ W
- 1 j% x1 t. w) p/ ^; o+ a& g
- #ifdef EDMA3_DEBUG
7 ?/ q: D+ D& |( N: j - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 I! C% x3 m% o# U" b; h# S! C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& n/ }+ x/ s3 ]' V/ I) X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- O9 X" a) ~; r; ^: v, L - #else$ g' l7 y0 A+ M3 B- A) t
- #define DMA_PRINTK( x... )
8 K: x y. J7 B' ]0 P - #define DMA_FN_IN8 R+ @+ T h* R! n! ?! h
- #define DMA_FN_OUT
* M: _& Q1 `7 {; s. ] - #endif+ ^" ?3 d' z# W6 m7 W( @: Z
- + u4 f4 h$ h3 q3 b- Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 v; Z: ?0 s$ x5 K/ c - #define STATIC_SHIFT 3
; W t! v& r* ~! Y& O7 Z - #define TCINTEN_SHIFT 20; M- }5 S6 j3 M
- #define ITCINTEN_SHIFT 21
2 \' h" S/ p' k: r* q+ r - #define TCCHEN_SHIFT 22
S' x0 L2 g' { t0 n - #define ITCCHEN_SHIFT 23
+ V; f% d2 u8 `! ?7 k$ u - ) ^' g+ }4 Q' T
- static volatile int irqraised1 = 0;6 F3 z9 B9 H+ V
- static volatile int irqraised2 = 0;
* ^- s5 i4 |1 x7 i( J' D$ m
' k# s' A* _" B/ A- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ {% a% L6 w+ B- l2 ^8 _ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; a' v! b% x" ~9 P* q8 q9 T
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- {. V8 o& Y A6 \/ w - - A/ \. W8 D" _) B: ~9 z4 R
- dma_addr_t dmaphyssrc1 = 0;
- Q9 o: g0 P6 B4 W9 Q7 d - dma_addr_t dmaphyssrc2 = 0;
' r1 b% d: W7 z+ C$ n. h0 @# U0 y - dma_addr_t dmaphysdest1 = 0;
" u, u Q, x. l& o8 d - dma_addr_t dmaphysdest2 = 0;
5 a# J" j( \9 m% ^5 u- T5 O) i V+ J* t
+ R8 ?" H0 C. N* z Z- char *dmabufsrc1 = NULL;% C2 \1 u1 A7 y# R: V
- char *dmabufsrc2 = NULL;
0 L ~! ?5 l/ M; m - char *dmabufdest1 = NULL;8 G/ K9 y4 P$ f) Y- R: k& Y
- char *dmabufdest2 = NULL;8 M; l1 v9 p, k0 g$ ]
8 f) Y, w1 H5 V1 l- static int acnt = 512;
5 S/ |+ x: S% o# Q5 N& C- T - static int bcnt = 8;
4 `: P: m& J9 H - static int ccnt = 8;3 v6 y( v( n* Q1 X3 s C
4 g/ a3 h0 T+ S* Y, g- module_param(acnt, int, S_IRUGO);
1 I3 d- D: a. b q* c# w0 P+ k1 C' S - module_param(bcnt, int, S_IRUGO);
4 G! M# q" y, |4 p% z - module_param(ccnt, int, S_IRUGO);
复制代码 2 y( Y) ?3 N3 F1 ?
" J3 h% w, ~& @. `# t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 G, S6 j* v* Y* b5 V( U! s' K# ?
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+ L- X' L6 E, p$ ^: b3 R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 B; t2 V. @, ?4 m8 Q. _
8 d8 ?# ?1 g( _% v. @
. `: a+ `7 B3 n" X4 j7 b5 M& e S |
|