FreeBSD kernel sound device code
|
#include "channel_if.h"
Go to the source code of this file.
Data Structures | |
struct | pcmchan_caps |
struct | pcmchan_matrix |
struct | pcmchan_syncgroup |
Specifies an audio device sync group. More... | |
struct | pcmchan_syncmember |
Specifies a container for members of a sync group. More... | |
struct | pcm_channel |
Macros | |
#define | PCM_SG_LOCK() mtx_lock(&snd_pcm_syncgroups_mtx) |
#define | PCM_SG_TRYLOCK() mtx_trylock(&snd_pcm_syncgroups_mtx) |
#define | PCM_SG_UNLOCK() mtx_unlock(&snd_pcm_syncgroups_mtx) |
#define | PCM_SG_LOCKASSERT(arg) mtx_assert(&snd_pcm_syncgroups_mtx, arg) |
#define | CHN_NAMELEN 32 |
#define | CHN_COMM_UNUSED "<UNUSED>" |
#define | CHN_COMM_UNKNOWN "<UNKNOWN>" |
#define | CHN_HEAD(x, y) &(x)->y.head |
#define | CHN_INIT(x, y) SLIST_INIT(CHN_HEAD(x, y)) |
#define | CHN_LINK(y) y.link |
#define | CHN_EMPTY(x, y) SLIST_EMPTY(CHN_HEAD(x, y)) |
#define | CHN_FIRST(x, y) SLIST_FIRST(CHN_HEAD(x, y)) |
#define | CHN_FOREACH(x, y, z) SLIST_FOREACH(x, CHN_HEAD(y, z), CHN_LINK(z)) |
#define | CHN_FOREACH_SAFE(w, x, y, z) SLIST_FOREACH_SAFE(w, CHN_HEAD(x, z), CHN_LINK(z), y) |
#define | CHN_INSERT_HEAD(x, y, z) SLIST_INSERT_HEAD(CHN_HEAD(x, z), y, CHN_LINK(z)) |
#define | CHN_INSERT_AFTER(x, y, z) SLIST_INSERT_AFTER(x, y, CHN_LINK(z)) |
#define | CHN_REMOVE(x, y, z) SLIST_REMOVE(CHN_HEAD(x, z), y, pcm_channel, CHN_LINK(z)) |
#define | CHN_INSERT_HEAD_SAFE(x, y, z) |
#define | CHN_INSERT_AFTER_SAFE(w, x, y, z) |
#define | CHN_REMOVE_SAFE(x, y, z) |
#define | CHN_INSERT_SORT(w, x, y, z) |
#define | CHN_INSERT_SORT_ASCEND(x, y, z) CHN_INSERT_SORT(>, x, y, z) |
#define | CHN_INSERT_SORT_DESCEND(x, y, z) CHN_INSERT_SORT(<, x, y, z) |
#define | CHN_UNIT(x) (snd_unit2u((x)->unit)) |
#define | CHN_DEV(x) (snd_unit2d((x)->unit)) |
#define | CHN_CHAN(x) (snd_unit2c((x)->unit)) |
#define | CHN_BUF_PARENT(x, y) |
#define | CHN_BROADCAST(x) |
#define | CHN_SETVOLUME(...) chn_setvolume_matrix(__VA_ARGS__) |
#define | CHN_GETVOLUME(x, y, z) ((x)->volume[y][z]) |
#define | CHN_GETMUTE(x, y, z) ((x)->muted[y][z]) |
#define | CHN_LOCKOWNED(c) mtx_owned((c)->lock) |
#define | CHN_LOCK(c) mtx_lock((c)->lock) |
#define | CHN_UNLOCK(c) mtx_unlock((c)->lock) |
#define | CHN_TRYLOCK(c) mtx_trylock((c)->lock) |
#define | CHN_LOCKASSERT(c) mtx_assert((c)->lock, MA_OWNED) |
#define | CHN_UNLOCKASSERT(c) mtx_assert((c)->lock, MA_NOTOWNED) |
#define | AFMTSTR_LEN 16 |
#define | PCMDIR_PLAY 1 |
#define | PCMDIR_PLAY_VIRTUAL 2 |
#define | PCMDIR_REC -1 |
#define | PCMDIR_REC_VIRTUAL -2 |
#define | PCMTRIG_START 1 |
#define | PCMTRIG_EMLDMAWR 2 |
#define | PCMTRIG_EMLDMARD 3 |
#define | PCMTRIG_STOP 0 |
#define | PCMTRIG_ABORT -1 |
#define | PCMTRIG_COMMON(x) |
#define | CHN_F_CLOSING 0x00000001 /* a pending close */ |
#define | CHN_F_ABORTING 0x00000002 /* a pending abort */ |
#define | CHN_F_RUNNING 0x00000004 /* dma is running */ |
#define | CHN_F_TRIGGERED 0x00000008 |
#define | CHN_F_NOTRIGGER 0x00000010 |
#define | CHN_F_SLEEPING 0x00000020 |
#define | CHN_F_NBIO 0x00000040 /* do non-blocking i/o */ |
#define | CHN_F_MMAP 0x00000080 /* has been mmap()ed */ |
#define | CHN_F_BUSY 0x00000100 /* has been opened */ |
#define | CHN_F_DIRTY 0x00000200 /* need re-config */ |
#define | CHN_F_DEAD 0x00000400 /* too many errors, dead, mdk */ |
#define | CHN_F_SILENCE 0x00000800 /* silence, nil, null, yada */ |
#define | CHN_F_HAS_SIZE 0x00001000 /* user set block size */ |
#define | CHN_F_HAS_VCHAN 0x00002000 /* vchan master */ |
#define | CHN_F_VCHAN_PASSTHROUGH 0x00004000 /* digital ac3/dts passthrough */ |
#define | CHN_F_VCHAN_ADAPTIVE 0x00008000 /* adaptive format/rate selection */ |
#define | CHN_F_VCHAN_DYNAMIC (CHN_F_VCHAN_PASSTHROUGH | CHN_F_VCHAN_ADAPTIVE) |
#define | CHN_F_VIRTUAL 0x10000000 /* not backed by hardware */ |
#define | CHN_F_BITPERFECT 0x20000000 /* un-cooked, Heh.. */ |
#define | CHN_F_PASSTHROUGH 0x40000000 /* passthrough re-config */ |
#define | CHN_F_EXCLUSIVE 0x80000000 /* exclusive access */ |
#define | CHN_F_BITS |
#define | CHN_F_RESET |
#define | CHN_F_MMAP_INVALID (CHN_F_DEAD | CHN_F_RUNNING) |
#define | CHN_N_RATE 0x00000001 |
#define | CHN_N_FORMAT 0x00000002 |
#define | CHN_N_VOLUME 0x00000004 |
#define | CHN_N_BLOCKSIZE 0x00000008 |
#define | CHN_N_TRIGGER 0x00000010 |
#define | CHN_LATENCY_MIN 0 |
#define | CHN_LATENCY_MAX 10 |
#define | CHN_LATENCY_DEFAULT 2 /* 21.3ms total buffering */ |
#define | CHN_POLICY_MIN CHN_LATENCY_MIN |
#define | CHN_POLICY_MAX CHN_LATENCY_MAX |
#define | CHN_POLICY_DEFAULT CHN_LATENCY_DEFAULT |
#define | CHN_LATENCY_PROFILE_MIN 0 |
#define | CHN_LATENCY_PROFILE_MAX 1 |
#define | CHN_LATENCY_PROFILE_DEFAULT CHN_LATENCY_PROFILE_MAX |
#define | CHN_STARTED(c) ((c)->flags & CHN_F_TRIGGERED) |
#define | CHN_STOPPED(c) (!CHN_STARTED(c)) |
#define | CHN_DIRSTR(c) |
#define | CHN_BITPERFECT(c) ((c)->flags & CHN_F_BITPERFECT) |
#define | CHN_PASSTHROUGH(c) ((c)->flags & CHN_F_PASSTHROUGH) |
#define | CHN_TIMEOUT 5 |
#define | CHN_TIMEOUT_MIN 1 |
#define | CHN_TIMEOUT_MAX 10 |
#define | CHN_2NDBUFBLKSIZE (2 * 1024) |
#define | CHN_2NDBUFBLKNUM (32) |
#define | CHN_2NDBUFMAXSIZE (131072) |
#define | CHANNEL_DECLARE(name) static DEFINE_CLASS(name, name ## _methods, sizeof(struct kobj)) |
Functions | |
SLIST_HEAD (pcm_synclist, pcmchan_syncgroup) snd_pcm_syncgroups | |
int | chn_reinit (struct pcm_channel *c) |
int | chn_write (struct pcm_channel *c, struct uio *buf) |
int | chn_read (struct pcm_channel *c, struct uio *buf) |
u_int32_t | chn_start (struct pcm_channel *c, int force) |
int | chn_sync (struct pcm_channel *c, int threshold) |
int | chn_flush (struct pcm_channel *c) |
int | chn_poll (struct pcm_channel *c, int ev, struct thread *td) |
int | chn_init (struct pcm_channel *c, void *devinfo, int dir, int direction) |
int | chn_kill (struct pcm_channel *c) |
int | chn_reset (struct pcm_channel *c, u_int32_t fmt, u_int32_t spd) |
int | chn_setvolume (struct pcm_channel *c, int left, int right) |
int | chn_setvolume_multi (struct pcm_channel *c, int vc, int left, int right, int center) |
int | chn_setvolume_matrix (struct pcm_channel *c, int vc, int vt, int val) |
int | chn_getvolume_matrix (struct pcm_channel *c, int vc, int vt) |
int | chn_setmute_multi (struct pcm_channel *c, int vc, int mute) |
int | chn_setmute_matrix (struct pcm_channel *c, int vc, int vt, int mute) |
int | chn_getmute_matrix (struct pcm_channel *c, int vc, int vt) |
void | chn_vpc_reset (struct pcm_channel *c, int vc, int force) |
int | chn_setparam (struct pcm_channel *c, uint32_t format, uint32_t speed) |
int | chn_setspeed (struct pcm_channel *c, uint32_t speed) |
int | chn_setformat (struct pcm_channel *c, uint32_t format) |
int | chn_setblocksize (struct pcm_channel *c, int blkcnt, int blksz) |
int | chn_setlatency (struct pcm_channel *c, int latency) |
void | chn_syncstate (struct pcm_channel *c) |
int | chn_trigger (struct pcm_channel *c, int go) |
int | chn_getptr (struct pcm_channel *c) |
Queries sound driver for sample-aligned hardware buffer pointer index. More... | |
struct pcmchan_caps * | chn_getcaps (struct pcm_channel *c) |
u_int32_t | chn_getformats (struct pcm_channel *c) |
struct pcmchan_matrix * | chn_getmatrix (struct pcm_channel *) |
int | chn_setmatrix (struct pcm_channel *, struct pcmchan_matrix *) |
int | chn_oss_getorder (struct pcm_channel *, unsigned long long *) |
int | chn_oss_setorder (struct pcm_channel *, unsigned long long *) |
int | chn_oss_getmask (struct pcm_channel *, uint32_t *) |
void | chn_resetbuf (struct pcm_channel *c) |
void | chn_intr_locked (struct pcm_channel *c) |
void | chn_intr (struct pcm_channel *c) |
int | chn_abort (struct pcm_channel *c) |
int | chn_notify (struct pcm_channel *c, u_int32_t flags) |
int | chn_getrates (struct pcm_channel *c, int **rates) |
Fetch array of supported discrete sample rates. More... | |
int | chn_syncdestroy (struct pcm_channel *c) |
Remove channel from a sync group, if there is one. More... | |
int | snd_fmtvalid (uint32_t fmt, uint32_t *fmtlist) |
uint32_t | snd_str2afmt (const char *) |
uint32_t | snd_afmt2str (uint32_t, char *, size_t) |
Variables | |
struct mtx | snd_pcm_syncgroups_mtx |
Channel sync group lock. More... | |
int | chn_latency |
int | chn_latency_profile |
int | report_soft_formats |
int | report_soft_matrix |
#define CHANNEL_DECLARE | ( | name | ) | static DEFINE_CLASS(name, name ## _methods, sizeof(struct kobj)) |
#define CHN_BITPERFECT | ( | c | ) | ((c)->flags & CHN_F_BITPERFECT) |
#define CHN_BROADCAST | ( | x | ) |
#define CHN_BUF_PARENT | ( | x, | |
y | |||
) |
#define CHN_CHAN | ( | x | ) | (snd_unit2c((x)->unit)) |
#define CHN_DEV | ( | x | ) | (snd_unit2d((x)->unit)) |
#define CHN_DIRSTR | ( | c | ) |
#define CHN_F_BITPERFECT 0x20000000 /* un-cooked, Heh.. */ |
#define CHN_F_BITS |
#define CHN_F_DEAD 0x00000400 /* too many errors, dead, mdk */ |
#define CHN_F_MMAP_INVALID (CHN_F_DEAD | CHN_F_RUNNING) |
#define CHN_F_PASSTHROUGH 0x40000000 /* passthrough re-config */ |
#define CHN_F_RESET |
#define CHN_F_SILENCE 0x00000800 /* silence, nil, null, yada */ |
#define CHN_F_VCHAN_DYNAMIC (CHN_F_VCHAN_PASSTHROUGH | CHN_F_VCHAN_ADAPTIVE) |
#define CHN_F_VCHAN_PASSTHROUGH 0x00004000 /* digital ac3/dts passthrough */ |
#define CHN_F_VIRTUAL 0x10000000 /* not backed by hardware */ |
#define CHN_INSERT_AFTER | ( | x, | |
y, | |||
z | |||
) | SLIST_INSERT_AFTER(x, y, CHN_LINK(z)) |
#define CHN_INSERT_AFTER_SAFE | ( | w, | |
x, | |||
y, | |||
z | |||
) |
#define CHN_INSERT_HEAD_SAFE | ( | x, | |
y, | |||
z | |||
) |
#define CHN_INSERT_SORT | ( | w, | |
x, | |||
y, | |||
z | |||
) |
#define CHN_INSERT_SORT_ASCEND | ( | x, | |
y, | |||
z | |||
) | CHN_INSERT_SORT(>, x, y, z) |
#define CHN_INSERT_SORT_DESCEND | ( | x, | |
y, | |||
z | |||
) | CHN_INSERT_SORT(<, x, y, z) |
#define CHN_LATENCY_DEFAULT 2 /* 21.3ms total buffering */ |
#define CHN_LATENCY_PROFILE_DEFAULT CHN_LATENCY_PROFILE_MAX |
#define CHN_PASSTHROUGH | ( | c | ) | ((c)->flags & CHN_F_PASSTHROUGH) |
#define CHN_POLICY_DEFAULT CHN_LATENCY_DEFAULT |
#define CHN_POLICY_MAX CHN_LATENCY_MAX |
#define CHN_POLICY_MIN CHN_LATENCY_MIN |
#define CHN_REMOVE | ( | x, | |
y, | |||
z | |||
) | SLIST_REMOVE(CHN_HEAD(x, z), y, pcm_channel, CHN_LINK(z)) |
#define CHN_REMOVE_SAFE | ( | x, | |
y, | |||
z | |||
) |
#define CHN_SETVOLUME | ( | ... | ) | chn_setvolume_matrix(__VA_ARGS__) |
#define CHN_STARTED | ( | c | ) | ((c)->flags & CHN_F_TRIGGERED) |
#define CHN_STOPPED | ( | c | ) | (!CHN_STARTED(c)) |
#define CHN_UNIT | ( | x | ) | (snd_unit2u((x)->unit)) |
#define PCM_SG_LOCK | ( | ) | mtx_lock(&snd_pcm_syncgroups_mtx) |
#define PCM_SG_LOCKASSERT | ( | arg | ) | mtx_assert(&snd_pcm_syncgroups_mtx, arg) |
#define PCM_SG_TRYLOCK | ( | ) | mtx_trylock(&snd_pcm_syncgroups_mtx) |
#define PCM_SG_UNLOCK | ( | ) | mtx_unlock(&snd_pcm_syncgroups_mtx) |
#define PCMTRIG_COMMON | ( | x | ) |
int chn_abort | ( | struct pcm_channel * | c | ) |
Definition at line 927 of file channel.c.
References b, pcm_channel::bufhard, pcm_channel::bufsoft, c, chn_dmaupdate(), CHN_F_ABORTING, CHN_F_VIRTUAL, CHN_LOCKASSERT, CHN_STOPPED, chn_trigger(), pcm_channel::flags, PCMTRIG_ABORT, sndbuf_getready(), and sndbuf_setrun().
Referenced by chn_notify(), dsp_close(), dsp_ioctl(), dsp_oss_syncgroup(), sysctl_dev_pcm_vchanformat(), and sysctl_dev_pcm_vchanrate().
int chn_flush | ( | struct pcm_channel * | c | ) |
Definition at line 962 of file channel.c.
References b, pcm_channel::bufhard, c, CHN_F_CLOSING, CHN_LOCKASSERT, chn_sync(), chn_trigger(), DEB, pcm_channel::direction, pcm_channel::flags, PCMDIR_PLAY, PCMTRIG_ABORT, and sndbuf_setrun().
Referenced by dsp_close().
struct pcmchan_caps * chn_getcaps | ( | struct pcm_channel * | c | ) |
Definition at line 2277 of file channel.c.
References c, CHN_LOCKASSERT, pcm_channel::devinfo, and pcm_channel::methods.
Referenced by chn_getformats(), chn_notify(), chn_oss_getmask(), chn_setparam(), dsp_ioctl(), dsp_oss_audioinfo(), feeder_chain(), pcm_setvchans(), sndstat_get_caps(), sysctl_dev_pcm_vchanrate(), vchan_create(), and vchan_init().
u_int32_t chn_getformats | ( | struct pcm_channel * | c | ) |
Definition at line 2284 of file channel.c.
References AFMT_CONVERTIBLE, AFMT_ENCODING, c, CHN_BITPERFECT, chn_getcaps(), pcmchan_caps::fmtlist, fmts, and report_soft_formats.
Referenced by dsp_ioctl().
struct pcmchan_matrix * chn_getmatrix | ( | struct pcm_channel * | c | ) |
Definition at line 1469 of file channel.c.
References AFMT_CONVERTIBLE, c, CHN_LOCKASSERT, pcm_channel::format, and pcm_channel::matrix.
int chn_getmute_matrix | ( | struct pcm_channel * | c, |
int | vc, | ||
int | vt | ||
) |
Definition at line 1456 of file channel.c.
References c, CHN_LOCKASSERT, pcm_channel::muted, SND_CHN_T_BEGIN, SND_CHN_T_END, SND_CHN_T_VOL_0DB, SND_VOL_C_MASTER, and SND_VOL_C_MAX.
int chn_getptr | ( | struct pcm_channel * | c | ) |
Queries sound driver for sample-aligned hardware buffer pointer index.
This function obtains the hardware pointer location, then aligns it to the current bytes-per-sample value before returning. (E.g., a channel running in 16 bit stereo mode would require 4 bytes per sample, so a hwptr value ranging from 32-35 would be returned as 32.)
c | PCM channel context |
Definition at line 2267 of file channel.c.
References pcm_channel::bufhard, c, CHN_LOCKASSERT, CHN_STARTED, pcm_channel::devinfo, pcm_channel::methods, and sndbuf_getalign().
Referenced by chn_dmaupdate(), and dsp_ioctl().
int chn_getrates | ( | struct pcm_channel * | c, |
int ** | rates | ||
) |
Fetch array of supported discrete sample rates.
Wrapper for CHANNEL_GETRATES. Please see channel_if.m:getrates() for detailed information.
c | pcm channel to examine |
rates | pointer to array of integers; rate table will be recorded here |
rates
Definition at line 2529 of file channel.c.
References c, CHN_LOCKASSERT, pcm_channel::devinfo, pcm_channel::methods, and rates.
Referenced by dsp_oss_audioinfo().
int chn_getvolume_matrix | ( | struct pcm_channel * | c, |
int | vc, | ||
int | vt | ||
) |
Definition at line 1387 of file channel.c.
References c, CHN_LOCKASSERT, SND_CHN_T_BEGIN, SND_CHN_T_END, SND_CHN_T_VOL_0DB, SND_VOL_C_MASTER, SND_VOL_C_MAX, and pcm_channel::volume.
int chn_init | ( | struct pcm_channel * | c, |
void * | devinfo, | ||
int | dir, | ||
int | direction | ||
) |
Definition at line 1163 of file channel.c.
References b, pcm_channel::bufhard, pcm_channel::bufsoft, pcm_channel::busy, c, chn_addfeeder(), CHN_F_DEAD, CHN_F_VIRTUAL, CHN_INIT, CHN_LOCK, chn_lockdestroy(), chn_lockinit(), chn_timeout, CHN_TIMEOUT, CHN_TIMEOUT_MAX, CHN_UNLOCK, chn_vol_0db_pcm, chn_vpc_reset(), pcm_channel::dev, devinfo, pcm_channel::devinfo, dir, pcm_channel::direction, DSP_DEFAULT_SPEED, pcm_channel::feeder, feeder_getclass(), feeder_matrix_id_map(), pcm_channel::feederflags, pcm_channel::flags, pcm_channel::format, pcmchan_matrix::id, pcm_channel::latency, pcm_channel::matrix, pcm_channel::methods, pcm_channel::muted, pcm_channel::name, PCMDIR_PLAY, snd_dbuf::shadbuf, snd_dbuf::sl, pcm_channel::sm, SND_CHN_MATRIX_1_0, SND_CHN_MATRIX_PCMCHANNEL, SND_CHN_T_MAX, SND_CHN_T_VOL_0DB, SND_FORMAT, SND_VOL_0DB_MASTER, SND_VOL_C_MASTER, SND_VOL_C_PCM, sndbuf_create(), sndbuf_destroy(), sndbuf_free(), sndbuf_getmaxsize(), sndbuf_getsize(), sndbuf_setfmt(), sndbuf_setspd(), sndbuf_setup(), pcm_channel::speed, pcm_channel::timeout, and pcm_channel::volume.
Referenced by pcm_chn_create().
void chn_intr | ( | struct pcm_channel * | c | ) |
Definition at line 660 of file channel.c.
References c, chn_intr_locked(), CHN_LOCK, CHN_LOCKOWNED, and CHN_UNLOCK.
Referenced by ad1816_intr(), als_intr(), aoa_interrupt(), atiixp_intr(), atiixp_poll_callback(), audio_soc_intr(), cmi_intr(), cs4281_intr(), csa_intr(), emu_intr(), emu_pcm_intr(), envy24_intr(), envy24ht_intr(), es_intr(), es_poll_callback(), ess_intr(), fm801_intr(), hdaa_stream_intr(), hdspe_pcm_intr(), ich_intr(), m3_intr(), mss_intr(), nm_intr(), opti931_intr(), sb_intr(), sv_intr(), tr_intr(), uaudio_chan_play_callback(), uaudio_chan_record_callback(), via_intr(), and via_poll_callback().
void chn_intr_locked | ( | struct pcm_channel * | c | ) |
Definition at line 646 of file channel.c.
References c, CHN_LOCKASSERT, chn_rdintr(), chn_wrintr(), pcm_channel::direction, pcm_channel::interrupts, and PCMDIR_PLAY.
Referenced by chn_intr().
int chn_kill | ( | struct pcm_channel * | c | ) |
Definition at line 1285 of file channel.c.
References b, pcm_channel::bufhard, pcm_channel::bufsoft, c, CHN_F_DEAD, CHN_LOCK, chn_lockdestroy(), chn_removefeeder(), CHN_STARTED, chn_trigger(), CHN_UNLOCK, pcm_channel::devinfo, pcm_channel::flags, pcm_channel::methods, PCMTRIG_ABORT, sndbuf_destroy(), and sndbuf_free().
Referenced by pcm_chn_destroy().
int chn_notify | ( | struct pcm_channel * | c, |
u_int32_t | flags | ||
) |
Definition at line 2302 of file channel.c.
References AFMT_BIT, AFMT_CHANNEL, AFMT_PASSTHROUGH, AFMT_VCHAN, pcm_channel::busy, c, pcmchan_caps::caps, chn_abort(), CHN_EMPTY, CHN_F_DIRTY, CHN_F_EXCLUSIVE, CHN_F_PASSTHROUGH, CHN_F_VCHAN_ADAPTIVE, CHN_F_VCHAN_DYNAMIC, CHN_FOREACH, chn_getcaps(), chn_latency, CHN_LOCK, CHN_LOCKASSERT, CHN_N_BLOCKSIZE, CHN_N_FORMAT, CHN_N_RATE, CHN_N_TRIGGER, CHN_N_VOLUME, chn_reset(), chn_setlatency(), chn_start(), CHN_STARTED, CHN_UNLOCK, pcm_channel::devinfo, pcm_channel::direction, pcm_channel::flags, pcm_channel::format, pcm_channel::methods, pcm_channel::parentsnddev, PCMDIR_PLAY, snddev_info::pvchanformat, snddev_info::pvchanrate, RANGE, snddev_info::rvchanformat, snddev_info::rvchanrate, snd_fmtbest(), snd_fmtvalid(), pcm_channel::speed, vchan_sync(), and VCHAN_SYNC_REQUIRED.
Referenced by chn_resizebuf(), and vchan_trigger().
int chn_oss_getmask | ( | struct pcm_channel * | c, |
uint32_t * | retmask | ||
) |
Definition at line 1542 of file channel.c.
References AFMT_CONVERTIBLE, c, pcmchan_caps::caps, CHN_BITPERFECT, chn_getcaps(), CHN_LOCKASSERT, pcm_channel::devinfo, format, m, pcmchan_matrix::mask, pcm_channel::methods, report_soft_matrix, SND_CHN_OSS_CENTER_LFE, SND_CHN_OSS_FRONT, SND_CHN_OSS_REAR, and SND_CHN_OSS_SURR.
Referenced by dsp_oss_getchannelmask().
int chn_oss_getorder | ( | struct pcm_channel * | c, |
unsigned long long * | map | ||
) |
Definition at line 1502 of file channel.c.
References AFMT_CONVERTIBLE, c, CHN_LOCKASSERT, feeder_matrix_oss_get_channel_order(), pcm_channel::format, pcmchan_matrix::map, and pcm_channel::matrix.
Referenced by dsp_oss_getchnorder().
int chn_oss_setorder | ( | struct pcm_channel * | c, |
unsigned long long * | map | ||
) |
Definition at line 1516 of file channel.c.
References AFMT_CONVERTIBLE, c, CHN_LOCKASSERT, chn_setmatrix(), feeder_matrix_oss_set_channel_order(), pcm_channel::format, m, pcmchan_matrix::map, and pcm_channel::matrix.
Referenced by dsp_oss_setchnorder().
int chn_poll | ( | struct pcm_channel * | c, |
int | ev, | ||
struct thread * | td | ||
) |
Definition at line 897 of file channel.c.
References pcm_channel::bufsoft, c, CHN_F_MMAP, CHN_F_TRIGGERED, CHN_LOCKASSERT, chn_pollreset(), chn_polltrigger(), chn_start(), pcm_channel::flags, and sndbuf_getsel().
Referenced by dsp_poll().
int chn_read | ( | struct pcm_channel * | c, |
struct uio * | buf | ||
) |
Definition at line 589 of file channel.c.
References buf, pcm_channel::bufsoft, c, CHN_F_ABORTING, CHN_F_DEAD, CHN_F_NBIO, CHN_F_NOTRIGGER, CHN_LOCK, CHN_LOCKASSERT, chn_sleep(), chn_start(), CHN_STOPPED, chn_timeout, CHN_UNLOCK, pcm_channel::dev, pcm_channel::flags, pcm_channel::name, sndbuf_dispose(), sndbuf_getbufofs(), sndbuf_getready(), sndbuf_getreadyptr(), and sndbuf_getsize().
Referenced by dsp_io_ops().
int chn_reinit | ( | struct pcm_channel * | c | ) |
int chn_reset | ( | struct pcm_channel * | c, |
u_int32_t | fmt, | ||
u_int32_t | spd | ||
) |
void chn_resetbuf | ( | struct pcm_channel * | c | ) |
Definition at line 750 of file channel.c.
References b, pcm_channel::blocks, pcm_channel::bufhard, pcm_channel::bufsoft, c, and sndbuf_reset().
Referenced by chn_reset(), chn_resizebuf(), and dsp_ioctl().
int chn_setblocksize | ( | struct pcm_channel * | c, |
int | blkcnt, | ||
int | blksz | ||
) |
Definition at line 1983 of file channel.c.
References blkcnt, blksz, c, CHN_LOCKASSERT, and chn_resizebuf().
Referenced by dsp_ioctl().
int chn_setformat | ( | struct pcm_channel * | c, |
uint32_t | format | ||
) |
Definition at line 2061 of file channel.c.
References AFMT_CHANNEL, AFMT_PASSTHROUGH, AFMT_PASSTHROUGH_CHANNEL, AFMT_PASSTHROUGH_EXTCHANNEL, c, chn_setparam(), pcm_channel::dev, format, pcm_channel::format, SND_FORMAT, snd_verbose, speed, and pcm_channel::speed.
Referenced by chn_reset(), chn_setmatrix(), and dsp_ioctl().
int chn_setlatency | ( | struct pcm_channel * | c, |
int | latency | ||
) |
Definition at line 1975 of file channel.c.
References c, CHN_LOCKASSERT, and chn_resizebuf().
Referenced by chn_notify(), chn_reset(), and dsp_oss_policy().
int chn_setmatrix | ( | struct pcm_channel * | c, |
struct pcmchan_matrix * | m | ||
) |
Definition at line 1482 of file channel.c.
References AFMT_CONVERTIBLE, c, pcmchan_matrix::channels, CHN_LOCKASSERT, chn_setformat(), pcmchan_matrix::ext, pcm_channel::format, pcmchan_matrix::id, m, pcm_channel::matrix, SND_CHN_MATRIX_PCMCHANNEL, and SND_FORMAT.
Referenced by chn_oss_setorder().
int chn_setmute_matrix | ( | struct pcm_channel * | c, |
int | vc, | ||
int | vt, | ||
int | mute | ||
) |
Definition at line 1418 of file channel.c.
References c, CHN_LOCKASSERT, pcm_channel::muted, SND_CHN_T_BEGIN, SND_CHN_T_END, SND_CHN_T_STEP, SND_CHN_T_VOL_0DB, SND_VOL_C_BEGIN, SND_VOL_C_END, SND_VOL_C_MASTER, SND_VOL_C_MAX, SND_VOL_C_STEP, and SND_VOL_C_VAL.
Referenced by chn_setmute_multi().
int chn_setmute_multi | ( | struct pcm_channel * | c, |
int | vc, | ||
int | mute | ||
) |
Definition at line 1400 of file channel.c.
References c, chn_setmute_matrix(), SND_CHN_LEFT_MASK, SND_CHN_RIGHT_MASK, and SND_CHN_T_MAX.
Referenced by dsp_ioctl_channel().
int chn_setparam | ( | struct pcm_channel * | c, |
uint32_t | format, | ||
uint32_t | speed | ||
) |
Definition at line 1991 of file channel.c.
References pcm_channel::bufhard, c, pcmchan_caps::caps, chn_getcaps(), CHN_LOCKASSERT, chn_resizebuf(), CHN_STARTED, pcm_channel::devinfo, feeder_chain(), feeder_rate_round, format, pcm_channel::format, pcm_channel::methods, RANGE, sndbuf_getfmt(), sndbuf_getspd(), sndbuf_setspd(), speed, and pcm_channel::speed.
Referenced by chn_reset(), chn_setformat(), and chn_setspeed().
int chn_setspeed | ( | struct pcm_channel * | c, |
uint32_t | speed | ||
) |
Definition at line 2032 of file channel.c.
References AFMT_PASSTHROUGH, AFMT_PASSTHROUGH_RATE, c, chn_setparam(), pcm_channel::dev, format, pcm_channel::format, snd_verbose, speed, and pcm_channel::speed.
Referenced by chn_reset(), and dsp_ioctl().
int chn_setvolume | ( | struct pcm_channel * | c, |
int | left, | ||
int | right | ||
) |
Definition at line 1310 of file channel.c.
References c, chn_setvolume_matrix(), left, right, SND_CHN_T_FL, SND_CHN_T_FR, and SND_VOL_C_MASTER.
int chn_setvolume_matrix | ( | struct pcm_channel * | c, |
int | vc, | ||
int | vt, | ||
int | val | ||
) |
Definition at line 1342 of file channel.c.
References c, CHN_LOCKASSERT, SND_CHN_T_BEGIN, SND_CHN_T_END, SND_CHN_T_STEP, SND_CHN_T_VOL_0DB, SND_VOL_0DB_MAX, SND_VOL_0DB_MIN, SND_VOL_C_BEGIN, SND_VOL_C_END, SND_VOL_C_MASTER, SND_VOL_C_MAX, SND_VOL_C_STEP, SND_VOL_C_VAL, SND_VOL_CALC_VAL, val, and pcm_channel::volume.
Referenced by chn_setvolume(), and chn_setvolume_multi().
int chn_setvolume_multi | ( | struct pcm_channel * | c, |
int | vc, | ||
int | left, | ||
int | right, | ||
int | center | ||
) |
Definition at line 1322 of file channel.c.
References c, chn_setvolume_matrix(), left, right, SND_CHN_LEFT_MASK, SND_CHN_RIGHT_MASK, and SND_CHN_T_MAX.
Referenced by chn_syncstate(), dsp_ioctl_channel(), mixer_ioctl_channel(), and mixer_set_softpcmvol().
u_int32_t chn_start | ( | struct pcm_channel * | c, |
int | force | ||
) |
Definition at line 674 of file channel.c.
References b, pcm_channel::bufhard, pcm_channel::bufsoft, c, CHN_BUF_PARENT, CHN_DIRSTR, CHN_EMPTY, CHN_F_CLOSING, CHN_F_HAS_VCHAN, CHN_F_NOTRIGGER, CHN_F_TRIGGERED, CHN_F_VIRTUAL, CHN_LOCKASSERT, CHN_STARTED, chn_trigger(), pcm_channel::dev, pcm_channel::direction, pcm_channel::feedcount, pcm_channel::flags, pcm_channel::interrupts, pcm_channel::parentchannel, PCMDIR_PLAY, PCMDIR_REC, PCMTRIG_START, snd_verbose, sndbuf_fillsilence_rl(), sndbuf_getalign(), sndbuf_getfree(), sndbuf_getready(), sndbuf_getsize(), sndbuf_getspd(), sndbuf_setrun(), sndbuf_xbytes(), pcm_channel::timeout, and pcm_channel::xruns.
Referenced by chn_notify(), chn_poll(), chn_read(), chn_sync(), chn_write(), dsp_ioctl(), dsp_oss_syncstart(), sysctl_dev_pcm_vchanformat(), and sysctl_dev_pcm_vchanrate().
int chn_sync | ( | struct pcm_channel * | c, |
int | threshold | ||
) |
Definition at line 766 of file channel.c.
References b, blksz, pcm_channel::bufhard, pcm_channel::bufsoft, c, CHN_BUF_PARENT, CHN_F_ABORTING, CHN_F_CLOSING, CHN_F_DEAD, CHN_LOCKASSERT, chn_sleep(), chn_start(), CHN_STOPPED, chn_syncdelay, count, pcm_channel::dev, pcm_channel::direction, pcm_channel::flags, PCMDIR_PLAY, snd_verbose, sndbuf_acquire(), sndbuf_clear(), sndbuf_getalign(), sndbuf_getblkcnt(), sndbuf_getblksz(), sndbuf_getfree(), sndbuf_getmaxsize(), sndbuf_getready(), sndbuf_getsize(), sndbuf_getspd(), sndbuf_xbytes(), and pcm_channel::timeout.
Referenced by chn_flush(), and dsp_ioctl().
int chn_syncdestroy | ( | struct pcm_channel * | c | ) |
Remove channel from a sync group, if there is one.
This function is initially intended for the following conditions:
SNDCTL_DSP_SYNCSTART
ioctl)c
is locked or not.)c | channel device to be started or closed |
Definition at line 2554 of file channel.c.
References c, free, pcmchan_syncgroup::id, pcmchan_syncmember::parent, PCM_SG_LOCKASSERT, pcm_channel::sm, and snd_pcm_syncgroups.
Referenced by dsp_close(), and dsp_oss_syncgroup().
void chn_syncstate | ( | struct pcm_channel * | c | ) |
Definition at line 2090 of file channel.c.
References c, chn_findfeeder(), CHN_LOCKASSERT, chn_setvolume_multi(), pcm_channel::dev, pcm_channel::direction, snddev_info::eqpreamp, FEEDEQ_BASS, FEEDEQ_BYPASS, FEEDEQ_DISABLE, FEEDEQ_ENABLE, FEEDEQ_PREAMP, FEEDEQ_STATE, FEEDEQ_TREBLE, FEEDER_EQ, FEEDER_VOLUME, pcm_channel::feederflags, snddev_info::flags, left, m, mix_get(), mix_getparent(), snddev_info::mixer_dev, snd_mixer::parent, pcm_channel::parentsnddev, PCMDIR_PLAY, right, SD_F_EQ_BYPASSED, SD_F_EQ_ENABLED, SD_F_SOFTPCMVOL, SND_VOL_C_MASTER, and state.
Referenced by chn_trigger(), and feeder_chain().
int chn_trigger | ( | struct pcm_channel * | c, |
int | go | ||
) |
Definition at line 2192 of file channel.c.
References b, pcm_channel::bufhard, c, snddev_info::channels, CHN_INSERT_HEAD, CHN_LOCK, CHN_LOCKASSERT, CHN_REMOVE, chn_syncstate(), CHN_UNLOCK, pcm_channel::dev, pcm_channel::devinfo, go, pcm_channel::methods, pcm_channel::name, pcm_channel::parentsnddev, PCM_LOCK, PCM_UNLOCK, PCMTRIG_ABORT, PCMTRIG_COMMON, PCMTRIG_EMLDMARD, PCMTRIG_EMLDMAWR, PCMTRIG_START, PCMTRIG_STOP, SND_DMA, snd_verbose, sndbuf_dmabounce(), and pcm_channel::trigger.
Referenced by chn_abort(), chn_flush(), chn_kill(), chn_rdintr(), chn_start(), and chn_wrintr().
void chn_vpc_reset | ( | struct pcm_channel * | c, |
int | vc, | ||
int | force | ||
) |
Definition at line 1584 of file channel.c.
References c, CHN_LOCKASSERT, CHN_SETVOLUME, chn_vpc_autoreset, SND_CHN_T_BEGIN, SND_CHN_T_END, SND_CHN_T_STEP, SND_CHN_T_VOL_0DB, SND_VOL_C_BEGIN, SND_VOL_C_END, and pcm_channel::volume.
Referenced by chn_init(), chn_vpc_proc(), and dsp_open().
int chn_write | ( | struct pcm_channel * | c, |
struct uio * | buf | ||
) |
The idea is that, while set with CHN_F_NOTRIGGER, a channel isn't playing, but without this we end up with "interrupt timeout / channel dead".
Definition at line 459 of file channel.c.
References buf, pcm_channel::bufsoft, c, CHN_F_ABORTING, CHN_F_DEAD, CHN_F_NBIO, CHN_F_NOTRIGGER, CHN_LOCK, CHN_LOCKASSERT, chn_sleep(), chn_start(), CHN_STOPPED, chn_timeout, CHN_UNLOCK, pcm_channel::dev, pcm_channel::flags, pcm_channel::name, sndbuf_acquire(), sndbuf_getbufofs(), sndbuf_getfree(), sndbuf_getfreeptr(), and sndbuf_getsize().
Referenced by dsp_io_ops().
SLIST_HEAD | ( | pcm_synclist | , |
pcmchan_syncgroup | |||
) |
uint32_t snd_afmt2str | ( | uint32_t | afmt, |
char * | buf, | ||
size_t | len | ||
) |
Definition at line 1099 of file channel.c.
References afmt, AFMT_CHANNEL, AFMT_ENCODING, AFMT_EXTCHANNEL, afmt_tab, AFMTSTR_LEN, buf, len, name, and SND_FORMAT.
Referenced by sysctl_dev_pcm_vchanformat().
int snd_fmtvalid | ( | uint32_t | fmt, |
uint32_t * | fmtlist | ||
) |
Definition at line 982 of file channel.c.
References AFMT_ENCODING, AFMT_PASSTHROUGH, and fmt.
Referenced by chn_notify(), feeder_chain(), snd_fmtbest(), snd_fmtbestfunc(), vchan_create(), and vchan_setformat().
uint32_t snd_str2afmt | ( | const char * | req | ) |
Definition at line 1031 of file channel.c.
References afmt, AFMT_CHANNEL_MAX, AFMT_EXTCHANNEL_MAX, afmt_tab, alias1, alias2, name, req, and SND_FORMAT.
Referenced by sysctl_dev_pcm_vchanformat(), and vchan_create().
|
extern |
Definition at line 53 of file channel.c.
Referenced by chn_notify(), chn_reset(), chn_resizebuf(), SLIST_HEAD(), and sysctl_hw_snd_latency().
|
extern |
Definition at line 76 of file channel.c.
Referenced by chn_calclatency(), SLIST_HEAD(), and sysctl_hw_snd_latency_profile().
|
extern |
Definition at line 45 of file channel.c.
Referenced by chn_getformats().
|
extern |
Definition at line 49 of file channel.c.
Referenced by chn_oss_getmask().
|
extern |
Channel sync group lock.
Clients should acquire this lock without holding any channel locks before touching syncgroups or the main syncgroup list.
Definition at line 212 of file channel.c.
Referenced by dsp_oss_syncstart().