xref: /freebsd/sys/dev/sound/usb/uaudio.h (revision 86c9b3f3a6e7b7de879e793e4e48aca088cc2746)
13a3f90c6SAndrew Thompson /* $FreeBSD$ */
23a3f90c6SAndrew Thompson 
33a3f90c6SAndrew Thompson /*-
4718cf2ccSPedro F. Giffuni  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
5718cf2ccSPedro F. Giffuni  *
63a3f90c6SAndrew Thompson  * Copyright (c) 2000-2002 Hiroyuki Aizu <aizu@navi.org>
73a3f90c6SAndrew Thompson  *
83a3f90c6SAndrew Thompson  * Redistribution and use in source and binary forms, with or without
93a3f90c6SAndrew Thompson  * modification, are permitted provided that the following conditions
103a3f90c6SAndrew Thompson  * are met:
113a3f90c6SAndrew Thompson  * 1. Redistributions of source code must retain the above copyright
123a3f90c6SAndrew Thompson  *    notice, this list of conditions and the following disclaimer.
133a3f90c6SAndrew Thompson  * 2. Redistributions in binary form must reproduce the above copyright
143a3f90c6SAndrew Thompson  *    notice, this list of conditions and the following disclaimer in the
153a3f90c6SAndrew Thompson  *    documentation and/or other materials provided with the distribution.
163a3f90c6SAndrew Thompson  *
173a3f90c6SAndrew Thompson  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
183a3f90c6SAndrew Thompson  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
193a3f90c6SAndrew Thompson  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
203a3f90c6SAndrew Thompson  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
213a3f90c6SAndrew Thompson  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
223a3f90c6SAndrew Thompson  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
233a3f90c6SAndrew Thompson  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
243a3f90c6SAndrew Thompson  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
253a3f90c6SAndrew Thompson  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
263a3f90c6SAndrew Thompson  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
273a3f90c6SAndrew Thompson  * SUCH DAMAGE.
283a3f90c6SAndrew Thompson  */
293a3f90c6SAndrew Thompson 
303a3f90c6SAndrew Thompson /* prototypes from "uaudio.c" used by "uaudio_pcm.c" */
313a3f90c6SAndrew Thompson 
32a6ed4937SHans Petter Selasky #ifndef _UAUDIO_H_
33a6ed4937SHans Petter Selasky #define	_UAUDIO_H_
34a6ed4937SHans Petter Selasky 
353a3f90c6SAndrew Thompson struct uaudio_chan;
363a3f90c6SAndrew Thompson struct uaudio_softc;
373a3f90c6SAndrew Thompson struct snd_dbuf;
383a3f90c6SAndrew Thompson struct snd_mixer;
393a3f90c6SAndrew Thompson struct pcm_channel;
403a3f90c6SAndrew Thompson 
413a3f90c6SAndrew Thompson extern int	uaudio_attach_sub(device_t dev, kobj_class_t mixer_class,
423a3f90c6SAndrew Thompson 		    kobj_class_t chan_class);
433a3f90c6SAndrew Thompson extern int	uaudio_detach_sub(device_t dev);
44*86c9b3f3SHans Petter Selasky extern void	*uaudio_chan_init(struct uaudio_chan *ch, struct snd_dbuf *b,
453a3f90c6SAndrew Thompson 		    struct pcm_channel *c, int dir);
463a3f90c6SAndrew Thompson extern int	uaudio_chan_free(struct uaudio_chan *ch);
473a3f90c6SAndrew Thompson extern int	uaudio_chan_set_param_blocksize(struct uaudio_chan *ch,
483a3f90c6SAndrew Thompson 		    uint32_t blocksize);
493a3f90c6SAndrew Thompson extern int	uaudio_chan_set_param_fragments(struct uaudio_chan *ch,
503a3f90c6SAndrew Thompson 		    uint32_t blocksize, uint32_t blockcount);
513a3f90c6SAndrew Thompson extern int	uaudio_chan_set_param_speed(struct uaudio_chan *ch,
523a3f90c6SAndrew Thompson 		    uint32_t speed);
533a3f90c6SAndrew Thompson extern int	uaudio_chan_getptr(struct uaudio_chan *ch);
543a3f90c6SAndrew Thompson extern struct	pcmchan_caps *uaudio_chan_getcaps(struct uaudio_chan *ch);
5590da2b28SAriff Abdullah extern struct	pcmchan_matrix *uaudio_chan_getmatrix(struct uaudio_chan *ch,
5690da2b28SAriff Abdullah 		    uint32_t format);
573a3f90c6SAndrew Thompson extern int	uaudio_chan_set_param_format(struct uaudio_chan *ch,
583a3f90c6SAndrew Thompson 		    uint32_t format);
5985bad582SHans Petter Selasky extern void	uaudio_chan_start(struct uaudio_chan *ch);
6085bad582SHans Petter Selasky extern void	uaudio_chan_stop(struct uaudio_chan *ch);
61*86c9b3f3SHans Petter Selasky extern int	uaudio_mixer_init_sub(struct uaudio_softc *, struct snd_mixer *);
62*86c9b3f3SHans Petter Selasky extern int	uaudio_mixer_uninit_sub(struct uaudio_softc *, struct snd_mixer *);
63*86c9b3f3SHans Petter Selasky extern void	uaudio_mixer_set(struct uaudio_softc *, struct snd_mixer *,
64*86c9b3f3SHans Petter Selasky 		    unsigned type, unsigned left, unsigned right);
65*86c9b3f3SHans Petter Selasky extern uint32_t	uaudio_mixer_setrecsrc(struct uaudio_softc *, struct snd_mixer *,
66*86c9b3f3SHans Petter Selasky 		    uint32_t src);
673a3f90c6SAndrew Thompson 
683a3f90c6SAndrew Thompson int	uaudio_get_vendor(device_t dev);
693a3f90c6SAndrew Thompson int	uaudio_get_product(device_t dev);
703a3f90c6SAndrew Thompson int	uaudio_get_release(device_t dev);
71a6ed4937SHans Petter Selasky 
72a6ed4937SHans Petter Selasky #endif			/* _UAUDIO_H_ */
73