|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' P, }( V1 F$ x; y9 X! R. K- [code]EDMA sample test application* e7 K$ Z7 u1 }
- /*
1 G" K& w: k, d8 O6 f1 T - * edma_test.c
) E5 k4 @# }& i7 |; ~: _ - *5 j3 M0 q# ^2 q0 H+ D
- * brief EDMA3 Test Application- R X9 t8 A* |) i2 q3 l$ y
- *5 Q3 i3 f$ A8 [6 e9 ~0 ^
- * This file contains EDMA3 Test code.
6 q" ~) R) d& {# Y. Y - *+ G# Y. [0 Y- A% |4 r! _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# Y& r# S5 O& w
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 x) t9 V- M0 N; V* r
- * TO CHANGE.6 ?. W. s# _3 |
- *
4 \8 P6 M4 M" b' N6 V - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 l/ K6 B7 [" z3 Q" \ - *
. v% @: t, N! _ - * This program is free software; you can redistribute it and/or- [1 ~ u! @' \# v+ O
- * modify it under the terms of the GNU General Public License as
/ V0 \6 d5 E4 C4 Z- @ - * published by the Free Software Foundation version 2.5 o% S/ n: l2 C+ ]6 T
- *& ^4 \# D8 C! g% c; n% R( D
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 O* k c; w1 e' W! o, k8 l
- * kind, whether express or implied; without even the implied warranty* q; Y8 z2 k: k( q: a0 B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- |( u+ {; g2 W
- * GNU General Public License for more details.. Y( y5 e& ?4 y( p3 l( B2 n
- */
' a5 K' G% c4 m2 ]4 ]8 ^9 o
. M. ^9 {# a8 j( J* E$ ^: B! r- #include <linux/module.h>
- W) b7 w( V) Y - #include <linux/init.h>
6 ^2 r& O# p4 m2 o- i - #include <linux/errno.h>
\5 E& q% V/ V1 l - #include <linux/types.h>1 ~1 E1 [% p* S7 ~. m
- #include <linux/interrupt.h>
6 |. a8 B) ], J# S) W+ s% i - #include <asm/io.h>( f7 ~. n; s3 z m. y
- #include <linux/moduleparam.h>
1 {0 ~4 Y9 u3 `. V - #include <linux/sysctl.h>+ Z# t$ W4 d8 G
- #include <linux/mm.h>
. f* `' x- m/ P - #include <linux/dma-mapping.h>
% D9 y9 J& T. K- S5 F
! g7 v+ r) z7 q, c- t# S- #include <mach/memory.h>. j+ y. \' c6 B3 u% `# K. k
- #include <mach/hardware.h>
. T, m& Y. K5 s - #include <mach/irqs.h>7 r+ u/ j/ N4 w7 n: u
- #include <asm/hardware/edma.h>
$ Z: Y5 W5 y+ @
4 U" @/ P2 c. f6 `- #undef EDMA3_DEBUG
0 \* j" h7 q' Z& J+ L5 ^1 } - /*#define EDMA3_DEBUG*/
8 [( X) o3 L _( L8 r' Y; l5 ~! _
; ]( o& P& S5 X9 T: _6 |: Z- #ifdef EDMA3_DEBUG
6 S7 y* M4 U% h1 D - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' v( q: a$ |! t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 ^" q2 |+ S4 j. _
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 d8 x3 z+ m a - #else+ a$ m1 v: I" O6 U
- #define DMA_PRINTK( x... )
1 @2 b- H+ ^; R; s$ R6 [) u" _ - #define DMA_FN_IN1 O& t' @3 s8 |' ~3 z
- #define DMA_FN_OUT9 @7 T2 W! u+ l
- #endif
! a5 J3 m- C0 q! w9 A- Q, { - / W# K# V7 F, ]
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 [# a x7 l4 L3 ?2 L! o) T5 T - #define STATIC_SHIFT 30 g6 [7 i/ y: a6 i& [
- #define TCINTEN_SHIFT 20
- K$ S2 D% P7 W. I% V - #define ITCINTEN_SHIFT 21, |2 X/ [! u/ ^7 m- E9 M6 Z1 p" ?9 @
- #define TCCHEN_SHIFT 22" O: _! r1 M! s; u/ G
- #define ITCCHEN_SHIFT 23% b) S( q" U% H6 [% }; V" I$ i
- 0 K* [6 E9 L' v3 |
- static volatile int irqraised1 = 0;
+ p2 @( `. u B- U& y- ] - static volatile int irqraised2 = 0;2 S* p+ f9 N, [7 x; d2 g* K
- % v1 P E* g+ b0 _
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) l# t: h/ G6 i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& D6 h8 R+ M7 @3 D. G& Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' J$ C: ]( ~: S9 i0 o* Q
- I+ }/ Q8 F9 q/ G- dma_addr_t dmaphyssrc1 = 0;( D1 w: @ a; h1 _- K8 k' D
- dma_addr_t dmaphyssrc2 = 0;
: ~$ Z' V9 h, ^ - dma_addr_t dmaphysdest1 = 0;% @& F* ]' B+ N$ A/ g* d' O
- dma_addr_t dmaphysdest2 = 0;% t! e+ W+ K [" e* P9 ?$ a
! V$ o# k) `) V- char *dmabufsrc1 = NULL;" v$ P: [% }& P# k7 W
- char *dmabufsrc2 = NULL;
1 ^* i& {, t+ N" n* y - char *dmabufdest1 = NULL;
3 V4 W# d' P" ~ o7 { - char *dmabufdest2 = NULL;
9 F; M3 h3 x& ~9 o$ [
$ G* J+ R$ g+ y8 P* P& \- static int acnt = 512;
0 G1 R8 a* Z$ l* M) H$ V5 I- f - static int bcnt = 8;! S1 s) ~: c# Q: \6 x7 D
- static int ccnt = 8;
) `8 V6 ]# G; u4 |; @) H9 R
$ Z4 \8 x: a7 P" Y' Y5 h) L- module_param(acnt, int, S_IRUGO);: ~# v+ n% Q% y. F4 _; G4 a
- module_param(bcnt, int, S_IRUGO);0 o# c- [1 g& s) `! e% [
- module_param(ccnt, int, S_IRUGO);
复制代码
* z# B9 L+ A* P
. h8 E3 O& a; x& M* O, e8 D 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- `" Y! B$ m' E9 z0 R% C$ ^" S
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 ^1 x; n0 ^- ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 a5 O% Y- ~: Y4 b
4 x* e r# Q I7 V0 \
0 P: f7 x* T( \. n9 T4 E% b' f |
|