|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 a" j: M! m9 i6 \) s" W
- [code]EDMA sample test application
/ ?: Q1 K- m: v. E A7 p - /*+ C! m/ \3 X: G7 s" r
- * edma_test.c' D- X) c2 [3 _5 G
- * v0 P! E& j( z0 b+ G, C
- * brief EDMA3 Test Application! o0 C! M1 j5 J1 h; S+ Y; {
- *
- ]: Y! Y& V$ S2 m0 U- f - * This file contains EDMA3 Test code.4 m! @( ?" y' `/ w# G: x
- *1 C5 c- W8 ~8 ~7 ?. r% @( M
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 { A! z+ l4 q- n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& j' E0 m8 c* c' H! x7 Z( s - * TO CHANGE.
7 \" Q c+ A @, Q - *
$ u: X- x8 x( S) K" ~, U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 A' n) V7 R( R7 r( c
- *
I' q; U- c" I @& L4 f - * This program is free software; you can redistribute it and/or
- P9 C* ~3 C, {6 R- H2 z+ p - * modify it under the terms of the GNU General Public License as
2 u' K% n5 b, r( ?) F. p - * published by the Free Software Foundation version 2.
0 e, ?) ~5 q6 P0 T - *
/ P0 e! |: Y& k [% k+ i! m2 _ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- l% ?- j3 U# E B d ^" i
- * kind, whether express or implied; without even the implied warranty
* V1 g9 l* J' u! H/ u2 X2 U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" z$ @( @/ D. E' v/ K
- * GNU General Public License for more details.
6 B# M/ ?0 b! L7 y/ ?; {) D - */
1 z' h1 f) B% Z& T0 y% G& k p - . P% Q- f1 J9 w3 g
- #include <linux/module.h>
( C- `# t' S! u: v+ M; J9 L3 ?+ U - #include <linux/init.h>, c' j9 n0 ^1 @3 |/ t
- #include <linux/errno.h>) Q r a8 H: X; p/ `
- #include <linux/types.h>
; @4 T5 n# S/ ~) W% l' f - #include <linux/interrupt.h>
6 {, U6 \* A5 M/ P4 [& S - #include <asm/io.h>4 w$ ^, T+ {' |5 G3 Q
- #include <linux/moduleparam.h>4 |) t5 C! u- O! ^& S
- #include <linux/sysctl.h>
8 [; A/ m8 d. h j' Y - #include <linux/mm.h>
8 Y) n: ^0 a6 W- _4 C+ X2 c; \ - #include <linux/dma-mapping.h>4 h0 W; ? G' ~/ G! g
5 i# k& T3 Y. |( T! j" H) Z: o- #include <mach/memory.h>! @* q& ]/ t+ A9 q
- #include <mach/hardware.h>
/ o- ^) e7 i! j5 E - #include <mach/irqs.h>
$ F7 k0 ], r9 P: l - #include <asm/hardware/edma.h># z5 }! @7 B. C
* L( I( R0 y& Z) s+ h9 }- #undef EDMA3_DEBUG+ z) a) r6 T& \ [/ ?
- /*#define EDMA3_DEBUG*/
+ P% }+ k6 b. @7 w" `7 x
3 p% [7 {+ H4 x Q$ u9 r- #ifdef EDMA3_DEBUG1 u: M) v+ Y/ `* K
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 l) @( o/ r I U( s- x - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* S3 _+ K! c3 w. Y) L2 S$ B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 E+ r9 B% i! U) c- I1 P1 ]! l
- #else$ J. a) }) F! h$ M0 `( Y
- #define DMA_PRINTK( x... )
' y& G( s* ]$ q5 s - #define DMA_FN_IN
" N) _0 F+ e: X* j: {# f - #define DMA_FN_OUT3 f) W. C4 j0 w4 v( s- e! a0 m
- #endif9 B2 d: E- \9 |
- 3 ~ ~0 |& j V7 j0 g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): u1 e: l' Q V, t+ h- X3 U8 t
- #define STATIC_SHIFT 3" X7 y% O# o h* z& K; D
- #define TCINTEN_SHIFT 20& F' b3 _9 S; S0 b( X8 a \3 w
- #define ITCINTEN_SHIFT 21
# k) h+ k/ c$ ?4 X2 j - #define TCCHEN_SHIFT 223 i5 U' m7 b% R, E' G
- #define ITCCHEN_SHIFT 23
! W( u8 F" p; ^# e3 L( D* H! j
k: t) I9 u9 c: H; \; r- static volatile int irqraised1 = 0;: y# K1 S n# e }4 W2 \( {- Z7 c
- static volatile int irqraised2 = 0;0 V& `- N) e( [# a" a: s; M& N
- $ V8 j% Y) \4 o; g7 L. j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! g8 e5 j. L" g
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ r! p: ^8 b' _$ Q9 K. c5 h - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; ?2 E* R1 n: d5 L2 P - : \' D+ V/ G/ c9 \: a& N- [
- dma_addr_t dmaphyssrc1 = 0;
. n6 U* f1 C! ^6 q - dma_addr_t dmaphyssrc2 = 0;
7 l. ^7 {4 x( H2 N1 R - dma_addr_t dmaphysdest1 = 0;" U' K7 W2 S6 ~: V3 m# x
- dma_addr_t dmaphysdest2 = 0;
- l7 i( s, p) {2 |5 t0 n- I0 w7 [$ n - 2 d2 w: R# ~4 `; |
- char *dmabufsrc1 = NULL;
0 Z+ I3 ?4 d% B# G6 a5 E - char *dmabufsrc2 = NULL;
! y" A5 ~" ~( y - char *dmabufdest1 = NULL;
# M) A n$ ?" |3 A - char *dmabufdest2 = NULL;
3 e' |+ q0 c6 c# X - 0 X) ?+ l) O; d* h+ t
- static int acnt = 512;
. E0 }" J* i0 _ - static int bcnt = 8;* ]2 B! a+ y9 Y0 K1 R8 Y
- static int ccnt = 8;" p( } f6 ~9 f7 t/ d# A F
- ! i/ d- q& _9 U+ z
- module_param(acnt, int, S_IRUGO);
. ]. z' l; |/ o - module_param(bcnt, int, S_IRUGO);1 j C4 m c# d8 u
- module_param(ccnt, int, S_IRUGO);
复制代码 # ]$ K3 I. }4 K1 U
$ v! g$ S: O( N0 l
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 Z' T0 y8 I5 g4 \& x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, n- S- t7 ^, X; D" H% J) O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 v- e& |3 b& {. f4 L9 i+ X$ f
# R3 M: j' U* G; i$ |8 P
! h+ g, U$ o5 z, K& l9 u! [3 X |
|