|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ y5 |, t. O5 v2 s3 B& }4 }
- [code]EDMA sample test application2 t2 c) j# ?( [7 g' N9 |
- /*6 ?/ ?# c. M" y
- * edma_test.c" T* J/ U% \' A0 y
- *
# k5 T4 S3 i5 |" r - * brief EDMA3 Test Application
8 Z) E& X. m0 w; U/ w0 L" } - *! \4 j9 m n |$ q6 X& s1 Q2 n8 s
- * This file contains EDMA3 Test code.
Y* D8 N/ ?1 @! S- b$ @) ]! U - *
$ Z1 \+ p/ G/ z- V9 U; } - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, R* R! a* Q3 I) u Z. h" z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% u& q6 J: `2 u# u
- * TO CHANGE.8 I# t" W U( O8 W( D* W
- *7 x- F: K) `+ G
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* m# d5 f& \, d: q) Y
- *
3 J/ ^' G5 v& q C& H/ K3 q4 ` - * This program is free software; you can redistribute it and/or
( {9 a/ @% x7 m( o8 F$ V - * modify it under the terms of the GNU General Public License as
4 _5 T. \- s2 X, W2 @ - * published by the Free Software Foundation version 2.2 y/ n- a8 p7 Z _
- *
- s8 N/ ~: n6 d/ z5 l. e( ^ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 O( B( B( }/ _5 p( M" ~ - * kind, whether express or implied; without even the implied warranty; Q3 \4 W$ Q$ S4 L4 Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; F0 G' |' b5 q4 H& ? - * GNU General Public License for more details.
" L) M4 s# C8 F# ^, m3 h - */; L. e; f. _' T1 \/ O$ P, K$ f. E
- 4 O+ a1 m, P; {$ i( w" b+ ^# X/ z
- #include <linux/module.h>
3 i9 W& J5 E& ~( N( C - #include <linux/init.h>
. C+ x9 x. p! Q" c - #include <linux/errno.h>. j2 v( k) }$ D' a1 S& H6 K
- #include <linux/types.h>& t$ `9 m5 U! w) U6 f- r
- #include <linux/interrupt.h>
7 c. `0 d/ U* O, | L* _& }+ @ - #include <asm/io.h>4 |) p J$ U/ A
- #include <linux/moduleparam.h>
* F2 b0 u" ~! X& Q& G: }& G. Y2 w - #include <linux/sysctl.h>
9 k- [& a; N/ b9 L2 i - #include <linux/mm.h>
$ X9 M# f; R ?. f4 J0 U7 d - #include <linux/dma-mapping.h>
. z2 q9 Y/ W, R. ?& u/ T: Q& f! e - : |( {0 F$ h; y- N2 C
- #include <mach/memory.h>
3 g- ]2 h S `( H t* N2 f - #include <mach/hardware.h>( u$ L* q/ t1 _- {& a* f# P' H
- #include <mach/irqs.h>
3 c. p/ q) t5 X+ q8 _+ r - #include <asm/hardware/edma.h>
6 A8 A$ p, }# L - 7 Z6 g! U6 A7 l5 @
- #undef EDMA3_DEBUG
. Q6 ~) l/ n% B3 t, \$ f' ~% ~ - /*#define EDMA3_DEBUG*/
/ N4 h! P1 }& R- A" k6 |4 m
- S2 J5 {* z- y9 p$ {- #ifdef EDMA3_DEBUG' j: u3 w3 h: q! k; E) e, J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' r7 q4 G. z, m0 ^# t) m0 t6 y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! \7 h4 d# d1 t+ q* A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 X+ t6 O* Q- u w, H - #else
: j+ B) k; F, u. P8 e: [7 O9 V- P I - #define DMA_PRINTK( x... )3 S! P o9 z, ?3 i# ]* D' {1 T
- #define DMA_FN_IN
4 ?" l! n1 _ u3 s - #define DMA_FN_OUT
/ _; n5 z' X# R& D - #endif
" s! w8 [% R: ^6 G5 Z
2 t# ~& {% j& Y+ O0 Q6 n3 \( Z% y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: G. q' i& C! v* y. A - #define STATIC_SHIFT 3* j1 N& u y- J% `% h
- #define TCINTEN_SHIFT 202 T1 k' X$ s$ z5 o/ _
- #define ITCINTEN_SHIFT 21
6 u, h' @5 P# O8 [# l: s. Z! `* j - #define TCCHEN_SHIFT 22
- P: k7 ~- S8 ]5 F - #define ITCCHEN_SHIFT 23% Z* u+ o$ J ~ q( c6 y
1 r. F: I9 S8 h- static volatile int irqraised1 = 0;3 d) O& j" Q& H+ s% H4 \4 ^
- static volatile int irqraised2 = 0;
4 n( A- n; I) p+ e! P* M0 I4 H - # T9 u1 u" z( t+ B9 @/ g
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 k5 ~2 X! X* M2 i/ j3 R - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
t3 v+ }* M: F7 T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" G6 F1 j+ T: r* a. j& g
- ) B& ?% l' Z- X- E
- dma_addr_t dmaphyssrc1 = 0;
" V$ R. a3 M% U/ f5 W2 {" C - dma_addr_t dmaphyssrc2 = 0;
2 Y" o: J5 N, F. J* s: L1 H o - dma_addr_t dmaphysdest1 = 0;) l3 _6 A1 _3 V
- dma_addr_t dmaphysdest2 = 0;+ e3 L1 W1 ]8 @7 G4 M" {
# v6 i' L* @) Z& G5 _ n" P* W2 \- char *dmabufsrc1 = NULL;$ D8 c- F4 S: }- m
- char *dmabufsrc2 = NULL;
0 J, }4 U- P8 t" y, u0 n - char *dmabufdest1 = NULL;
5 R2 Q: z7 m; n g \" m - char *dmabufdest2 = NULL;6 C+ \9 |. T0 f% a' Z1 v- Z
+ \6 g* v: I! C: c0 p) F1 S) z- static int acnt = 512;
9 y7 Q9 `- y3 f @. G& ?2 l - static int bcnt = 8;
- p* I) f% a! I - static int ccnt = 8;! P" K% i! @3 p4 P9 V9 R. A
- . a& {. H/ u( n' r* O7 t9 N
- module_param(acnt, int, S_IRUGO);8 F9 T- F+ k% E: G0 Q# a' j
- module_param(bcnt, int, S_IRUGO);
7 o+ Y: P/ w* U7 ]7 j7 ?( E* f - module_param(ccnt, int, S_IRUGO);
复制代码
- a9 H' Q5 @8 U3 r+ p* w* U
4 H# r: B8 f0 |* b9 H1 r9 c 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. @* W: ]% t; \( O; yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* x v/ @ N. Y& j1 `
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ w9 T* ~, {" E
+ A u5 b0 |" ~
0 ?: E+ x% i' _: ^9 G# @
|
|