1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
/* $OpenBSD: mpu_isapnp.c,v 1.7 2013/05/24 07:58:46 ratchov Exp $ */
#include "midi.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <sys/syslog.h>
#include <sys/device.h>
#include <sys/proc.h>
#include <machine/bus.h>
#include <sys/audioio.h>
#include <dev/audio_if.h>
#include <dev/midi_if.h>
#include <dev/mulaw.h>
#include <dev/isa/isavar.h>
#include <dev/isa/isadmavar.h>
#include <dev/ic/mpuvar.h>
int mpu_isapnp_match(struct device *, void *, void *);
void mpu_isapnp_attach(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;
void *match, *aux;
{
struct isa_attach_args *ipa = aux;
if (ipa->ipa_nirq != 1)
return 0;
return 1;
}
void
mpu_isapnp_attach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
struct mpu_isapnp_softc *sc = (struct mpu_isapnp_softc *)self;
struct isa_attach_args *ipa = aux;
printf("\n");
sc->sc_mpu.iot = ipa->ia_iot;
sc->sc_mpu.ioh = ipa->ipa_io[0].h;
sc->sc_ih = isa_intr_establish(ipa->ia_ic, ipa->ipa_irq[0].num,
ipa->ipa_irq[0].type, IPL_AUDIO | IPL_MPSAFE,
mpu_intr, &sc->sc_mpu, sc->sc_dev.dv_xname);
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);
}
|