|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 N8 r! x1 Y! V: H% v' j9 m7 S
- [code]EDMA sample test application( [( U0 h0 U1 c0 U7 ^
- /*: m; X; j, S1 U
- * edma_test.c" {( n# `3 e9 t2 Q
- *; a- p+ ^ \% [$ ?# x
- * brief EDMA3 Test Application+ C; N" b3 d' P2 | f/ V$ C
- *$ @& l; K( Y9 Z/ ^
- * This file contains EDMA3 Test code.% M* C6 m/ x; l2 W/ o$ B
- *
3 w! j3 c/ _3 ]& l* D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ `" ?9 g' u9 V3 T# z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. ?+ h4 J8 l( i% y0 q
- * TO CHANGE.
/ [: `5 q& \, Y - *0 W8 G! s3 t. r3 ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ C+ T! E6 M4 Z# P3 x - *
/ ]+ O/ K7 L1 N5 l4 M6 p# [ - * This program is free software; you can redistribute it and/or
6 m9 O$ G! q8 M4 y; h+ ]) U* a - * modify it under the terms of the GNU General Public License as
' v, i. m/ R; e; n. e, U - * published by the Free Software Foundation version 2.
2 E! o! }& X. ~- Z( ` - *
, ^/ b' M2 V& H* ~% m - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* J7 z5 _' w7 N) t - * kind, whether express or implied; without even the implied warranty
$ S% z$ Z( i" R% L3 S" u4 _% Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 a3 F) \$ X4 @- U7 g" R% w5 \ - * GNU General Public License for more details.2 h/ A# O/ g) \" P3 _: A& ]
- */
' q/ ~ H/ F% } - 7 F" Q) e" i1 J' w" m! m
- #include <linux/module.h>0 y( e+ r/ O/ Z. ]4 s
- #include <linux/init.h>1 B1 Z3 P3 s9 n: i' j! l
- #include <linux/errno.h>' |1 u" L. c8 j3 x
- #include <linux/types.h>6 v% Z; O9 D* o% }
- #include <linux/interrupt.h>
3 \5 @7 {1 }$ J# G' p - #include <asm/io.h>
$ P6 S/ ^- S: Z& X: X. Z3 \5 \ - #include <linux/moduleparam.h>
& s1 c1 t4 w2 s! V2 x4 R z% T: h - #include <linux/sysctl.h>9 E4 [0 B2 M8 }: d: L4 W O
- #include <linux/mm.h>, }1 A/ ~8 E8 e. D/ J# `- n4 x
- #include <linux/dma-mapping.h>9 V& d7 e1 C8 D! K4 y) n
+ A7 R! j3 L" I- F3 D3 C- #include <mach/memory.h>
! c9 y6 Y1 \* }0 J - #include <mach/hardware.h>
( c4 l2 K- ~. q2 o. X( s) t# B - #include <mach/irqs.h>
4 T5 ?# Z/ N! a% M" u - #include <asm/hardware/edma.h>9 _7 q9 ]. d( d! k& [6 O
- 5 Y/ B1 n* ~' X$ b% h/ y
- #undef EDMA3_DEBUG
! }3 o. _/ Q9 _0 j - /*#define EDMA3_DEBUG*/
/ v: F: a2 E1 k2 J2 [5 W' s
# J2 R% E5 L9 s4 A8 w+ G9 \- #ifdef EDMA3_DEBUG
) _8 W3 a2 x/ ~* F z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): U* t* a$ L( e8 b7 M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 m9 V! s o; r1 _ k) K# d - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 V' H' ^; c! T E* w- Y' g6 z
- #else, J- `6 C. G7 @% r. h
- #define DMA_PRINTK( x... )
( m, I! |) A' s' ] - #define DMA_FN_IN
( V! s* L8 V: A9 |* `+ L - #define DMA_FN_OUT
. j# R7 U+ @! D4 B - #endif
- {3 P2 Z4 |& K
- l, z' p# [: I# b: l. b* p3 L ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 p# F) G8 d. `) F* W4 o - #define STATIC_SHIFT 3
$ ]6 @- E& z+ \0 ]# \ ~' | - #define TCINTEN_SHIFT 20- L- ]3 w$ q5 r0 V2 s6 ~
- #define ITCINTEN_SHIFT 21) c- P8 J" H7 I( T ]6 E
- #define TCCHEN_SHIFT 22
. ]+ [1 O5 J* ]0 I/ \& u5 i' @ - #define ITCCHEN_SHIFT 233 q% S6 U# V7 `9 d1 A% j
1 J2 A) e8 i# n) I0 [9 j0 O8 V& n5 }- static volatile int irqraised1 = 0;
' I; R2 t o) E' ~: F) B - static volatile int irqraised2 = 0;
& C$ S/ r/ V" }2 ^6 o# ~4 I
, v" r3 v* r% P' t) c2 p7 e0 A) H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* v4 z6 V$ h7 A3 D. t) u4 e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: ]$ ]* R! Y2 c! s - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. H3 s( ~, x3 L& p
- 7 H- c( a/ u l6 ~: S
- dma_addr_t dmaphyssrc1 = 0;2 V" {( L& A6 T
- dma_addr_t dmaphyssrc2 = 0;
w$ m* @2 L$ H - dma_addr_t dmaphysdest1 = 0;
, A1 @0 Q3 O4 D0 ^9 t& ^ - dma_addr_t dmaphysdest2 = 0;" l9 B" J7 J$ \; x, p) P( E
- G9 q! V# P% b* `3 {6 H
- char *dmabufsrc1 = NULL;
* o: M. _0 ~$ n3 a6 v- C& l( ?# i2 Y - char *dmabufsrc2 = NULL;
! f r6 X) w3 I; Y. r0 i8 s' j - char *dmabufdest1 = NULL;) P7 Y, b! ?) ~" j$ H* P1 N$ Z
- char *dmabufdest2 = NULL;/ k- P( I! c3 f l
H* J! E/ e j M ?5 \! I- static int acnt = 512;; F2 h1 @2 k+ l, Q$ O$ f
- static int bcnt = 8;/ e+ f' ?) A1 `# C* [( y9 [( H
- static int ccnt = 8;3 _6 x- j# D8 u" C4 I5 Q; e' e7 R7 M
- 3 L6 B, O) `9 u8 Q+ N2 q. L) Y. x
- module_param(acnt, int, S_IRUGO);5 _# ]" R" _% y" p3 u3 r! U6 d
- module_param(bcnt, int, S_IRUGO);
+ A' D( f* o) O9 F - module_param(ccnt, int, S_IRUGO);
复制代码 ' |0 B. `/ w% n0 \0 T0 Z$ T9 Z5 r5 S: F
( Z" Z' W; B8 L, N: G 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# G) W) Q; m6 h3 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* ~, b4 q% u8 O) X* T* X
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( E# o/ }# Q5 {
$ {% r$ X0 V* Y3 n/ X# Q' M, P) M+ i2 K8 v
|
|