summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorjmcneill <jmcneill@NetBSD.org>2008-09-30 16:51:45 +0000
committerjmcneill <jmcneill@NetBSD.org>2008-09-30 16:51:45 +0000
commit536d3f6c8b60049ec43042005af4febdf81aa0ef (patch)
tree068fe8a545108c3736322fbe9fbc6cbb522e7bec /sys/dev
parent8bf6577840472f7c11138708af57c3b3dfc5a43b (diff)
Remove esl(4)
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/DEVNAMES3
-rw-r--r--sys/dev/pcmcia/esl.c993
-rw-r--r--sys/dev/pcmcia/esl_pcmcia.c190
-rw-r--r--sys/dev/pcmcia/eslvar.h87
-rw-r--r--sys/dev/pcmcia/files.pcmcia12
-rw-r--r--sys/dev/pcmcia/opl_esl.c98
6 files changed, 2 insertions, 1381 deletions
diff --git a/sys/dev/DEVNAMES b/sys/dev/DEVNAMES
index b42cb53ce1b..aa095c36abe 100644
--- a/sys/dev/DEVNAMES
+++ b/sys/dev/DEVNAMES
@@ -1,4 +1,4 @@
-# $NetBSD: DEVNAMES,v 1.240 2008/08/12 17:54:47 hans Exp $
+# $NetBSD: DEVNAMES,v 1.241 2008/09/30 16:52:39 jmcneill Exp $
#
# This file contains all used device names and defined attributes in
# alphabetical order. New devices added to the system somewhere should first
@@ -394,7 +394,6 @@ esa MI
esc acorn32 Attribute
esh MI
esiop MI
-esl MI
esm MI
eso MI
esp MI
diff --git a/sys/dev/pcmcia/esl.c b/sys/dev/pcmcia/esl.c
deleted file mode 100644
index 7f8bdbbd264..00000000000
--- a/sys/dev/pcmcia/esl.c
+++ /dev/null
@@ -1,993 +0,0 @@
-/* $NetBSD: esl.c,v 1.24 2008/05/05 00:15:25 jmcneill Exp $ */
-
-/*
- * Copyright (c) 2001 Jared D. McNeill <jmcneill@invisible.ca>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: esl.c,v 1.24 2008/05/05 00:15:25 jmcneill Exp $");
-
-#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 <sys/kernel.h>
-#include <sys/audioio.h>
-
-#include <sys/cpu.h>
-#include <sys/intr.h>
-#include <sys/bus.h>
-#include <machine/pio.h>
-
-#include <dev/audio_if.h>
-#include <dev/auconv.h>
-#include <dev/mulaw.h>
-
-#include <dev/pcmcia/pcmciavar.h>
-
-#include <dev/isa/essreg.h>
-#include <dev/pcmcia/eslvar.h>
-
-int esl_open(void *, int);
-void esl_close(void *);
-int esl_query_encoding(void *, struct audio_encoding *);
-int esl_set_params(void *, int, int, audio_params_t *, audio_params_t *,
- stream_filter_list_t *, stream_filter_list_t *);
-int esl_round_blocksize(void *, int, int, const audio_params_t *);
-int esl_halt_output(void *);
-int esl_halt_input(void *);
-int esl_speaker_ctl(void *, int);
-int esl_getdev(void *, struct audio_device *);
-int esl_set_port(void *, mixer_ctrl_t *);
-int esl_get_port(void *, mixer_ctrl_t *);
-int esl_query_devinfo(void *, mixer_devinfo_t *);
-int esl_get_props(void *);
-int esl_trigger_output(void *, void *, void *, int, void (*)(void *),
- void *, const audio_params_t *);
-
-/* Supporting subroutines */
-int esl_reset(struct esl_pcmcia_softc *);
-void esl_setup(struct esl_pcmcia_softc *);
-void esl_set_gain(struct esl_pcmcia_softc *, int, int);
-void esl_speaker_on(struct esl_pcmcia_softc *);
-void esl_speaker_off(struct esl_pcmcia_softc *);
-int esl_identify(struct esl_pcmcia_softc *);
-int esl_rdsp(struct esl_pcmcia_softc *);
-int esl_wdsp(struct esl_pcmcia_softc *, u_char);
-u_char esl_dsp_read_ready(struct esl_pcmcia_softc *);
-u_char esl_dsp_write_ready(struct esl_pcmcia_softc *);
-u_char esl_get_dsp_status(struct esl_pcmcia_softc *);
-u_char esl_read_x_reg(struct esl_pcmcia_softc *, u_char);
-int esl_write_x_reg(struct esl_pcmcia_softc *, u_char, u_char);
-void esl_clear_xreg_bits(struct esl_pcmcia_softc *, u_char, u_char);
-void esl_set_xreg_bits(struct esl_pcmcia_softc *, u_char, u_char);
-u_char esl_read_mix_reg(struct esl_pcmcia_softc *, u_char);
-void esl_write_mix_reg(struct esl_pcmcia_softc *, u_char, u_char);
-void esl_clear_mreg_bits(struct esl_pcmcia_softc *, u_char, u_char);
-void esl_set_mreg_bits(struct esl_pcmcia_softc *, u_char, u_char);
-void esl_read_multi_mix_reg(struct esl_pcmcia_softc *, u_char,
- uint8_t *, bus_size_t);
-u_int esl_srtotc(u_int);
-u_int esl_srtofc(u_int);
-
-struct audio_device esl_device = {
- "AudioDrive",
- "",
- "esl"
-};
-
-const struct audio_hw_if esl_hw_if = {
- esl_open,
- esl_close,
- NULL,
- esl_query_encoding,
- esl_set_params,
- esl_round_blocksize,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- esl_halt_output,
- esl_halt_input,
- esl_speaker_ctl,
- esl_getdev,
- NULL,
- esl_set_port,
- esl_get_port,
- esl_query_devinfo,
- NULL,
- NULL,
- NULL,
- NULL,
- esl_get_props,
- esl_trigger_output,
- NULL,
- NULL,
- NULL,
-};
-
-static const char *eslmodel[] = {
- "1688",
- "688",
-};
-
-int
-esl_open(void *hdl, int flags)
-{
- struct esl_pcmcia_softc *sc;
- int i;
-
- sc = hdl;
- if ((*sc->sc_enable)(sc))
- return ENXIO;
-
- if (esl_reset(sc) != 0) {
- aprint_error_dev(&sc->sc_esl.sc_dev, "esl_open: esl_reset failed\n");
- return ENXIO;
- }
-
- /* because we did a reset */
- esl_setup(sc);
-
- /* Set all mixer controls to sane values (since we just did a reset) */
- for (i = 0; i < ESS_MAX_NDEVS; i++)
- esl_set_gain(sc, i, 1);
-
- /* XXX: Delay a bit */
- delay(10000);
-
- return 0;
-}
-
-
-void
-esl_close(void *hdl)
-{
- struct esl_pcmcia_softc *sc;
-
- sc = hdl;
- esl_speaker_off(sc);
- (*sc->sc_disable)(sc);
- return;
-}
-
-int
-esl_query_encoding(void *hdl, struct audio_encoding *ae)
-{
-
- switch (ae->index) {
- case 0:
- strcpy(ae->name, AudioEulinear);
- ae->encoding = AUDIO_ENCODING_ULINEAR;
- ae->precision = 8;
- ae->flags = 0;
- return 0;
- case 1:
- strcpy(ae->name, AudioEmulaw);
- ae->encoding = AUDIO_ENCODING_ULAW;
- ae->precision = 8;
- ae->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
- case 2:
- strcpy(ae->name, AudioEalaw);
- ae->encoding = AUDIO_ENCODING_ALAW;
- ae->precision = 8;
- ae->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
- case 3:
- strcpy(ae->name, AudioEslinear);
- ae->encoding = AUDIO_ENCODING_SLINEAR;
- ae->precision = 8;
- ae->flags = 0;
- return 0;
- case 4:
- strcpy(ae->name, AudioEslinear_le);
- ae->encoding = AUDIO_ENCODING_SLINEAR_LE;
- ae->precision = 16;
- ae->flags = 0;
- return 0;
- case 5:
- strcpy(ae->name, AudioEulinear_le);
- ae->encoding = AUDIO_ENCODING_ULINEAR_LE;
- ae->precision = 16;
- ae->flags = 0;
- return 0;
- case 6:
- strcpy(ae->name, AudioEslinear_be);
- ae->encoding = AUDIO_ENCODING_SLINEAR_BE;
- ae->precision = 16;
- ae->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
- case 7:
- strcpy(ae->name, AudioEulinear_be);
- ae->encoding = AUDIO_ENCODING_ULINEAR_BE;
- ae->precision = 16;
- ae->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
- default:
- return EINVAL;
- }
- return 0;
-}
-
-int
-esl_set_params(void *hdl, int setmode, int usemode,
- audio_params_t *play, audio_params_t *rec,
- stream_filter_list_t *pfil, stream_filter_list_t *rfil)
-{
- audio_params_t hw;
- struct esl_pcmcia_softc *sc;
- int rate;
-
- sc = hdl;
- if (play->sample_rate < ESS_MINRATE ||
- play->sample_rate > ESS_MAXRATE ||
- (play->precision != 8 && play->precision != 16) ||
- (play->channels != 1 && play->channels != 2))
- return EINVAL;
-
- hw = *play;
- switch (play->encoding) {
- case AUDIO_ENCODING_SLINEAR_BE:
- if (play->precision == 16) {
- hw.encoding = AUDIO_ENCODING_SLINEAR_LE;
- pfil->append(pfil, swap_bytes, &hw);
- }
- break;
- case AUDIO_ENCODING_ULINEAR_BE:
- if (play->precision == 16) {
- hw.encoding = AUDIO_ENCODING_ULINEAR_LE;
- pfil->append(pfil, swap_bytes, &hw);
- }
- break;
- case AUDIO_ENCODING_SLINEAR_LE:
- case AUDIO_ENCODING_ULINEAR_LE:
- break;
- case AUDIO_ENCODING_ULAW:
- hw.encoding = AUDIO_ENCODING_ULINEAR_LE;
- pfil->append(pfil, mulaw_to_linear16, &hw);
- break;
- case AUDIO_ENCODING_ALAW:
- hw.encoding = AUDIO_ENCODING_ULINEAR_LE;
- pfil->append(pfil, alaw_to_linear16, &hw);
- break;
- default:
- return EINVAL;
- }
-
- rate = play->sample_rate;
-
- esl_write_x_reg(sc, ESS_XCMD_SAMPLE_RATE, esl_srtotc(rate));
- esl_write_x_reg(sc, ESS_XCMD_FILTER_CLOCK, esl_srtofc(rate));
-
- return 0;
-}
-
-int
-esl_round_blocksize(void *hdl, int bs, int mode,
- const audio_params_t *param)
-{
-
- return (bs / 128) * 128;
-}
-
-
-int
-esl_halt_output(void *hdl)
-{
- struct esl_pcmcia_softc *sc;
-
- sc = hdl;
- if (sc->sc_esl.active) {
- esl_clear_xreg_bits(sc, ESS_XCMD_AUDIO1_CTRL2,
- ESS_AUDIO1_CTRL2_FIFO_ENABLE);
- sc->sc_esl.active = 0;
- }
-
- return 0;
-}
-
-int
-esl_halt_input(void *hdl)
-{
-
- return 0;
-}
-
-int
-esl_speaker_ctl(void *hdl, int on)
-{
-
- return 0;
-}
-
-int
-esl_getdev(void *hdl, struct audio_device *ret)
-{
-
- *ret = esl_device;
- return 0;
-}
-
-int
-esl_set_port(void *hdl, mixer_ctrl_t *mc)
-{
- struct esl_pcmcia_softc *sc;
- int lgain, rgain;
-
- sc = hdl;
- switch(mc->dev) {
- case ESS_MASTER_VOL:
- case ESS_DAC_PLAY_VOL:
- case ESS_SYNTH_PLAY_VOL:
- if (mc->type != AUDIO_MIXER_VALUE)
- return EINVAL;
-
- switch(mc->un.value.num_channels) {
- case 1:
- lgain = rgain = ESS_4BIT_GAIN(
- mc->un.value.level[AUDIO_MIXER_LEVEL_MONO]);
- break;
- case 2:
- lgain = ESS_4BIT_GAIN(
- mc->un.value.level[AUDIO_MIXER_LEVEL_LEFT]);
- rgain = ESS_4BIT_GAIN(
- mc->un.value.level[AUDIO_MIXER_LEVEL_RIGHT]);
- break;
- default:
- return EINVAL;
- }
- sc->sc_esl.gain[mc->dev][ESS_LEFT] = lgain;
- sc->sc_esl.gain[mc->dev][ESS_RIGHT] = rgain;
- esl_set_gain(sc, mc->dev, 1);
- return 0;
- default:
- break;
- }
-
- return EINVAL;
-}
-
-int
-esl_get_port(void *hdl, mixer_ctrl_t *mc)
-{
- struct esl_pcmcia_softc *sc;
-
- sc = hdl;
- switch(mc->dev) {
- case ESS_MASTER_VOL:
- case ESS_DAC_PLAY_VOL:
- case ESS_SYNTH_PLAY_VOL:
- switch(mc->un.value.num_channels) {
- case 1:
- mc->un.value.level[AUDIO_MIXER_LEVEL_MONO] =
- sc->sc_esl.gain[mc->dev][ESS_LEFT];
- break;
- case 2:
- mc->un.value.level[AUDIO_MIXER_LEVEL_LEFT] =
- sc->sc_esl.gain[mc->dev][ESS_LEFT];
- mc->un.value.level[AUDIO_MIXER_LEVEL_RIGHT] =
- sc->sc_esl.gain[mc->dev][ESS_RIGHT];
- break;
- default:
- return EINVAL;
- }
- return 0;
- default:
- break;
- }
-
- return EINVAL;
-}
-
-int
-esl_query_devinfo(void *hdl, mixer_devinfo_t *di)
-{
-
- switch(di->index) {
- case ESS_DAC_PLAY_VOL:
- di->mixer_class = ESS_INPUT_CLASS;
- di->next = di->prev = AUDIO_MIXER_LAST;
- strcpy(di->label.name, AudioNdac);
- di->type = AUDIO_MIXER_VALUE;
- di->un.v.num_channels = 2;
- strcpy(di->un.v.units.name, AudioNvolume);
- return 0;
- case ESS_SYNTH_PLAY_VOL:
- di->mixer_class = ESS_INPUT_CLASS;
- di->next = di->prev = AUDIO_MIXER_LAST;
- strcpy(di->label.name, AudioNfmsynth);
- di->type = AUDIO_MIXER_VALUE;
- di->un.v.num_channels = 2;
- strcpy(di->un.v.units.name, AudioNvolume);
- return 0;
- case ESS_INPUT_CLASS:
- di->mixer_class = ESS_INPUT_CLASS;
- di->next = di->prev = AUDIO_MIXER_LAST;
- strcpy(di->label.name, AudioCinputs);
- di->type = AUDIO_MIXER_CLASS;
- return 0;
- case ESS_MASTER_VOL:
- di->mixer_class = ESS_OUTPUT_CLASS;
- di->next = di->prev = AUDIO_MIXER_LAST;
- strcpy(di->label.name, AudioNmaster);
- di->type = AUDIO_MIXER_VALUE;
- di->un.v.num_channels = 2;
- strcpy(di->un.v.units.name, AudioNvolume);
- return 0;
- case ESS_OUTPUT_CLASS:
- di->mixer_class = ESS_OUTPUT_CLASS;
- di->next = di->prev = AUDIO_MIXER_LAST;
- strcpy(di->label.name, AudioCoutputs);
- di->type = AUDIO_MIXER_CLASS;
- return 0;
- default:
- break;
- }
-
- return ENXIO;
-}
-
-int
-esl_get_props(void *hdl)
-{
-
- return AUDIO_PROP_MMAP;
-}
-
-int
-esl_trigger_output(void *hdl, void *start, void *end, int blksize,
- void (*intr)(void *), void *intrarg,
- const audio_params_t *param)
-{
- struct esl_pcmcia_softc *sc;
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
- int bs;
- int cnt;
- uint8_t reg;
-
- sc = hdl;
- iot = sc->sc_iot;
- ioh = sc->sc_ioh;
- if (sc->sc_esl.active) {
- aprint_error_dev(&sc->sc_esl.sc_dev, "esl_trigger_output: already running\n");
- return 1;
- }
-
- sc->sc_esl.active = 1;
- sc->sc_esl.intr = intr;
- sc->sc_esl.arg = intrarg;
-
- /* Stereo or Mono selection */
- reg = esl_read_x_reg(sc, ESS_XCMD_AUDIO_CTRL);
- if (param->channels == 2) {
- reg &= ~ESS_AUDIO_CTRL_MONO;
- reg |= ESS_AUDIO_CTRL_STEREO;
- } else {
- reg |= ESS_AUDIO_CTRL_MONO;
- reg &= ~ESS_AUDIO_CTRL_STEREO;
- }
- esl_write_x_reg(sc, ESS_XCMD_AUDIO_CTRL, reg);
-
- /* Program the FIFO (16-bit/8-bit, signed/unsigned, stereo/mono) */
- reg = esl_read_x_reg(sc, ESS_XCMD_AUDIO1_CTRL1);
- if (param->precision == 16)
- reg |= ESS_AUDIO1_CTRL1_FIFO_SIZE;
- else
- reg &= ~ESS_AUDIO1_CTRL1_FIFO_SIZE;
- if (param->channels == 2)
- reg |= ESS_AUDIO1_CTRL1_FIFO_STEREO;
- else
- reg &= ~ESS_AUDIO1_CTRL1_FIFO_STEREO;
- if (param->encoding == AUDIO_ENCODING_SLINEAR_BE ||
- param->encoding == AUDIO_ENCODING_SLINEAR_LE)
- reg |= ESS_AUDIO1_CTRL1_FIFO_SIGNED;
- else
- reg &= ~ESS_AUDIO1_CTRL1_FIFO_SIGNED;
- reg |= ESS_AUDIO1_CTRL1_FIFO_CONNECT;
- esl_write_x_reg(sc, ESS_XCMD_AUDIO1_CTRL1, reg);
-
- /* Program transfer count registers with 2s complement of count */
- bs = -blksize;
- esl_write_x_reg(sc, ESS_XCMD_XFER_COUNTLO, bs);
- esl_write_x_reg(sc, ESS_XCMD_XFER_COUNTHI, bs >> 8);
-
- esl_wdsp(sc, ESS_ACMD_ENABLE_SPKR);
- reg = esl_read_x_reg(sc, ESS_XCMD_AUDIO1_CTRL2);
- reg &= ~(ESS_AUDIO1_CTRL2_DMA_READ | ESS_AUDIO1_CTRL2_ADC_ENABLE);
- reg |= ESS_AUDIO1_CTRL2_FIFO_ENABLE | ESS_AUDIO1_CTRL2_AUTO_INIT;
- esl_write_x_reg(sc, ESS_XCMD_AUDIO1_CTRL2, reg);
- cnt = (char *)end - (char *)start;
- if (cnt == 0)
- aprint_error_dev(&sc->sc_esl.sc_dev, "no count left\n");
-
- sc->sc_esl.sc_dmaaddr = sc->sc_esl.sc_dmastart = start;
- sc->sc_esl.sc_dmaend = end;
- sc->sc_esl.sc_blksize = blksize;
- sc->sc_esl.sc_blkpos = 0;
-
- /* XXX: Delay a bit */
- delay(10000);
-
- /* Prime the FIFO */
- bus_space_write_multi_1(iot, ioh, ESS_FIFO_WRITE, start, ESS_FIFO_SIZE);
- sc->sc_esl.sc_dmaaddr += ESS_FIFO_SIZE;
- sc->sc_esl.sc_blkpos += ESS_FIFO_SIZE;
-
- return 0;
-}
-
-/* Additional subroutines used by the above (NOT required by audio(9)) */
-
-int
-esl_init(struct esl_pcmcia_softc *sc)
-{
- static const int ENABLE[] = { 0x0, 0x9, 0xb };
- static const int ENABLE_ORDER[] = { 1, 1, 1, 2, 1, 2, 1, 1, 2, 1, 0, -1 };
- struct audio_attach_args aa;
- int i;
- int model;
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
-
- iot = sc->sc_iot;
- ioh = sc->sc_ioh;
- /* Initialization sequence */
- for (i = 0; ENABLE_ORDER[i] != -1; i++)
- bus_space_read_1(iot, ioh, ENABLE[i]);
- if (esl_reset(sc)) {
- aprint_error_dev(&sc->sc_esl.sc_dev, "esl_init: esl_reset failed\n");
- return 1;
- }
-
- if (esl_identify(sc)) {
- aprint_error_dev(&sc->sc_esl.sc_dev, "esl_init: esl_identify failed\n");
- return 1;
- }
-
- if (!sc->sc_esl.sc_version)
- return 1; /* Probably a Sound Blaster */
-
- model = ESS_UNSUPPORTED;
-
- switch (sc->sc_esl.sc_version & 0xfff0) {
- case 0x6880:
- if ((sc->sc_esl.sc_version & 0x0f) >= 8) {
- model = ESS_1688;
- } else {
- model = ESS_688;
- }
- break;
- }
-
- if (model == ESS_UNSUPPORTED) {
- printf("%s: unknown model 0x%04x\n",
- device_xname(&sc->sc_esl.sc_dev), sc->sc_esl.sc_version);
- return 1;
- }
-
- printf("%s: ESS AudioDrive %s [version 0x%04x]\n",
- device_xname(&sc->sc_esl.sc_dev), eslmodel[model],
- sc->sc_esl.sc_version);
-
- /* Set volumes to 50% */
- for (i = 0; i < ESS_MAX_NDEVS; i++) {
- sc->sc_esl.gain[i][ESS_LEFT] =
- sc->sc_esl.gain[i][ESS_RIGHT] =
- ESS_4BIT_GAIN(AUDIO_MAX_GAIN / 2);
- esl_set_gain(sc, i, 1);
- }
-
- sc->sc_audiodev = audio_attach_mi(&esl_hw_if, sc, &sc->sc_esl.sc_dev);
-
- /* Attach the OPL device */
- aa.type = AUDIODEV_TYPE_OPL;
- aa.hwif = 0;
- aa.hdl = 0;
-
- sc->sc_opldev = config_found(&sc->sc_esl.sc_dev, &aa, audioprint);
-
- /* Disable speaker until device is opened */
- esl_speaker_off(sc);
-
- return 0;
-}
-
-int
-esl_intr(void *hdl)
-{
- struct esl_pcmcia_softc *sc;
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
- uint8_t reg;
- u_char *pos;
-
- sc = hdl;
- iot = sc->sc_iot;
- ioh = sc->sc_ioh;
- /* Clear interrupt */
- reg = bus_space_read_1(iot, ioh, ESS_CLEAR_INTR);
-
- if (sc->sc_esl.active) {
- reg = bus_space_read_1(iot, ioh, ESS_DSP_RW_STATUS);
- while (reg & ESS_DSP_READ_HALF) {
- pos = sc->sc_esl.sc_dmaaddr;
- bus_space_write_multi_1(iot, ioh, ESS_FIFO_WRITE, pos,
- ESS_FIFO_SIZE / 2);
-
- sc->sc_esl.sc_blkpos += (ESS_FIFO_SIZE / 2);
- if (sc->sc_esl.sc_blkpos >= sc->sc_esl.sc_blksize) {
- (*sc->sc_esl.intr)(sc->sc_esl.arg);
- sc->sc_esl.sc_blkpos -= sc->sc_esl.sc_blksize;
- }
- pos += (ESS_FIFO_SIZE / 2);
- if (pos >= sc->sc_esl.sc_dmaend)
- pos = sc->sc_esl.sc_dmastart;
-
- sc->sc_esl.sc_dmaaddr = pos;
- reg = bus_space_read_1(iot, ioh, ESS_DSP_RW_STATUS);
- }
- }
-
- return 1;
-}
-
-int
-esl_reset(struct esl_pcmcia_softc *sc)
-{
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
-
- iot = sc->sc_iot;
- ioh = sc->sc_ioh;
- bus_space_write_1(iot, ioh, ESS_DSP_RESET, ESS_RESET_EXT);
- delay(10000); /* XXX: Ugly, but ess.c does this too */
- bus_space_write_1(iot, ioh, ESS_DSP_RESET, 0);
- if (esl_rdsp(sc) != ESS_MAGIC)
- return 1;
-
- /* Enable access to the extended command set */
- esl_wdsp(sc, ESS_ACMD_ENABLE_EXT);
-
- return 0;
-}
-
-void
-esl_setup(struct esl_pcmcia_softc *sc)
-{
- u_char reg;
-
- /*
- * Configure IRQ. Set bit 5 of B1h high to enable interrupt on
- * FIFOHE, and keep bit 6 low.
- */
- reg = ESS_IRQ_CTRL_MASK | 0x20 | ESS_IRQ_CTRL_INTRA;
- esl_write_x_reg(sc, ESS_XCMD_IRQ_CTRL, reg);
-
- /*
- * "Config DRQ", well not really. Instead of configuring a DRQ,
- * we leave bits 7 and 5 of B2h low.
- */
- reg = 0x10 | 0x40;
- esl_write_x_reg(sc, ESS_XCMD_DRQ_CTRL, reg);
-
- return;
-}
-
-void
-esl_set_gain(struct esl_pcmcia_softc *sc, int port, int on)
-{
- int gain, left, right;
- int src;
-
- switch(port) {
- case ESS_MASTER_VOL:
- src = ESS_MREG_VOLUME_MASTER;
- break;
- case ESS_DAC_PLAY_VOL:
- src = ESS_MREG_VOLUME_VOICE;
- break;
- case ESS_SYNTH_PLAY_VOL:
- src = ESS_MREG_VOLUME_SYNTH;
- break;
- default:
- return;
- }
-
- if (on) {
- left = sc->sc_esl.gain[port][ESS_LEFT];
- right = sc->sc_esl.gain[port][ESS_RIGHT];
- } else
- left = right = 0;
-
- gain = ESS_STEREO_GAIN(left, right);
-
- esl_write_mix_reg(sc, src, gain);
-
- return;
-}
-
-void
-esl_speaker_on(struct esl_pcmcia_softc *sc)
-{
-
- /* Unmute the DAC */
- esl_set_gain(sc, ESS_DAC_PLAY_VOL, 1);
-
- return;
-}
-
-void
-esl_speaker_off(struct esl_pcmcia_softc *sc)
-{
-
- /* Mute the DAC */
- esl_set_gain(sc, ESS_DAC_PLAY_VOL, 0);
-
- return;
-}
-
-int
-esl_identify(struct esl_pcmcia_softc *sc)
-{
- u_char reg1, reg2;
- int i;
-
- esl_wdsp(sc, ESS_ACMD_LEGACY_ID);
- for (i = 1000, reg1 = reg2 = 0; i; i--)
- if (esl_dsp_read_ready(sc)) {
- if (reg1 == 0)
- reg1 = esl_rdsp(sc);
- else
- reg2 = esl_rdsp(sc);
- }
-
- sc->sc_esl.sc_version = (reg1 << 8) + reg2;
-
- return 0;
-}
-
-/* Read a byte from the DSP */
-int
-esl_rdsp(struct esl_pcmcia_softc *sc)
-{
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
- int i;
-
- iot = sc->sc_iot;
- ioh = sc->sc_ioh;
- for (i = ESS_READ_TIMEOUT; i > 0; --i) {
- if (esl_dsp_read_ready(sc)) {
- i = bus_space_read_1(iot, ioh, ESS_DSP_READ);
- return i;
- } else
- delay(10);
- }
-
- printf("esl_rdsp: timed out\n");
- return -1;
-}
-
-/* Write a byte to the DSP */
-int
-esl_wdsp(struct esl_pcmcia_softc *sc, u_char v)
-{
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
- int i;
-
- iot = sc->sc_iot;
- ioh = sc->sc_ioh;
- for (i = ESS_WRITE_TIMEOUT; i > 0; --i) {
- if (esl_dsp_write_ready(sc)) {
- bus_space_write_1(iot, ioh, ESS_DSP_WRITE, v);
- return 0;
- } else
- delay(10);
- }
-
- printf("esl_wdsp(0x%02x): timed out\n", v);
- return -1;
-}
-
-/* Get the read status of the DSP: 1 == Ready, 0 == Not Ready */
-u_char
-esl_dsp_read_ready(struct esl_pcmcia_softc *sc)
-{
-
- return (esl_get_dsp_status(sc) & ESS_DSP_READ_READY) ? 1 : 0;
-}
-
-/* Get the write status of the DSP: 1 == Ready, 0 == Not Ready */
-u_char
-esl_dsp_write_ready(struct esl_pcmcia_softc *sc)
-{
-
- return (esl_get_dsp_status(sc) & ESS_DSP_WRITE_BUSY) ? 0 : 1;
-}
-
-/* Return the status of the DSP */
-u_char
-esl_get_dsp_status(struct esl_pcmcia_softc *sc)
-{
-
- return bus_space_read_1(sc->sc_iot, sc->sc_ioh,
- ESS_DSP_RW_STATUS);
-}
-
-/* Read a value from one of the extended registers */
-u_char
-esl_read_x_reg(struct esl_pcmcia_softc *sc, u_char reg)
-{
- int error;
-
- if ((error = esl_wdsp(sc, 0xC0)) == 0)
- error = esl_wdsp(sc, reg);
- if (error)
- printf("esl_read_x_reg: error reading 0x%02x\n", reg);
- return esl_rdsp(sc);
-}
-
-/* Write a value to one of the extended registers */
-int
-esl_write_x_reg(struct esl_pcmcia_softc *sc, u_char reg, u_char val)
-{
- int error;
-
- if ((error = esl_wdsp(sc, reg)) == 0)
- error = esl_wdsp(sc, val);
-
- return error;
-}
-
-void
-esl_clear_xreg_bits(struct esl_pcmcia_softc *sc, u_char reg, u_char mask)
-{
-
- esl_write_x_reg(sc, reg, esl_read_x_reg(sc, reg) & ~mask);
-
- return;
-}
-
-void
-esl_set_xreg_bits(struct esl_pcmcia_softc *sc, u_char reg, u_char mask)
-{
-
- esl_write_x_reg(sc, reg, esl_read_x_reg(sc, reg) | mask);
-}
-
-u_char
-esl_read_mix_reg(struct esl_pcmcia_softc *sc, u_char reg)
-{
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
- u_char val;
-#if 0
- int s;
-
- s = splaudio();
-#endif
- iot = sc->sc_iot;
- ioh = sc->sc_ioh;
- bus_space_write_1(iot, ioh, ESS_MIX_REG_SELECT, reg);
- val = bus_space_read_1(iot, ioh, ESS_MIX_REG_DATA);
-#if 0
- splx(s);
-#endif
-
- return val;
-}
-
-void
-esl_write_mix_reg(struct esl_pcmcia_softc *sc, u_char reg, u_char val)
-{
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
-#if 0
- int s;
-
- s = splaudio();
-#endif
- iot = sc->sc_iot;
- ioh = sc->sc_ioh;
- bus_space_write_1(iot, ioh, ESS_MIX_REG_SELECT, reg);
- bus_space_write_1(iot, ioh, ESS_MIX_REG_DATA, val);
-#if 0
- splx(s);
-#endif
-
- return;
-}
-
-void
-esl_clear_mreg_bits(struct esl_pcmcia_softc *sc, u_char reg, u_char mask)
-{
-
- esl_write_mix_reg(sc, reg, esl_read_mix_reg(sc, reg) & ~mask);
-
- return;
-}
-
-void
-esl_set_mreg_bits(struct esl_pcmcia_softc *sc, u_char reg, u_char mask)
-{
-
- esl_write_mix_reg(sc, reg, esl_read_mix_reg(sc, reg) | mask);
-
- return;
-}
-
-void
-esl_read_multi_mix_reg(struct esl_pcmcia_softc *sc, u_char reg,
- uint8_t *datap, bus_size_t count)
-{
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
-#if 0
- int s;
-
- s = splaudio();
-#endif
- iot = sc->sc_iot;
- ioh = sc->sc_ioh;
- bus_space_write_1(iot, ioh, ESS_MIX_REG_SELECT, reg);
- bus_space_read_multi_1(iot, ioh, ESS_MIX_REG_DATA, datap, count);
-#if 0
- splx(s);
-#endif
-
- return;
-}
-
-/* Calculate the time constant for the requested sampling rate */
-u_int
-esl_srtotc(u_int rate)
-{
- u_int tc;
-
- /* The following formulas are from the ESS data sheet. */
- if (rate <= 22050)
- tc = 128 - 397700L / rate;
- else
- tc = 256 - 795500L / rate;
-
- return tc;
-}
-
-/* Calculate the filter constant for the requested sampling rate */
-u_int
-esl_srtofc(u_int rate)
-{
-
- /* From dev/isa/ess.c:ess_srtofc() rev 1.53 */
- return 256 - 200279L / rate;
-}
diff --git a/sys/dev/pcmcia/esl_pcmcia.c b/sys/dev/pcmcia/esl_pcmcia.c
deleted file mode 100644
index 681b752c5c4..00000000000
--- a/sys/dev/pcmcia/esl_pcmcia.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/* $NetBSD: esl_pcmcia.c,v 1.20 2008/05/05 00:15:26 jmcneill Exp $ */
-
-/*
- * Copyright (c) 2000 Jared D. McNeill <jmcneill@invisible.ca>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: esl_pcmcia.c,v 1.20 2008/05/05 00:15:26 jmcneill Exp $");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/buf.h>
-#include <sys/audioio.h>
-
-#include <sys/bus.h>
-#include <sys/intr.h>
-
-#include <dev/audio_if.h>
-
-#include <dev/pcmcia/pcmciareg.h>
-#include <dev/pcmcia/pcmciavar.h>
-#include <dev/pcmcia/pcmciadevs.h>
-
-#include <dev/isa/essreg.h>
-#include <dev/pcmcia/eslvar.h>
-
-static const struct pcmcia_product esl_pcmcia_products[] = {
- { PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID,
- PCMCIA_CIS_EIGERLABS_EPX_AA2000 },
-};
-static const size_t esl_pcmcia_nproducts =
- sizeof(esl_pcmcia_products) / sizeof(esl_pcmcia_products[0]);
-
-int esl_pcmcia_match(struct device *, struct cfdata *, void *);
-int esl_pcmcia_validate_config(struct pcmcia_config_entry *);
-void esl_pcmcia_attach(struct device *, struct device *, void *);
-int esl_pcmcia_detach(struct device *, int);
-
-int esl_pcmcia_enable(struct esl_pcmcia_softc *);
-void esl_pcmcia_disable(struct esl_pcmcia_softc *);
-
-CFATTACH_DECL(esl_pcmcia, sizeof(struct esl_pcmcia_softc),
- esl_pcmcia_match, esl_pcmcia_attach, esl_pcmcia_detach, NULL);
-
-int
-esl_pcmcia_match(struct device *parent, struct cfdata *match,
- void *aux)
-{
- struct pcmcia_attach_args *pa;
-
- pa = aux;
- if (pcmcia_product_lookup(pa, esl_pcmcia_products, esl_pcmcia_nproducts,
- sizeof(esl_pcmcia_products[0]), NULL))
- return 2;
- return 0;
-}
-
-int
-esl_pcmcia_validate_config(struct pcmcia_config_entry *cfe)
-{
-
- if (cfe->iftype != PCMCIA_IFTYPE_IO ||
- cfe->num_memspace != 0 ||
- cfe->num_iospace != 1)
- return EINVAL;
- return 0;
-}
-
-void
-esl_pcmcia_attach(struct device *parent, struct device *self,
- void *aux)
-{
- struct esl_pcmcia_softc *esc;
- struct pcmcia_attach_args *pa;
- struct pcmcia_config_entry *cfe;
- struct pcmcia_function *pf;
- int error;
-
- esc = (void *)self;
- pa = aux;
- pf = pa->pf;
- esc->sc_pf = pf;
-
- error = pcmcia_function_configure(pf, esl_pcmcia_validate_config);
- if (error) {
- aprint_error_dev(self, "configure failed, error=%d\n",
- error);
- return;
- }
-
- cfe = pf->cfe;
- esc->sc_iot = cfe->iospace[0].handle.iot;
- esc->sc_ioh = cfe->iospace[0].handle.ioh;
-
- error = esl_pcmcia_enable(esc);
- if (error)
- goto fail;
-
- /* Setup power management hooks */
- esc->sc_enable = esl_pcmcia_enable;
- esc->sc_disable = esl_pcmcia_disable;
-
- if (!esl_init(esc))
- aprint_error_dev(self, "initialization failed\n");
-
- esl_pcmcia_disable(esc);
- esc->sc_state = ESL_PCMCIA_ATTACHED;
- return;
-
-fail:
- pcmcia_function_unconfigure(pf);
-}
-
-int
-esl_pcmcia_detach(struct device *self, int flags)
-{
- struct esl_pcmcia_softc *esc;
- int rv;
-
- esc = (void *)self;
- if (esc->sc_state != ESL_PCMCIA_ATTACHED)
- return 0;
-
- if (esc->sc_opldev) {
- rv = config_detach(esc->sc_opldev, flags);
- if (rv)
- return rv;
- }
- if (esc->sc_audiodev) {
- rv = config_detach(esc->sc_audiodev, flags);
- if (rv)
- return rv;
- }
-
- pcmcia_function_unconfigure(esc->sc_pf);
-
- return 0;
-}
-
-int
-esl_pcmcia_enable(struct esl_pcmcia_softc *sc)
-{
- int error;
-
- sc->sc_ih = pcmcia_intr_establish(sc->sc_pf, IPL_AUDIO, esl_intr,
- sc);
- if (!sc->sc_ih)
- return EIO;
-
- error = pcmcia_function_enable(sc->sc_pf);
- if (error) {
- pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih);
- sc->sc_ih = 0;
- }
-
- return error;
-}
-
-void
-esl_pcmcia_disable(struct esl_pcmcia_softc *sc)
-{
-
- pcmcia_function_disable(sc->sc_pf);
- pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih);
- sc->sc_ih = 0;
-}
diff --git a/sys/dev/pcmcia/eslvar.h b/sys/dev/pcmcia/eslvar.h
deleted file mode 100644
index 2f6e2f08f23..00000000000
--- a/sys/dev/pcmcia/eslvar.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* $NetBSD: eslvar.h,v 1.9 2008/05/05 00:15:26 jmcneill Exp $ */
-
-/*
- * Copyright (c) 2001 Jared D. McNeill <jmcneill@invisible.ca>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#include <sys/device.h>
-
-#define ESS_DAC_PLAY_VOL 0
-#define ESS_SYNTH_PLAY_VOL 1
-#define ESS_INPUT_CLASS 2
-
-#define ESS_MASTER_VOL 3
-#define ESS_OUTPUT_CLASS 4
-
-#define ESS_MAX_NDEVS 5
-
-/* Model numbers */
-#define ESS_UNSUPPORTED -1
-#define ESS_1688 0
-#define ESS_688 1
-
-/* FIFO Size */
-#define ESS_FIFO_SIZE 256 /* in bytes */
-
-struct esl_softc
-{
- struct device sc_dev; /* base device */
- u_char gain[ESS_MAX_NDEVS][2]; /* kept in input levels */
-#define ESS_LEFT 0
-#define ESS_RIGHT 1
-
- void (*intr)(void *); /* ISR for FIFO Half-Empty */
- void *arg; /* argument for intr() */
-
- /* Pseudo-DMA state vars */
- int active; /* are we active? */
- u_char *sc_dmaaddr;
- u_char *sc_dmastart;
- u_char *sc_dmaend;
- int sc_blksize;
- int sc_blkpos;
-
- u_int sc_version; /* Legacy ES688/ES1688 ID */
-};
-
-struct esl_pcmcia_softc {
- struct esl_softc sc_esl;
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_ioh;
- struct pcmcia_function *sc_pf;
- void *sc_ih;
- struct device *sc_audiodev;
- struct device *sc_opldev;
-
- int (*sc_enable)(struct esl_pcmcia_softc *);
- void (*sc_disable)(struct esl_pcmcia_softc *);
-
- int sc_state;
-#define ESL_PCMCIA_ATTACHED 3
-};
-
-int esl_init(struct esl_pcmcia_softc *sc);
-int esl_intr(void *);
diff --git a/sys/dev/pcmcia/files.pcmcia b/sys/dev/pcmcia/files.pcmcia
index c84898b9d41..70a08033ada 100644
--- a/sys/dev/pcmcia/files.pcmcia
+++ b/sys/dev/pcmcia/files.pcmcia
@@ -1,4 +1,4 @@
-# $NetBSD: files.pcmcia,v 1.56 2007/08/20 00:29:43 kiyohara Exp $
+# $NetBSD: files.pcmcia,v 1.57 2008/09/30 16:51:45 jmcneill Exp $
#
# Config.new file and device description for machine-independent PCMCIA code.
# Included by ports that need it.
@@ -127,16 +127,6 @@ file dev/pcmcia/isic_pcmcia_elsa_isdnmc.c isic_pcmcia
file dev/pcmcia/isic_pcmcia_elsa_mcall.c isic_pcmcia
file dev/pcmcia/isic_pcmcia_sbspeedstar2.c isic_pcmcia
-# Audio devices
-# Eiger Labs with ESS 1688
-device esl { }: audiobus, midibus, auconv, mulaw
-attach esl at pcmcia with esl_pcmcia
-file dev/pcmcia/esl_pcmcia.c esl_pcmcia
-file dev/pcmcia/esl.c esl
-
-attach opl at esl with opl_esl
-file dev/pcmcia/opl_esl.c opl_esl
-
# 3Com Bluetooth controller 3CRW6096
device bt3c: btbus, bluetooth, firmload
attach bt3c at pcmcia
diff --git a/sys/dev/pcmcia/opl_esl.c b/sys/dev/pcmcia/opl_esl.c
deleted file mode 100644
index f26383bcc25..00000000000
--- a/sys/dev/pcmcia/opl_esl.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/* $NetBSD: opl_esl.c,v 1.18 2008/05/05 00:15:26 jmcneill Exp $ */
-
-/*
- * Copyright (c) 2001 Jared D. McNeill <jmcneill@invisible.ca>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: opl_esl.c,v 1.18 2008/05/05 00:15:26 jmcneill Exp $");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/errno.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-#include <sys/proc.h>
-#include <sys/conf.h>
-#include <sys/select.h>
-#include <sys/audioio.h>
-#include <sys/midiio.h>
-
-#include <sys/bus.h>
-
-#include <dev/audio_if.h>
-#include <dev/midi_if.h>
-#include <dev/ic/oplreg.h>
-#include <dev/ic/oplvar.h>
-
-#include <dev/pcmcia/pcmciavar.h>
-#include <dev/pcmcia/eslvar.h>
-
-int opl_esl_match(device_t, cfdata_t, void *);
-void opl_esl_attach(device_t, device_t, void *);
-int opl_esl_detach(device_t, int);
-
-CFATTACH_DECL_NEW(opl_esl, sizeof(struct opl_softc),
- opl_esl_match, opl_esl_attach, opl_esl_detach, NULL);
-
-int
-opl_esl_match(device_t parent, cfdata_t match, void *aux)
-{
- struct audio_attach_args *aa = (struct audio_attach_args *)aux;
- struct esl_pcmcia_softc *ssc = device_private(parent);
-
- if (aa->type != AUDIODEV_TYPE_OPL)
- return (0);
-
- return opl_match(ssc->sc_iot, ssc->sc_ioh, 0);
-}
-
-void
-opl_esl_attach(device_t parent, device_t self, void *aux)
-{
- struct esl_pcmcia_softc *ssc = device_private(parent);
- struct opl_softc *sc = device_private(self);
-
- sc->mididev.dev = self;
- sc->iot = ssc->sc_iot;
- sc->ioh = ssc->sc_ioh;
- sc->offs = 0;
- strcpy(sc->syn.name, "ESS AudioDrive ");
-
- opl_attach(sc);
-}
-
-int
-opl_esl_detach(device_t self, int flags)
-{
- struct opl_softc *sc = device_private(self);
- int rv;
-
- rv = opl_detach(sc, flags);
-
- return (rv);
-}