/*
* Copyright (c) 1991-1993 Regents of the University of California.
* 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the Computer Systems
* Engineering Group at Lawrence Berkeley Laboratory.
* 4. Neither the name of the University nor of the Laboratory may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* 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.
*
*/
/*
* Software state, per SoundBlaster card.
* The soundblaster has multiple functionality, which we must demultiplex.
* One approach is to have one major device number for the soundblaster card,
* and use different minor numbers to indicate which hardware function
* we want. This would make for one large driver. Instead our approach
* is to partition the design into a set of drivers that share an underlying
* piece of hardware. Most things are hard to share, for example, the audio
* and midi ports. For audio, we might want to mix two processes' signals,
* and for midi we might want to merge streams (this is hard due to
* running status). Moreover, we should be able to re-use the high-level
* modules with other kinds of hardware. In this module, we only handle the
* most basic communications with the sb card.
*/
struct sbdsp_softc {
device_t sc_dev; /* base device */
isa_chipset_tag_t sc_ic;
bus_space_tag_t sc_iot; /* tag */
bus_space_handle_t sc_ioh; /* handle */
void *sc_ih; /* interrupt vectoring */
kmutex_t sc_lock;
kmutex_t sc_intr_lock;
/* XXX These are only for setting chip configuration registers. */
int sc_iobase; /* I/O port base address */
int sc_irq; /* interrupt */
int sc_drq8; /* DMA (8-bit) */
bus_size_t sc_drq8_maxsize;
int sc_drq16; /* DMA (16-bit) */
bus_size_t sc_drq16_maxsize;
u_int sc_quirks; /* minor variations */
#define SB_QUIRK_NO_INIT_DRQ 0x01
int sc_open; /* reference count of open calls */
#define SB_CLOSED 0
#define SB_OPEN_AUDIO 1
#define SB_OPEN_MIDI 2
int sbdsp_open(void *, int);
void sbdsp_close(void *);
int sbdsp_probe(struct sbdsp_softc *, cfdata_t);
void sbdsp_attach(struct sbdsp_softc *);
int sbdsp_set_in_gain(void *, u_int, u_char);
int sbdsp_set_in_gain_real(void *, u_int, u_char);
int sbdsp_get_in_gain(void *);
int sbdsp_set_out_gain(void *, u_int, u_char);
int sbdsp_set_out_gain_real(void *, u_int, u_char);
int sbdsp_get_out_gain(void *);
int sbdsp_set_monitor_gain(void *, u_int);
int sbdsp_get_monitor_gain(void *);
int sbdsp_query_format(void *, audio_format_query_t *);
int sbdsp_set_format(void *, int,
const audio_params_t *, const audio_params_t *,
audio_filter_reg_t *, audio_filter_reg_t *);
int sbdsp_round_blocksize(void *, int, int, const audio_params_t *);
int sbdsp_get_avail_in_ports(void *);
int sbdsp_get_avail_out_ports(void *);
int sbdsp_speaker_ctl(void *, int);
int sbdsp_commit(void *);
int sbdsp_trigger_output(void *, void *, void *, int, void (*)(void *),
void *, const audio_params_t *);
int sbdsp_trigger_input(void *, void *, void *, int, void (*)(void *),
void *, const audio_params_t *);
int sbdsp_halt_output(void *);
int sbdsp_halt_input(void *);
int sbdsp_mixer_set_port(void *, mixer_ctrl_t *);
int sbdsp_mixer_get_port(void *, mixer_ctrl_t *);
int sbdsp_mixer_query_devinfo(void *, mixer_devinfo_t *);