^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef __SOUND_PCM_OSS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define __SOUND_PCM_OSS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Digital Audio (PCM) - OSS compatibility abstract layer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) struct snd_pcm_oss_setup {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) char *task_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) unsigned int disable:1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) direct:1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) block:1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) nonblock:1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) partialfrag:1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) nosilence:1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) buggyptr:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) unsigned int periods;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) unsigned int period_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) struct snd_pcm_oss_setup *next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) struct snd_pcm_oss_runtime {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) unsigned params: 1, /* format/parameter change */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) prepare: 1, /* need to prepare the operation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) trigger: 1, /* trigger flag */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) sync_trigger: 1; /* sync trigger flag */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) int rate; /* requested rate */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) int format; /* requested OSS format */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) unsigned int channels; /* requested channels */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) unsigned int fragshift;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) unsigned int maxfrags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) unsigned int subdivision; /* requested subdivision */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) size_t period_bytes; /* requested period size */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) size_t period_frames; /* period frames for poll */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) size_t period_ptr; /* actual write pointer to period */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) unsigned int periods;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) size_t buffer_bytes; /* requested buffer size */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) size_t bytes; /* total # bytes processed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) size_t mmap_bytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) char *buffer; /* vmallocated period */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) size_t buffer_used; /* used length from period buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) struct mutex params_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) atomic_t rw_ref; /* concurrent read/write accesses */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #ifdef CONFIG_SND_PCM_OSS_PLUGINS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) struct snd_pcm_plugin *plugin_first;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) struct snd_pcm_plugin *plugin_last;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) unsigned int prev_hw_ptr_period;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) struct snd_pcm_oss_file {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) struct snd_pcm_substream *streams[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) struct snd_pcm_oss_substream {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) unsigned oss: 1; /* oss mode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) struct snd_pcm_oss_setup setup; /* active setup */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) struct snd_pcm_oss_stream {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) struct snd_pcm_oss_setup *setup_list; /* setup list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) struct mutex setup_mutex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) #ifdef CONFIG_SND_VERBOSE_PROCFS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) struct snd_info_entry *proc_entry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) struct snd_pcm_oss {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) int reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) unsigned int reg_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) #endif /* __SOUND_PCM_OSS_H */