/*
* Copyright (c) 1994 Havard Eidnes.
* 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.
*
*/
struct audio_hw_if {
int (*open)(void *, int); /* open hardware */
void (*close)(void *); /* close hardware */
int (*query_format)(void *, audio_format_query_t *);
int (*set_format)(void *, int,
const audio_params_t *, const audio_params_t *,
audio_filter_reg_t *, audio_filter_reg_t *);
/* Hardware may have some say in the blocksize to choose */
int (*round_blocksize)(void *, int, int, const audio_params_t *);
/*
* Changing settings may require taking device out of "data mode",
* which can be quite expensive. Also, audiosetinfo() may
* change several settings in quick succession. To avoid
* having to take the device in/out of "data mode", we provide
* this function which indicates completion of settings
* adjustment.
*/
int (*commit_settings)(void *);
/* Start input/output routines. These usually control DMA. */
int (*init_output)(void *, void *, int);
int (*init_input)(void *, void *, int);
int (*start_output)(void *, void *, int,
void (*)(void *), void *);
int (*start_input)(void *, void *, int,
void (*)(void *), void *);
int (*halt_output)(void *);
int (*halt_input)(void *);
int (*speaker_ctl)(void *, int);
#define SPKR_ON 1
#define SPKR_OFF 0
int (*getdev)(void *, struct audio_device *);
/* Mixer (in/out ports) */
int (*set_port)(void *, mixer_ctrl_t *);
int (*get_port)(void *, mixer_ctrl_t *);
int (*query_devinfo)(void *, mixer_devinfo_t *);
/* Allocate/free memory for the ring buffer. Usually malloc/free. */
void *(*allocm)(void *, int, size_t);
void (*freem)(void *, void *, size_t);
size_t (*round_buffersize)(void *, int, size_t);
/* Attach the MI driver(s) to the MD driver. */
device_t audio_attach_mi(const struct audio_hw_if *, void *, device_t);
int audioprint(void *, const char *);