|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 c" C8 H4 d. o
- [code]EDMA sample test application
" r3 k, R6 _7 F- C0 A - /*
! t% S, E* x3 Y! C# Q# _" g - * edma_test.c
; j. W1 e! I$ ]; ]* K: { - *
5 U5 l# |+ E! i. e3 O - * brief EDMA3 Test Application
. B4 R* Q% a8 Z: Y; y - *
* E1 a% c. [/ I/ ]: l4 d/ G - * This file contains EDMA3 Test code.
5 Y& i7 T0 ~5 r' y - *
6 {3 w0 H: g5 j+ ^ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! u' [- Q Q8 }& Y$ U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 J- \5 K8 y$ `( s1 j0 d
- * TO CHANGE.! v( @7 W/ A' L, y5 r0 B P
- *4 l8 j8 G6 W1 s5 @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' E& W |6 v: O: W- J
- *
. N7 m& f5 L$ X6 C" }% N7 q/ Y - * This program is free software; you can redistribute it and/or. A4 e5 m- G0 | }$ L1 U
- * modify it under the terms of the GNU General Public License as C% B3 x4 T3 ]* B- `* h
- * published by the Free Software Foundation version 2.
& b& D3 F/ H) t6 q - *! {% |0 ^* t$ X
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 L/ J+ V* N7 q4 X' r - * kind, whether express or implied; without even the implied warranty. f0 Z. b9 P3 v0 p9 x. C9 O# B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 f5 B' a5 g% L+ L2 A
- * GNU General Public License for more details.
2 I+ U' u( c, o - */
$ J/ Q( @( _" S% c9 A
4 X1 P2 H9 \ F5 K7 z- #include <linux/module.h>
; V- ?: m o& ?/ ]3 F; |3 e - #include <linux/init.h>. Q: U% K1 G& k0 H; e" B e$ r5 ]
- #include <linux/errno.h>
* |% s4 t6 j* O! ]) g7 X5 T - #include <linux/types.h>( e' A: G# T% y6 x* e
- #include <linux/interrupt.h>0 {; C4 P2 f u6 c8 a
- #include <asm/io.h>
5 d# l7 ]! h1 u* z7 q* T - #include <linux/moduleparam.h>
- c; }6 U$ Q3 V - #include <linux/sysctl.h>
& H$ a6 _: u1 K! m( I% q( s1 Z - #include <linux/mm.h>
7 k# }5 K0 f m4 }4 H* C" E& T7 s - #include <linux/dma-mapping.h>
. f4 G v" W3 d
% @& L( t$ E% R% Q- a- #include <mach/memory.h>
. v$ K+ y5 A) G- c c- N. I - #include <mach/hardware.h>
# E+ T* x8 D1 I$ V/ @" a& \ - #include <mach/irqs.h>
2 f% m3 `& z& Y5 t; b0 ~* s - #include <asm/hardware/edma.h>
9 b G- J0 @. F! h) ~
3 }& H3 h0 F% {, [- #undef EDMA3_DEBUG9 Q/ Q* O0 l6 [: P* {" l
- /*#define EDMA3_DEBUG*/
: t# H5 l- `, \ Y8 x9 M - . r) Z! A/ L2 F
- #ifdef EDMA3_DEBUG, x$ o5 M7 R* _4 |) j1 r
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* H- A7 L$ o; j! Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 ^. ~( a8 O3 G. v$ c3 r# Q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) M# [) U9 Z: ]; R1 ~ - #else
G5 u; E; V/ A; w5 t$ {7 C9 P' g - #define DMA_PRINTK( x... )+ v4 U+ K5 |. t9 [' J
- #define DMA_FN_IN/ i( o2 @, ?$ U5 }5 j
- #define DMA_FN_OUT
# x& c/ C9 Y5 w! r V0 H3 D - #endif$ a/ p* x' d7 H5 A7 q1 F- a
- : v8 v* B( n% U: ^( x p
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 O2 o. F2 h& s - #define STATIC_SHIFT 3, M8 k% i1 R) E9 }9 Y
- #define TCINTEN_SHIFT 20, q+ {8 a' [ ^5 s) \3 J
- #define ITCINTEN_SHIFT 21+ \ t# K' w' {; T$ K9 g: D
- #define TCCHEN_SHIFT 22* h5 `3 P/ L. U6 M
- #define ITCCHEN_SHIFT 23& T$ W1 z% \+ \0 Z
( g( F! T+ b; L7 l2 F8 k- static volatile int irqraised1 = 0;
/ g5 A7 p: t8 r - static volatile int irqraised2 = 0;4 ?) c9 R1 G$ T2 ~2 A3 L$ I
- 2 ?3 w: M& c+ f2 ~ L) S1 M
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ D- O3 o, Y9 n: k- r {
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; f: X. h8 Z3 W0 ~4 V! W, i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ K$ g% S) O. D9 S8 E - 5 c9 P" q/ X2 N2 W# a- |' I% J$ T
- dma_addr_t dmaphyssrc1 = 0;
9 w7 M# G9 _+ x: p - dma_addr_t dmaphyssrc2 = 0;
4 f' m9 Q0 c& u( _( y$ G - dma_addr_t dmaphysdest1 = 0;( U; d, G; M( L/ Q u, m# N7 h. P
- dma_addr_t dmaphysdest2 = 0;5 j9 R5 s# S* c0 f
$ {! H& Z3 K/ _4 H- char *dmabufsrc1 = NULL; T2 W- v0 a9 R3 h, f7 Y) {! w
- char *dmabufsrc2 = NULL;
" Y! i4 J; x4 ` - char *dmabufdest1 = NULL;
* m& R. w* Y! c7 w! s$ _ - char *dmabufdest2 = NULL;9 F/ V3 i* t; t8 V
- - ~- i4 p7 j, J. J3 k9 T" b2 O' K0 f& O
- static int acnt = 512;
6 s* a d3 H! [ D9 A - static int bcnt = 8;
& c y& E7 R) Z2 b& H% s( a - static int ccnt = 8;
- Y& B8 O; C$ i2 i+ r
& V4 {2 X( y6 t- module_param(acnt, int, S_IRUGO);+ z, |' c# G/ W6 j4 |
- module_param(bcnt, int, S_IRUGO);
5 O( q# S: m( c" \/ p* ]& G$ _8 K. Q - module_param(ccnt, int, S_IRUGO);
复制代码
2 v' v/ V$ V7 B! m0 r' v7 E- d4 O! S! E2 Z1 v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, ` U3 i5 |; R2 r9 {4 ?0 Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 Y0 Z) n+ k: J0 v( h5 M. I1 X
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 R7 m% l6 W8 `0 ?
0 j d1 Y1 Y8 v0 }1 V; c4 ?
% p; l; D) l; w6 ?9 g$ R
|
|