|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 Z1 S J( x1 {3 c; F1 c
- [code]EDMA sample test application5 g$ B* O0 W* v" G E& q) ]
- /*
, ~* J: H6 m; h# D3 j6 H+ K - * edma_test.c! w5 p% _) n' A5 O
- *
( P, R/ G* P5 K! H5 A4 `+ E - * brief EDMA3 Test Application
1 X$ ]! m) K+ K1 c( ^7 A1 c - *- s q. A0 n$ N4 s2 ^
- * This file contains EDMA3 Test code.
+ k: b* e6 `) H$ z# t h* M - *
2 B1 x$ r8 M- p - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* @! Y$ O+ Z$ f' z4 D. [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! E! ~# A `4 w8 S: ^ - * TO CHANGE.
/ l( r3 g; P( j/ R6 g, @6 I - ** O L% r P' s) M4 A5 ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 P" G( Y( \7 _# _1 P7 ^ - *& X" p/ U+ f( |3 V. ]
- * This program is free software; you can redistribute it and/or
( J/ ?' q6 E u) X2 V - * modify it under the terms of the GNU General Public License as
+ q# l/ B# L6 {& H - * published by the Free Software Foundation version 2.3 W0 i# ]6 p: k/ H
- *8 Y$ I0 W8 y) g. Y7 o- q, I* H5 x* y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 D# G" E6 z2 A - * kind, whether express or implied; without even the implied warranty
3 p/ E$ z* c5 S- B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 v$ l- i: V! Q) S- n
- * GNU General Public License for more details.
7 b6 h5 i9 [; l. i) E - */
& l6 ?2 k' t1 V3 [- Y7 ]
* d. [$ l2 R* d- E5 I5 {/ ]- #include <linux/module.h>- u* @! y/ `7 Z1 J3 a/ D" ~
- #include <linux/init.h>3 o& W( s, @, h
- #include <linux/errno.h>1 c# t/ u# C, d0 D- i9 P, t5 I: z
- #include <linux/types.h>6 u" g' t; p% e
- #include <linux/interrupt.h>
. _/ j- E4 C$ f; ]' ~+ |* ] - #include <asm/io.h>
8 j4 w7 h* n" }5 A$ U; g B - #include <linux/moduleparam.h>1 E8 X8 w6 _8 \+ F* d. J: b
- #include <linux/sysctl.h>. J5 v& c, y. T2 M7 p/ @, e
- #include <linux/mm.h>
1 Q/ `4 J1 T9 g" m0 p, f - #include <linux/dma-mapping.h>' l) B, ?4 r/ P. }6 c, v: a3 K' L
- 8 C$ ^# _7 a' ]. p7 l
- #include <mach/memory.h>
/ e3 e+ P7 {5 ~5 `8 [ - #include <mach/hardware.h>
- k8 T- l2 h% C1 U c - #include <mach/irqs.h>
6 N; s/ X5 c" p. t* v& g1 Q0 m6 P# D& N - #include <asm/hardware/edma.h>
2 `3 m: s9 d( x: I; y - ( T0 V& Q6 h3 x t2 [
- #undef EDMA3_DEBUG
3 ?' m6 v& l7 p4 I x5 D8 m - /*#define EDMA3_DEBUG*/% E/ L$ a# l5 c# `
4 j" e' @9 A! z S. R- #ifdef EDMA3_DEBUG" ?% d. o, U$ F
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 B: C+ S( P/ A) L. s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& j; o9 [) v1 D( r; Q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) v+ E+ {+ [& N* l+ x, l( q6 Y
- #else
9 I) l6 M; A4 ^" h' ^$ i - #define DMA_PRINTK( x... )
5 Z3 @& B+ Z1 a0 G/ P% u - #define DMA_FN_IN
/ f. e0 M! u1 w& s1 I0 Y' Y6 C - #define DMA_FN_OUT- Y. O2 t# E" _( ~
- #endif
1 X: U+ U* z- H1 a2 |+ N: G$ } - ; I8 p( [. ?) i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 T' L+ l1 _9 |5 H* G1 R
- #define STATIC_SHIFT 34 N8 A9 i1 O7 r* @$ |
- #define TCINTEN_SHIFT 20+ F4 m% ^! \# E
- #define ITCINTEN_SHIFT 21
# H" L1 b" \5 z* N5 Z - #define TCCHEN_SHIFT 22
* J9 u5 x4 ~7 [( C2 ^ - #define ITCCHEN_SHIFT 23
, B$ |1 C1 m( O/ p4 c% S1 b - & _7 X9 [- i& d9 c* K. |, Q
- static volatile int irqraised1 = 0;
- z. I0 R3 X. t - static volatile int irqraised2 = 0;) m. Z/ c, v- v3 Q% i6 d
- + u6 A- ~# Z/ M) E1 X- j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& M$ S0 y( s8 ]" G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# D% J2 o0 q7 |& r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' P- B: ?& m* j
; j: _6 e8 Z& |1 @8 x5 S- dma_addr_t dmaphyssrc1 = 0;
( U0 o, X/ k2 ~& N8 U; E- d2 Y - dma_addr_t dmaphyssrc2 = 0;' y+ x) M. K' Q) j
- dma_addr_t dmaphysdest1 = 0;
- c q9 N' D4 b& b# U - dma_addr_t dmaphysdest2 = 0;, x4 u9 ?' A6 @
- ' Z8 b8 j! X6 o& ~) O9 D3 S
- char *dmabufsrc1 = NULL;
) [, ^( Q$ |; E+ {# T) T6 I - char *dmabufsrc2 = NULL;
' @9 y$ @* Z& q - char *dmabufdest1 = NULL;; t) `, g: y; Y3 `% X' F y: P
- char *dmabufdest2 = NULL;
2 s" [, n1 _* T& k! w - 7 v- B+ A) g4 M5 {
- static int acnt = 512;( F. y& P: ?; i3 Z" e7 B; N; Y% w
- static int bcnt = 8;! h. w# x8 x6 r* N2 o- l
- static int ccnt = 8; j/ H* A- a7 R
- $ J( |+ I; {- m, ^4 \ K9 B
- module_param(acnt, int, S_IRUGO);
! t! @( v2 Q% ]6 ` - module_param(bcnt, int, S_IRUGO);
) {9 |, j7 }* u4 ?2 t3 o& F. Z - module_param(ccnt, int, S_IRUGO);
复制代码
1 ` F2 Z: U- v/ f
" k, M, H! V7 F( n" S0 U" T 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- i0 c9 w* k- u- t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 u4 ` f( y# U+ _$ W5 d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, h/ Z7 w: b2 Y3 a) A. a+ ~4 i, K0 b6 T
/ B+ J" E* R( l8 e% J" @. C
|
|