FreeBSD kernel sound device code
|
#include <dev/sound/pcm/sound.h>
#include <sys/ctype.h>
#include <sys/lock.h>
#include <sys/rwlock.h>
#include <sys/sysent.h>
#include <vm/vm.h>
#include <vm/vm_object.h>
#include <vm/vm_page.h>
#include <vm/vm_pager.h>
Go to the source code of this file.
Data Structures | |
struct | dsp_cdevinfo |
Macros | |
#define | PCM_RDCH(x) (((struct dsp_cdevinfo *)(x)->si_drv1)->rdch) |
#define | PCM_WRCH(x) (((struct dsp_cdevinfo *)(x)->si_drv1)->wrch) |
#define | PCM_VOLCH(x) (((struct dsp_cdevinfo *)(x)->si_drv1)->volch) |
#define | PCM_SIMPLEX(x) (((struct dsp_cdevinfo *)(x)->si_drv1)->simplex) |
#define | DSP_CDEVINFO_CACHESIZE 8 |
#define | DSP_REGISTERED(x, y) |
#define | OLDPCM_IOCTL |
#define | DSP_F_VALID(x) ((x) & (FREAD | FWRITE)) |
#define | DSP_F_DUPLEX(x) (((x) & (FREAD | FWRITE)) == (FREAD | FWRITE)) |
#define | DSP_F_SIMPLEX(x) (!DSP_F_DUPLEX(x)) |
#define | DSP_F_READ(x) ((x) & FREAD) |
#define | DSP_F_WRITE(x) ((x) & FWRITE) |
#define | DSP_FIXUP_ERROR() |
#define | THE_REAL_SNDCTL_DSP_GETBLKSIZE _IOWR('P', 4, int) |
Enumerations | |
enum | { DSP_CDEV_TYPE_RDONLY , DSP_CDEV_TYPE_WRONLY , DSP_CDEV_TYPE_RDWR } |
enum | { DSP_CDEV_VOLCTL_NONE , DSP_CDEV_VOLCTL_READ , DSP_CDEV_VOLCTL_WRITE } |
Functions | |
SND_DECLARE_FILE ("$FreeBSD$") | |
SYSCTL_INT (_hw_snd, OID_AUTO, compat_linux_mmap, CTLFLAG_RWTUN, &dsp_mmap_allow_prot_exec, 0, "linux mmap compatibility (-1=force disable 0=auto 1=force enable)") | |
SYSCTL_INT (_hw_snd, OID_AUTO, basename_clone, CTLFLAG_RWTUN, &dsp_basename_clone, 0, "DSP basename cloning (0: Disable; 1: Enabled)") | |
static int | dsp_oss_syncgroup (struct pcm_channel *wrch, struct pcm_channel *rdch, oss_syncgroup *group) |
Assigns a PCM channel to a sync group. More... | |
static int | dsp_oss_syncstart (int sg_id) |
Launch a sync group into action. More... | |
static int | dsp_oss_policy (struct pcm_channel *wrch, struct pcm_channel *rdch, int policy) |
Handler for SNDCTL_DSP_POLICY. More... | |
static int | dsp_oss_cookedmode (struct pcm_channel *wrch, struct pcm_channel *rdch, int enabled) |
Enable or disable "cooked" mode. More... | |
static int | dsp_oss_getchnorder (struct pcm_channel *wrch, struct pcm_channel *rdch, unsigned long long *map) |
Retrieve channel interleaving order. More... | |
static int | dsp_oss_setchnorder (struct pcm_channel *wrch, struct pcm_channel *rdch, unsigned long long *map) |
Specify channel interleaving order. More... | |
static int | dsp_oss_getchannelmask (struct pcm_channel *wrch, struct pcm_channel *rdch, int *mask) |
static struct snddev_info * | dsp_get_info (struct cdev *dev) |
static uint32_t | dsp_get_flags (struct cdev *dev) |
static void | dsp_set_flags (struct cdev *dev, uint32_t flags) |
static int | getchns (struct cdev *dev, struct pcm_channel **rdch, struct pcm_channel **wrch, uint32_t prio) |
static void | relchns (struct cdev *dev, struct pcm_channel *rdch, struct pcm_channel *wrch, uint32_t prio) |
static void | dsp_cdevinfo_alloc (struct cdev *dev, struct pcm_channel *rdch, struct pcm_channel *wrch, struct pcm_channel *volch) |
static void | dsp_cdevinfo_free (struct cdev *dev) |
void | dsp_cdevinfo_init (struct snddev_info *d) |
void | dsp_cdevinfo_flush (struct snddev_info *d) |
static int | dsp_open (struct cdev *i_dev, int flags, int mode, struct thread *td) |
static int | dsp_close (struct cdev *i_dev, int flags, int mode, struct thread *td) |
static __inline int | dsp_io_ops (struct cdev *i_dev, struct uio *buf) |
static int | dsp_read (struct cdev *i_dev, struct uio *buf, int flag) |
static int | dsp_write (struct cdev *i_dev, struct uio *buf, int flag) |
static int | dsp_get_volume_channel (struct cdev *dev, struct pcm_channel **volch) |
static int | dsp_ioctl_channel (struct cdev *dev, struct pcm_channel *volch, u_long cmd, caddr_t arg) |
static int | dsp_ioctl (struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, struct thread *td) |
static int | dsp_poll (struct cdev *i_dev, int events, struct thread *td) |
static int | dsp_mmap (struct cdev *i_dev, vm_ooffset_t offset, vm_paddr_t *paddr, int nprot, vm_memattr_t *memattr) |
static int | dsp_mmap_single (struct cdev *i_dev, vm_ooffset_t *offset, vm_size_t size, struct vm_object **object, int nprot) |
static int | dsp_stdclone (char *name, char *namep, char *sep, int use_sep, int *u, int *c) |
static void | dsp_clone (void *arg, struct ucred *cred, char *name, int namelen, struct cdev **dev) |
static void | dsp_sysinit (void *p) |
static void | dsp_sysuninit (void *p) |
SYSINIT (dsp_sysinit, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, dsp_sysinit, NULL) | |
SYSUNINIT (dsp_sysuninit, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, dsp_sysuninit, NULL) | |
char * | dsp_unit2name (char *buf, size_t len, int unit) |
int | dsp_oss_audioinfo (struct cdev *i_dev, oss_audioinfo *ai) |
Handler for SNDCTL_AUDIOINFO. More... | |
Variables | |
static int | dsp_mmap_allow_prot_exec = 0 |
static int | dsp_basename_clone = 1 |
static d_open_t | dsp_open |
static d_close_t | dsp_close |
static d_read_t | dsp_read |
static d_write_t | dsp_write |
static d_ioctl_t | dsp_ioctl |
static d_poll_t | dsp_poll |
static d_mmap_t | dsp_mmap |
static d_mmap_single_t | dsp_mmap_single |
struct cdevsw | dsp_cdevsw |
static eventhandler_tag | dsp_ehtag = NULL |
static int | dsp_umax = -1 |
static int | dsp_cmax = -1 |
struct { | |
int type | |
char * name | |
char * sep | |
char * alias | |
int use_sep | |
int hw | |
int max | |
int volctl | |
uint32_t fmt | |
uint32_t spd | |
int query | |
} | dsp_cdevs [] |
#define DSP_F_DUPLEX | ( | x | ) | (((x) & (FREAD | FWRITE)) == (FREAD | FWRITE)) |
#define DSP_F_SIMPLEX | ( | x | ) | (!DSP_F_DUPLEX(x)) |
#define DSP_FIXUP_ERROR | ( | ) |
#define DSP_REGISTERED | ( | x, | |
y | |||
) |
#define PCM_RDCH | ( | x | ) | (((struct dsp_cdevinfo *)(x)->si_drv1)->rdch) |
#define PCM_SIMPLEX | ( | x | ) | (((struct dsp_cdevinfo *)(x)->si_drv1)->simplex) |
#define PCM_VOLCH | ( | x | ) | (((struct dsp_cdevinfo *)(x)->si_drv1)->volch) |
#define PCM_WRCH | ( | x | ) | (((struct dsp_cdevinfo *)(x)->si_drv1)->wrch) |
#define THE_REAL_SNDCTL_DSP_GETBLKSIZE _IOWR('P', 4, int) |
anonymous enum |
anonymous enum |
|
static |
Definition at line 227 of file dsp.c.
References dsp_cdevinfo::busy, dev, dsp_get_flags(), dsp_get_info(), PCM_BUSYASSERT, PCM_LOCK, PCM_LOCKASSERT, PCM_REGISTERED, PCM_UNLOCK, dsp_cdevinfo::rdch, SD_F_SIMPLEX, dsp_cdevinfo::simplex, dsp_cdevinfo::volch, and dsp_cdevinfo::wrch.
Referenced by dsp_open().
void dsp_cdevinfo_flush | ( | struct snddev_info * | d | ) |
Definition at line 349 of file dsp.c.
References free, PCM_BUSYASSERT, and PCM_UNLOCKASSERT.
Referenced by pcm_unregister().
|
static |
Definition at line 275 of file dsp.c.
References dsp_cdevinfo::busy, dev, DSP_CDEVINFO_CACHESIZE, dsp_get_flags(), dsp_get_info(), dsp_set_flags(), free, PCM_BUSYASSERT, PCM_LOCKASSERT, PCM_RDCH, PCM_REGISTERED, PCM_VOLCH, PCM_WRCH, dsp_cdevinfo::rdch, SD_F_PRIO_RD, SD_F_PRIO_WR, dsp_cdevinfo::simplex, dsp_cdevinfo::volch, and dsp_cdevinfo::wrch.
Referenced by dsp_close().
void dsp_cdevinfo_init | ( | struct snddev_info * | d | ) |
Definition at line 332 of file dsp.c.
References DSP_CDEVINFO_CACHESIZE, PCM_BUSYASSERT, and PCM_UNLOCKASSERT.
Referenced by pcm_register().
|
static |
Definition at line 2371 of file dsp.c.
References c, pcm_channel::channels, CHN_FOREACH, CHN_LOCK, CHN_UNLOCK, snddev_info::clones, dev, dsp_basename_clone, dsp_cdevs, dsp_cdevsw, dsp_cmax, dsp_stdclone(), dsp_umax, name, PCM_ACQUIRE, pcm_devclass, PCM_LOCK, PCM_REGISTERED, PCM_RELEASE_QUICK, PCM_UNLOCK, PCM_WAIT, PCMMINOR, snddev_info::pvchancount, snddev_info::rvchancount, snd_c2unit(), snd_clone_alloc(), snd_clone_disabled, snd_clone_getmaxunit(), snd_clone_register(), snd_clone_setmaxunit(), snd_d2unit(), SND_DEV_DSPHW_VPLAY, SND_DEV_DSPHW_VREC, snd_maxautovchans, snd_u2unit(), snd_unit, pcm_channel::unit, and use_sep.
Referenced by dsp_sysinit().
|
static |
Definition at line 701 of file dsp.c.
References snddev_info::channels, chn_abort(), CHN_F_DEAD, CHN_F_EXCLUSIVE, CHN_F_MMAP, CHN_F_RUNNING, chn_flush(), CHN_LOCK, CHN_REMOVE, chn_reset(), chn_syncdestroy(), CHN_UNLOCK, dsp_cdevinfo_free(), dsp_get_info(), DSP_REGISTERED, pcm_channel::flags, PCM_ACQUIRE, pcm_chnref(), pcm_chnrelease(), PCM_GIANT_ENTER, PCM_GIANT_LEAVE, PCM_LOCK, PCM_RDCH, PCM_RELEASE, PCM_SG_LOCK, PCM_SG_UNLOCK, PCM_UNLOCK, PCM_VOLCH, PCM_WAIT, PCM_WRCH, pcmsg_unrhdr, snd_clone_release(), and snd_clone_unref().
|
static |
Definition at line 125 of file dsp.c.
References dev, pcm_devclass, pcm_getflags(), and PCMUNIT.
Referenced by dsp_cdevinfo_alloc(), dsp_cdevinfo_free(), dsp_ioctl(), dsp_ioctl_channel(), and getchns().
|
static |
Definition at line 119 of file dsp.c.
References dev, pcm_devclass, and PCMUNIT.
Referenced by dsp_cdevinfo_alloc(), dsp_cdevinfo_free(), dsp_close(), dsp_get_volume_channel(), dsp_io_ops(), dsp_ioctl(), dsp_ioctl_channel(), dsp_mmap_single(), dsp_open(), dsp_poll(), and getchns().
|
static |
Definition at line 907 of file dsp.c.
References c, pcm_channel::channels, CHN_FOREACH, CHN_LOCK, CHN_UNLOCK, dev, dsp_get_info(), FEEDER_VOLUME, pcm_channel::feederflags, PCM_ACQUIRE, pcm_chnref(), PCM_LOCK, PCM_REGISTERED, PCM_RELEASE, PCM_UNLOCK, PCM_UNLOCKASSERT, PCM_VOLCH, PCM_WAIT, and pcm_channel::unit.
Referenced by dsp_ioctl_channel().
|
static |
Definition at line 819 of file dsp.c.
References buf, CHN_BROADCAST, CHN_F_BUSY, CHN_F_DEAD, CHN_F_MMAP, CHN_F_RUNNING, chn_read(), chn_write(), dsp_get_info(), DSP_REGISTERED, getchns(), PCM_DETACHING, PCM_GIANT_ENTER, PCM_GIANT_EXIT, PCM_GIANT_LEAVE, relchns(), SD_F_PRIO_RD, and SD_F_PRIO_WR.
Referenced by dsp_read(), and dsp_write().
|
static |
CURRENT_OPTR
is called immediately after write returns, this driver is about 32K samples behind whereas 4Front's is about 8K samples behind. Should determine source of discrepancy, even if only out of curiosity.Definition at line 1099 of file dsp.c.
References AFMT_16BIT, AFMT_24BIT, AFMT_32BIT, AFMT_8BIT, AFMT_CHANNEL, AFMT_ENCODING, AFMT_EXTCHANNEL, b, pcm_channel::blocks, pcm_channel::bufsoft, chan, CHN_2NDBUFMAXSIZE, chn_abort(), CHN_F_DEAD, CHN_F_NBIO, CHN_F_NOTRIGGER, CHN_F_TRIGGERED, CHN_F_VIRTUAL, chn_getcaps(), chn_getformats(), chn_getptr(), CHN_LOCK, chn_resetbuf(), chn_setblocksize(), chn_setformat(), chn_setspeed(), chn_start(), chn_sync(), CHN_UNLOCK, pcm_channel::cv, DEB, dsp_get_flags(), dsp_get_info(), dsp_ioctl_channel(), dsp_oss_audioinfo(), dsp_oss_cookedmode(), dsp_oss_getchannelmask(), dsp_oss_getchnorder(), dsp_oss_policy(), dsp_oss_setchnorder(), dsp_oss_syncgroup(), dsp_oss_syncstart(), DSP_REGISTERED, dsp_set_flags(), pcmchan_matrix::ext, feeder_matrix_default_channel_map(), pcm_channel::flags, pcm_channel::format, getchns(), pcm_channel::inprog, pcm_channel::lock, lpeak, pcm_channel::lw, m, max, pcmchan_caps::maxspeed, pcmchan_caps::minspeed, mix_getdevs(), MIXER_CMD_DIRECT, snddev_info::mixer_dev, mixer_ioctl_cmd(), mixer_oss_mixerinfo(), pcm_channel::name, PCM_ACQUIRE_QUICK, PCM_DETACHING, PCM_GIANT_ENTER, PCM_GIANT_EXIT, PCM_GIANT_LEAVE, PCM_LOCK, PCM_RELEASE_QUICK, PCM_UNLOCK, PCM_VOLCH, RANGE, rpeak, SD_F_BITPERFECT, SD_F_SIMPLEX, snd_dbuf::shadbuf, snd_dbuf::sl, SND_CHN_MAX, SND_FORMAT, sndbuf_acquire(), sndbuf_dispose(), sndbuf_fillsilence(), sndbuf_getalign(), sndbuf_getblkcnt(), sndbuf_getblksz(), sndbuf_getblocks(), sndbuf_getfree(), sndbuf_getfreeptr(), sndbuf_gethwptr(), sndbuf_getready(), sndbuf_getreadyptr(), sndbuf_getsize(), sndbuf_gettotal(), sndbuf_softreset(), sound_oss_card_info(), sound_oss_sysinfo(), pcm_channel::speed, THE_REAL_SNDCTL_DSP_GETBLKSIZE, and pcm_channel::xruns.
|
static |
Definition at line 962 of file dsp.c.
References CHN_GETMUTE, CHN_GETVOLUME, CHN_LOCK, chn_setmute_multi(), chn_setvolume_multi(), CHN_UNLOCK, dev, pcm_channel::direction, dsp_get_flags(), dsp_get_info(), dsp_get_volume_channel(), FEEDER_VOLUME, pcm_channel::feederflags, left, PCM_RDCH, PCM_REGISTERED, PCM_UNLOCKASSERT, PCM_VOLCH, PCM_WRCH, PCMDEV, PCMDIR_PLAY, PCMDIR_REC, right, SD_F_VPC, SND_CHN_T_FL, SND_CHN_T_FR, SND_DEV_DSPHW_PLAY, SND_DEV_DSPHW_REC, SND_DEV_DSPHW_VPLAY, SND_DEV_DSPHW_VREC, and SND_VOL_C_PCM.
Referenced by dsp_ioctl().
|
static |
|
static |
Definition at line 2253 of file dsp.c.
References pcm_channel::bufsoft, c, CHN_F_MMAP, CHN_F_MMAP_INVALID, dsp_get_info(), dsp_mmap_allow_prot_exec, DSP_REGISTERED, pcm_channel::flags, getchns(), offset, PCM_DETACHING, PCM_GIANT_ENTER, PCM_GIANT_EXIT, PCM_GIANT_LEAVE, relchns(), SD_F_PRIO_RD, SD_F_PRIO_WR, size, sndbuf_getbufofs(), and sndbuf_getsize().
|
static |
Definition at line 451 of file dsp.c.
References alias, snddev_info::channels, CHN_F_EXCLUSIVE, CHN_F_NBIO, CHN_INSERT_HEAD, CHN_LOCK, chn_reset(), CHN_UNLOCK, chn_vpc_reset(), DSP_CDEV_TYPE_RDONLY, DSP_CDEV_TYPE_WRONLY, DSP_CDEV_VOLCTL_NONE, DSP_CDEV_VOLCTL_READ, DSP_CDEV_VOLCTL_WRITE, dsp_cdevinfo_alloc(), dsp_cdevs, DSP_F_DUPLEX, DSP_F_READ, DSP_F_WRITE, DSP_FIXUP_ERROR, dsp_get_info(), error, pcm_channel::flags, snddev_info::flags, fmt, PCM_ACQUIRE, pcm_chnalloc(), pcm_chnref(), pcm_chnrelease(), PCM_DETACHING, PCM_GIANT_ENTER, PCM_GIANT_EXIT, PCM_GIANT_LEAVE, PCM_LOCK, PCM_REGISTERED, PCM_RELEASE, PCM_RELEASE_QUICK, PCM_UNLOCK, PCM_WAIT, PCMDEV, PCMDIR_PLAY, PCMDIR_REC, query, snd_clone_acquire(), snd_clone_ref(), snd_clone_release(), SND_VOL_C_PCM, spd, type, and volctl.
int dsp_oss_audioinfo | ( | struct cdev * | i_dev, |
oss_audioinfo * | ai | ||
) |
Handler for SNDCTL_AUDIOINFO.
Gathers information about the audio device specified in ai->dev. If ai->dev == -1, then this function gathers information about the current device. If the call comes in on a non-audio device and ai->dev == -1, return EINVAL.
This routine is supposed to go practically straight to the hardware, getting capabilities directly from the sound card driver, side-stepping the intermediate channel interface.
Note, however, that the usefulness of this command is significantly decreased when requesting info about any device other than the one serving the request. While each snddev_channel refers to a specific device node, the converse is not true. Currently, when a sound device node is opened, the sound subsystem scans for an available audio channel (or channels, if opened in read+write) and then assigns them to the si_drv[12] private data fields. As a result, any information returned linking a channel to a specific character device isn't necessarily accurate.
dev | device on which the ioctl was issued |
ai | ioctl request data container |
0 | success |
EINVAL | ai->dev specifies an invalid device |
cmd
- OSSv4 docs: "Only supported under Linux at
this moment." Cop-out, I know, but I'll save running around in the process table for later. Is there a risk of leaking information?SNDCTL_AUDIOINFO::caps
- Make drivers keep these in pcmchan::caps? magic
- OSSv4 docs: "Reserved for internal use
by OSS."card_number
- OSSv4 docs: "Number of the sound
card where this device belongs or -1 if this
information is not available. Applications
should normally not use this field for any
purpose."song_name
- depends first on SNDCTL_[GS]ETSONGlabel
- depends on SNDCTL_[GS]ETLABEL port_number
- routing information? real_device
- OSSv4 docs: "Obsolete."flags
- OSSv4 docs: "Reserved for future use."binding
- OSSv4 docs: "Reserved for future use."handle
- haven't decided how to generate this yet; bus, vendor, device IDs? Definition at line 2587 of file dsp.c.
References AFMT_CHANNEL, buf, pcmchan_caps::caps, snddev_info::channels, CHN_F_BUSY, CHN_F_VIRTUAL, CHN_FOREACH, chn_getcaps(), chn_getrates(), CHN_LOCK, CHN_NAMELEN, CHN_UNLOCK, CHN_UNLOCKASSERT, snddev_info::dev, pcm_channel::direction, dsp_cdevsw, DSP_REGISTERED, dsp_unit2name(), pcm_channel::flags, pcmchan_caps::fmtlist, fmts, pcmchan_caps::maxspeed, pcmchan_caps::minspeed, snddev_info::mixer_dev, pcm_channel::name, pcm_devclass, PCM_LOCK, PCM_RDCH, PCM_REGISTERED, PCM_UNLOCK, PCM_UNLOCKASSERT, PCM_WRCH, PCMDIR_PLAY, PCMUNIT, pcm_channel::pid, rates, and pcm_channel::unit.
Referenced by dsp_ioctl(), and mixer_ioctl_cmd().
|
static |
Enable or disable "cooked" mode.
This is a handler for SNDCTL_DSP_COOKEDMODE
. When in cooked mode, which is the default, the sound system handles rate and format conversions automatically (ex: user writing 11025Hz/8 bit/unsigned but card only operates with 44100Hz/16bit/signed samples).
Disabling cooked mode is intended for applications wanting to mmap() a sound card's buffer space directly, bypassing the FreeBSD 2-stage feeder architecture, presumably to gain as much control over audio hardware as possible.
See http://manuals.opensound.com/developer/SNDCTL_DSP_COOKEDMODE.html
for more details.
wrch | playback channel (optional; may be NULL) |
rdch | recording channel (optional; may be NULL) |
enabled | 0 = raw mode, 1 = cooked mode |
EINVAL | Operation not yet supported. |
Definition at line 3146 of file dsp.c.
References CHN_F_BITPERFECT, CHN_LOCK, CHN_UNLOCK, and pcm_channel::flags.
Referenced by dsp_ioctl().
|
static |
Definition at line 3253 of file dsp.c.
References CHN_LOCK, chn_oss_getmask(), CHN_UNLOCK, and mask.
Referenced by dsp_ioctl().
|
static |
Retrieve channel interleaving order.
This is the handler for SNDCTL_DSP_GET_CHNORDER
.
See http://manuals.opensound.com/developer/SNDCTL_DSP_GET_CHNORDER.html
for more details.
wrch | playback channel (optional; may be NULL) |
rdch | recording channel (optional; may be NULL) |
map | channel map (result will be stored there) |
EINVAL | Operation not yet supported. |
Definition at line 3200 of file dsp.c.
References CHN_LOCK, chn_oss_getorder(), and CHN_UNLOCK.
Referenced by dsp_ioctl().
|
static |
Handler for SNDCTL_DSP_POLICY.
The SNDCTL_DSP_POLICY ioctl is a simpler interface to control fragment size and count like with SNDCTL_DSP_SETFRAGMENT. Instead of the user specifying those two parameters, s/he simply selects a number from 0..10 which corresponds to a buffer size. Smaller numbers request smaller buffers with lower latencies (at greater overhead from more frequent interrupts), while greater numbers behave in the opposite manner.
The 4Front spec states that a value of 5 should be the default. However, this implementation deviates slightly by using a linear scale without consulting drivers. I.e., even though drivers may have different default buffer sizes, a policy argument of 5 will have the same result across all drivers.
See http://manuals.opensound.com/developer/SNDCTL_DSP_POLICY.html for more information.
wrch | Pointer to opened playback channel (optional; may be NULL) |
rdch | " recording channel (optional; may be NULL) |
policy | Integer from [0:10] |
0 | constant (for now) |
Definition at line 3095 of file dsp.c.
References CHN_LOCK, CHN_POLICY_MAX, chn_setlatency(), and CHN_UNLOCK.
Referenced by dsp_ioctl().
|
static |
Specify channel interleaving order.
This is the handler for SNDCTL_DSP_SET_CHNORDER
.
SNDCTL_DSP_SET_CHNORDER
.wrch | playback channel (optional; may be NULL) |
rdch | recording channel (optional; may be NULL) |
map | channel map |
EINVAL | Operation not yet supported. |
Definition at line 3231 of file dsp.c.
References CHN_LOCK, chn_oss_setorder(), and CHN_UNLOCK.
Referenced by dsp_ioctl().
|
static |
Assigns a PCM channel to a sync group.
Sync groups are used to enable audio operations on multiple devices simultaneously. They may be used with any number of devices and may span across applications. Devices are added to groups with the SNDCTL_DSP_SYNCGROUP ioctl, and operations are triggered with the SNDCTL_DSP_SYNCSTART ioctl.
If the id
field of the group
parameter is set to zero, then a new sync group is created. Otherwise, wrch and rdch (if set) are added to the group specified.
wrch | output channel associated w/ device (if any) |
rdch | input channel associated w/ device (if any) |
group | Sync group parameters |
0 | success |
non-zero | error to be propagated upstream |
Definition at line 2814 of file dsp.c.
References pcmchan_syncmember::ch, chn_abort(), CHN_F_NOTRIGGER, CHN_LOCK, chn_syncdestroy(), CHN_UNLOCK, pcm_channel::flags, free, pcmchan_syncgroup::id, pcmchan_syncmember::parent, PCM_SG_LOCK, PCM_SG_UNLOCK, pcmsg_unrhdr, pcm_channel::sm, and snd_pcm_syncgroups.
Referenced by dsp_ioctl().
|
static |
Launch a sync group into action.
Sync groups are established via SNDCTL_DSP_SYNCGROUP. This function iterates over all members, triggering them along the way.
sg_id | sync group identifier |
0 | success |
non-zero | error worthy of propagating upstream to user |
Definition at line 2973 of file dsp.c.
References c, pcmchan_syncmember::ch, chn_start(), CHN_TRYLOCK, CHN_UNLOCK, pcm_channel::flags, free, pcmchan_syncgroup::id, PCM_SG_LOCK, PCM_SG_UNLOCK, pcmsg_unrhdr, pcm_channel::sm, snd_pcm_syncgroups, and snd_pcm_syncgroups_mtx.
Referenced by dsp_ioctl().
|
static |
Definition at line 2200 of file dsp.c.
References CHN_F_DEAD, chn_poll(), dsp_get_info(), DSP_REGISTERED, pcm_channel::flags, getchns(), PCM_DETACHING, PCM_GIANT_ENTER, PCM_GIANT_LEAVE, relchns(), SD_F_PRIO_RD, and SD_F_PRIO_WR.
|
static |
Definition at line 895 of file dsp.c.
References buf, and dsp_io_ops().
|
static |
Definition at line 135 of file dsp.c.
References dev, snddev_info::flags, pcm_devclass, pcm_setflags(), and PCMUNIT.
Referenced by dsp_cdevinfo_free(), dsp_ioctl(), and getchns().
|
static |
|
static |
Definition at line 2510 of file dsp.c.
References dsp_clone(), dsp_cmax, dsp_ehtag, dsp_umax, PCMMAXCHAN, PCMMAXUNIT, and snd_unit_init().
|
static |
char * dsp_unit2name | ( | char * | buf, |
size_t | len, | ||
int | unit | ||
) |
Definition at line 2534 of file dsp.c.
References alias, buf, dsp_cdevs, len, name, sep, snd_unit2c(), snd_unit2d(), snd_unit2u(), type, and pcm_channel::unit.
Referenced by dsp_oss_audioinfo(), pcm_chn_create(), and vchan_sync().
|
static |
Definition at line 901 of file dsp.c.
References buf, and dsp_io_ops().
|
static |
Definition at line 150 of file dsp.c.
References CHN_LOCK, dev, dsp_get_flags(), dsp_get_info(), dsp_set_flags(), pcm_channel::flags, PCM_ACQUIRE, pcm_chnref(), pcm_chnrelease(), PCM_LOCK, PCM_RDCH, PCM_REGISTERED, PCM_RELEASE, PCM_SIMPLEX, PCM_UNLOCK, PCM_WAIT, PCM_WRCH, SD_F_PRIO_RD, and SD_F_PRIO_WR.
Referenced by dsp_io_ops(), dsp_ioctl(), dsp_mmap_single(), and dsp_poll().
|
static |
Definition at line 217 of file dsp.c.
References CHN_UNLOCK, SD_F_PRIO_RD, and SD_F_PRIO_WR.
Referenced by dsp_io_ops(), dsp_mmap_single(), and dsp_poll().
SND_DECLARE_FILE | ( | "$FreeBSD$" | ) |
SYSCTL_INT | ( | _hw_snd | , |
OID_AUTO | , | ||
basename_clone | , | ||
CTLFLAG_RWTUN | , | ||
& | dsp_basename_clone, | ||
0 | , | ||
"DSP basename cloning (0: Disable; 1: Enabled)" | |||
) |
SYSCTL_INT | ( | _hw_snd | , |
OID_AUTO | , | ||
compat_linux_mmap | , | ||
CTLFLAG_RWTUN | , | ||
& | dsp_mmap_allow_prot_exec, | ||
0 | , | ||
"linux mmap compatibility (-1=force disable 0=auto 1=force enable)" | |||
) |
SYSINIT | ( | dsp_sysinit | , |
SI_SUB_DRIVERS | , | ||
SI_ORDER_MIDDLE | , | ||
dsp_sysinit | , | ||
NULL | |||
) |
SYSUNINIT | ( | dsp_sysuninit | , |
SI_SUB_DRIVERS | , | ||
SI_ORDER_MIDDLE | , | ||
dsp_sysuninit | , | ||
NULL | |||
) |
char* alias |
Definition at line 389 of file dsp.c.
Referenced by dsp_open(), and dsp_unit2name().
|
static |
Definition at line 53 of file dsp.c.
Referenced by dsp_clone().
const struct { ... } dsp_cdevs[] |
Referenced by dsp_clone(), dsp_open(), and dsp_unit2name().
struct cdevsw dsp_cdevsw |
Definition at line 86 of file dsp.c.
Referenced by dsp_clone(), and dsp_oss_audioinfo().
|
static |
Definition at line 101 of file dsp.c.
Referenced by dsp_clone(), dsp_stdclone(), and dsp_sysinit().
|
static |
Definition at line 99 of file dsp.c.
Referenced by dsp_sysinit(), and dsp_sysuninit().
|
static |
Definition at line 48 of file dsp.c.
Referenced by dsp_mmap_single().
|
static |
Definition at line 100 of file dsp.c.
Referenced by dsp_clone(), dsp_stdclone(), and dsp_sysinit().
uint32_t fmt |
Definition at line 394 of file dsp.c.
Referenced by dsp_open().
int max |
Definition at line 392 of file dsp.c.
Referenced by ac97_setmixer(), atiixp_chip_post_init(), chn_calclatency(), cmimix_set(), dsp_ioctl(), hdaa_audio_as_parse(), hdaa_audio_ctl_parse(), hdaa_prepare_pcms(), hdaa_widget_connection_parse(), pcm_chn_create(), pcm_clonereset(), rel2abs_volume(), sb16mix_set(), sb_speed(), sbmix_set(), sbpromix_set(), sndstat_get_caps(), sv_mix_init(), uaudio20_check_rate(), and uaudio_mixer_merge_outputs().
char* name |
Definition at line 387 of file dsp.c.
Referenced by dsp_clone(), dsp_stdclone(), and dsp_unit2name().
int query |
Definition at line 395 of file dsp.c.
Referenced by dsp_open().
char* sep |
Definition at line 388 of file dsp.c.
Referenced by dsp_stdclone(), and dsp_unit2name().
uint32_t spd |
Definition at line 394 of file dsp.c.
Referenced by chn_reset(), dsp_open(), emu_vsetup(), ess_calcfilter(), ess_calcspeed8(), ess_calcspeed9(), ess_setupch(), feed_eq_coeff_rate(), hdaa_channel_setspeed(), and sndbuf_setspd().
int type |
Definition at line 386 of file dsp.c.
Referenced by chn_findfeeder(), csa_alloc_resource(), dsp_open(), dsp_unit2name(), fm801_alloc_resource(), gusc_alloc_resource(), gusc_release_resource(), hdaa_audio_as_parse(), hdaa_audio_assign_names(), midi_modevent(), mixer_obj_create(), sbc_alloc_resource(), sbc_release_resource(), seq_modevent(), snd_modevent(), snd_mtxcreate(), sndstat_register(), sound_modevent(), spicds_settype(), ua_mixer_set(), uaudio20_mixer_add_feature(), uaudio_mixer_add_feature(), uaudio_mixer_set(), and uaudio_mixer_signext().
int use_sep |
Definition at line 390 of file dsp.c.
Referenced by dsp_clone(), and dsp_stdclone().
int volctl |
Definition at line 393 of file dsp.c.
Referenced by dsp_open().