|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" y: g0 ]5 E8 O6 f% l4 Y- [code]EDMA sample test application
& x x+ w9 Y$ ~ - /*4 o2 s% l( I0 X- ~1 r
- * edma_test.c
$ g, a2 I8 @3 P5 ~( Z1 f - *
' X( P1 `# s( c4 z - * brief EDMA3 Test Application
9 ^, f6 R# j6 P - *
& U3 B e1 }4 P# b' k P$ T3 O - * This file contains EDMA3 Test code.4 s4 N# _2 p0 T5 k' F/ O
- *5 U; c& A. D) Y- F! u- N
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' {0 ]( i7 U' {7 g, s
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' J1 J% _' D" L3 v/ R3 S% f - * TO CHANGE.
3 S v/ x$ y1 Y6 p, s+ u - *0 [& d& `; S$ \1 H( J& K. s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 v1 w! c/ k+ a# h - *
) p8 o# D9 m* g+ ?$ U9 W - * This program is free software; you can redistribute it and/or1 m& W" A1 B7 [
- * modify it under the terms of the GNU General Public License as6 R* i) F2 g! G* n+ n( H: t8 v
- * published by the Free Software Foundation version 2.1 y: s; M7 z# g; J6 ?: b. f
- *
9 p0 B9 S8 }+ L. _% ?/ J p. s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 ^) \( y* l6 S$ R - * kind, whether express or implied; without even the implied warranty
$ f5 _$ F$ x$ i9 g2 B; r4 F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! x; I( ]$ m6 q# R8 ^ - * GNU General Public License for more details.
, r* D, X+ x7 \; X6 C4 l: ~ - */
C+ J3 r$ n6 |$ q- s- q8 J
0 y# A9 q2 j) F( _. \2 |- #include <linux/module.h>& ]* S5 r- _3 u3 u8 ` ]( `
- #include <linux/init.h> G. Q8 _+ ^: B1 Z& G J; G
- #include <linux/errno.h>
0 N; @9 [( {5 {( ]' a - #include <linux/types.h>+ z5 I8 k3 \. i/ d
- #include <linux/interrupt.h>
3 S/ M' L$ g' e. z# V - #include <asm/io.h>& Z6 u& z% k7 W: |* R2 Y
- #include <linux/moduleparam.h>
! |$ v7 w0 ^: C: \ - #include <linux/sysctl.h>
# f: V/ ?# l& C! B - #include <linux/mm.h>! c/ @# Y- E x" T. ^% F
- #include <linux/dma-mapping.h>/ O% j' q# {( t( D R
- . o0 V$ Y4 i2 I1 K" X2 N
- #include <mach/memory.h>
* x) t1 }; X; Z! P4 A4 W - #include <mach/hardware.h>
0 F! ]# ?7 K: N. Z' C9 j - #include <mach/irqs.h>
" J1 r% p/ f. o! y" f" k - #include <asm/hardware/edma.h>
8 r+ u1 P4 `* ?/ Y
2 @: _. q& Y/ z- #undef EDMA3_DEBUG: e6 q" i! y3 |& T$ V( i3 l
- /*#define EDMA3_DEBUG*/
3 v0 d2 O( M. d4 V6 ~ - * ~, q. P5 w2 Y9 d- _4 Y# E+ Y9 t/ A
- #ifdef EDMA3_DEBUG9 f2 C. v2 J8 ~# ?5 D- j7 M/ z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( @7 |# r6 s( O- f6 v% c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ P' U% N+ n6 H a+ a2 V8 [0 d7 ? - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 e1 T1 O) N: |( B7 j3 T
- #else e) q) u9 [; \8 e$ G4 q, {! h! b
- #define DMA_PRINTK( x... )
) @' t/ q+ X% s7 Z6 p5 k - #define DMA_FN_IN
; _; \2 i1 D2 ?; Z0 [2 ~7 F- \ - #define DMA_FN_OUT5 l. x" `9 j3 X8 H
- #endif
3 }; }* i. @! s, I' q - - o# d# U: u7 c4 f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! @6 _' W2 p: M, x% f9 x
- #define STATIC_SHIFT 3
; K* s0 v! O! | c, o$ G - #define TCINTEN_SHIFT 20. B% w- i: A/ C' b; H6 L
- #define ITCINTEN_SHIFT 213 g% g9 ^6 d E+ Q0 d7 _7 f8 H
- #define TCCHEN_SHIFT 22) g: ^* A5 e* ~% ~! K
- #define ITCCHEN_SHIFT 23 s, a) F& T) a' y4 h! h ^
$ N# B( f- g3 b5 u7 a3 H5 B$ M+ r4 u- static volatile int irqraised1 = 0;, N' t$ L6 M' C
- static volatile int irqraised2 = 0;
6 j9 I4 Q. X% y0 l9 _; O# p: q
`9 P6 {4 S) x* V/ X% S' o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ [+ C" ]0 |! }8 x8 U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- D) O- m+ H5 X
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ _' F+ t+ A. B
- & G# m0 O$ p C- e, R5 d
- dma_addr_t dmaphyssrc1 = 0;
" O9 G& n9 V) f* i. i" W( e: M - dma_addr_t dmaphyssrc2 = 0;4 w& `) q6 h. A3 K1 X; o
- dma_addr_t dmaphysdest1 = 0;
; v/ \! Z8 S1 o0 Q3 P) X1 z" n8 ^ - dma_addr_t dmaphysdest2 = 0;
8 l5 U! d r: K, y2 g2 ^' d - : m" }# f6 ]- v4 l: w/ @
- char *dmabufsrc1 = NULL;; N+ M7 ]( {8 r$ y
- char *dmabufsrc2 = NULL;4 k9 q% |2 X* a' D
- char *dmabufdest1 = NULL;
* G6 k$ Q; ?7 c3 j - char *dmabufdest2 = NULL;
/ b( g& [8 f( {7 X6 G: i - ! F! ^. h/ k6 F& x+ }* d# I$ s: I- O
- static int acnt = 512;0 a, @& u9 I7 n
- static int bcnt = 8;
$ {- i* K0 B5 `5 M. r/ t - static int ccnt = 8;( R8 A# Y2 R D8 [, N
- % t; m4 @9 B1 U0 L7 X' B0 l
- module_param(acnt, int, S_IRUGO);2 [, I2 Y4 V. u& ~$ M( }" n
- module_param(bcnt, int, S_IRUGO);. b$ v$ W! G3 P! F$ N& u
- module_param(ccnt, int, S_IRUGO);
复制代码
+ b1 u, ?" M! N2 n/ K8 Q3 s. X2 d" q; m* _8 f( X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' r R0 J O1 f+ J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 Q7 |* i7 ^: ^9 _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 y/ k/ D: _+ j; ~
/ A6 u' I. b7 c8 P M8 {" n s- v8 @! r! r# M, F: ~( |
|
|