|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 i3 x3 j3 r5 D( }* S- g: a! R- [code]EDMA sample test application/ U; C( v2 u+ E# f y* o; d
- /*7 J. m# L# u5 I& \$ S; ^8 V" j
- * edma_test.c% ^5 R6 `( }8 u8 p9 r
- *
( q$ y5 q% [: m" v+ e - * brief EDMA3 Test Application. O: ?0 V6 E! B a3 _$ J
- *: j- w! L a4 v% d6 h- v
- * This file contains EDMA3 Test code.$ u, W9 m( h. `
- *
3 x# R/ f0 y* L- W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 a- D$ W8 f: H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% W; E8 h- `7 j8 K" J6 k
- * TO CHANGE.: V; \! j! X2 p5 \/ W+ g4 @1 X2 j
- *
' d6 J2 h) F% N* _6 k& i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 m- b2 c( j7 _- X0 O2 Z% ~
- *
2 e2 G- u9 y4 [+ A/ v% [0 l - * This program is free software; you can redistribute it and/or* `; G" z: P U- ]3 U
- * modify it under the terms of the GNU General Public License as+ _0 w" d" g# W" [9 R
- * published by the Free Software Foundation version 2.
$ ~$ {$ O! a' O% j+ c - *' V! P' x$ Q5 I- T2 }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" w: j! I8 M2 l. T v
- * kind, whether express or implied; without even the implied warranty6 g' t; J( u' w: ]& s
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 I$ [% z( `( u/ Y/ k
- * GNU General Public License for more details.: u: y# y. t! ?9 b
- */) Q( `$ j( {% v
- - w2 R/ s( w7 J2 H4 j ^
- #include <linux/module.h>
! j6 }3 X( ~5 S3 {) X7 |7 h( S - #include <linux/init.h>
; \+ L0 ~% _8 q% i - #include <linux/errno.h>
1 p: {1 B9 |% y0 D2 g# k8 P/ ] - #include <linux/types.h>
' k+ |7 P; f0 Z4 | r - #include <linux/interrupt.h>, x9 T2 n9 a2 u0 J4 K, l" w
- #include <asm/io.h>! d4 \% z. \1 l! k0 |1 ~! j) O8 t
- #include <linux/moduleparam.h>
/ n- [' F. I( b, V - #include <linux/sysctl.h>2 y. A, D1 _+ E# m' J% R1 q) p
- #include <linux/mm.h>. F) J+ f1 R$ G$ R
- #include <linux/dma-mapping.h># t7 _8 ?& {6 J5 Z" z; {# k( V
& ]) j& z0 `3 K1 k- #include <mach/memory.h>
) r+ u, ]- n) U4 I" D - #include <mach/hardware.h>
8 _0 e1 f2 Q+ m* V6 G' ~3 c; o3 r - #include <mach/irqs.h>
; i6 ?* o, R; s; h8 r. w - #include <asm/hardware/edma.h>4 G: R' {+ N9 @
- 8 x0 a# t5 v' \' U9 ?: j
- #undef EDMA3_DEBUG7 W: m$ {. D; g: F6 W( V) w
- /*#define EDMA3_DEBUG*/$ U$ Y& E; v }
- 3 M2 `7 m0 ]# o) g3 c
- #ifdef EDMA3_DEBUG
. h/ W3 H2 e" { P1 V( ~4 o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 [3 e. e( Z" x3 n& @
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 n* |, W% z+ x u4 F
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) X* m: \# ^6 C; q9 @6 J3 ?! N7 L
- #else" k, i, Y/ ?1 j& O( C+ V/ }9 ~
- #define DMA_PRINTK( x... )
% A8 Y+ K+ W: w1 f& s - #define DMA_FN_IN- S5 A: e2 K' ~) f: i# M
- #define DMA_FN_OUT
7 x- N5 W3 S; d4 Z - #endif$ P7 T$ R+ c3 G' ^3 ?4 P- C, I. e" Y
0 a2 X2 l; t8 F+ ? m. |- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 s# z8 V$ z( u9 O7 e- O% q1 T
- #define STATIC_SHIFT 33 {4 @: |6 o7 P/ ^' N. G& Z
- #define TCINTEN_SHIFT 208 h* L7 \- N" Q' D0 O
- #define ITCINTEN_SHIFT 21/ s& e; N: B- [/ a d. |. e
- #define TCCHEN_SHIFT 22
8 O! o6 t$ Y) c, I. c! |( s - #define ITCCHEN_SHIFT 23
9 c; l1 P* d# O) L - 1 Q8 s4 k* P7 [' r( b5 l
- static volatile int irqraised1 = 0;
. E% z, [0 ^* o' Q$ U - static volatile int irqraised2 = 0;& H' `: D, Y+ [' p* ]
, I: y: C P3 O8 p5 Q7 p- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ k' T$ a: `3 A! l; A. n6 v! W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 D( l v5 r/ n) n) P: G; T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- E. w$ X) Q. e/ Q
/ i; V6 y2 B# R& Y% ?- dma_addr_t dmaphyssrc1 = 0;' }! O7 a# D) |! W N2 |
- dma_addr_t dmaphyssrc2 = 0;1 `9 r0 F% z/ u( ^9 g3 W. \
- dma_addr_t dmaphysdest1 = 0;' a; G+ v# b2 b
- dma_addr_t dmaphysdest2 = 0;
% d- c$ y- i. P1 A7 y0 X - - p$ ~$ ~! w3 `/ L
- char *dmabufsrc1 = NULL;) R M4 B7 H# G! y) b P4 v: v
- char *dmabufsrc2 = NULL;
8 `. \% t8 y B& u* { - char *dmabufdest1 = NULL;- T, C S/ e9 \. o* B
- char *dmabufdest2 = NULL;. h9 y" a: M5 d2 W& `0 h0 ]) R$ U+ b
- ! j) w* Q1 g) Q7 G
- static int acnt = 512;$ Z( T. o. S: w
- static int bcnt = 8;" e% C& u- U( t3 `, s
- static int ccnt = 8;1 B% ^( l1 [4 g" m
: k7 F# Z- \& `, O- module_param(acnt, int, S_IRUGO);) }8 i2 b. ]. ?
- module_param(bcnt, int, S_IRUGO);
4 O# ~5 I/ d/ x F - module_param(ccnt, int, S_IRUGO);
复制代码
1 ^3 k( J$ D# d9 K
/ P7 C# L2 n" T$ G b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ l" t( R" Y$ }. d( @" `+ v+ uarm-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 t" U3 m6 U8 D$ \$ L9 L) S4 n4 x
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" L6 Z8 u8 {; h- [" a$ n. d! A- I- \; @- A5 Y6 O
7 t! f( S% \) x/ o
|
|