Home | History | Annotate | Line # | Download | only in iomd
      1  1.3      dsl /*	$NetBSD: iomd_dma.h,v 1.3 2009/03/14 14:45:55 dsl Exp $	*/
      2  1.1  reinoud 
      3  1.1  reinoud /*
      4  1.1  reinoud  * Copyright (c) 1997 Scott Stevens
      5  1.1  reinoud  *
      6  1.1  reinoud  * Redistribution and use in source and binary forms, with or without
      7  1.1  reinoud  * modification, are permitted provided that the following conditions
      8  1.1  reinoud  * are met:
      9  1.1  reinoud  * 1. Redistributions of source code must retain the above copyright
     10  1.1  reinoud  *    notice, this list of conditions and the following disclaimer.
     11  1.1  reinoud  * 2. Redistributions in binary form must reproduce the above copyright
     12  1.1  reinoud  *    notice, this list of conditions and the following disclaimer in the
     13  1.1  reinoud  *    documentation and/or other materials provided with the distribution.
     14  1.1  reinoud  * 3. All advertising materials mentioning features or use of this software
     15  1.1  reinoud  *    must display the following acknowledgement:
     16  1.1  reinoud  *      This product includes software developed by Scott Stevens.
     17  1.1  reinoud  * 4. Neither the name of the University nor the names of its contributors
     18  1.1  reinoud  *    may be used to endorse or promote products derived from this software
     19  1.1  reinoud  *    without specific prior written permission.
     20  1.1  reinoud  *
     21  1.1  reinoud  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     22  1.1  reinoud  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     23  1.1  reinoud  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     24  1.1  reinoud  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
     25  1.1  reinoud  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     26  1.1  reinoud  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     27  1.1  reinoud  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     28  1.1  reinoud  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     29  1.1  reinoud  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     30  1.1  reinoud  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     31  1.1  reinoud  * SUCH DAMAGE.
     32  1.1  reinoud  *
     33  1.1  reinoud  *      @(#)dmavar.h
     34  1.1  reinoud  */
     35  1.1  reinoud 
     36  1.1  reinoud /*
     37  1.1  reinoud  * dma structures
     38  1.1  reinoud  */
     39  1.1  reinoud 
     40  1.1  reinoud struct dma_ctrl {
     41  1.1  reinoud 	int			dc_flags;
     42  1.1  reinoud 	int			dc_channel;
     43  1.1  reinoud 	int			dc_dmasize;
     44  1.1  reinoud 	volatile u_int		*dc_cura;
     45  1.1  reinoud 	volatile u_int		*dc_enda;
     46  1.1  reinoud 	volatile u_int		*dc_curb;
     47  1.1  reinoud 	volatile u_int		*dc_endb;
     48  1.1  reinoud 	volatile u_char		*dc_cr;
     49  1.1  reinoud 	volatile u_char		*dc_st;
     50  1.1  reinoud 
     51  1.1  reinoud 	u_char			*dc_nextaddr;
     52  1.1  reinoud 	int			dc_len;
     53  1.1  reinoud 
     54  1.1  reinoud 	irqhandler_t		dc_ih;
     55  1.1  reinoud };
     56  1.1  reinoud 
     57  1.1  reinoud #define DMA_FL_ACTIVE	0x01
     58  1.1  reinoud #define DMA_FL_READY	0x02
     59  1.1  reinoud 
     60  1.1  reinoud #define DMA_CR_CLEAR	0x80
     61  1.1  reinoud #define DMA_CR_DIR	0x40
     62  1.1  reinoud #define DMA_CR_ENABLE	0x20
     63  1.1  reinoud #define DMA_CR_INC	0x1f
     64  1.1  reinoud 
     65  1.1  reinoud #define DMA_ST_CHAN	0x01
     66  1.1  reinoud #define DMA_ST_INT	0x02
     67  1.1  reinoud #define DMA_ST_OVER	0x04
     68  1.1  reinoud #define DMA_ST_MASK	(DMA_ST_CHAN | DMA_ST_INT | DMA_ST_OVER)
     69  1.1  reinoud 
     70  1.1  reinoud #define DMA_END_STOP	0x80000000
     71  1.1  reinoud #define DMA_END_LAST	0x40000000
     72  1.1  reinoud 
     73  1.1  reinoud /* Prototypes */
     74  1.3      dsl struct dma_ctrl *dma_init(int, int, int, int);
     75  1.3      dsl void dma_go(struct dma_ctrl *);
     76  1.3      dsl int dma_reset(struct dma_ctrl *);
     77  1.3      dsl int dma_setup(struct dma_ctrl *, u_char *, int, int);
     78  1.3      dsl int dma_isactive(struct dma_ctrl *);
     79  1.3      dsl int dma_isintr(struct dma_ctrl *);
     80  1.3      dsl int dma_intr(void *);
     81