|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& e( C0 S3 S% B l t/ q/ n3 z- [code]EDMA sample test application
9 D+ s" u1 L+ b& J6 J - /*
A2 L& J7 D; F! J# _/ m- Y - * edma_test.c5 o: @, N& b7 I7 [( g- v
- *
3 ^3 a/ f* q7 N: _2 b3 b3 M1 E% e& L - * brief EDMA3 Test Application4 C- e, [% [- l0 C& s5 E/ x
- *7 B6 o3 b9 k, d. g* H
- * This file contains EDMA3 Test code.
0 [8 C* _! H5 w6 x1 p - *
5 y; E2 h7 z R# l9 z0 L- F! W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) v9 O. q. I0 O- I0 @& d, W4 I
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( O2 E+ w# }) R0 ^+ r6 X+ t' C - * TO CHANGE.
# M: O4 V: j1 ^- E, W - *
' D! V5 k4 |. Y( O - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: J: S4 F; x9 r; b1 y% c0 K- n) T
- *( P; y! u. y) K' l$ x
- * This program is free software; you can redistribute it and/or7 k! A8 q2 h+ k9 a. c: _( q
- * modify it under the terms of the GNU General Public License as
; n8 Z/ b# q" i& l - * published by the Free Software Foundation version 2.
. P' L/ z3 |' l7 w - * G- F8 h% g K3 E ]' W3 S* Q0 a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
X: W! T4 ]4 Q' j+ H, S - * kind, whether express or implied; without even the implied warranty' h8 G+ [5 v6 ]1 V7 F" y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 u9 I( ^' g; h. x( e1 f' T
- * GNU General Public License for more details.
4 I* ?, Y) i* Y# U i; {( ` - */: w0 O6 z- s3 h9 Z+ {
- & w* S. @8 I7 u+ {0 y$ S/ n1 d" F% V
- #include <linux/module.h>
- E ~7 K* e5 i( K9 H X( K - #include <linux/init.h>
: L5 D5 L: F3 I - #include <linux/errno.h>+ P0 Q& D3 }) T0 d
- #include <linux/types.h>7 O' W, x! w+ g }# _% t! ?! k
- #include <linux/interrupt.h>7 O" l( @/ ?& ~( S$ i0 q
- #include <asm/io.h>8 p! C# }1 S% t
- #include <linux/moduleparam.h>8 P2 A# ]4 ]7 w
- #include <linux/sysctl.h>, w4 g+ E% ]$ Q- ]5 U" Z" G
- #include <linux/mm.h> s" |) D( Q( Q
- #include <linux/dma-mapping.h>
' o q1 }9 F) B7 s
) @+ I0 C2 c7 u/ M7 f* T6 j- #include <mach/memory.h>
* R. ?6 C7 M9 F) g* L; p" c$ W - #include <mach/hardware.h>
0 x" i4 l( B2 X' w4 U - #include <mach/irqs.h>7 D( q: l8 L# b6 y [9 M. |
- #include <asm/hardware/edma.h>
e! b$ g4 [* F0 v; `( I6 X - 4 s* o$ [( S5 R% Q
- #undef EDMA3_DEBUG
$ s( v, T8 Z3 o; F7 ^ - /*#define EDMA3_DEBUG*/
4 _: Y& ?) u. W) q9 p6 F: _& b
+ f- X& v5 K4 ?4 Q! C: v- #ifdef EDMA3_DEBUG8 x5 `3 Y7 y9 c, c# }
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# W" m! D) f7 `8 Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); ?- }5 [8 N8 z1 f9 ?
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( ?6 M# D, P+ s( M6 @+ B' P4 e - #else
1 S" N/ G1 z: w; D$ e, K - #define DMA_PRINTK( x... )2 p: m1 ]' t+ K
- #define DMA_FN_IN
& B. ]; M! f+ T/ O' h0 G - #define DMA_FN_OUT
5 F9 G# J6 V7 B0 ?$ Y R# o) M8 |1 e - #endif
9 ]4 N# k4 a/ @# C* J - : S- u& C4 G& i/ A2 E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ }. w% s1 ~* ]# }5 d - #define STATIC_SHIFT 36 Z2 @! j+ p0 u/ ]* q
- #define TCINTEN_SHIFT 205 N6 D9 M6 s* y
- #define ITCINTEN_SHIFT 21& a% _ _& A) C5 i# ~
- #define TCCHEN_SHIFT 22
4 C- c8 \/ L+ h% o' \2 {: O$ s+ g - #define ITCCHEN_SHIFT 23
' c/ P8 v2 M+ A7 s2 ^3 G% ^5 ~+ G
8 g8 _& m9 I- p/ Q: S z! D- static volatile int irqraised1 = 0;9 H, `+ @$ ]6 Q; }5 f
- static volatile int irqraised2 = 0;% N( Z- K; R, d5 M* z$ b
- 0 `' s7 A. P5 \( O2 S/ K- b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 R3 a! ]& {& ]) ]( Y/ g1 H" f
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 |/ ]' K/ z# L/ a( c8 q3 r- b - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# A6 k! A+ h7 ?1 a, {
( ^% u7 f4 f6 {- dma_addr_t dmaphyssrc1 = 0;1 }# P6 d8 R" A9 G6 L
- dma_addr_t dmaphyssrc2 = 0;' w+ Q r1 `2 [0 @: @
- dma_addr_t dmaphysdest1 = 0;8 h* ]/ E3 |5 Q& T" D
- dma_addr_t dmaphysdest2 = 0;5 s% O( h. W0 ^+ e! Y
" y; S' }) |8 ~9 p0 [- char *dmabufsrc1 = NULL;( k& Z! U1 b/ |9 Q+ [& k8 L# \$ A
- char *dmabufsrc2 = NULL;
# V, }( W" K" ]& N9 V( F) M( [ - char *dmabufdest1 = NULL;8 a" J1 ^1 J) a
- char *dmabufdest2 = NULL;- Z6 N5 {' z' {8 c. d' d
9 h. Z5 A/ C" b/ ?# V- static int acnt = 512;0 `6 k- X! a3 }8 t
- static int bcnt = 8;
- d/ i$ X, e6 t" O; u1 u* ~ - static int ccnt = 8;
+ p& C9 q( q6 T. V; r/ [1 E% @
' ?' e, f0 l/ Y7 p* `0 ?: l- module_param(acnt, int, S_IRUGO);
6 n; f8 N% c0 s2 @! Q8 j x' H - module_param(bcnt, int, S_IRUGO);
* A# Z5 }. D6 \7 d! Y - module_param(ccnt, int, S_IRUGO);
复制代码 ! {: ^. X) E0 y3 {' F
- ^- M$ q+ Z0 y. x& H n6 O
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 }7 v8 k6 Q: X6 ~; X! 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; \1 d7 x- C# L- O |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: x3 c6 _- D5 ^1 p8 J1 Q1 E& s2 f) z% D) l2 y6 g, p1 R+ p, c& s
* T% G0 v" e" G+ o |
|