|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , k+ K' z" H {2 Z% u$ h( I. h
- [code]EDMA sample test application
7 D. `3 r# E3 G% Z1 F! J - /*" |8 R; Q4 l& }" O2 C$ _! z: }( N* W) B
- * edma_test.c: G, o% D* _) ?$ {1 E, ]0 N8 D, C8 c
- *
; p' W2 w% j+ M6 ]* G - * brief EDMA3 Test Application6 V! P8 H$ Q% d# b6 `& `
- *% [8 J i. Q: _; t4 [" x$ P
- * This file contains EDMA3 Test code.
& H# y+ n6 ]) R8 a) n% V3 b - *
0 a8 Y5 e; ^6 b+ ?4 z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. L& T" j, \; N0 s( U: _! L$ a8 e - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 [ P' S* W1 [$ x - * TO CHANGE.
- D2 s' W8 @# M. d2 ]! B# x& {9 C - *
* A# K# j4 g8 d* R: z7 c8 K8 f0 g4 ?4 I; E9 [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
f2 Z& s. ?2 m% d% i3 x$ z' t0 s - *" ?6 m) ]& R: n" w
- * This program is free software; you can redistribute it and/or j" f0 L: h, ^1 Q9 x7 H
- * modify it under the terms of the GNU General Public License as
9 n3 D" L/ A* J - * published by the Free Software Foundation version 2.1 Q X, a X$ J1 O! l
- *
: d- v% u$ a9 h3 Y7 w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& Z% f1 V& i M, a1 y
- * kind, whether express or implied; without even the implied warranty6 O/ @4 h) Y/ L1 t! V! c, S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 B, W3 f' x, x+ E( k. R
- * GNU General Public License for more details.5 q3 \) _, V8 y5 @
- */
* m2 d1 e9 Z! [ - ( R. Z$ d' [# s$ M5 D r5 | Z) C* @
- #include <linux/module.h>* L% X- p7 G1 U9 f
- #include <linux/init.h>
4 R$ Z* W5 G6 |' c" U - #include <linux/errno.h>
2 D: X5 S* d' r' T - #include <linux/types.h>& G& `1 q! S4 p) i/ N1 I5 a" v
- #include <linux/interrupt.h>
7 A0 h3 u; p4 M. Y - #include <asm/io.h>) ~' v, b0 A" ^0 K. X' W
- #include <linux/moduleparam.h>
! s1 l" T. o$ r& }: } - #include <linux/sysctl.h>$ U7 w4 S5 w( p! ` Z
- #include <linux/mm.h>
) i7 R$ T+ N$ a* U! c - #include <linux/dma-mapping.h>( K' z. t( m5 u0 N! W, t
- ) D2 y2 d; f$ d8 K& N- [1 F
- #include <mach/memory.h>
7 j( ~2 I5 z# y0 ` - #include <mach/hardware.h>) `" e- Z' T/ H0 o3 T) i. a
- #include <mach/irqs.h>
; g% c' T' H7 k9 k - #include <asm/hardware/edma.h>
( ?% _. ]8 i6 e8 _, g+ K4 X
3 H) I" T- n' n. t3 ]; s- #undef EDMA3_DEBUG s- }" g4 S' `3 a
- /*#define EDMA3_DEBUG*/
; Z, ?% i$ p! _1 U8 g( {
" B; P% O% |! K/ ]) C4 Q' u2 H* s- #ifdef EDMA3_DEBUG3 Y+ H" @8 X& b
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 ]0 R) q" v( K - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ k( H; h0 y! T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 J5 z6 H$ Y# F" M# S5 F z - #else& J1 a0 [" i4 J3 ?* s
- #define DMA_PRINTK( x... )3 a3 y# e P& d9 g. S1 Z
- #define DMA_FN_IN4 S, @0 P$ `+ c7 x) O! S$ E* l
- #define DMA_FN_OUT- E9 G$ y3 E- Z" o4 q6 u" m6 V5 T
- #endif1 i+ I& M9 T6 T e& \1 K! x# n
- ( u; v. g `# ^, B: n( t" Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- z Z6 }. P7 f- |1 b3 F% H5 Y - #define STATIC_SHIFT 3
/ |1 M1 C5 l- ]% E" \" F - #define TCINTEN_SHIFT 20
h# g8 w5 P' f7 d - #define ITCINTEN_SHIFT 21
, ?4 S% l, B. X - #define TCCHEN_SHIFT 22' e3 N' m, F! }& C7 W3 t4 @
- #define ITCCHEN_SHIFT 230 i0 X& J' A$ h9 o: d
- 5 s0 _( L; k4 W: K2 b& o
- static volatile int irqraised1 = 0;; i9 k) _$ G2 y h, @2 a/ F2 U: k
- static volatile int irqraised2 = 0;3 T/ v+ }" l. \0 R7 G# j4 l' r
* s3 [/ G- u: t5 h. C- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% p0 b' c2 G9 I( h: q# r
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 n6 b4 _7 g/ H1 Z: @& O2 W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 s7 P* {' P0 S
- 6 L7 p3 h6 @ X+ O6 x& I
- dma_addr_t dmaphyssrc1 = 0;9 _5 R6 V! R5 R# O) n0 x" ^3 i
- dma_addr_t dmaphyssrc2 = 0;) E: B" P; J& X" I0 S* |4 g6 E
- dma_addr_t dmaphysdest1 = 0;
`/ _4 U. Q) |1 [8 w8 Z9 q9 L - dma_addr_t dmaphysdest2 = 0;. w$ ~3 ~$ O2 h7 C* P
- " Y) H k& {" A+ o
- char *dmabufsrc1 = NULL;
4 Z/ I. n0 N- Y4 E/ R- M - char *dmabufsrc2 = NULL;
g6 [) ?7 h7 e# B$ Y" } - char *dmabufdest1 = NULL;: G9 D% Q0 X0 s" v! ?
- char *dmabufdest2 = NULL;
- o# F$ S3 }% j w) R
" q3 X3 s0 Z1 @) Z0 {, f- static int acnt = 512;0 e# E; ~) L' M
- static int bcnt = 8;- _6 o% P; I+ @! p7 V! M
- static int ccnt = 8;
# Q: }$ o, w6 r$ T) k) R
5 j1 o" i# U% I0 |/ f( ]6 ~- module_param(acnt, int, S_IRUGO);
5 W* M/ v( N1 h6 I' U- O - module_param(bcnt, int, S_IRUGO);
1 j! W. O( a/ y6 H5 R - module_param(ccnt, int, S_IRUGO);
复制代码 F" Z9 R7 j' ?( e# O
4 Z# {' e8 i0 `7 p7 U9 \ }1 j7 x$ H: N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 J" }. l8 v0 y# e5 |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# F9 N6 P. ^) a. Y9 _1 K/ E1 E$ O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, f3 K/ L/ h$ s2 Y% k& e6 p
, E' r5 r) z' ]* S, q4 @5 x
2 W4 T9 I0 E$ B) V) E- z
|
|