|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 U, c1 i, ~, h& ]$ U+ i
- [code]EDMA sample test application
/ {! O9 t8 `$ d" M# f9 u - /*
q8 A v* I5 K" w1 I: w$ V1 ? - * edma_test.c
# t6 x' F: E) b& G' a/ ? - *; x5 S2 ~% p- J: y- i0 F. w
- * brief EDMA3 Test Application9 [" N Z+ Y' `7 t# l0 O, U
- *
$ l4 L$ _: K$ f: U9 r - * This file contains EDMA3 Test code.5 J/ y) V' j( d
- * s0 \8 L# P+ T- C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, g- g1 ~) O( P/ c. A( A. S9 y) B
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 Z- s- K8 P: G - * TO CHANGE.
+ |4 V4 l# X8 C - *
9 Q% _0 g8 p# t0 ^9 y9 f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 Y. z, ~. {5 @5 J - *5 ?8 M, F+ d# w, f* U# \) H
- * This program is free software; you can redistribute it and/or) F& `9 e4 \4 S6 \) B+ O
- * modify it under the terms of the GNU General Public License as& |3 C! y7 c: `
- * published by the Free Software Foundation version 2.
+ Q8 J7 m9 q) V' ~6 }* b" K M - *
# j, e8 s! {$ ~3 i - * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 ^4 w8 V# S: I' D* i: V
- * kind, whether express or implied; without even the implied warranty
W4 Y3 F3 U+ X1 k3 U4 y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 c$ k/ O( g/ O3 Z, K/ E4 p
- * GNU General Public License for more details.8 B X, R! j& V3 z
- */
% R- z! Y8 R# ^
6 F0 x( B7 F( c) c. X) h- #include <linux/module.h>7 h+ M+ Z7 `+ r$ r& A. i1 j
- #include <linux/init.h>
1 w8 ]( a4 x% ?# q - #include <linux/errno.h>
1 X5 N. s# @- p6 W) | - #include <linux/types.h>4 \2 j5 D. X' G$ ]# \
- #include <linux/interrupt.h>1 O6 S- C. l' H5 V0 u
- #include <asm/io.h>
9 z2 l; j+ @4 l' O2 N - #include <linux/moduleparam.h>, ?' a% n+ J/ H, e, _' D
- #include <linux/sysctl.h>1 |. c8 ^1 G: d# Z
- #include <linux/mm.h>
+ D8 X; u7 |6 Q; i - #include <linux/dma-mapping.h># @& t( X+ C- l+ {3 h
- & W8 ]' q% {" L- W% S/ s( n
- #include <mach/memory.h>
- G h* T" {9 }( u3 a( m0 a - #include <mach/hardware.h>) ]7 `6 L0 R: D6 _9 r% W
- #include <mach/irqs.h>
7 ]# `$ O- E5 G6 Q2 F6 E - #include <asm/hardware/edma.h>
2 E! T# X6 _5 _9 X. u - & _$ ]+ ]5 a! u; R0 |( Z
- #undef EDMA3_DEBUG! g1 |- t4 {! Q. ?2 u. s) S5 l- ?
- /*#define EDMA3_DEBUG*/
0 S! }8 Z4 {6 P$ L, Q3 u - # L4 P/ u4 u, W# E
- #ifdef EDMA3_DEBUG& K" Y5 U2 D2 Q+ l/ J( u) a+ J2 ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# z2 W: i' S: z' w8 i) \
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 M5 K% {1 h0 q9 S# K% d+ J, z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 L8 }4 \. l- Q: Y R9 f, w# t$ P
- #else* p+ R: \! G @" _2 Z/ ~8 k& J, G
- #define DMA_PRINTK( x... )
$ k9 R2 t: {( g! g* h% `, F - #define DMA_FN_IN
6 j$ B" I: E4 j: v - #define DMA_FN_OUT
/ @1 y: x/ G1 j' z - #endif5 {& S' s+ }, P+ a7 ?/ f: }. L
) B; S$ R: O. C9 Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 f3 f6 [" s% {: ` - #define STATIC_SHIFT 3! l% S" D8 b6 n+ C3 b
- #define TCINTEN_SHIFT 20& ~. q3 d# Q% ~' L
- #define ITCINTEN_SHIFT 21
2 V8 S% I0 K" G9 A* ~' @% d% a4 v - #define TCCHEN_SHIFT 22
2 Q$ p' M- L B/ N - #define ITCCHEN_SHIFT 23
! L# G$ _; d; v - $ h, g/ Q# e1 }+ E1 V) z
- static volatile int irqraised1 = 0;" G/ X; i6 X4 x/ M8 z
- static volatile int irqraised2 = 0;; B8 O4 ^% v- e% \& w4 Y; D, N
- 8 z- B/ o2 Y- `8 f1 A' p& m# X
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* t& F6 i2 c# L( r' u0 V - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 V, E+ l- T0 ^# M* ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ P. U6 b1 C4 d5 z/ N+ P m& G5 ?
: E: E4 V3 V# t+ S: Y1 k- dma_addr_t dmaphyssrc1 = 0;
# Y. I1 R; t {6 O: p3 g# D* i - dma_addr_t dmaphyssrc2 = 0;' r, X+ s7 U( s* D
- dma_addr_t dmaphysdest1 = 0;
6 |8 y q: D9 ?) `; Z) Z - dma_addr_t dmaphysdest2 = 0;" ], x5 m0 Z6 p* `
- " i, ^& ~" _) k' g2 N; U
- char *dmabufsrc1 = NULL;
- @* l( w+ ]$ F% b6 V* C - char *dmabufsrc2 = NULL;
0 B6 d3 q# p5 V - char *dmabufdest1 = NULL;# @2 D) }6 E& a# M' ]" n
- char *dmabufdest2 = NULL;
4 y, }& V1 u) d7 Z3 g
0 A ]9 _6 w% }# t- static int acnt = 512;
' N2 `4 E7 C! a7 S6 F; q1 W; T - static int bcnt = 8;
% Y; i! }" Z2 U5 G - static int ccnt = 8;( D% V3 i0 H3 u! i6 w V
9 B& c. N( D$ a; o) E- module_param(acnt, int, S_IRUGO);
. [0 T9 e& m, [, l - module_param(bcnt, int, S_IRUGO);
: ~* N) R0 |( L" X/ @) p: k - module_param(ccnt, int, S_IRUGO);
复制代码
4 K. z6 i$ h5 C6 ]( _, ]- y0 s, Q, p" [- |6 n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, b, Y1 ~9 p$ i5 u7 R8 Q b; h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 c$ g2 r! v4 F4 ]4 E% _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% O; u& o7 `$ `9 @; v4 i( z5 ?, \) I* t. {- G8 ]4 K. d+ y
, i# C) k: m# M3 Y" }, r
|
|