diff --git a/sys/dev/isa/pas.c b/sys/dev/isa/pas.c index cefb8b00ca8c..09febb230e86 100644 --- a/sys/dev/isa/pas.c +++ b/sys/dev/isa/pas.c @@ -1,4 +1,4 @@ -/* $NetBSD: pas.c,v 1.7 1995/05/08 22:02:01 brezak Exp $ */ +/* $NetBSD: pas.c,v 1.8 1995/07/07 02:19:48 brezak Exp $ */ /* * Copyright (c) 1991-1993 Regents of the University of California. @@ -55,7 +55,6 @@ #include #include -#include /* XXX BROKEN; WHY? */ #include #include @@ -63,8 +62,7 @@ #define DEFINE_TRANSLATIONS #include -#define DEBUG /*XXX*/ -#ifdef DEBUG +#ifdef AUDIO_DEBUG #define DPRINTF(x) if (pasdebug) printf x int pasdebug = 0; #else @@ -432,28 +430,11 @@ pasattach(parent, self, aux) register struct pas_softc *sc = (struct pas_softc *)self; struct isa_attach_args *ia = (struct isa_attach_args *)aux; register u_short iobase = ia->ia_iobase; - + int err; + sc->sc_iobase = iobase; - -#ifdef NEWCONFIG - isa_establish(&sc->sc_id, &sc->sc_dev); -#endif - sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_BIO, - sbdsp_intr, &sc->sc_sbdsp); - -#ifdef NEWCONFIG - /* - * We limit DMA transfers to a page, and use the generic DMA handling - * code in isa.c. This code can end up copying a buffer, but since - * the audio driver uses relative small buffers this isn't likely. - * - * This allocation scheme means that the maximum transfer is limited - * by the page size (rather than 64k). This is reasonable. For 4K - * pages, the transfer time at 48KHz is 4096 / 48000 = 85ms. This - * is plenty long enough to amortize any fixed time overhead. - */ - at_setup_dmachan(sc->sc_dmachan, NBPG); -#endif + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_AUDIO, + sbdsp_intr, &sc->sc_sbdsp); printf(" ProAudio Spectrum %s [rev %d] ", pasnames[sc->model], sc->rev); @@ -462,8 +443,8 @@ pasattach(parent, self, aux) sprintf(pas_device.name, "pas,%s", pasnames[sc->model]); sprintf(pas_device.version, "%d", sc->rev); - if (audio_hardware_attach(&pas_hw_if, &sc->sc_sbdsp) != 0) - printf("pas: could not attach to audio pseudo-device driver\n"); + if ((err = audio_hardware_attach(&pas_hw_if, &sc->sc_sbdsp)) != 0) + printf("pas: could not attach to audio pseudo-device driver (%d)\n", err); } int diff --git a/sys/dev/isa/pss.c b/sys/dev/isa/pss.c index 5f4082ad3b78..c61f30ffe687 100644 --- a/sys/dev/isa/pss.c +++ b/sys/dev/isa/pss.c @@ -1,4 +1,4 @@ -/* $NetBSD: pss.c,v 1.7 1995/05/08 22:02:05 brezak Exp $ */ +/* $NetBSD: pss.c,v 1.8 1995/07/07 02:19:51 brezak Exp $ */ /* * Copyright (c) 1994 John Brezak @@ -67,7 +67,6 @@ #include #include -#include /* XXX BROKEN; WHY? */ #include #include @@ -142,9 +141,9 @@ struct cd_softc { u_short sc_irq; /* CD interrupt */ }; -#define DEBUG /*XXX*/ -#ifdef DEBUG -#define DPRINTF(x) if (pssdebug) printf x +#ifdef AUDIO_DEBUG +extern void Dprintf __P((const char *, ...)); +#define DPRINTF(x) if (pssdebug) Dprintf x int pssdebug = 0; #else #define DPRINTF(x) @@ -702,7 +701,7 @@ pssprobe(parent, self, aux) int i; if (!PSS_BASE_VALID(iobase)) { - printf("pss: configured iobase %d invalid\n", iobase); + printf("pss: configured iobase %x invalid\n", iobase); return 0; } @@ -865,6 +864,7 @@ spprobe(parent, match, aux) } sc->sc_drq = cf->cf_drq; } + sc->sc_recdrq = sc->sc_drq; /* Set WSS config registers */ if ((bits = wss_interrupt_bits[sc->sc_irq]) == 0xff) { @@ -994,6 +994,7 @@ pssattach(parent, self, aux) u_short iobase = ia->ia_iobase; u_char vers; struct ad1848_volume vol = {150, 150}; + int err; sc->sc_iobase = iobase; sc->sc_drq = ia->ia_drq; @@ -1003,11 +1004,11 @@ pssattach(parent, self, aux) #endif /* Setup interrupt handler for PSS */ - sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_CLOCK, - pssintr, sc); + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_AUDIO, + pssintr, sc); vers = (inw(sc->sc_iobase+PSS_ID_VERS)&0xff) - 1; - printf(": esc614%c\n", (vers > 0)?'A'+vers:' '); + printf(": ESC614%c\n", (vers > 0)?'A'+vers:' '); (void)config_found(self, NULL, NULL); @@ -1018,8 +1019,8 @@ pssattach(parent, self, aux) (void)pss_set_treble(sc, AUDIO_MAX_GAIN/2); (void)pss_set_bass(sc, AUDIO_MAX_GAIN/2); - if (audio_hardware_attach(&pss_audio_if, sc->ad1848_sc) != 0) - printf("pss: could not attach to audio pseudo-device driver\n"); + if ((err = audio_hardware_attach(&pss_audio_if, sc->ad1848_sc)) != 0) + printf("pss: could not attach to audio pseudo-device driver (%d)\n", err); } void @@ -1038,7 +1039,7 @@ spattach(parent, self, aux) isa_establish(&sc->sc_id, &sc->sc_dev); #endif - sc->sc_ih = isa_intr_establish(cf->cf_irq, ISA_IST_EDGE, ISA_IPL_CLOCK, + sc->sc_ih = isa_intr_establish(cf->cf_irq, ISA_IST_EDGE, ISA_IPL_AUDIO, ad1848_intr, sc); /* XXX might use pssprint func ?? */ @@ -1066,7 +1067,7 @@ mpuattach(parent, self, aux) isa_establish(&sc->sc_id, &sc->sc_dev); #endif - sc->sc_ih = isa_intr_establish(cf->cf_irq, ISA_IST_EDGE, ISA_IPL_CLOCK, + sc->sc_ih = isa_intr_establish(cf->cf_irq, ISA_IST_EDGE, ISA_IPL_AUDIO, mpuintr, sc); /* XXX might use pssprint func ?? */ @@ -1462,6 +1463,7 @@ pss_mixer_set_port(addr, cp) if (cp->type == AUDIO_MIXER_ENUM) { sc->mic_mute = cp->un.ord; DPRINTF(("mic mute %d\n", cp->un.ord)); + ad1848_mute_aux2(ac, cp->un.ord); error = 0; } break; @@ -1477,6 +1479,7 @@ pss_mixer_set_port(addr, cp) if (cp->type == AUDIO_MIXER_ENUM) { sc->cd_mute = cp->un.ord; DPRINTF(("CD mute %d\n", cp->un.ord)); + ad1848_mute_aux1(ac, cp->un.ord); error = 0; } break; diff --git a/sys/dev/isa/sb.c b/sys/dev/isa/sb.c index ec42ddfa8cff..fa8218a63dac 100644 --- a/sys/dev/isa/sb.c +++ b/sys/dev/isa/sb.c @@ -1,4 +1,4 @@ -/* $NetBSD: sb.c,v 1.25 1995/05/08 22:02:14 brezak Exp $ */ +/* $NetBSD: sb.c,v 1.26 1995/07/07 02:19:54 brezak Exp $ */ /* * Copyright (c) 1991-1993 Regents of the University of California. @@ -50,14 +50,13 @@ #include #include -#include /* XXX BROKEN; WHY? */ #include #include -#define DEBUG /*XXX*/ -#ifdef DEBUG -#define DPRINTF(x) if (sbdebug) printf x +#ifdef AUDIO_DEBUG +extern void Dprintf __P((const char *, ...)); +#define DPRINTF(x) if (sbdebug) Dprintf x int sbdebug = 0; #else #define DPRINTF(x) @@ -75,7 +74,7 @@ int sbprobe(); void sbattach __P((struct device *, struct device *, void *)); struct cfdriver sbcd = { - NULL, "sb", sbprobe, sbattach, DV_DULL, sizeof(struct sb_softc) + NULL, "sb", sbprobe, sbattach, DV_DULL, sizeof(struct sbdsp_softc) }; struct audio_device sb_device = { @@ -147,7 +146,7 @@ sbprobe(parent, self, aux) struct device *parent, *self; void *aux; { - register struct sb_softc *sc = (void *)self; + register struct sbdsp_softc *sc = (void *)self; register struct isa_attach_args *ia = aux; register u_short iobase = ia->ia_iobase; static u_char irq_conf[11] = { @@ -158,8 +157,8 @@ sbprobe(parent, self, aux) printf("sb: configured iobase %d invalid\n", ia->ia_iobase); return 0; } - sc->sc_sbdsp.sc_iobase = iobase; - if (sbdsp_probe(&sc->sc_sbdsp) == 0) { + sc->sc_iobase = iobase; + if (sbdsp_probe(sc) == 0) { DPRINTF(("sb: sbdsp probe failed\n")); return 0; } @@ -167,13 +166,13 @@ sbprobe(parent, self, aux) /* * Cannot auto-discover DMA channel. */ - if (ISSBPROCLASS(&sc->sc_sbdsp)) { + if (ISSBPROCLASS(sc)) { if (!SBP_DRQ_VALID(ia->ia_drq)) { printf("sb: configured dma chan %d invalid\n", ia->ia_drq); return 0; } - if (ISSB16CLASS(&sc->sc_sbdsp)) { - sbdsp_mix_write(&sc->sc_sbdsp, SBP_SET_DRQ, + if (ISSB16CLASS(sc)) { + sbdsp_mix_write(sc, SBP_SET_DRQ, 1 << ia->ia_drq); } } @@ -190,8 +189,8 @@ sbprobe(parent, self, aux) */ if (ia->ia_irq == IRQUNK) { ia->ia_irq = isa_discoverintr(sbforceintr, aux); - sbdsp_reset(&sc->sc_sbdsp); - if (ISSBPROCLASS(&sc->sc_sbdsp)) { + sbdsp_reset(sc); + if (ISSBPROCLASS(sc)) { if (!SBP_IRQ_VALID(ia->ia_irq)) { printf("sb: couldn't auto-detect interrupt"); return 0; @@ -205,13 +204,13 @@ sbprobe(parent, self, aux) } } else #endif - if (ISSBPROCLASS(&sc->sc_sbdsp)) { + if (ISSBPROCLASS(sc)) { if (!SBP_IRQ_VALID(ia->ia_irq)) { printf("sb: configured irq %d invalid\n", ia->ia_irq); return 0; } - if (ISSB16CLASS(&sc->sc_sbdsp)) { - sbdsp_mix_write(&sc->sc_sbdsp, SBP_SET_IRQ, + if (ISSB16CLASS(sc)) { + sbdsp_mix_write(sc, SBP_SET_IRQ, irq_conf[ia->ia_irq]); } } @@ -222,10 +221,10 @@ sbprobe(parent, self, aux) } } - sc->sc_sbdsp.sc_irq = ia->ia_irq; - sc->sc_sbdsp.sc_drq = ia->ia_drq; + sc->sc_irq = ia->ia_irq; + sc->sc_drq = ia->ia_drq; - if (ISSBPROCLASS(&sc->sc_sbdsp)) + if (ISSBPROCLASS(sc)) ia->ia_iosize = SBP_NPORT; else ia->ia_iosize = SB_NPORT; @@ -269,24 +268,22 @@ sbattach(parent, self, aux) struct device *parent, *self; void *aux; { - register struct sb_softc *sc = (struct sb_softc *)self; + register struct sbdsp_softc *sc = (struct sbdsp_softc *)self; struct isa_attach_args *ia = (struct isa_attach_args *)aux; register u_short iobase = ia->ia_iobase; + int err; + + sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_AUDIO, + sbdsp_intr, sc); -#ifdef NEWCONFIG - isa_establish(&sc->sc_id, &sc->sc_dev); -#endif - sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_BIO, - sbdsp_intr, &sc->sc_sbdsp); - - sbdsp_attach(&sc->sc_sbdsp); + sbdsp_attach(sc); sprintf(sb_device.version, "%d.%d", - SBVER_MAJOR(sc->sc_sbdsp.sc_model), - SBVER_MINOR(sc->sc_sbdsp.sc_model)); + SBVER_MAJOR(sc->sc_model), + SBVER_MINOR(sc->sc_model)); - if (audio_hardware_attach(&sb_hw_if, &sc->sc_sbdsp) != 0) - printf("sb: could not attach to audio pseudo-device driver\n"); + if ((err = audio_hardware_attach(&sb_hw_if, sc)) != 0) + printf("sb: could not attach to audio pseudo-device driver (%d)\n", err); } /* @@ -298,7 +295,7 @@ sbopen(dev, flags) dev_t dev; int flags; { - struct sb_softc *sc; + struct sbdsp_softc *sc; int unit = AUDIOUNIT(dev); if (unit >= sbcd.cd_ndevs) @@ -308,7 +305,7 @@ sbopen(dev, flags) if (!sc) return ENXIO; - return sbdsp_open(&sc->sc_sbdsp, dev, flags); + return sbdsp_open(sc, dev, flags); } int diff --git a/sys/dev/isa/sbdsp.c b/sys/dev/isa/sbdsp.c index c2bba2401603..f0e3904dd3cd 100644 --- a/sys/dev/isa/sbdsp.c +++ b/sys/dev/isa/sbdsp.c @@ -1,4 +1,4 @@ -/* $NetBSD: sbdsp.c,v 1.11 1995/05/08 22:02:19 brezak Exp $ */ +/* $NetBSD: sbdsp.c,v 1.12 1995/07/07 02:19:55 brezak Exp $ */ /* * Copyright (c) 1991-1993 Regents of the University of California. @@ -63,19 +63,14 @@ #include #include -#ifdef DEBUG +#ifdef AUDIO_DEBUG extern void Dprintf __P((const char *, ...)); - -#define DPRINTF(x) if (sbdspdebug) printf x +#define DPRINTF(x) if (sbdspdebug) Dprintf x int sbdspdebug = 0; #else #define DPRINTF(x) #endif -#ifndef NEWCONFIG -#define at_dma(flags, ptr, cc, chan) isa_dmastart(flags, ptr, cc, chan) -#endif - #ifndef SBDSP_NPOLL #define SBDSP_NPOLL 3000 #endif @@ -86,7 +81,7 @@ struct { int wmidi; } sberr; -#ifdef DEBUG +#ifdef AUDIO_DEBUG void sb_printsc(struct sbdsp_softc *sc) { @@ -141,20 +136,6 @@ sbdsp_attach(sc) sc->sc_locked = 0; -#ifdef NEWCONFIG - /* - * We limit DMA transfers to a page, and use the generic DMA handling - * code in isa.c. This code can end up copying a buffer, but since - * the audio driver uses relative small buffers this isn't likely. - * - * This allocation scheme means that the maximum transfer is limited - * by the page size (rather than 64k). This is reasonable. For 4K - * pages, the transfer time at 48KHz is 4096 / 48000 = 85ms. This - * is plenty long enough to amortize any fixed time overhead. - */ - at_setup_dmachan(sc->sc_drq, NBPG); -#endif - /* Set defaults */ if (ISSBPROCLASS(sc)) sc->sc_irate = sc->sc_orate = 45454; @@ -962,7 +943,7 @@ sbdsp_dma_input(addr, p, cc, intr, arg) register u_short iobase; u_int phys; -#ifdef DEBUG +#ifdef AUDIO_DEBUG if (sbdspdebug > 1) Dprintf("sbdsp_dma_input: cc=%d 0x%x (0x%x)\n", cc, intr, arg); #endif @@ -995,7 +976,7 @@ sbdsp_dma_input(addr, p, cc, intr, arg) } sc->sc_dmaout_inprogress = 0; - at_dma(B_READ, p, cc, sc->sc_drq); + isa_dmastart(B_READ, p, cc, sc->sc_drq); sc->sc_intr = intr; sc->sc_arg = arg; sc->dmaflags = B_READ; @@ -1045,7 +1026,7 @@ sbdsp_dma_output(addr, p, cc, intr, arg) register struct sbdsp_softc *sc = addr; register u_short iobase; -#ifdef DEBUG +#ifdef AUDIO_DEBUG if (sbdspdebug > 1) Dprintf("sbdsp_dma_output: cc=%d 0x%x (0x%x)\n", cc, intr, arg); #endif @@ -1065,7 +1046,7 @@ sbdsp_dma_output(addr, p, cc, intr, arg) sc->sc_last_hsw_size = 0; /* restarting */ } sc->sc_dmain_inprogress = 0; - at_dma(B_WRITE, p, cc, sc->sc_drq); + isa_dmastart(B_WRITE, p, cc, sc->sc_drq); sc->sc_intr = intr; sc->sc_arg = arg; sc->dmaflags = B_WRITE; @@ -1131,7 +1112,7 @@ sbdsp_intr(arg) { register struct sbdsp_softc *sc = arg; -#ifdef DEBUG +#ifdef AUDIO_DEBUG if (sbdspdebug > 1) Dprintf("sbdsp_intr: intr=0x%x\n", sc->sc_intr); #endif