Home | History | Annotate | Line # | Download | only in dev
dmavar.h revision 1.1.2.1
      1  1.1.2.1      is /*	$NetBSD: dmavar.h,v 1.1.2.1 1997/03/12 14:21:47 is Exp $ */
      2      1.1  jeremy 
      3      1.1  jeremy /*
      4      1.1  jeremy  * Copyright (c) 1994 Peter Galbavy.  All rights reserved.
      5      1.1  jeremy  * Redistribution and use in source and binary forms, with or without
      6      1.1  jeremy  * modification, are permitted provided that the following conditions
      7      1.1  jeremy  * are met:
      8      1.1  jeremy  * 1. Redistributions of source code must retain the above copyright
      9      1.1  jeremy  *    notice, this list of conditions and the following disclaimer.
     10      1.1  jeremy  * 2. Redistributions in binary form must reproduce the above copyright
     11      1.1  jeremy  *    notice, this list of conditions and the following disclaimer in the
     12      1.1  jeremy  *    documentation and/or other materials provided with the distribution.
     13      1.1  jeremy  * 3. All advertising materials mentioning features or use of this software
     14      1.1  jeremy  *    must display the following acknowledgement:
     15      1.1  jeremy  *	This product includes software developed by Peter Galbavy.
     16      1.1  jeremy  * 4. The name of the author may not be used to endorse or promote products
     17      1.1  jeremy  *    derived from this software without specific prior written permission.
     18      1.1  jeremy  *
     19      1.1  jeremy  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     20      1.1  jeremy  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     21      1.1  jeremy  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     22      1.1  jeremy  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     23      1.1  jeremy  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     24      1.1  jeremy  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     25      1.1  jeremy  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     26      1.1  jeremy  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     27      1.1  jeremy  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     28      1.1  jeremy  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     29      1.1  jeremy  */
     30      1.1  jeremy 
     31      1.1  jeremy struct dma_softc {
     32      1.1  jeremy 	struct device sc_dev;			/* us as a device */
     33      1.1  jeremy 	struct esp_softc *sc_esp;		/* my scsi */
     34      1.1  jeremy 	struct dma_regs *sc_regs;		/* the registers */
     35      1.1  jeremy 	int	sc_active;			/* DMA active ? */
     36      1.1  jeremy 	u_int	sc_rev;				/* revision */
     37      1.1  jeremy 	int	sc_burst;			/* DVMA burst size in effect */
     38      1.1  jeremy 	caddr_t	sc_dvmakaddr;			/* DVMA cookies */
     39      1.1  jeremy 	caddr_t	sc_dvmaaddr;			/*		*/
     40      1.1  jeremy 	u_long  sc_dmasaddr;			/* Slave address */
     41      1.1  jeremy 	size_t	sc_dmasize;
     42      1.1  jeremy 	caddr_t	*sc_dmaaddr;
     43      1.1  jeremy 	size_t  *sc_dmalen;
     44      1.1  jeremy 	void (*reset)(struct dma_softc *);	/* reset routine */
     45      1.1  jeremy 	void (*enintr)(struct dma_softc *);	/* enable interrupts */
     46      1.1  jeremy 	int (*isintr)(struct dma_softc *);	/* interrupt ? */
     47      1.1  jeremy 	int (*intr)(struct dma_softc *);	/* interrupt ! */
     48      1.1  jeremy 	int (*setup)(struct dma_softc *, caddr_t *, size_t *, int, size_t *);
     49      1.1  jeremy 	void (*go)(struct dma_softc *);
     50      1.1  jeremy };
     51      1.1  jeremy 
     52      1.1  jeremy #define DMACSR(sc)	(sc->sc_regs->csr)
     53      1.1  jeremy #define DMADDR(sc)	(sc->sc_regs->addr)
     54      1.1  jeremy #define DMACNT(sc)	(sc->sc_regs->bcnt)
     55      1.1  jeremy 
     56      1.1  jeremy /* DMA engine functions */
     57      1.1  jeremy #define DMA_ENINTR(r)		(((r)->enintr)(r))
     58      1.1  jeremy #define DMA_ISINTR(r)		(((r)->isintr)(r))
     59      1.1  jeremy #define DMA_RESET(r)		(((r)->reset)(r))
     60      1.1  jeremy #define DMA_INTR(r)		(((r)->intr)(r))
     61      1.1  jeremy #define DMA_ISACTIVE(r)		((r)->sc_active)
     62      1.1  jeremy #define DMA_SETUP(a, b, c, d, e)	(((a)->setup)(a, b, c, d, e))
     63      1.1  jeremy #define DMA_GO(r)		(((r)->go)(r))
     64      1.1  jeremy 
     65      1.1  jeremy void dmaattach __P((struct device *, struct device *, void *));
     66