diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-10-18 17:20:17 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-10-18 17:20:17 +0000 |
commit | 0c04730b6718e2a9cd357673c6601fb978d07256 (patch) | |
tree | 8522f5db91f122a7907fb298a279ee46fc8255f9 /sys/arch/sparc/dev/dmavar.h | |
parent | 3e81c8c2af67101fa47ce68b5ee9a02c44c97a62 (diff) |
new driver by me
Diffstat (limited to 'sys/arch/sparc/dev/dmavar.h')
-rw-r--r-- | sys/arch/sparc/dev/dmavar.h | 73 |
1 files changed, 42 insertions, 31 deletions
diff --git a/sys/arch/sparc/dev/dmavar.h b/sys/arch/sparc/dev/dmavar.h index e921d6b2fcd..c5ebb58357c 100644 --- a/sys/arch/sparc/dev/dmavar.h +++ b/sys/arch/sparc/dev/dmavar.h @@ -1,7 +1,10 @@ /* $NetBSD: dmavar.h,v 1.4 1994/11/27 00:08:34 deraadt Exp $ */ /* - * Copyright (c) 1994 Peter Galbavy. All rights reserved. + * Copyright (c) 1994 Peter Galbavy + * Copyright (c) 1995 Theo de Raadt + * All rights reserved. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -12,7 +15,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Peter Galbavy. + * This product includes software developed by Peter Galbavy and + * Theo de Raadt. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * @@ -29,42 +33,49 @@ */ struct dma_softc { - struct device sc_dev; /* us as a device */ - struct sbusdev sc_sd; /* sbus device */ - struct esp_softc *sc_esp; /* my scsi */ - struct dma_regs *sc_regs; /* the registers */ + struct device sc_dev; /* us as a device */ + struct sbusdev sc_sd; /* sbus device */ + struct esp_softc *sc_esp; /* my scsi */ + struct dma_regs *sc_regs; /* the registers */ int sc_active; /* DMA active ? */ int sc_rev; /* revision */ int sc_node; /* PROM node ID */ - size_t sc_dmasize; - caddr_t *sc_dmaaddr; + + size_t sc_segsize; /* current operation */ + void **sc_dmaaddr; size_t *sc_dmalen; - void (*reset)(struct dma_softc *); /* reset routine */ - void (*enintr)(struct dma_softc *); /* enable interrupts */ - void (*start)(struct dma_softc *, caddr_t *, size_t *, int); - int (*isintr)(struct dma_softc *); /* intrerrupt ? */ - int (*intr)(struct dma_softc *); /* intrerrupt ! */ + char sc_dmapolling; /* ... is polled */ + char sc_dmadev2mem; /* transfer direction */ }; -/* - * We are not allowed to touch the DMA "flush" and "drain" bits - * while it is still thinking about a request (DMA_RP). - */ +void dmareset __P((struct dma_softc *sc)); +void dmastart __P((struct dma_softc *sc, void *addr, + size_t *len, int datain, int poll)); +int dmaintr __P((struct dma_softc *sc, int restart)); +int dmapending __P((struct dma_softc *sc)); +void dmadrain __P((struct dma_softc *sc)); +void dmaenintr __P((struct dma_softc *sc)); +int dmadisintr __P((struct dma_softc *sc)); -/* - * TIME WAIT (to debug hanging machine problem) - */ +#define DMACSR(sc) (sc->sc_regs->csr) +#define DMADDR(sc) (sc->sc_regs->addr) +#define DMABCNT(sc) (sc->sc_regs->bcnt) -#define TIME_WAIT(COND, MSG, SC) { int count = 500000; \ - while (--count > 0 && (COND)) DELAY(1); \ - if (count == 0) { \ - printf("CSR = %x\n", SC->sc_regs->csr);\ - panic(MSG); } \ - } +#define TIME_WAIT(cond, msg, sc) { \ + int count = 500000; \ + while (--count > 0 && (cond)) \ + DELAY(1); \ + if (count == 0) { \ + printf("CSR = %x\n", (sc)->sc_regs->csr); \ + panic(msg); \ + } \ +} -#define DMAWAIT(sc) TIME_WAIT((sc->sc_regs->csr & D_R_PEND), "DMAWAIT", sc) -#define DMAWAIT1(sc) TIME_WAIT((sc->sc_regs->csr & D_DRAINING), "DMAWAIT1", sc) -#define DMAREADY(sc) TIME_WAIT((!(sc->sc_regs->csr & D_DMA_ON)), "DMAREADY", sc) +#define DMAWAIT_PEND(sc) \ + TIME_WAIT((DMACSR(sc) & D_R_PEND), \ + "DMAWAIT_PEND", sc) -#define DMACSR(sc) (sc->sc_regs->csr) -#define DMADDR(sc) (sc->sc_regs->addr) +/* keep punching the chip until it's flushed */ +#define DMAWAIT_DRAIN(sc) \ + TIME_WAIT((DMACSR(sc) |= D_DRAIN, DMACSR(sc) & D_DRAINING), \ + "DMAWAIT_DRAIN", sc) |