mpu_isapnp.c revision 1.1 1 1.1 mycroft #include "midi.h"
2 1.1 mycroft
3 1.1 mycroft #include <sys/param.h>
4 1.1 mycroft #include <sys/systm.h>
5 1.1 mycroft #include <sys/errno.h>
6 1.1 mycroft #include <sys/ioctl.h>
7 1.1 mycroft #include <sys/syslog.h>
8 1.1 mycroft #include <sys/device.h>
9 1.1 mycroft #include <sys/proc.h>
10 1.1 mycroft
11 1.1 mycroft #include <machine/bus.h>
12 1.1 mycroft
13 1.1 mycroft #include <sys/audioio.h>
14 1.1 mycroft #include <dev/audio_if.h>
15 1.1 mycroft #include <dev/midi_if.h>
16 1.1 mycroft #include <dev/mulaw.h>
17 1.1 mycroft
18 1.1 mycroft #include <dev/isa/isavar.h>
19 1.1 mycroft #include <dev/isa/isadmavar.h>
20 1.1 mycroft
21 1.1 mycroft #include <dev/isapnp/isapnpreg.h>
22 1.1 mycroft #include <dev/isapnp/isapnpvar.h>
23 1.1 mycroft #include <dev/isapnp/isapnpdevs.h>
24 1.1 mycroft
25 1.1 mycroft #include <dev/isa/mpuvar.h>
26 1.1 mycroft
27 1.1 mycroft int mpu_isapnp_match __P((struct device *, struct cfdata *, void *));
28 1.1 mycroft void mpu_isapnp_attach __P((struct device *, struct device *, void *));
29 1.1 mycroft
30 1.1 mycroft struct mpu_isapnp_softc {
31 1.1 mycroft struct device sc_dev;
32 1.1 mycroft void *sc_ih;
33 1.1 mycroft
34 1.1 mycroft struct mpu_softc sc_mpu;
35 1.1 mycroft };
36 1.1 mycroft
37 1.1 mycroft struct cfattach mpu_isapnp_ca = {
38 1.1 mycroft sizeof(struct mpu_isapnp_softc), mpu_isapnp_match, mpu_isapnp_attach
39 1.1 mycroft };
40 1.1 mycroft
41 1.1 mycroft int
42 1.1 mycroft mpu_isapnp_match(parent, match, aux)
43 1.1 mycroft struct device *parent;
44 1.1 mycroft struct cfdata *match;
45 1.1 mycroft void *aux;
46 1.1 mycroft {
47 1.1 mycroft return (isapnp_devmatch(aux, &isapnp_mpu_devinfo));
48 1.1 mycroft }
49 1.1 mycroft
50 1.1 mycroft void
51 1.1 mycroft mpu_isapnp_attach(parent, self, aux)
52 1.1 mycroft struct device *parent, *self;
53 1.1 mycroft void *aux;
54 1.1 mycroft {
55 1.1 mycroft struct mpu_isapnp_softc *sc = (struct mpu_isapnp_softc *)self;
56 1.1 mycroft struct isapnp_attach_args *ipa = aux;
57 1.1 mycroft
58 1.1 mycroft printf("\n");
59 1.1 mycroft
60 1.1 mycroft if (isapnp_config(ipa->ipa_iot, ipa->ipa_memt, ipa)) {
61 1.1 mycroft printf("%s: error in region allocation\n",
62 1.1 mycroft sc->sc_dev.dv_xname);
63 1.1 mycroft return;
64 1.1 mycroft }
65 1.1 mycroft
66 1.1 mycroft sc->sc_mpu.iot = ipa->ipa_iot;
67 1.1 mycroft sc->sc_mpu.ioh = ipa->ipa_io[0].h;
68 1.1 mycroft
69 1.1 mycroft if (!mpu_find(&sc->sc_mpu)) {
70 1.1 mycroft printf("%s: find failed\n", sc->sc_dev.dv_xname);
71 1.1 mycroft return;
72 1.1 mycroft }
73 1.1 mycroft
74 1.1 mycroft printf("%s: %s %s\n", sc->sc_dev.dv_xname, ipa->ipa_devident,
75 1.1 mycroft ipa->ipa_devclass);
76 1.1 mycroft
77 1.1 mycroft midi_attach_mi(&mpu_midi_hw_if, &sc->sc_mpu, &sc->sc_dev);
78 1.1 mycroft
79 1.1 mycroft sc->sc_ih = isa_intr_establish(ipa->ipa_ic, ipa->ipa_irq[0].num,
80 1.1 mycroft ipa->ipa_irq[0].type, IPL_AUDIO, mpu_intr, &sc->sc_mpu);
81 1.1 mycroft }
82