From ccbad3061c53f857d87b9c4080d8a3b9e8620287 Mon Sep 17 00:00:00 2001 From: mycroft Date: Mon, 22 Mar 1999 07:39:33 +0000 Subject: [PATCH] Add a mpu_isapnp attachment. --- sys/dev/isapnp/files.isapnp | 6 ++- sys/dev/isapnp/mpu_isapnp.c | 81 +++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 sys/dev/isapnp/mpu_isapnp.c diff --git a/sys/dev/isapnp/files.isapnp b/sys/dev/isapnp/files.isapnp index 7c5391a2ca8b..3c26197b9b98 100644 --- a/sys/dev/isapnp/files.isapnp +++ b/sys/dev/isapnp/files.isapnp @@ -1,4 +1,4 @@ -# $NetBSD: files.isapnp,v 1.21 1999/01/10 10:23:24 augustss Exp $ +# $NetBSD: files.isapnp,v 1.22 1999/03/22 07:39:33 mycroft Exp $ # # Config file and device description for machine-independent ISAPnP code. # Included by ports that need it. @@ -59,6 +59,10 @@ file dev/isapnp/wss_isapnp.c wss_isapnp needs-flag attach ess at isapnp with ess_isapnp file dev/isapnp/ess_isapnp.c ess_isapnp +# MPU401 compatibles +attach mpu at isapnp with mpu_isapnp +file dev/isapnp/mpu_isapnp.c mpu_isapnp + # # ISAPnP SCSI Controller # diff --git a/sys/dev/isapnp/mpu_isapnp.c b/sys/dev/isapnp/mpu_isapnp.c new file mode 100644 index 000000000000..97c88fea1b23 --- /dev/null +++ b/sys/dev/isapnp/mpu_isapnp.c @@ -0,0 +1,81 @@ +#include "midi.h" + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include + +int mpu_isapnp_match __P((struct device *, struct cfdata *, void *)); +void mpu_isapnp_attach __P((struct device *, struct device *, void *)); + +struct mpu_isapnp_softc { + struct device sc_dev; + void *sc_ih; + + struct mpu_softc sc_mpu; +}; + +struct cfattach mpu_isapnp_ca = { + sizeof(struct mpu_isapnp_softc), mpu_isapnp_match, mpu_isapnp_attach +}; + +int +mpu_isapnp_match(parent, match, aux) + struct device *parent; + struct cfdata *match; + void *aux; +{ + return (isapnp_devmatch(aux, &isapnp_mpu_devinfo)); +} + +void +mpu_isapnp_attach(parent, self, aux) + struct device *parent, *self; + void *aux; +{ + struct mpu_isapnp_softc *sc = (struct mpu_isapnp_softc *)self; + struct isapnp_attach_args *ipa = aux; + + printf("\n"); + + if (isapnp_config(ipa->ipa_iot, ipa->ipa_memt, ipa)) { + printf("%s: error in region allocation\n", + sc->sc_dev.dv_xname); + return; + } + + sc->sc_mpu.iot = ipa->ipa_iot; + sc->sc_mpu.ioh = ipa->ipa_io[0].h; + + if (!mpu_find(&sc->sc_mpu)) { + printf("%s: find failed\n", sc->sc_dev.dv_xname); + return; + } + + printf("%s: %s %s\n", sc->sc_dev.dv_xname, ipa->ipa_devident, + ipa->ipa_devclass); + + midi_attach_mi(&mpu_midi_hw_if, &sc->sc_mpu, &sc->sc_dev); + + sc->sc_ih = isa_intr_establish(ipa->ipa_ic, ipa->ipa_irq[0].num, + ipa->ipa_irq[0].type, IPL_AUDIO, mpu_intr, &sc->sc_mpu); +}