|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + E& z" I. b1 V0 f$ L4 U& D
- [code]EDMA sample test application
" p- d( ]2 F; L/ s' d - /*
% R( r( W$ K) @ U3 y - * edma_test.c
% B6 b9 Y @1 H/ v, f* c - *: d; v8 U/ ^: g1 I; a5 E; }
- * brief EDMA3 Test Application8 R2 b4 L. @9 T( y K! I1 t$ a, d3 K
- *5 t5 ]8 R ? d+ [# ~! q5 O2 A" Q2 b
- * This file contains EDMA3 Test code.
# R7 Z% E/ L9 ]4 _' z% ` - ** b( P+ v+ H9 H( w# L6 J' C4 j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ j& t0 l/ H: W. _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* U1 o$ b2 U9 M6 ` - * TO CHANGE.
) S+ p% E L( f( \5 r2 G0 z" v - *+ k. U! N# J/ q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; ?" M- a4 j9 R2 t; u7 G6 e# _, Q - *
# s8 G' \) |& T# Y9 J" j: d M h - * This program is free software; you can redistribute it and/or5 k+ _9 h1 g$ H' ` Z8 A0 M" V
- * modify it under the terms of the GNU General Public License as& \: `: l, \2 M( l- A. P
- * published by the Free Software Foundation version 2.
9 o2 |3 c) }6 G$ f: E - *; C0 B- C7 b: X# _' o; z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 l+ @/ p+ A! Q: k( |) z - * kind, whether express or implied; without even the implied warranty
4 b, E/ l B* \6 ~' Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% f% w1 k% X7 S: o5 w8 V1 v
- * GNU General Public License for more details.) Q2 G( G ~5 y S
- */
" C9 i; P/ D/ K6 p1 n$ q. a! g - # b8 A3 V4 o* n" v# D O
- #include <linux/module.h>. \% k+ p8 u" s0 S; H8 ~ V
- #include <linux/init.h>
) {6 u3 a' I% Z4 h( r. u7 q - #include <linux/errno.h>. ^' X. S: d: H3 t! p/ L9 H
- #include <linux/types.h>
# v; H8 K0 T% Y0 F - #include <linux/interrupt.h>7 v0 n8 X: K( `2 J; T G
- #include <asm/io.h>* s# |4 ^9 b; }, V
- #include <linux/moduleparam.h># v7 X. ~4 H0 M+ ?5 f
- #include <linux/sysctl.h>
0 p% B" _5 G: u, I' @8 z - #include <linux/mm.h>
5 Q% Z E- _1 q) f4 l. C) @( [ - #include <linux/dma-mapping.h>2 t( @" P# `% f3 m+ D) A1 G
& `4 F n+ U/ Z E6 a( E- #include <mach/memory.h>) u6 V9 S" v, u! h
- #include <mach/hardware.h>( T$ g2 p% i2 Z" }
- #include <mach/irqs.h>9 [# u! t7 w" J' c1 M+ F3 [ g5 q
- #include <asm/hardware/edma.h>+ J. Q: e% L; C4 |) J+ y
- 2 n& u! V% C: b( [6 B7 U
- #undef EDMA3_DEBUG2 ~+ z4 w; `* W* _
- /*#define EDMA3_DEBUG*/
: y* F5 g1 t1 Q' g, Q
u1 J% t0 j) e" v9 @- #ifdef EDMA3_DEBUG
& e$ I. _1 p$ ]; `- ?- R9 P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' c7 k: y4 \/ B
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 T! m4 z: i2 e# e. O2 x - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- d7 X3 k9 F8 d( I1 |) W - #else
+ Z8 R) z% _/ c, k3 f6 m6 @ - #define DMA_PRINTK( x... )
9 y( C8 F$ r+ j3 x/ m - #define DMA_FN_IN/ `6 P* t: m4 a: E' n/ I
- #define DMA_FN_OUT
( B5 K# x9 {& S' @, E3 b - #endif8 s( `5 i! n7 W- k8 ]
- w$ h' Y# Y# ^
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* B9 c8 Y/ E; p* `6 c3 m - #define STATIC_SHIFT 3
" @$ L# D6 i7 C' E0 k6 C - #define TCINTEN_SHIFT 20* m, v% ], Q }/ c5 R
- #define ITCINTEN_SHIFT 21% e' @$ W0 Q0 h7 U6 C
- #define TCCHEN_SHIFT 22
& X/ h h5 h, F; H - #define ITCCHEN_SHIFT 23
9 S+ }. c: \5 a( E- j6 B D# ?
. x8 Z: e9 W2 f( _$ s- static volatile int irqraised1 = 0;$ W: q: t. ^( `" T
- static volatile int irqraised2 = 0;" K& Q6 `5 [$ }1 \. x ]
2 ]1 r1 d2 T {7 W w" X- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 z8 S5 r8 n2 L y2 L$ p+ C: r0 D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 U$ _7 o) D0 E$ j
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- } y% m8 ^* ~+ O1 {! s
1 `0 G" ?* |% w: j$ [1 c- dma_addr_t dmaphyssrc1 = 0;' p( h2 r* C* W- J3 o
- dma_addr_t dmaphyssrc2 = 0;* s! \; V- x8 }" E9 M) C; a
- dma_addr_t dmaphysdest1 = 0; a* R0 q& g0 [+ L6 ?4 K3 F: U( l0 e+ G
- dma_addr_t dmaphysdest2 = 0;
1 N% t) w, h5 m8 v2 E/ P - + A' G0 R5 F1 e) v$ ]
- char *dmabufsrc1 = NULL;
$ L) [/ R% F+ y3 A - char *dmabufsrc2 = NULL;4 ~' q" Y& d- x4 S- K. k* i: l$ S
- char *dmabufdest1 = NULL;( I5 c9 u9 z: { ^4 C0 r
- char *dmabufdest2 = NULL;
8 F# F( W) b" |, j$ @5 a* M* l' | - 9 F' U* l& H% |' m& x2 ~0 ?
- static int acnt = 512;; k3 F, Y; _- _9 Y/ x6 f
- static int bcnt = 8;
4 n0 H3 a# X4 W - static int ccnt = 8;
& Y0 B8 w$ N7 N% |! y) ]" K
* v& ]6 n+ _$ y( \2 J8 N- module_param(acnt, int, S_IRUGO);+ F) K2 d! ^- n e& ?2 g
- module_param(bcnt, int, S_IRUGO);
4 k0 n5 \! }( c) R I7 m/ g; c - module_param(ccnt, int, S_IRUGO);
复制代码 9 c; h1 q: {0 K) d, U( I$ d% i
2 w* g) v$ m) I J, t/ q' k: Y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; G* G$ W1 k& }2 d) _' }4 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' \/ {2 q( S9 y4 j! D) v5 i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) u/ H7 o+ [' i
4 n7 d1 | A$ L+ F3 G* e4 V. h& D( W2 \1 Z
|
|