1/* 2 * Copyright (c) 1999 Cameron Grant <cg@freebsd.org> 3 * Copyright by Hannu Savolainen 1995 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 *
| 1/* 2 * Copyright (c) 1999 Cameron Grant <cg@freebsd.org> 3 * Copyright by Hannu Savolainen 1995 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 *
|
27 * $FreeBSD: head/sys/dev/sound/pcm/sound.h 124617 2004-01-17 10:37:11Z phk $
| 27 * $FreeBSD: head/sys/dev/sound/pcm/sound.h 124740 2004-01-20 03:58:57Z matk $
|
28 */ 29 30/* 31 * first, include kernel header files. 32 */ 33 34#ifndef _OS_H_ 35#define _OS_H_ 36 37#ifdef _KERNEL 38#include <sys/param.h> 39#include <sys/systm.h> 40#include <sys/ioccom.h> 41#include <sys/filio.h> 42#include <sys/sockio.h> 43#include <sys/fcntl.h> 44#include <sys/tty.h> 45#include <sys/proc.h> 46#include <sys/kernel.h> /* for DATA_SET */ 47#include <sys/module.h> 48#include <sys/conf.h> 49#include <sys/file.h> 50#include <sys/uio.h> 51#include <sys/syslog.h> 52#include <sys/errno.h> 53#include <sys/malloc.h> 54#include <sys/bus.h> 55#if __FreeBSD_version < 500000 56#include <sys/buf.h> 57#endif 58#include <machine/clock.h> /* for DELAY */ 59#include <machine/resource.h> 60#include <machine/bus.h> 61#include <sys/rman.h> 62#include <sys/mman.h> 63#include <sys/poll.h> 64#include <sys/sbuf.h> 65#include <sys/soundcard.h> 66#include <sys/sysctl.h> 67#include <sys/kobj.h> 68#include <vm/vm.h> 69#include <vm/pmap.h> 70 71#undef USING_MUTEX 72#undef USING_DEVFS 73 74#if __FreeBSD_version > 500000 75#include <sys/lock.h> 76#include <sys/mutex.h> 77 78#define USING_MUTEX 79#define USING_DEVFS 80#endif 81 82#define SND_DYNSYSCTL 83 84#ifndef INTR_MPSAFE 85#define INTR_TYPE_AV INTR_TYPE_TTY 86#endif 87 88#ifndef INTR_MPSAFE 89#define INTR_MPSAFE 0 90#endif 91 92struct pcm_channel; 93struct pcm_feeder; 94struct snd_dbuf; 95struct snd_mixer; 96 97#include <dev/sound/pcm/buffer.h> 98#include <dev/sound/pcm/channel.h> 99#include <dev/sound/pcm/feeder.h> 100#include <dev/sound/pcm/mixer.h>
| 28 */ 29 30/* 31 * first, include kernel header files. 32 */ 33 34#ifndef _OS_H_ 35#define _OS_H_ 36 37#ifdef _KERNEL 38#include <sys/param.h> 39#include <sys/systm.h> 40#include <sys/ioccom.h> 41#include <sys/filio.h> 42#include <sys/sockio.h> 43#include <sys/fcntl.h> 44#include <sys/tty.h> 45#include <sys/proc.h> 46#include <sys/kernel.h> /* for DATA_SET */ 47#include <sys/module.h> 48#include <sys/conf.h> 49#include <sys/file.h> 50#include <sys/uio.h> 51#include <sys/syslog.h> 52#include <sys/errno.h> 53#include <sys/malloc.h> 54#include <sys/bus.h> 55#if __FreeBSD_version < 500000 56#include <sys/buf.h> 57#endif 58#include <machine/clock.h> /* for DELAY */ 59#include <machine/resource.h> 60#include <machine/bus.h> 61#include <sys/rman.h> 62#include <sys/mman.h> 63#include <sys/poll.h> 64#include <sys/sbuf.h> 65#include <sys/soundcard.h> 66#include <sys/sysctl.h> 67#include <sys/kobj.h> 68#include <vm/vm.h> 69#include <vm/pmap.h> 70 71#undef USING_MUTEX 72#undef USING_DEVFS 73 74#if __FreeBSD_version > 500000 75#include <sys/lock.h> 76#include <sys/mutex.h> 77 78#define USING_MUTEX 79#define USING_DEVFS 80#endif 81 82#define SND_DYNSYSCTL 83 84#ifndef INTR_MPSAFE 85#define INTR_TYPE_AV INTR_TYPE_TTY 86#endif 87 88#ifndef INTR_MPSAFE 89#define INTR_MPSAFE 0 90#endif 91 92struct pcm_channel; 93struct pcm_feeder; 94struct snd_dbuf; 95struct snd_mixer; 96 97#include <dev/sound/pcm/buffer.h> 98#include <dev/sound/pcm/channel.h> 99#include <dev/sound/pcm/feeder.h> 100#include <dev/sound/pcm/mixer.h>
|
101#include <dev/sound/pcm/dsp.h>
| |
102 103#define PCM_SOFTC_SIZE 512 104 105#define SND_STATUSLEN 64 106 107#define PCM_MODVER 1 108 109#define PCM_MINVER 1 110#define PCM_PREFVER PCM_MODVER 111#define PCM_MAXVER 1 112 113/* 114PROPOSAL: 115each unit needs: 116status, mixer, dsp, dspW, audio, sequencer, midi-in, seq2, sndproc = 9 devices 117dspW and audio are deprecated. 118dsp needs min 64 channels, will give it 256 119 120minor = (unit << 20) + (dev << 16) + channel 121currently minor = (channel << 16) + (unit << 4) + dev 122 123nomenclature: 124 /dev/pcmX/dsp.(0..255) 125 /dev/pcmX/dspW 126 /dev/pcmX/audio 127 /dev/pcmX/status 128 /dev/pcmX/mixer 129 [etc.] 130*/ 131 132#define PCMMINOR(x) (minor(x)) 133#define PCMCHAN(x) ((PCMMINOR(x) & 0x00ff0000) >> 16) 134#define PCMUNIT(x) ((PCMMINOR(x) & 0x000000f0) >> 4) 135#define PCMDEV(x) (PCMMINOR(x) & 0x0000000f) 136#define PCMMKMINOR(u, d, c) ((((c) & 0xff) << 16) | (((u) & 0x0f) << 4) | ((d) & 0x0f)) 137 138#define SD_F_SIMPLEX 0x00000001 139#define SD_F_AUTOVCHAN 0x00000002 140#define SD_F_PRIO_RD 0x10000000 141#define SD_F_PRIO_WR 0x20000000 142#define SD_F_PRIO_SET (SD_F_PRIO_RD | SD_F_PRIO_WR) 143#define SD_F_DIR_SET 0x40000000 144#define SD_F_TRANSIENT 0xf0000000 145 146/* many variables should be reduced to a range. Here define a macro */ 147#define RANGE(var, low, high) (var) = \ 148 (((var)<(low))? (low) : ((var)>(high))? (high) : (var)) 149#define DSP_BUFFSIZE (8192) 150 151/* make figuring out what a format is easier. got AFMT_STEREO already */ 152#define AFMT_32BIT (AFMT_S32_LE | AFMT_S32_BE | AFMT_U32_LE | AFMT_U32_BE) 153#define AFMT_16BIT (AFMT_S16_LE | AFMT_S16_BE | AFMT_U16_LE | AFMT_U16_BE) 154#define AFMT_8BIT (AFMT_U8 | AFMT_S8) 155#define AFMT_SIGNED (AFMT_S16_LE | AFMT_S16_BE | AFMT_S8) 156#define AFMT_BIGENDIAN (AFMT_S16_BE | AFMT_U16_BE) 157 158struct pcm_channel *fkchan_setup(device_t dev); 159int fkchan_kill(struct pcm_channel *c); 160 161/* 162 * Major nuber for the sound driver. 163 */ 164#define SND_CDEV_MAJOR 30 165 166#define SND_MAXVCHANS 255 167 168/* 169 * Minor numbers for the sound driver. 170 * 171 * Unfortunately Creative called the codec chip of SB as a DSP. For this 172 * reason the /dev/dsp is reserved for digitized audio use. There is a 173 * device for true DSP processors but it will be called something else. 174 * In v3.0 it's /dev/sndproc but this could be a temporary solution. 175 */ 176 177#define SND_DEV_CTL 0 /* Control port /dev/mixer */ 178#define SND_DEV_SEQ 1 /* Sequencer /dev/sequencer */ 179#define SND_DEV_MIDIN 2 /* Raw midi access */ 180#define SND_DEV_DSP 3 /* Digitized voice /dev/dsp */ 181#define SND_DEV_AUDIO 4 /* Sparc compatible /dev/audio */ 182#define SND_DEV_DSP16 5 /* Like /dev/dsp but 16 bits/sample */ 183#define SND_DEV_STATUS 6 /* /dev/sndstat */ 184 /* #7 not in use now. */ 185#define SND_DEV_SEQ2 8 /* /dev/sequencer, level 2 interface */ 186#define SND_DEV_SNDPROC 9 /* /dev/sndproc for programmable devices */ 187#define SND_DEV_PSS SND_DEV_SNDPROC /* ? */ 188#define SND_DEV_NORESET 10 189#define SND_DEV_DSPREC 11 /* recording channels */ 190 191#define DSP_DEFAULT_SPEED 8000 192 193#define ON 1 194#define OFF 0 195 196extern int pcm_veto_load; 197extern int snd_unit; 198extern devclass_t pcm_devclass; 199 200/* 201 * some macros for debugging purposes 202 * DDB/DEB to enable/disable debugging stuff 203 * BVDDB to enable debugging when bootverbose 204 */ 205#define DDB(x) x /* XXX */ 206#define BVDDB(x) if (bootverbose) x 207 208#ifndef DEB 209#define DEB(x) 210#endif 211 212SYSCTL_DECL(_hw_snd); 213 214struct sysctl_ctx_list *snd_sysctl_tree(device_t dev); 215struct sysctl_oid *snd_sysctl_tree_top(device_t dev); 216 217struct pcm_channel *pcm_getfakechan(struct snddev_info *d); 218struct pcm_channel *pcm_chnalloc(struct snddev_info *d, int direction, pid_t pid, int chnum); 219int pcm_chnrelease(struct pcm_channel *c); 220int pcm_chnref(struct pcm_channel *c, int ref); 221int pcm_inprog(struct snddev_info *d, int delta); 222 223struct pcm_channel *pcm_chn_create(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, int dir, void *devinfo); 224int pcm_chn_destroy(struct pcm_channel *ch);
| 101 102#define PCM_SOFTC_SIZE 512 103 104#define SND_STATUSLEN 64 105 106#define PCM_MODVER 1 107 108#define PCM_MINVER 1 109#define PCM_PREFVER PCM_MODVER 110#define PCM_MAXVER 1 111 112/* 113PROPOSAL: 114each unit needs: 115status, mixer, dsp, dspW, audio, sequencer, midi-in, seq2, sndproc = 9 devices 116dspW and audio are deprecated. 117dsp needs min 64 channels, will give it 256 118 119minor = (unit << 20) + (dev << 16) + channel 120currently minor = (channel << 16) + (unit << 4) + dev 121 122nomenclature: 123 /dev/pcmX/dsp.(0..255) 124 /dev/pcmX/dspW 125 /dev/pcmX/audio 126 /dev/pcmX/status 127 /dev/pcmX/mixer 128 [etc.] 129*/ 130 131#define PCMMINOR(x) (minor(x)) 132#define PCMCHAN(x) ((PCMMINOR(x) & 0x00ff0000) >> 16) 133#define PCMUNIT(x) ((PCMMINOR(x) & 0x000000f0) >> 4) 134#define PCMDEV(x) (PCMMINOR(x) & 0x0000000f) 135#define PCMMKMINOR(u, d, c) ((((c) & 0xff) << 16) | (((u) & 0x0f) << 4) | ((d) & 0x0f)) 136 137#define SD_F_SIMPLEX 0x00000001 138#define SD_F_AUTOVCHAN 0x00000002 139#define SD_F_PRIO_RD 0x10000000 140#define SD_F_PRIO_WR 0x20000000 141#define SD_F_PRIO_SET (SD_F_PRIO_RD | SD_F_PRIO_WR) 142#define SD_F_DIR_SET 0x40000000 143#define SD_F_TRANSIENT 0xf0000000 144 145/* many variables should be reduced to a range. Here define a macro */ 146#define RANGE(var, low, high) (var) = \ 147 (((var)<(low))? (low) : ((var)>(high))? (high) : (var)) 148#define DSP_BUFFSIZE (8192) 149 150/* make figuring out what a format is easier. got AFMT_STEREO already */ 151#define AFMT_32BIT (AFMT_S32_LE | AFMT_S32_BE | AFMT_U32_LE | AFMT_U32_BE) 152#define AFMT_16BIT (AFMT_S16_LE | AFMT_S16_BE | AFMT_U16_LE | AFMT_U16_BE) 153#define AFMT_8BIT (AFMT_U8 | AFMT_S8) 154#define AFMT_SIGNED (AFMT_S16_LE | AFMT_S16_BE | AFMT_S8) 155#define AFMT_BIGENDIAN (AFMT_S16_BE | AFMT_U16_BE) 156 157struct pcm_channel *fkchan_setup(device_t dev); 158int fkchan_kill(struct pcm_channel *c); 159 160/* 161 * Major nuber for the sound driver. 162 */ 163#define SND_CDEV_MAJOR 30 164 165#define SND_MAXVCHANS 255 166 167/* 168 * Minor numbers for the sound driver. 169 * 170 * Unfortunately Creative called the codec chip of SB as a DSP. For this 171 * reason the /dev/dsp is reserved for digitized audio use. There is a 172 * device for true DSP processors but it will be called something else. 173 * In v3.0 it's /dev/sndproc but this could be a temporary solution. 174 */ 175 176#define SND_DEV_CTL 0 /* Control port /dev/mixer */ 177#define SND_DEV_SEQ 1 /* Sequencer /dev/sequencer */ 178#define SND_DEV_MIDIN 2 /* Raw midi access */ 179#define SND_DEV_DSP 3 /* Digitized voice /dev/dsp */ 180#define SND_DEV_AUDIO 4 /* Sparc compatible /dev/audio */ 181#define SND_DEV_DSP16 5 /* Like /dev/dsp but 16 bits/sample */ 182#define SND_DEV_STATUS 6 /* /dev/sndstat */ 183 /* #7 not in use now. */ 184#define SND_DEV_SEQ2 8 /* /dev/sequencer, level 2 interface */ 185#define SND_DEV_SNDPROC 9 /* /dev/sndproc for programmable devices */ 186#define SND_DEV_PSS SND_DEV_SNDPROC /* ? */ 187#define SND_DEV_NORESET 10 188#define SND_DEV_DSPREC 11 /* recording channels */ 189 190#define DSP_DEFAULT_SPEED 8000 191 192#define ON 1 193#define OFF 0 194 195extern int pcm_veto_load; 196extern int snd_unit; 197extern devclass_t pcm_devclass; 198 199/* 200 * some macros for debugging purposes 201 * DDB/DEB to enable/disable debugging stuff 202 * BVDDB to enable debugging when bootverbose 203 */ 204#define DDB(x) x /* XXX */ 205#define BVDDB(x) if (bootverbose) x 206 207#ifndef DEB 208#define DEB(x) 209#endif 210 211SYSCTL_DECL(_hw_snd); 212 213struct sysctl_ctx_list *snd_sysctl_tree(device_t dev); 214struct sysctl_oid *snd_sysctl_tree_top(device_t dev); 215 216struct pcm_channel *pcm_getfakechan(struct snddev_info *d); 217struct pcm_channel *pcm_chnalloc(struct snddev_info *d, int direction, pid_t pid, int chnum); 218int pcm_chnrelease(struct pcm_channel *c); 219int pcm_chnref(struct pcm_channel *c, int ref); 220int pcm_inprog(struct snddev_info *d, int delta); 221 222struct pcm_channel *pcm_chn_create(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, int dir, void *devinfo); 223int pcm_chn_destroy(struct pcm_channel *ch);
|
225int pcm_chn_add(struct snddev_info *d, struct pcm_channel *ch, int mkdev); 226int pcm_chn_remove(struct snddev_info *d, struct pcm_channel *ch, int rmdev);
| 224int pcm_chn_add(struct snddev_info *d, struct pcm_channel *ch); 225int pcm_chn_remove(struct snddev_info *d, struct pcm_channel *ch);
|
227 228int pcm_addchan(device_t dev, int dir, kobj_class_t cls, void *devinfo); 229unsigned int pcm_getbuffersize(device_t dev, unsigned int min, unsigned int deflt, unsigned int max); 230int pcm_register(device_t dev, void *devinfo, int numplay, int numrec); 231int pcm_unregister(device_t dev); 232int pcm_setstatus(device_t dev, char *str); 233u_int32_t pcm_getflags(device_t dev); 234void pcm_setflags(device_t dev, u_int32_t val); 235void *pcm_getdevinfo(device_t dev); 236
| 226 227int pcm_addchan(device_t dev, int dir, kobj_class_t cls, void *devinfo); 228unsigned int pcm_getbuffersize(device_t dev, unsigned int min, unsigned int deflt, unsigned int max); 229int pcm_register(device_t dev, void *devinfo, int numplay, int numrec); 230int pcm_unregister(device_t dev); 231int pcm_setstatus(device_t dev, char *str); 232u_int32_t pcm_getflags(device_t dev); 233void pcm_setflags(device_t dev, u_int32_t val); 234void *pcm_getdevinfo(device_t dev); 235
|
237int pcm_regdevt(dev_t dev, unsigned unit, unsigned type, unsigned channel); 238dev_t pcm_getdevt(unsigned unit, unsigned type, unsigned channel); 239int pcm_unregdevt(unsigned unit, unsigned type, unsigned channel);
| |
240 241int snd_setup_intr(device_t dev, struct resource *res, int flags, 242 driver_intr_t hand, void *param, void **cookiep); 243 244void *snd_mtxcreate(const char *desc, const char *type); 245void snd_mtxfree(void *m); 246void snd_mtxassert(void *m); 247#define snd_mtxlock(m) mtx_lock(m) 248#define snd_mtxunlock(m) mtx_unlock(m) 249 250int sysctl_hw_snd_vchans(SYSCTL_HANDLER_ARGS); 251 252typedef int (*sndstat_handler)(struct sbuf *s, device_t dev, int verbose); 253int sndstat_register(device_t dev, char *str, sndstat_handler handler); 254int sndstat_registerfile(char *str); 255int sndstat_unregister(device_t dev); 256int sndstat_unregisterfile(char *str); 257int sndstat_busy(void); 258 259#define SND_DECLARE_FILE(version) \ 260 _SND_DECLARE_FILE(__LINE__, version) 261 262#define _SND_DECLARE_FILE(uniq, version) \ 263 __SND_DECLARE_FILE(uniq, version) 264 265#define __SND_DECLARE_FILE(uniq, version) \ 266 static char sndstat_vinfo[] = version; \ 267 SYSINIT(sdf_ ## uniq, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, sndstat_registerfile, sndstat_vinfo); \ 268 SYSUNINIT(sdf_ ## uniq, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, sndstat_unregisterfile, sndstat_vinfo); 269 270/* usage of flags in device config entry (config file) */ 271#define DV_F_DRQ_MASK 0x00000007 /* mask for secondary drq */ 272#define DV_F_DUAL_DMA 0x00000010 /* set to use secondary dma channel */ 273 274/* ought to be made obsolete but still used by mss */ 275#define DV_F_DEV_MASK 0x0000ff00 /* force device type/class */ 276#define DV_F_DEV_SHIFT 8 /* force device type/class */ 277 278#define PCM_DEBUG_MTX 279 280/* 281 * this is rather kludgey- we need to duplicate these struct def'ns from sound.c 282 * so that the macro versions of pcm_{,un}lock can dereference them. 283 * we also have to do this now makedev() has gone away. 284 */ 285 286struct snddev_channel { 287 SLIST_ENTRY(snddev_channel) link; 288 struct pcm_channel *channel;
| 236 237int snd_setup_intr(device_t dev, struct resource *res, int flags, 238 driver_intr_t hand, void *param, void **cookiep); 239 240void *snd_mtxcreate(const char *desc, const char *type); 241void snd_mtxfree(void *m); 242void snd_mtxassert(void *m); 243#define snd_mtxlock(m) mtx_lock(m) 244#define snd_mtxunlock(m) mtx_unlock(m) 245 246int sysctl_hw_snd_vchans(SYSCTL_HANDLER_ARGS); 247 248typedef int (*sndstat_handler)(struct sbuf *s, device_t dev, int verbose); 249int sndstat_register(device_t dev, char *str, sndstat_handler handler); 250int sndstat_registerfile(char *str); 251int sndstat_unregister(device_t dev); 252int sndstat_unregisterfile(char *str); 253int sndstat_busy(void); 254 255#define SND_DECLARE_FILE(version) \ 256 _SND_DECLARE_FILE(__LINE__, version) 257 258#define _SND_DECLARE_FILE(uniq, version) \ 259 __SND_DECLARE_FILE(uniq, version) 260 261#define __SND_DECLARE_FILE(uniq, version) \ 262 static char sndstat_vinfo[] = version; \ 263 SYSINIT(sdf_ ## uniq, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, sndstat_registerfile, sndstat_vinfo); \ 264 SYSUNINIT(sdf_ ## uniq, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, sndstat_unregisterfile, sndstat_vinfo); 265 266/* usage of flags in device config entry (config file) */ 267#define DV_F_DRQ_MASK 0x00000007 /* mask for secondary drq */ 268#define DV_F_DUAL_DMA 0x00000010 /* set to use secondary dma channel */ 269 270/* ought to be made obsolete but still used by mss */ 271#define DV_F_DEV_MASK 0x0000ff00 /* force device type/class */ 272#define DV_F_DEV_SHIFT 8 /* force device type/class */ 273 274#define PCM_DEBUG_MTX 275 276/* 277 * this is rather kludgey- we need to duplicate these struct def'ns from sound.c 278 * so that the macro versions of pcm_{,un}lock can dereference them. 279 * we also have to do this now makedev() has gone away. 280 */ 281 282struct snddev_channel { 283 SLIST_ENTRY(snddev_channel) link; 284 struct pcm_channel *channel;
|
| 285 int chan_num; 286 dev_t dsp_devt; 287 dev_t dspW_devt; 288 dev_t audio_devt; 289 dev_t dspr_devt;
|
289}; 290
| 290}; 291
|
291struct snddev_devt { 292 SLIST_ENTRY(snddev_devt) link; 293 dev_t dev; 294 unsigned channel; 295 unsigned type; 296}; 297
| |
298struct snddev_info { 299 SLIST_HEAD(, snddev_channel) channels;
| 292struct snddev_info { 293 SLIST_HEAD(, snddev_channel) channels;
|
300 SLIST_HEAD(, snddev_devt) devs;
| |
301 struct pcm_channel *fakechan; 302 unsigned devcount, playcount, reccount, vchancount; 303 unsigned flags; 304 int inprog; 305 unsigned int bufsz; 306 void *devinfo; 307 device_t dev; 308 char status[SND_STATUSLEN]; 309 struct sysctl_ctx_list sysctl_tree; 310 struct sysctl_oid *sysctl_tree_top; 311 struct mtx *lock; 312 dev_t mixer_dev; 313 314}; 315 316#ifdef PCM_DEBUG_MTX 317#define pcm_lock(d) mtx_lock(((struct snddev_info *)(d))->lock) 318#define pcm_unlock(d) mtx_unlock(((struct snddev_info *)(d))->lock) 319#else 320void pcm_lock(struct snddev_info *d); 321void pcm_unlock(struct snddev_info *d); 322#endif 323 324#endif /* _KERNEL */ 325 326#endif /* _OS_H_ */
| 294 struct pcm_channel *fakechan; 295 unsigned devcount, playcount, reccount, vchancount; 296 unsigned flags; 297 int inprog; 298 unsigned int bufsz; 299 void *devinfo; 300 device_t dev; 301 char status[SND_STATUSLEN]; 302 struct sysctl_ctx_list sysctl_tree; 303 struct sysctl_oid *sysctl_tree_top; 304 struct mtx *lock; 305 dev_t mixer_dev; 306 307}; 308 309#ifdef PCM_DEBUG_MTX 310#define pcm_lock(d) mtx_lock(((struct snddev_info *)(d))->lock) 311#define pcm_unlock(d) mtx_unlock(((struct snddev_info *)(d))->lock) 312#else 313void pcm_lock(struct snddev_info *d); 314void pcm_unlock(struct snddev_info *d); 315#endif 316 317#endif /* _KERNEL */ 318 319#endif /* _OS_H_ */
|