KNF.
This commit is contained in:
parent
0b9ec50365
commit
aa04459121
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: wss.c,v 1.45 1998/05/20 16:19:43 augustss Exp $ */
|
||||
/* $NetBSD: wss.c,v 1.46 1998/05/21 19:17:50 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 John Brezak
|
||||
|
@ -116,214 +116,215 @@ struct audio_hw_if wss_hw_if = {
|
|||
*/
|
||||
void
|
||||
wssattach(sc)
|
||||
struct wss_softc *sc;
|
||||
struct wss_softc *sc;
|
||||
{
|
||||
int version;
|
||||
int version;
|
||||
|
||||
madattach(sc);
|
||||
madattach(sc);
|
||||
|
||||
sc->sc_ih = isa_intr_establish(sc->sc_ic, sc->wss_irq, IST_EDGE, IPL_AUDIO,
|
||||
ad1848_intr, &sc->sc_ad1848);
|
||||
sc->sc_ih = isa_intr_establish(sc->sc_ic, sc->wss_irq, IST_EDGE,
|
||||
IPL_AUDIO, ad1848_intr, &sc->sc_ad1848);
|
||||
|
||||
ad1848_attach(&sc->sc_ad1848);
|
||||
printf(": %s", sc->sc_ad1848.chip_name);
|
||||
ad1848_attach(&sc->sc_ad1848);
|
||||
printf(": %s", sc->sc_ad1848.chip_name);
|
||||
|
||||
version = bus_space_read_1(sc->sc_iot, sc->sc_ioh, WSS_STATUS) & WSS_VERSMASK;
|
||||
printf(" (vers %d)", version);
|
||||
switch(sc->mad_chip_type) {
|
||||
case MAD_82C928:
|
||||
printf(", 82C928");
|
||||
break;
|
||||
case MAD_OTI601D:
|
||||
printf(", OTI-601D");
|
||||
break;
|
||||
case MAD_82C929:
|
||||
printf(", 82C929");
|
||||
break;
|
||||
case MAD_82C931:
|
||||
printf(", 82C931");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
printf("\n");
|
||||
version = bus_space_read_1(sc->sc_iot, sc->sc_ioh, WSS_STATUS)
|
||||
& WSS_VERSMASK;
|
||||
printf(" (vers %d)", version);
|
||||
switch(sc->mad_chip_type) {
|
||||
case MAD_82C928:
|
||||
printf(", 82C928");
|
||||
break;
|
||||
case MAD_OTI601D:
|
||||
printf(", OTI-601D");
|
||||
break;
|
||||
case MAD_82C929:
|
||||
printf(", 82C929");
|
||||
break;
|
||||
case MAD_82C931:
|
||||
printf(", 82C931");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
sc->sc_ad1848.parent = sc;
|
||||
sc->sc_ad1848.parent = sc;
|
||||
|
||||
audio_attach_mi(&wss_hw_if, 0, &sc->sc_ad1848, &sc->sc_dev);
|
||||
audio_attach_mi(&wss_hw_if, 0, &sc->sc_ad1848, &sc->sc_dev);
|
||||
}
|
||||
|
||||
int
|
||||
wss_getdev(addr, retp)
|
||||
void *addr;
|
||||
struct audio_device *retp;
|
||||
void *addr;
|
||||
struct audio_device *retp;
|
||||
{
|
||||
*retp = wss_device;
|
||||
*retp = wss_device;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ad1848_devmap_t mappings[] = {
|
||||
{ WSS_MIC_IN_LVL, AD1848_KIND_LVL, AD1848_AUX2_CHANNEL },
|
||||
{ WSS_LINE_IN_LVL, AD1848_KIND_LVL, AD1848_AUX1_CHANNEL },
|
||||
{ WSS_DAC_LVL, AD1848_KIND_LVL, AD1848_DAC_CHANNEL },
|
||||
{ WSS_MON_LVL, AD1848_KIND_LVL, AD1848_MONO_CHANNEL },
|
||||
{ WSS_MIC_IN_MUTE, AD1848_KIND_MUTE, AD1848_AUX2_CHANNEL },
|
||||
{ WSS_LINE_IN_MUTE, AD1848_KIND_MUTE, AD1848_AUX1_CHANNEL },
|
||||
{ WSS_DAC_MUTE, AD1848_KIND_MUTE, AD1848_DAC_CHANNEL },
|
||||
{ WSS_REC_LVL, AD1848_KIND_RECORDGAIN, -1 },
|
||||
{ WSS_RECORD_SOURCE, AD1848_KIND_RECORDSOURCE, -1}
|
||||
{ WSS_MIC_IN_LVL, AD1848_KIND_LVL, AD1848_AUX2_CHANNEL },
|
||||
{ WSS_LINE_IN_LVL, AD1848_KIND_LVL, AD1848_AUX1_CHANNEL },
|
||||
{ WSS_DAC_LVL, AD1848_KIND_LVL, AD1848_DAC_CHANNEL },
|
||||
{ WSS_MON_LVL, AD1848_KIND_LVL, AD1848_MONO_CHANNEL },
|
||||
{ WSS_MIC_IN_MUTE, AD1848_KIND_MUTE, AD1848_AUX2_CHANNEL },
|
||||
{ WSS_LINE_IN_MUTE, AD1848_KIND_MUTE, AD1848_AUX1_CHANNEL },
|
||||
{ WSS_DAC_MUTE, AD1848_KIND_MUTE, AD1848_DAC_CHANNEL },
|
||||
{ WSS_REC_LVL, AD1848_KIND_RECORDGAIN, -1 },
|
||||
{ WSS_RECORD_SOURCE, AD1848_KIND_RECORDSOURCE, -1}
|
||||
};
|
||||
|
||||
static int nummap = sizeof(mappings) / sizeof(mappings[0]);
|
||||
|
||||
int
|
||||
wss_mixer_set_port(addr, cp)
|
||||
void *addr;
|
||||
mixer_ctrl_t *cp;
|
||||
void *addr;
|
||||
mixer_ctrl_t *cp;
|
||||
{
|
||||
struct ad1848_softc *ac = addr;
|
||||
struct ad1848_softc *ac = addr;
|
||||
|
||||
return (ad1848_mixer_set_port(ac, mappings, nummap, cp));
|
||||
return (ad1848_mixer_set_port(ac, mappings, nummap, cp));
|
||||
}
|
||||
|
||||
int
|
||||
wss_mixer_get_port(addr, cp)
|
||||
void *addr;
|
||||
mixer_ctrl_t *cp;
|
||||
void *addr;
|
||||
mixer_ctrl_t *cp;
|
||||
{
|
||||
struct ad1848_softc *ac = addr;
|
||||
struct ad1848_softc *ac = addr;
|
||||
|
||||
return (ad1848_mixer_get_port(ac, mappings, nummap, cp));
|
||||
return (ad1848_mixer_get_port(ac, mappings, nummap, cp));
|
||||
}
|
||||
|
||||
int
|
||||
wss_query_devinfo(addr, dip)
|
||||
void *addr;
|
||||
mixer_devinfo_t *dip;
|
||||
void *addr;
|
||||
mixer_devinfo_t *dip;
|
||||
{
|
||||
DPRINTF(("wss_query_devinfo: index=%d\n", dip->index));
|
||||
DPRINTF(("wss_query_devinfo: index=%d\n", dip->index));
|
||||
|
||||
switch(dip->index) {
|
||||
case WSS_MIC_IN_LVL: /* Microphone */
|
||||
dip->type = AUDIO_MIXER_VALUE;
|
||||
dip->mixer_class = WSS_INPUT_CLASS;
|
||||
dip->prev = AUDIO_MIXER_LAST;
|
||||
dip->next = WSS_MIC_IN_MUTE;
|
||||
strcpy(dip->label.name, AudioNmicrophone);
|
||||
dip->un.v.num_channels = 2;
|
||||
strcpy(dip->un.v.units.name, AudioNvolume);
|
||||
break;
|
||||
switch(dip->index) {
|
||||
case WSS_MIC_IN_LVL: /* Microphone */
|
||||
dip->type = AUDIO_MIXER_VALUE;
|
||||
dip->mixer_class = WSS_INPUT_CLASS;
|
||||
dip->prev = AUDIO_MIXER_LAST;
|
||||
dip->next = WSS_MIC_IN_MUTE;
|
||||
strcpy(dip->label.name, AudioNmicrophone);
|
||||
dip->un.v.num_channels = 2;
|
||||
strcpy(dip->un.v.units.name, AudioNvolume);
|
||||
break;
|
||||
|
||||
case WSS_LINE_IN_LVL: /* line/CD */
|
||||
dip->type = AUDIO_MIXER_VALUE;
|
||||
dip->mixer_class = WSS_INPUT_CLASS;
|
||||
dip->prev = AUDIO_MIXER_LAST;
|
||||
dip->next = WSS_LINE_IN_MUTE;
|
||||
strcpy(dip->label.name, AudioNcd);
|
||||
dip->un.v.num_channels = 2;
|
||||
strcpy(dip->un.v.units.name, AudioNvolume);
|
||||
break;
|
||||
|
||||
case WSS_DAC_LVL: /* dacout */
|
||||
dip->type = AUDIO_MIXER_VALUE;
|
||||
dip->mixer_class = WSS_INPUT_CLASS;
|
||||
dip->prev = AUDIO_MIXER_LAST;
|
||||
dip->next = WSS_DAC_MUTE;
|
||||
strcpy(dip->label.name, AudioNdac);
|
||||
dip->un.v.num_channels = 2;
|
||||
strcpy(dip->un.v.units.name, AudioNvolume);
|
||||
break;
|
||||
|
||||
case WSS_REC_LVL: /* record level */
|
||||
dip->type = AUDIO_MIXER_VALUE;
|
||||
dip->mixer_class = WSS_RECORD_CLASS;
|
||||
dip->prev = AUDIO_MIXER_LAST;
|
||||
dip->next = WSS_RECORD_SOURCE;
|
||||
strcpy(dip->label.name, AudioNrecord);
|
||||
dip->un.v.num_channels = 2;
|
||||
strcpy(dip->un.v.units.name, AudioNvolume);
|
||||
break;
|
||||
|
||||
case WSS_MON_LVL: /* monitor level */
|
||||
dip->type = AUDIO_MIXER_VALUE;
|
||||
dip->mixer_class = WSS_MONITOR_CLASS;
|
||||
dip->next = dip->prev = AUDIO_MIXER_LAST;
|
||||
strcpy(dip->label.name, AudioNmonitor);
|
||||
dip->un.v.num_channels = 1;
|
||||
strcpy(dip->un.v.units.name, AudioNvolume);
|
||||
break;
|
||||
|
||||
case WSS_INPUT_CLASS: /* input class descriptor */
|
||||
dip->type = AUDIO_MIXER_CLASS;
|
||||
dip->mixer_class = WSS_INPUT_CLASS;
|
||||
dip->next = dip->prev = AUDIO_MIXER_LAST;
|
||||
strcpy(dip->label.name, AudioCinputs);
|
||||
break;
|
||||
|
||||
case WSS_MONITOR_CLASS: /* monitor class descriptor */
|
||||
dip->type = AUDIO_MIXER_CLASS;
|
||||
dip->mixer_class = WSS_MONITOR_CLASS;
|
||||
dip->next = dip->prev = AUDIO_MIXER_LAST;
|
||||
strcpy(dip->label.name, AudioCmonitor);
|
||||
break;
|
||||
|
||||
case WSS_RECORD_CLASS: /* record source class */
|
||||
dip->type = AUDIO_MIXER_CLASS;
|
||||
dip->mixer_class = WSS_RECORD_CLASS;
|
||||
dip->next = dip->prev = AUDIO_MIXER_LAST;
|
||||
strcpy(dip->label.name, AudioCrecord);
|
||||
break;
|
||||
|
||||
case WSS_MIC_IN_MUTE:
|
||||
dip->mixer_class = WSS_INPUT_CLASS;
|
||||
dip->type = AUDIO_MIXER_ENUM;
|
||||
dip->prev = WSS_MIC_IN_LVL;
|
||||
dip->next = AUDIO_MIXER_LAST;
|
||||
goto mute;
|
||||
|
||||
case WSS_LINE_IN_MUTE:
|
||||
dip->mixer_class = WSS_INPUT_CLASS;
|
||||
dip->type = AUDIO_MIXER_ENUM;
|
||||
dip->prev = WSS_LINE_IN_LVL;
|
||||
dip->next = AUDIO_MIXER_LAST;
|
||||
goto mute;
|
||||
|
||||
case WSS_DAC_MUTE:
|
||||
dip->mixer_class = WSS_INPUT_CLASS;
|
||||
dip->type = AUDIO_MIXER_ENUM;
|
||||
dip->prev = WSS_DAC_LVL;
|
||||
dip->next = AUDIO_MIXER_LAST;
|
||||
mute:
|
||||
strcpy(dip->label.name, AudioNmute);
|
||||
dip->un.e.num_mem = 2;
|
||||
strcpy(dip->un.e.member[0].label.name, AudioNoff);
|
||||
dip->un.e.member[0].ord = 0;
|
||||
strcpy(dip->un.e.member[1].label.name, AudioNon);
|
||||
dip->un.e.member[1].ord = 1;
|
||||
break;
|
||||
|
||||
case WSS_RECORD_SOURCE:
|
||||
dip->mixer_class = WSS_RECORD_CLASS;
|
||||
dip->type = AUDIO_MIXER_ENUM;
|
||||
dip->prev = WSS_REC_LVL;
|
||||
dip->next = AUDIO_MIXER_LAST;
|
||||
strcpy(dip->label.name, AudioNsource);
|
||||
dip->un.e.num_mem = 3;
|
||||
strcpy(dip->un.e.member[0].label.name, AudioNmicrophone);
|
||||
dip->un.e.member[0].ord = WSS_MIC_IN_LVL;
|
||||
strcpy(dip->un.e.member[1].label.name, AudioNcd);
|
||||
dip->un.e.member[1].ord = WSS_LINE_IN_LVL;
|
||||
strcpy(dip->un.e.member[2].label.name, AudioNdac);
|
||||
dip->un.e.member[2].ord = WSS_DAC_LVL;
|
||||
break;
|
||||
|
||||
case WSS_LINE_IN_LVL: /* line/CD */
|
||||
dip->type = AUDIO_MIXER_VALUE;
|
||||
dip->mixer_class = WSS_INPUT_CLASS;
|
||||
dip->prev = AUDIO_MIXER_LAST;
|
||||
dip->next = WSS_LINE_IN_MUTE;
|
||||
strcpy(dip->label.name, AudioNcd);
|
||||
dip->un.v.num_channels = 2;
|
||||
strcpy(dip->un.v.units.name, AudioNvolume);
|
||||
break;
|
||||
|
||||
case WSS_DAC_LVL: /* dacout */
|
||||
dip->type = AUDIO_MIXER_VALUE;
|
||||
dip->mixer_class = WSS_INPUT_CLASS;
|
||||
dip->prev = AUDIO_MIXER_LAST;
|
||||
dip->next = WSS_DAC_MUTE;
|
||||
strcpy(dip->label.name, AudioNdac);
|
||||
dip->un.v.num_channels = 2;
|
||||
strcpy(dip->un.v.units.name, AudioNvolume);
|
||||
break;
|
||||
|
||||
case WSS_REC_LVL: /* record level */
|
||||
dip->type = AUDIO_MIXER_VALUE;
|
||||
dip->mixer_class = WSS_RECORD_CLASS;
|
||||
dip->prev = AUDIO_MIXER_LAST;
|
||||
dip->next = WSS_RECORD_SOURCE;
|
||||
strcpy(dip->label.name, AudioNrecord);
|
||||
dip->un.v.num_channels = 2;
|
||||
strcpy(dip->un.v.units.name, AudioNvolume);
|
||||
break;
|
||||
|
||||
case WSS_MON_LVL: /* monitor level */
|
||||
dip->type = AUDIO_MIXER_VALUE;
|
||||
dip->mixer_class = WSS_MONITOR_CLASS;
|
||||
dip->next = dip->prev = AUDIO_MIXER_LAST;
|
||||
strcpy(dip->label.name, AudioNmonitor);
|
||||
dip->un.v.num_channels = 1;
|
||||
strcpy(dip->un.v.units.name, AudioNvolume);
|
||||
break;
|
||||
|
||||
case WSS_INPUT_CLASS: /* input class descriptor */
|
||||
dip->type = AUDIO_MIXER_CLASS;
|
||||
dip->mixer_class = WSS_INPUT_CLASS;
|
||||
dip->next = dip->prev = AUDIO_MIXER_LAST;
|
||||
strcpy(dip->label.name, AudioCinputs);
|
||||
break;
|
||||
|
||||
case WSS_MONITOR_CLASS: /* monitor class descriptor */
|
||||
dip->type = AUDIO_MIXER_CLASS;
|
||||
dip->mixer_class = WSS_MONITOR_CLASS;
|
||||
dip->next = dip->prev = AUDIO_MIXER_LAST;
|
||||
strcpy(dip->label.name, AudioCmonitor);
|
||||
break;
|
||||
|
||||
case WSS_RECORD_CLASS: /* record source class */
|
||||
dip->type = AUDIO_MIXER_CLASS;
|
||||
dip->mixer_class = WSS_RECORD_CLASS;
|
||||
dip->next = dip->prev = AUDIO_MIXER_LAST;
|
||||
strcpy(dip->label.name, AudioCrecord);
|
||||
break;
|
||||
default:
|
||||
return ENXIO;
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
DPRINTF(("AUDIO_MIXER_DEVINFO: name=%s\n", dip->label.name));
|
||||
|
||||
case WSS_MIC_IN_MUTE:
|
||||
dip->mixer_class = WSS_INPUT_CLASS;
|
||||
dip->type = AUDIO_MIXER_ENUM;
|
||||
dip->prev = WSS_MIC_IN_LVL;
|
||||
dip->next = AUDIO_MIXER_LAST;
|
||||
goto mute;
|
||||
|
||||
case WSS_LINE_IN_MUTE:
|
||||
dip->mixer_class = WSS_INPUT_CLASS;
|
||||
dip->type = AUDIO_MIXER_ENUM;
|
||||
dip->prev = WSS_LINE_IN_LVL;
|
||||
dip->next = AUDIO_MIXER_LAST;
|
||||
goto mute;
|
||||
|
||||
case WSS_DAC_MUTE:
|
||||
dip->mixer_class = WSS_INPUT_CLASS;
|
||||
dip->type = AUDIO_MIXER_ENUM;
|
||||
dip->prev = WSS_DAC_LVL;
|
||||
dip->next = AUDIO_MIXER_LAST;
|
||||
mute:
|
||||
strcpy(dip->label.name, AudioNmute);
|
||||
dip->un.e.num_mem = 2;
|
||||
strcpy(dip->un.e.member[0].label.name, AudioNoff);
|
||||
dip->un.e.member[0].ord = 0;
|
||||
strcpy(dip->un.e.member[1].label.name, AudioNon);
|
||||
dip->un.e.member[1].ord = 1;
|
||||
break;
|
||||
|
||||
case WSS_RECORD_SOURCE:
|
||||
dip->mixer_class = WSS_RECORD_CLASS;
|
||||
dip->type = AUDIO_MIXER_ENUM;
|
||||
dip->prev = WSS_REC_LVL;
|
||||
dip->next = AUDIO_MIXER_LAST;
|
||||
strcpy(dip->label.name, AudioNsource);
|
||||
dip->un.e.num_mem = 3;
|
||||
strcpy(dip->un.e.member[0].label.name, AudioNmicrophone);
|
||||
dip->un.e.member[0].ord = WSS_MIC_IN_LVL;
|
||||
strcpy(dip->un.e.member[1].label.name, AudioNcd);
|
||||
dip->un.e.member[1].ord = WSS_LINE_IN_LVL;
|
||||
strcpy(dip->un.e.member[2].label.name, AudioNdac);
|
||||
dip->un.e.member[2].ord = WSS_DAC_LVL;
|
||||
break;
|
||||
|
||||
default:
|
||||
return ENXIO;
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
DPRINTF(("AUDIO_MIXER_DEVINFO: name=%s\n", dip->label.name));
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -362,99 +363,100 @@ wss_query_devinfo(addr, dip)
|
|||
|
||||
u_int
|
||||
mad_read(sc, port)
|
||||
struct wss_softc *sc;
|
||||
int port;
|
||||
struct wss_softc *sc;
|
||||
int port;
|
||||
{
|
||||
u_int tmp;
|
||||
int pwd;
|
||||
int s;
|
||||
|
||||
switch (sc->mad_chip_type) { /* Output password */
|
||||
case MAD_82C928:
|
||||
case MAD_OTI601D:
|
||||
pwd = M_PASSWD_928;
|
||||
break;
|
||||
case MAD_82C929:
|
||||
pwd = M_PASSWD_929;
|
||||
break;
|
||||
case MAD_82C931:
|
||||
pwd = M_PASSWD_931;
|
||||
break;
|
||||
default:
|
||||
panic("mad_read: Bad chip type=%d\n", sc->mad_chip_type);
|
||||
}
|
||||
s = splaudio(); /* don't want an interrupt between outb&inb */
|
||||
bus_space_write_1(sc->sc_iot, sc->mad_ioh, MC_PASSWD_REG, pwd);
|
||||
tmp = bus_space_read_1(sc->sc_iot, sc->mad_ioh, port);
|
||||
splx(s);
|
||||
return tmp;
|
||||
u_int tmp;
|
||||
int pwd;
|
||||
int s;
|
||||
|
||||
switch (sc->mad_chip_type) { /* Output password */
|
||||
case MAD_82C928:
|
||||
case MAD_OTI601D:
|
||||
pwd = M_PASSWD_928;
|
||||
break;
|
||||
case MAD_82C929:
|
||||
pwd = M_PASSWD_929;
|
||||
break;
|
||||
case MAD_82C931:
|
||||
pwd = M_PASSWD_931;
|
||||
break;
|
||||
default:
|
||||
panic("mad_read: Bad chip type=%d\n", sc->mad_chip_type);
|
||||
}
|
||||
s = splaudio(); /* don't want an interrupt between outb&inb */
|
||||
bus_space_write_1(sc->sc_iot, sc->mad_ioh, MC_PASSWD_REG, pwd);
|
||||
tmp = bus_space_read_1(sc->sc_iot, sc->mad_ioh, port);
|
||||
splx(s);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
void
|
||||
mad_write(sc, port, value)
|
||||
struct wss_softc *sc;
|
||||
int port;
|
||||
int value;
|
||||
struct wss_softc *sc;
|
||||
int port;
|
||||
int value;
|
||||
{
|
||||
int pwd;
|
||||
int s;
|
||||
|
||||
switch (sc->mad_chip_type) { /* Output password */
|
||||
case MAD_82C928:
|
||||
case MAD_OTI601D:
|
||||
pwd = M_PASSWD_928;
|
||||
break;
|
||||
case MAD_82C929:
|
||||
pwd = M_PASSWD_929;
|
||||
break;
|
||||
case MAD_82C931:
|
||||
pwd = M_PASSWD_931;
|
||||
break;
|
||||
default:
|
||||
panic("mad_write: Bad chip type=%d\n", sc->mad_chip_type);
|
||||
}
|
||||
s = splaudio();
|
||||
bus_space_write_1(sc->sc_iot, sc->mad_ioh, MC_PASSWD_REG, pwd);
|
||||
bus_space_write_1(sc->sc_iot, sc->mad_ioh, port, value & 0xff);
|
||||
splx(s);
|
||||
int pwd;
|
||||
int s;
|
||||
|
||||
switch (sc->mad_chip_type) { /* Output password */
|
||||
case MAD_82C928:
|
||||
case MAD_OTI601D:
|
||||
pwd = M_PASSWD_928;
|
||||
break;
|
||||
case MAD_82C929:
|
||||
pwd = M_PASSWD_929;
|
||||
break;
|
||||
case MAD_82C931:
|
||||
pwd = M_PASSWD_931;
|
||||
break;
|
||||
default:
|
||||
panic("mad_write: Bad chip type=%d\n", sc->mad_chip_type);
|
||||
}
|
||||
s = splaudio();
|
||||
bus_space_write_1(sc->sc_iot, sc->mad_ioh, MC_PASSWD_REG, pwd);
|
||||
bus_space_write_1(sc->sc_iot, sc->mad_ioh, port, value & 0xff);
|
||||
splx(s);
|
||||
}
|
||||
|
||||
void
|
||||
madattach(sc)
|
||||
struct wss_softc *sc;
|
||||
struct wss_softc *sc;
|
||||
{
|
||||
unsigned char cs4231_mode;
|
||||
int joy;
|
||||
|
||||
if (sc->mad_chip_type == MAD_NONE)
|
||||
return;
|
||||
|
||||
/* Do we want the joystick disabled? */
|
||||
joy = sc->sc_dev.dv_cfdata->cf_flags & 2 ? MC1_JOYDISABLE : 0;
|
||||
|
||||
/* enable WSS emulation at the I/O port */
|
||||
mad_write(sc, MC1_PORT, M_WSS_PORT_SELECT(sc->mad_ioindex) | joy);
|
||||
mad_write(sc, MC2_PORT, 0x03); /* ? */
|
||||
mad_write(sc, MC3_PORT, 0xf0); /* Disable SB */
|
||||
|
||||
cs4231_mode =
|
||||
strncmp(sc->sc_ad1848.chip_name, "CS4248", 6) == 0 ||
|
||||
strncmp(sc->sc_ad1848.chip_name, "CS4231", 6) == 0 ? 0x02 : 0;
|
||||
|
||||
if (sc->mad_chip_type == MAD_82C929) {
|
||||
mad_write(sc, MC4_PORT, 0x92);
|
||||
mad_write(sc, MC5_PORT, 0xA5 | cs4231_mode);
|
||||
mad_write(sc, MC6_PORT, 0x03); /* Disable MPU401 */
|
||||
} else {
|
||||
mad_write(sc, MC4_PORT, 0x02);
|
||||
mad_write(sc, MC5_PORT, 0x30 | cs4231_mode);
|
||||
}
|
||||
|
||||
unsigned char cs4231_mode;
|
||||
int joy;
|
||||
|
||||
if (sc->mad_chip_type == MAD_NONE)
|
||||
return;
|
||||
|
||||
/* Do we want the joystick disabled? */
|
||||
joy = sc->sc_dev.dv_cfdata->cf_flags & 2 ? MC1_JOYDISABLE : 0;
|
||||
|
||||
/* enable WSS emulation at the I/O port */
|
||||
mad_write(sc, MC1_PORT, M_WSS_PORT_SELECT(sc->mad_ioindex) | joy);
|
||||
mad_write(sc, MC2_PORT, 0x03); /* ? */
|
||||
mad_write(sc, MC3_PORT, 0xf0); /* Disable SB */
|
||||
|
||||
cs4231_mode =
|
||||
strncmp(sc->sc_ad1848.chip_name, "CS4248", 6) == 0 ||
|
||||
strncmp(sc->sc_ad1848.chip_name, "CS4231", 6) == 0 ? 0x02 : 0;
|
||||
|
||||
if (sc->mad_chip_type == MAD_82C929) {
|
||||
mad_write(sc, MC4_PORT, 0x92);
|
||||
mad_write(sc, MC5_PORT, 0xA5 | cs4231_mode);
|
||||
mad_write(sc, MC6_PORT, 0x03); /* Disable MPU401 */
|
||||
} else {
|
||||
mad_write(sc, MC4_PORT, 0x02);
|
||||
mad_write(sc, MC5_PORT, 0x30 | cs4231_mode);
|
||||
}
|
||||
|
||||
#ifdef AUDIO_DEBUG
|
||||
if (wssdebug) {
|
||||
int i;
|
||||
for (i = MC1_PORT; i <= MC7_PORT; i++)
|
||||
DPRINTF(("port %03x after init = %02x\n", i, mad_read(sc, i)));
|
||||
}
|
||||
if (wssdebug) {
|
||||
int i;
|
||||
for (i = MC1_PORT; i <= MC7_PORT; i++)
|
||||
DPRINTF(("port %03x after init = %02x\n",
|
||||
i, mad_read(sc, i)));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue