Tidy up a little, the way that midi attachment code works
- change midi_attach() to omit the 'parent' arg (there are only two callers of this and it is not used) - change midisyn_attach() to midisyn_init(), so not needing a midi_softc, and fix the midi_pcppi driver to set hw_if and hw_hdl directly in its midi_softc before calling midi_attach() - add a device_t to opl_softc structure, change opl drivers to store the device 'self' in opl_softc and fix opl_attach() to use this opl_softc->dev field directly rather than a field in an otherwise unused midi_softc - remove unnecessary midi_softc from opl and cms drivers (child device provides that) reviewed by mrg
This commit is contained in:
parent
3348a6d20f
commit
1687854c43
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: opl.c,v 1.38 2011/11/23 23:07:32 jmcneill Exp $ */
|
/* $NetBSD: opl.c,v 1.39 2012/04/09 10:18:16 plunky Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
|
* Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
|
||||||
@ -35,7 +35,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: opl.c,v 1.38 2011/11/23 23:07:32 jmcneill Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: opl.c,v 1.39 2012/04/09 10:18:16 plunky Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
@ -142,9 +142,8 @@ opl_attach(struct opl_softc *sc)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (sc->lock == NULL) {
|
KASSERT(sc->dev != NULL);
|
||||||
panic("opl_attach: no lock");
|
KASSERT(sc->lock != NULL);
|
||||||
}
|
|
||||||
|
|
||||||
mutex_enter(sc->lock);
|
mutex_enter(sc->lock);
|
||||||
i = opl_find(sc);
|
i = opl_find(sc);
|
||||||
@ -164,7 +163,7 @@ opl_attach(struct opl_softc *sc)
|
|||||||
sc->syn.data = sc;
|
sc->syn.data = sc;
|
||||||
sc->syn.nvoice = sc->model == OPL_2 ? OPL2_NVOICE : OPL3_NVOICE;
|
sc->syn.nvoice = sc->model == OPL_2 ? OPL2_NVOICE : OPL3_NVOICE;
|
||||||
sc->syn.lock = sc->lock;
|
sc->syn.lock = sc->lock;
|
||||||
midisyn_attach(&sc->mididev, &sc->syn);
|
midisyn_init(&sc->syn);
|
||||||
|
|
||||||
/* Set up voice table */
|
/* Set up voice table */
|
||||||
for (i = 0; i < OPL3_NVOICE; i++)
|
for (i = 0; i < OPL3_NVOICE; i++)
|
||||||
@ -176,7 +175,7 @@ opl_attach(struct opl_softc *sc)
|
|||||||
sc->panl = OPL_VOICE_TO_LEFT;
|
sc->panl = OPL_VOICE_TO_LEFT;
|
||||||
sc->panr = OPL_VOICE_TO_RIGHT;
|
sc->panr = OPL_VOICE_TO_RIGHT;
|
||||||
if (sc->model == OPL_3 &&
|
if (sc->model == OPL_3 &&
|
||||||
device_cfdata(sc->mididev.dev)->cf_flags & OPL_FLAGS_SWAP_LR) {
|
device_cfdata(sc->dev)->cf_flags & OPL_FLAGS_SWAP_LR) {
|
||||||
sc->panl = OPL_VOICE_TO_RIGHT;
|
sc->panl = OPL_VOICE_TO_RIGHT;
|
||||||
sc->panr = OPL_VOICE_TO_LEFT;
|
sc->panr = OPL_VOICE_TO_LEFT;
|
||||||
aprint_normal(": LR swapped");
|
aprint_normal(": LR swapped");
|
||||||
@ -186,7 +185,7 @@ opl_attach(struct opl_softc *sc)
|
|||||||
aprint_naive("\n");
|
aprint_naive("\n");
|
||||||
|
|
||||||
sc->sc_mididev =
|
sc->sc_mididev =
|
||||||
midi_attach_mi(&midisyn_hw_if, &sc->syn, sc->mididev.dev);
|
midi_attach_mi(&midisyn_hw_if, &sc->syn, sc->dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: oplvar.h,v 1.16 2011/11/23 23:07:32 jmcneill Exp $ */
|
/* $NetBSD: oplvar.h,v 1.17 2012/04/09 10:18:16 plunky Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
|
* Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
|
||||||
@ -41,7 +41,7 @@ struct opl_voice {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct opl_softc {
|
struct opl_softc {
|
||||||
struct midi_softc mididev;
|
device_t dev;
|
||||||
bus_space_tag_t iot;
|
bus_space_tag_t iot;
|
||||||
bus_space_handle_t ioh;
|
bus_space_handle_t ioh;
|
||||||
kmutex_t *lock;
|
kmutex_t *lock;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: cms.c,v 1.20 2011/11/24 16:11:02 jakllsch Exp $ */
|
/* $NetBSD: cms.c,v 1.21 2012/04/09 10:18:16 plunky Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000 The NetBSD Foundation, Inc.
|
* Copyright (c) 2000 The NetBSD Foundation, Inc.
|
||||||
@ -27,7 +27,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: cms.c,v 1.20 2011/11/24 16:11:02 jakllsch Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: cms.c,v 1.21 2012/04/09 10:18:16 plunky Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
@ -58,8 +58,6 @@ int cmsdebug = 0;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct cms_softc {
|
struct cms_softc {
|
||||||
struct midi_softc sc_mididev;
|
|
||||||
|
|
||||||
kmutex_t sc_lock;
|
kmutex_t sc_lock;
|
||||||
|
|
||||||
bus_space_tag_t sc_iot;
|
bus_space_tag_t sc_iot;
|
||||||
@ -165,9 +163,7 @@ cms_attach(device_t parent, device_t self, void *aux)
|
|||||||
bus_space_tag_t iot;
|
bus_space_tag_t iot;
|
||||||
bus_space_handle_t ioh;
|
bus_space_handle_t ioh;
|
||||||
midisyn *ms;
|
midisyn *ms;
|
||||||
struct audio_attach_args arg;
|
|
||||||
|
|
||||||
sc->sc_mididev.dev = self;
|
|
||||||
mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_AUDIO);
|
mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_AUDIO);
|
||||||
|
|
||||||
aprint_normal("\n");
|
aprint_normal("\n");
|
||||||
@ -187,21 +183,17 @@ cms_attach(device_t parent, device_t self, void *aux)
|
|||||||
/* now let's reset the chips */
|
/* now let's reset the chips */
|
||||||
cms_reset(sc);
|
cms_reset(sc);
|
||||||
|
|
||||||
|
/* init the synthesiser */
|
||||||
ms = &sc->sc_midisyn;
|
ms = &sc->sc_midisyn;
|
||||||
ms->mets = &midi_cms_hw;
|
ms->mets = &midi_cms_hw;
|
||||||
strcpy(ms->name, "Creative Music System");
|
strcpy(ms->name, "Creative Music System");
|
||||||
ms->nvoice = CMS_NVOICES;
|
ms->nvoice = CMS_NVOICES;
|
||||||
ms->data = sc;
|
ms->data = sc;
|
||||||
ms->lock = &sc->sc_lock;
|
ms->lock = &sc->sc_lock;
|
||||||
|
midisyn_init(ms);
|
||||||
|
|
||||||
/* use the synthesiser */
|
/* and attach the midi device with the synthesiser */
|
||||||
midisyn_attach(&sc->sc_mididev, ms);
|
midi_attach_mi(&midisyn_hw_if, ms, self);
|
||||||
|
|
||||||
/* now attach the midi device to the synthesiser */
|
|
||||||
arg.type = AUDIODEV_TYPE_MIDI;
|
|
||||||
arg.hwif = sc->sc_mididev.hw_if;
|
|
||||||
arg.hdl = sc->sc_mididev.hw_hdl;
|
|
||||||
config_found(self, &arg, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: midi_pcppi.c,v 1.25 2012/04/05 20:13:35 plunky Exp $ */
|
/* $NetBSD: midi_pcppi.c,v 1.26 2012/04/09 10:18:17 plunky Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
|
* Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: midi_pcppi.c,v 1.25 2012/04/05 20:13:35 plunky Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: midi_pcppi.c,v 1.26 2012/04/09 10:18:17 plunky Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
@ -94,18 +94,20 @@ midi_pcppi_attach(device_t parent, device_t self, void *aux)
|
|||||||
struct pcppi_attach_args *pa = (struct pcppi_attach_args *)aux;
|
struct pcppi_attach_args *pa = (struct pcppi_attach_args *)aux;
|
||||||
midisyn *ms;
|
midisyn *ms;
|
||||||
|
|
||||||
sc->sc_mididev.dev = self;
|
midi_pcppi_attached++;
|
||||||
|
|
||||||
ms = &sc->sc_midisyn;
|
ms = &sc->sc_midisyn;
|
||||||
ms->mets = &midi_pcppi_hw;
|
ms->mets = &midi_pcppi_hw;
|
||||||
strcpy(ms->name, "PC speaker");
|
strcpy(ms->name, "PC speaker");
|
||||||
ms->nvoice = 1;
|
ms->nvoice = 1;
|
||||||
ms->data = pa->pa_cookie;
|
ms->data = pa->pa_cookie;
|
||||||
ms->lock = &tty_lock;
|
ms->lock = &tty_lock;
|
||||||
|
midisyn_init(ms);
|
||||||
|
|
||||||
midi_pcppi_attached++;
|
sc->sc_mididev.dev = self;
|
||||||
|
sc->sc_mididev.hw_if = &midisyn_hw_if;
|
||||||
midisyn_attach(&sc->sc_mididev, ms);
|
sc->sc_mididev.hw_hdl = ms;
|
||||||
midi_attach(&sc->sc_mididev, parent);
|
midi_attach(&sc->sc_mididev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: opl_ess.c,v 1.17 2011/11/23 23:07:32 jmcneill Exp $ */
|
/* $NetBSD: opl_ess.c,v 1.18 2012/04/09 10:18:17 plunky Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1999, 2008 The NetBSD Foundation, Inc.
|
* Copyright (c) 1999, 2008 The NetBSD Foundation, Inc.
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: opl_ess.c,v 1.17 2011/11/23 23:07:32 jmcneill Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: opl_ess.c,v 1.18 2012/04/09 10:18:17 plunky Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
@ -79,7 +79,7 @@ opl_ess_attach(device_t parent, device_t self, void *aux)
|
|||||||
struct ess_softc *ssc = device_private(parent);
|
struct ess_softc *ssc = device_private(parent);
|
||||||
struct opl_softc *sc = device_private(self);
|
struct opl_softc *sc = device_private(self);
|
||||||
|
|
||||||
sc->mididev.dev = self;
|
sc->dev = self;
|
||||||
sc->ioh = ssc->sc_ioh;
|
sc->ioh = ssc->sc_ioh;
|
||||||
sc->iot = ssc->sc_iot;
|
sc->iot = ssc->sc_iot;
|
||||||
sc->offs = 0;
|
sc->offs = 0;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: opl_isa.c,v 1.20 2011/11/23 23:07:32 jmcneill Exp $ */
|
/* $NetBSD: opl_isa.c,v 1.21 2012/04/09 10:18:17 plunky Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1999, 2008 The NetBSD Foundation, Inc.
|
* Copyright (c) 1999, 2008 The NetBSD Foundation, Inc.
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: opl_isa.c,v 1.20 2011/11/23 23:07:32 jmcneill Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: opl_isa.c,v 1.21 2012/04/09 10:18:17 plunky Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
@ -105,7 +105,7 @@ opl_isa_attach(device_t parent, device_t self, void *aux)
|
|||||||
struct opl_isa_softc *isa = device_private(self);
|
struct opl_isa_softc *isa = device_private(self);
|
||||||
struct isa_attach_args *ia = aux;
|
struct isa_attach_args *ia = aux;
|
||||||
|
|
||||||
sc->mididev.dev = self;
|
sc->dev = self;
|
||||||
sc->iot = ia->ia_iot;
|
sc->iot = ia->ia_iot;
|
||||||
|
|
||||||
if (bus_space_map(sc->iot, ia->ia_io[0].ir_addr, OPL_SIZE,
|
if (bus_space_map(sc->iot, ia->ia_io[0].ir_addr, OPL_SIZE,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: opl_sb.c,v 1.19 2011/11/23 23:07:32 jmcneill Exp $ */
|
/* $NetBSD: opl_sb.c,v 1.20 2012/04/09 10:18:17 plunky Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
|
* Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: opl_sb.c,v 1.19 2011/11/23 23:07:32 jmcneill Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: opl_sb.c,v 1.20 2012/04/09 10:18:17 plunky Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
@ -77,7 +77,7 @@ opl_sb_attach(device_t parent, device_t self, void *aux)
|
|||||||
struct sbdsp_softc *ssc = device_private(parent);
|
struct sbdsp_softc *ssc = device_private(parent);
|
||||||
struct opl_softc *sc = device_private(self);
|
struct opl_softc *sc = device_private(self);
|
||||||
|
|
||||||
sc->mididev.dev = self;
|
sc->dev = self;
|
||||||
sc->ioh = ssc->sc_ioh;
|
sc->ioh = ssc->sc_ioh;
|
||||||
sc->iot = ssc->sc_iot;
|
sc->iot = ssc->sc_iot;
|
||||||
sc->offs = 0;
|
sc->offs = 0;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: opl_wss.c,v 1.14 2011/12/07 17:38:50 jakllsch Exp $ */
|
/* $NetBSD: opl_wss.c,v 1.15 2012/04/09 10:18:17 plunky Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||||
@ -29,7 +29,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: opl_wss.c,v 1.14 2011/12/07 17:38:50 jakllsch Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: opl_wss.c,v 1.15 2012/04/09 10:18:17 plunky Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
@ -77,7 +77,7 @@ opl_wss_attach(device_t parent, device_t self, void *aux)
|
|||||||
struct wss_softc *ssc = device_private(parent);
|
struct wss_softc *ssc = device_private(parent);
|
||||||
struct opl_softc *sc = device_private(self);
|
struct opl_softc *sc = device_private(self);
|
||||||
|
|
||||||
sc->mididev.dev = self;
|
sc->dev = self;
|
||||||
sc->ioh = ssc->sc_opl_ioh;
|
sc->ioh = ssc->sc_opl_ioh;
|
||||||
sc->iot = ssc->sc_iot;
|
sc->iot = ssc->sc_iot;
|
||||||
sc->offs = 0;
|
sc->offs = 0;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: opl_ym.c,v 1.17 2011/12/07 17:38:50 jakllsch Exp $ */
|
/* $NetBSD: opl_ym.c,v 1.18 2012/04/09 10:18:17 plunky Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||||
@ -29,7 +29,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: opl_ym.c,v 1.17 2011/12/07 17:38:50 jakllsch Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: opl_ym.c,v 1.18 2012/04/09 10:18:17 plunky Exp $");
|
||||||
|
|
||||||
#include "mpu_ym.h"
|
#include "mpu_ym.h"
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ opl_ym_attach(device_t parent, device_t self, void *aux)
|
|||||||
struct ym_softc *ssc = device_private(parent);
|
struct ym_softc *ssc = device_private(parent);
|
||||||
struct opl_softc *sc = device_private(self);
|
struct opl_softc *sc = device_private(self);
|
||||||
|
|
||||||
sc->mididev.dev = self;
|
sc->dev = self;
|
||||||
sc->ioh = ssc->sc_opl_ioh;
|
sc->ioh = ssc->sc_opl_ioh;
|
||||||
sc->iot = ssc->sc_iot;
|
sc->iot = ssc->sc_iot;
|
||||||
sc->offs = 0;
|
sc->offs = 0;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: midi.c,v 1.77 2012/04/05 20:25:53 plunky Exp $ */
|
/* $NetBSD: midi.c,v 1.78 2012/04/09 10:18:16 plunky Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
|
* Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: midi.c,v 1.77 2012/04/05 20:25:53 plunky Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: midi.c,v 1.78 2012/04/09 10:18:16 plunky Exp $");
|
||||||
|
|
||||||
#include "midi.h"
|
#include "midi.h"
|
||||||
#include "sequencer.h"
|
#include "sequencer.h"
|
||||||
@ -137,13 +137,11 @@ midiprobe(device_t parent, cfdata_t match, void *aux)
|
|||||||
static void
|
static void
|
||||||
midiattach(device_t parent, device_t self, void *aux)
|
midiattach(device_t parent, device_t self, void *aux)
|
||||||
{
|
{
|
||||||
struct midi_softc *sc;
|
struct midi_softc *sc = device_private(self);
|
||||||
struct audio_attach_args *sa;
|
struct audio_attach_args *sa = aux;
|
||||||
const struct midi_hw_if *hwp;
|
const struct midi_hw_if *hwp;
|
||||||
void *hdlp;
|
void *hdlp;
|
||||||
|
|
||||||
sc = device_private(self);
|
|
||||||
sa = aux;
|
|
||||||
hwp = sa->hwif;
|
hwp = sa->hwif;
|
||||||
hdlp = sa->hdl;
|
hdlp = sa->hdl;
|
||||||
|
|
||||||
@ -165,7 +163,7 @@ midiattach(device_t parent, device_t self, void *aux)
|
|||||||
sc->dev = self;
|
sc->dev = self;
|
||||||
sc->hw_if = hwp;
|
sc->hw_if = hwp;
|
||||||
sc->hw_hdl = hdlp;
|
sc->hw_hdl = hdlp;
|
||||||
midi_attach(sc, parent);
|
midi_attach(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -235,7 +233,7 @@ mididetach(device_t self, int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
midi_attach(struct midi_softc *sc, device_t parent)
|
midi_attach(struct midi_softc *sc)
|
||||||
{
|
{
|
||||||
struct midi_info mi;
|
struct midi_info mi;
|
||||||
kmutex_t *dummy;
|
kmutex_t *dummy;
|
||||||
@ -1769,8 +1767,6 @@ midi_register_hw_if_ext(struct midi_hw_if_ext *exthw)
|
|||||||
|
|
||||||
#if NMIDI > 0 || NMIDIBUS > 0
|
#if NMIDI > 0 || NMIDIBUS > 0
|
||||||
|
|
||||||
int audioprint(void *, const char *);
|
|
||||||
|
|
||||||
device_t
|
device_t
|
||||||
midi_attach_mi(const struct midi_hw_if *mhwp, void *hdlp, device_t dev)
|
midi_attach_mi(const struct midi_hw_if *mhwp, void *hdlp, device_t dev)
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: midi_if.h,v 1.24 2011/11/24 21:59:35 mrg Exp $ */
|
/* $NetBSD: midi_if.h,v 1.25 2012/04/09 10:18:16 plunky Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||||
@ -102,7 +102,7 @@ struct midi_hw_if_ext {
|
|||||||
};
|
};
|
||||||
void midi_register_hw_if_ext(struct midi_hw_if_ext *);
|
void midi_register_hw_if_ext(struct midi_hw_if_ext *);
|
||||||
|
|
||||||
void midi_attach(struct midi_softc *, device_t);
|
void midi_attach(struct midi_softc *);
|
||||||
int mididetach(device_t, int);
|
int mididetach(device_t, int);
|
||||||
device_t midi_attach_mi(const struct midi_hw_if *, void *, device_t);
|
device_t midi_attach_mi(const struct midi_hw_if *, void *, device_t);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: midisyn.c,v 1.23 2011/11/23 23:07:31 jmcneill Exp $ */
|
/* $NetBSD: midisyn.c,v 1.24 2012/04/09 10:18:16 plunky Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
|
* Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: midisyn.c,v 1.23 2011/11/23 23:07:31 jmcneill Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: midisyn.c,v 1.24 2012/04/09 10:18:16 plunky Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
@ -133,10 +133,7 @@ midisyn_open(void *addr, int flags, void (*iintr)(void *, int),
|
|||||||
int rslt, error;
|
int rslt, error;
|
||||||
uint_fast8_t chan;
|
uint_fast8_t chan;
|
||||||
|
|
||||||
if (ms->lock == NULL) {
|
KASSERT(ms->lock != NULL);
|
||||||
panic("midisyn_open: no lock");
|
|
||||||
}
|
|
||||||
|
|
||||||
KASSERT(mutex_owned(ms->lock));
|
KASSERT(mutex_owned(ms->lock));
|
||||||
DPRINTF(("midisyn_open: ms=%p ms->mets=%p\n", ms, ms->mets));
|
DPRINTF(("midisyn_open: ms=%p ms->mets=%p\n", ms, ms->mets));
|
||||||
|
|
||||||
@ -250,12 +247,10 @@ midisyn_findvoice(midisyn *ms, int chan, int note)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
midisyn_attach(struct midi_softc *sc, midisyn *ms)
|
midisyn_init(midisyn *ms)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (ms->lock == NULL) {
|
KASSERT(ms->lock != NULL);
|
||||||
panic("midisyn_attach: no lock");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XXX there should be a way for this function to indicate failure
|
* XXX there should be a way for this function to indicate failure
|
||||||
@ -278,9 +273,7 @@ midisyn_attach(struct midi_softc *sc, midisyn *ms)
|
|||||||
.notify = midisyn_notify
|
.notify = midisyn_notify
|
||||||
};
|
};
|
||||||
|
|
||||||
sc->hw_if = &midisyn_hw_if;
|
DPRINTF(("midisyn_init: ms=%p\n", ms));
|
||||||
sc->hw_hdl = ms;
|
|
||||||
DPRINTF(("midisyn_attach: ms=%p\n", sc->hw_hdl));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: midisynvar.h,v 1.13 2011/11/23 23:07:31 jmcneill Exp $ */
|
/* $NetBSD: midisynvar.h,v 1.14 2012/04/09 10:18:16 plunky Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||||
@ -184,11 +184,9 @@ struct midisyn {
|
|||||||
|
|
||||||
#define MS_GETPGM(ms, vno) ((ms)->pgms[MS_GETCHAN(&(ms)->voices[vno])])
|
#define MS_GETPGM(ms, vno) ((ms)->pgms[MS_GETCHAN(&(ms)->voices[vno])])
|
||||||
|
|
||||||
struct midi_softc;
|
|
||||||
|
|
||||||
extern const struct midi_hw_if midisyn_hw_if;
|
extern const struct midi_hw_if midisyn_hw_if;
|
||||||
|
|
||||||
void midisyn_attach (struct midi_softc *, midisyn *);
|
void midisyn_init(midisyn *);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert a 14-bit volume or expression controller value to centibels using
|
* Convert a 14-bit volume or expression controller value to centibels using
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: opl_cmpci.c,v 1.16 2011/12/07 17:38:50 jakllsch Exp $ */
|
/* $NetBSD: opl_cmpci.c,v 1.17 2012/04/09 10:18:17 plunky Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: opl_cmpci.c,v 1.16 2011/12/07 17:38:50 jakllsch Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: opl_cmpci.c,v 1.17 2012/04/09 10:18:17 plunky Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
@ -73,7 +73,7 @@ opl_cmpci_attach(device_t parent, device_t self, void *aux)
|
|||||||
struct cmpci_softc *ssc = device_private(parent);
|
struct cmpci_softc *ssc = device_private(parent);
|
||||||
struct opl_softc *sc = device_private(self);
|
struct opl_softc *sc = device_private(self);
|
||||||
|
|
||||||
sc->mididev.dev = self;
|
sc->dev = self;
|
||||||
sc->ioh = ssc->sc_ioh;
|
sc->ioh = ssc->sc_ioh;
|
||||||
sc->iot = ssc->sc_iot;
|
sc->iot = ssc->sc_iot;
|
||||||
sc->offs = CMPCI_REG_FM_BASE;
|
sc->offs = CMPCI_REG_FM_BASE;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: opl_eso.c,v 1.17 2011/11/23 23:07:36 jmcneill Exp $ */
|
/* $NetBSD: opl_eso.c,v 1.18 2012/04/09 10:18:17 plunky Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: opl_eso.c,v 1.17 2011/11/23 23:07:36 jmcneill Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: opl_eso.c,v 1.18 2012/04/09 10:18:17 plunky Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
@ -72,7 +72,7 @@ opl_eso_attach(device_t parent, device_t self, void *aux)
|
|||||||
struct eso_softc *esc = device_private(parent);
|
struct eso_softc *esc = device_private(parent);
|
||||||
struct opl_softc *sc = device_private(self);
|
struct opl_softc *sc = device_private(self);
|
||||||
|
|
||||||
sc->mididev.dev = self;
|
sc->dev = self;
|
||||||
sc->ioh = esc->sc_sb_ioh;
|
sc->ioh = esc->sc_sb_ioh;
|
||||||
sc->iot = esc->sc_sb_iot;
|
sc->iot = esc->sc_sb_iot;
|
||||||
sc->offs = 0;
|
sc->offs = 0;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: opl_fms.c,v 1.16 2011/12/07 17:38:50 jakllsch Exp $ */
|
/* $NetBSD: opl_fms.c,v 1.17 2012/04/09 10:18:17 plunky Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: opl_fms.c,v 1.16 2011/12/07 17:38:50 jakllsch Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: opl_fms.c,v 1.17 2012/04/09 10:18:17 plunky Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
@ -73,7 +73,7 @@ opl_fms_attach(device_t parent, device_t self, void *aux)
|
|||||||
struct fms_softc *ssc = device_private(parent);
|
struct fms_softc *ssc = device_private(parent);
|
||||||
struct opl_softc *sc = device_private(self);
|
struct opl_softc *sc = device_private(self);
|
||||||
|
|
||||||
sc->mididev.dev = self;
|
sc->dev = self;
|
||||||
sc->ioh = ssc->sc_opl_ioh;
|
sc->ioh = ssc->sc_opl_ioh;
|
||||||
sc->iot = ssc->sc_iot;
|
sc->iot = ssc->sc_iot;
|
||||||
sc->offs = 0;
|
sc->offs = 0;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: opl_sv.c,v 1.15 2011/12/07 17:38:50 jakllsch Exp $ */
|
/* $NetBSD: opl_sv.c,v 1.16 2012/04/09 10:18:17 plunky Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: opl_sv.c,v 1.15 2011/12/07 17:38:50 jakllsch Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: opl_sv.c,v 1.16 2012/04/09 10:18:17 plunky Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
@ -72,7 +72,7 @@ opl_sv_attach(device_t parent, device_t self, void *aux)
|
|||||||
struct sv_softc *ssc = device_private(parent);
|
struct sv_softc *ssc = device_private(parent);
|
||||||
struct opl_softc *sc = device_private(self);
|
struct opl_softc *sc = device_private(self);
|
||||||
|
|
||||||
sc->mididev.dev = self;
|
sc->dev = self;
|
||||||
sc->ioh = ssc->sc_oplioh;
|
sc->ioh = ssc->sc_oplioh;
|
||||||
sc->iot = ssc->sc_opliot;
|
sc->iot = ssc->sc_opliot;
|
||||||
sc->offs = 0;
|
sc->offs = 0;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: opl_yds.c,v 1.16 2011/12/07 17:38:50 jakllsch Exp $ */
|
/* $NetBSD: opl_yds.c,v 1.17 2012/04/09 10:18:17 plunky Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: opl_yds.c,v 1.16 2011/12/07 17:38:50 jakllsch Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: opl_yds.c,v 1.17 2012/04/09 10:18:17 plunky Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
@ -75,7 +75,7 @@ opl_yds_attach(device_t parent, device_t self, void *aux)
|
|||||||
struct yds_softc *ssc = device_private(parent);
|
struct yds_softc *ssc = device_private(parent);
|
||||||
struct opl_softc *sc = device_private(self);
|
struct opl_softc *sc = device_private(self);
|
||||||
|
|
||||||
sc->mididev.dev = self;
|
sc->dev = self;
|
||||||
sc->ioh = ssc->sc_opl_ioh;
|
sc->ioh = ssc->sc_opl_ioh;
|
||||||
sc->iot = ssc->sc_opl_iot;
|
sc->iot = ssc->sc_opl_iot;
|
||||||
sc->offs = 0;
|
sc->offs = 0;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: sequencer.c,v 1.54 2012/02/13 01:47:16 mrg Exp $ */
|
/* $NetBSD: sequencer.c,v 1.55 2012/04/09 10:18:16 plunky Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
|
* Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
|
||||||
@ -55,7 +55,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: sequencer.c,v 1.54 2012/02/13 01:47:16 mrg Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: sequencer.c,v 1.55 2012/04/09 10:18:16 plunky Exp $");
|
||||||
|
|
||||||
#include "sequencer.h"
|
#include "sequencer.h"
|
||||||
|
|
||||||
@ -136,7 +136,6 @@ static void seq_timeout(void *);
|
|||||||
static int seq_to_new(seq_event_t *, struct uio *);
|
static int seq_to_new(seq_event_t *, struct uio *);
|
||||||
static void seq_softintr(void *);
|
static void seq_softintr(void *);
|
||||||
|
|
||||||
struct midi_softc;
|
|
||||||
static int midiseq_out(struct midi_dev *, u_char *, u_int, int);
|
static int midiseq_out(struct midi_dev *, u_char *, u_int, int);
|
||||||
static struct midi_dev *midiseq_open(int, int);
|
static struct midi_dev *midiseq_open(int, int);
|
||||||
static void midiseq_close(struct midi_dev *);
|
static void midiseq_close(struct midi_dev *);
|
||||||
|
Loading…
Reference in New Issue
Block a user