FreeBSD kernel sound device code
|
#include <sys/param.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/nv.h>
#include <sys/dnv.h>
#include <sys/sx.h>
#include <dev/sound/pcm/sound.h>
#include <dev/sound/pcm/pcm.h>
#include <dev/sound/version.h>
Go to the source code of this file.
Data Structures | |
struct | sndstat_entry |
struct | sndstat_userdev |
struct | sndstat_file |
Macros | |
#define | SS_TYPE_MODULE 0 |
#define | SS_TYPE_PCM 1 |
#define | SS_TYPE_MIDI 2 |
#define | SS_TYPE_SEQUENCER 3 |
#define | SNDSTAT_LOCK() sx_xlock(&sndstat_lock) |
#define | SNDSTAT_UNLOCK() sx_xunlock(&sndstat_lock) |
Functions | |
SND_DECLARE_FILE ("$FreeBSD$") | |
static void | sndstat_close (void *) |
static | TAILQ_HEAD (sndstat_entry) |
SYSCTL_PROC (_hw_snd, OID_AUTO, verbose, CTLTYPE_INT|CTLFLAG_RWTUN|CTLFLAG_MPSAFE, 0, sizeof(int), sysctl_hw_sndverbose, "I", "verbosity level") | |
static int | sndstat_open (struct cdev *i_dev, int flags, int mode, struct thread *td) |
static void | sndstat_remove_all_userdevs (struct sndstat_file *pf) |
static int | sndstat_read (struct cdev *i_dev, struct uio *buf, int flag) |
static int | sndstat_write (struct cdev *i_dev, struct uio *buf, int flag) |
static void | sndstat_get_caps (struct snddev_info *d, bool play, uint32_t *min_rate, uint32_t *max_rate, uint32_t *fmts, uint32_t *minchn, uint32_t *maxchn) |
static nvlist_t * | sndstat_create_diinfo_nv (uint32_t min_rate, uint32_t max_rate, uint32_t formats, uint32_t min_chn, uint32_t max_chn) |
static int | sndstat_build_sound4_nvlist (struct snddev_info *d, nvlist_t **dip) |
static int | sndstat_build_userland_nvlist (struct sndstat_userdev *ud, nvlist_t **dip) |
static int | sndstat_create_devs_nvlist (nvlist_t **nvlp) |
static int | sndstat_refresh_devs (struct sndstat_file *pf) |
static int | sndstat_get_devs (struct sndstat_file *pf, caddr_t data) |
static int | sndstat_unpack_user_nvlbuf (const void *unvlbuf, size_t nbytes, nvlist_t **nvl) |
static bool | sndstat_diinfo_is_sane (const nvlist_t *diinfo) |
static bool | sndstat_dsp_nvlist_is_sane (const nvlist_t *nvlist) |
static void | sndstat_get_diinfo_nv (const nvlist_t *nv, uint32_t *min_rate, uint32_t *max_rate, uint32_t *formats, uint32_t *min_chn, uint32_t *max_chn) |
static int | sndstat_dsp_unpack_nvlist (const nvlist_t *nvlist, struct sndstat_userdev *ud) |
static int | sndstat_add_user_devs (struct sndstat_file *pf, caddr_t data) |
static int | sndstat_flush_user_devs (struct sndstat_file *pf) |
static int | sndstat_ioctl (struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td) |
static struct sndstat_userdev * | sndstat_line2userdev (struct sndstat_file *pf, const char *line, int n) |
int | sndstat_register (device_t dev, char *str, sndstat_handler handler) |
int | sndstat_registerfile (char *str) |
int | sndstat_unregister (device_t dev) |
int | sndstat_unregisterfile (char *str) |
static int | sndstat_prepare (struct sndstat_file *pf_self) |
static void | sndstat_sysinit (void *p) |
SYSINIT (sndstat_sysinit, SI_SUB_DRIVERS, SI_ORDER_FIRST, sndstat_sysinit, NULL) | |
static void | sndstat_sysuninit (void *p) |
SYSUNINIT (sndstat_sysuninit, SI_SUB_DRIVERS, SI_ORDER_FIRST, sndstat_sysuninit, NULL) | |
Variables | |
static d_open_t | sndstat_open |
static d_read_t | sndstat_read |
static d_write_t | sndstat_write |
static d_ioctl_t | sndstat_ioctl |
static struct cdevsw | sndstat_cdevsw |
static struct sx | sndstat_lock |
static struct cdev * | sndstat_dev |
#define SNDSTAT_LOCK | ( | ) | sx_xlock(&sndstat_lock) |
#define SNDSTAT_UNLOCK | ( | ) | sx_xunlock(&sndstat_lock) |
SND_DECLARE_FILE | ( | "$FreeBSD$" | ) |
|
static |
Definition at line 856 of file sndstat.c.
References data, pf, sndstat_dsp_nvlist_is_sane(), sndstat_dsp_unpack_nvlist(), and sndstat_unpack_user_nvlbuf().
Referenced by sndstat_ioctl().
|
static |
Definition at line 397 of file sndstat.c.
References snddev_info::dev, snddev_info::flags, fmts, PCM_ACQUIRE_QUICK, PCM_RELEASE_QUICK, snddev_info::playcount, snddev_info::pvchancount, snddev_info::reccount, snddev_info::rvchancount, SD_F_BITPERFECT, sndstat_create_diinfo_nv(), and sndstat_get_caps().
Referenced by sndstat_create_devs_nvlist().
|
static |
Definition at line 478 of file sndstat.c.
References sndstat_userdev::info_play, sndstat_userdev::info_rec, sndstat_userdev::provider_nvl, and sndstat_create_diinfo_nv().
Referenced by sndstat_create_devs_nvlist().
|
static |
Definition at line 198 of file sndstat.c.
References free, pf, SNDSTAT_LOCK, sndstat_remove_all_userdevs(), and SNDSTAT_UNLOCK.
Referenced by sndstat_open().
|
static |
Definition at line 549 of file sndstat.c.
References PCM_REGISTERED, pf, sndstat_build_sound4_nvlist(), and sndstat_build_userland_nvlist().
Referenced by sndstat_get_devs().
|
static |
Definition at line 380 of file sndstat.c.
Referenced by sndstat_build_sound4_nvlist(), and sndstat_build_userland_nvlist().
|
static |
Definition at line 718 of file sndstat.c.
Referenced by sndstat_dsp_nvlist_is_sane().
|
static |
Definition at line 730 of file sndstat.c.
References sndstat_diinfo_is_sane().
Referenced by sndstat_add_user_devs().
|
static |
Definition at line 777 of file sndstat.c.
References desc, sndstat_userdev::info_play, sndstat_userdev::info_rec, provider, sndstat_userdev::provider_nvl, and sndstat_get_diinfo_nv().
Referenced by sndstat_add_user_devs().
|
static |
Definition at line 903 of file sndstat.c.
References pf, and sndstat_remove_all_userdevs().
Referenced by sndstat_ioctl().
|
static |
Definition at line 329 of file sndstat.c.
References AFMT_CHANNEL, AFMT_ENCODING, c, pcmchan_caps::caps, pcm_channel::channels, CHN_F_VIRTUAL, CHN_FOREACH, chn_getcaps(), CHN_LOCK, CHN_UNLOCK, dir, pcm_channel::direction, pcm_channel::flags, fmts, max, PCMDIR_PLAY, PCMDIR_REC, snddev_info::pvchancount, snddev_info::pvchanformat, snddev_info::pvchanrate, snddev_info::rvchancount, snddev_info::rvchanformat, and snddev_info::rvchanrate.
Referenced by sndstat_build_sound4_nvlist().
|
static |
Definition at line 628 of file sndstat.c.
References data, free, pf, sndstat_create_devs_nvlist(), SNDSTAT_LOCK, and SNDSTAT_UNLOCK.
Referenced by sndstat_ioctl().
|
static |
Definition at line 765 of file sndstat.c.
Referenced by sndstat_dsp_unpack_nvlist().
|
static |
Definition at line 956 of file sndstat.c.
References data, pf, sndstat_add_user_devs(), sndstat_flush_user_devs(), sndstat_get_devs(), and sndstat_refresh_devs().
|
static |
Definition at line 1005 of file sndstat.c.
References fail, free, m, and sndstat_userdev::provider_nvl.
Referenced by sndstat_write().
|
static |
Definition at line 150 of file sndstat.c.
References free, pf, sndstat_close(), SNDSTAT_LOCK, and SNDSTAT_UNLOCK.
|
static |
Definition at line 1160 of file sndstat.c.
References k, PCM_ACQUIRE_QUICK, PCM_REGISTERED, PCM_RELEASE_QUICK, pf, SND_DRV_VERSION, and snd_verbose.
Referenced by sndstat_read().
|
static |
Definition at line 217 of file sndstat.c.
References buf, len, pf, SNDSTAT_LOCK, sndstat_prepare(), and SNDSTAT_UNLOCK.
|
static |
Definition at line 616 of file sndstat.c.
Referenced by sndstat_ioctl().
int sndstat_register | ( | device_t | dev, |
char * | str, | ||
sndstat_handler | handler | ||
) |
Definition at line 1059 of file sndstat.c.
References dev, SNDSTAT_LOCK, SNDSTAT_UNLOCK, SS_TYPE_MIDI, SS_TYPE_MODULE, SS_TYPE_PCM, SS_TYPE_SEQUENCER, and type.
Referenced by pcm_register(), and sndstat_registerfile().
int sndstat_registerfile | ( | char * | str | ) |
Definition at line 1112 of file sndstat.c.
References sndstat_register().
|
static |
Definition at line 180 of file sndstat.c.
References free, pf, and sndstat_userdev::provider_nvl.
Referenced by sndstat_close(), sndstat_flush_user_devs(), and sndstat_write().
|
static |
Definition at line 1247 of file sndstat.c.
References SND_DEV_STATUS, sndstat_cdevsw, sndstat_dev, and sndstat_lock.
|
static |
Definition at line 1256 of file sndstat.c.
References sndstat_dev, and sndstat_lock.
|
static |
Definition at line 697 of file sndstat.c.
References free.
Referenced by sndstat_add_user_devs().
int sndstat_unregister | ( | device_t | dev | ) |
Definition at line 1118 of file sndstat.c.
References dev, error, free, SNDSTAT_LOCK, and SNDSTAT_UNLOCK.
Referenced by pcm_unregister().
int sndstat_unregisterfile | ( | char * | str | ) |
Definition at line 1138 of file sndstat.c.
References error, free, SNDSTAT_LOCK, and SNDSTAT_UNLOCK.
|
static |
Definition at line 255 of file sndstat.c.
References buf, len, pf, sndstat_line2userdev(), SNDSTAT_LOCK, sndstat_remove_all_userdevs(), and SNDSTAT_UNLOCK.
SYSCTL_PROC | ( | _hw_snd | , |
OID_AUTO | , | ||
verbose | , | ||
CTLTYPE_INT|CTLFLAG_RWTUN| | CTLFLAG_MPSAFE, | ||
0 | , | ||
sizeof(int) | , | ||
sysctl_hw_sndverbose | , | ||
"I" | , | ||
"verbosity level" | |||
) |
SYSINIT | ( | sndstat_sysinit | , |
SI_SUB_DRIVERS | , | ||
SI_ORDER_FIRST | , | ||
sndstat_sysinit | , | ||
NULL | |||
) |
SYSUNINIT | ( | sndstat_sysuninit | , |
SI_SUB_DRIVERS | , | ||
SI_ORDER_FIRST | , | ||
sndstat_sysuninit | , | ||
NULL | |||
) |
|
static |
|
static |
Definition at line 66 of file sndstat.c.
Referenced by sndstat_sysinit().
|
static |
Definition at line 115 of file sndstat.c.
Referenced by sndstat_sysinit(), and sndstat_sysuninit().
|
static |
Definition at line 114 of file sndstat.c.
Referenced by sndstat_sysinit(), and sndstat_sysuninit().