blob: c96f23c7755b15164b4b22501e78798d9a56ca24 [file] [log] [blame]
Thomas Gleixner1a59d1b82019-05-27 08:55:05 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002#ifndef __SOUND_PCM_OSS_H
3#define __SOUND_PCM_OSS_H
4
5/*
6 * Digital Audio (PCM) - OSS compatibility abstract layer
Jaroslav Kyselac1017a42007-10-15 09:50:19 +02007 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
Linus Torvalds1da177e2005-04-16 15:20:36 -07008 */
9
Takashi Iwai6ac77bc2005-11-17 14:01:49 +010010struct snd_pcm_oss_setup {
Linus Torvalds1da177e2005-04-16 15:20:36 -070011 char *task_name;
12 unsigned int disable:1,
13 direct:1,
14 block:1,
15 nonblock:1,
16 partialfrag:1,
Takashi Iwai10f69f92005-09-08 13:48:34 +020017 nosilence:1,
18 buggyptr:1;
Linus Torvalds1da177e2005-04-16 15:20:36 -070019 unsigned int periods;
20 unsigned int period_size;
Takashi Iwai6ac77bc2005-11-17 14:01:49 +010021 struct snd_pcm_oss_setup *next;
Linus Torvalds1da177e2005-04-16 15:20:36 -070022};
23
Takashi Iwai6ac77bc2005-11-17 14:01:49 +010024struct snd_pcm_oss_runtime {
Linus Torvalds1da177e2005-04-16 15:20:36 -070025 unsigned params: 1, /* format/parameter change */
26 prepare: 1, /* need to prepare the operation */
27 trigger: 1, /* trigger flag */
28 sync_trigger: 1; /* sync trigger flag */
29 int rate; /* requested rate */
30 int format; /* requested OSS format */
31 unsigned int channels; /* requested channels */
32 unsigned int fragshift;
33 unsigned int maxfrags;
34 unsigned int subdivision; /* requested subdivision */
35 size_t period_bytes; /* requested period size */
36 size_t period_frames; /* period frames for poll */
37 size_t period_ptr; /* actual write pointer to period */
38 unsigned int periods;
39 size_t buffer_bytes; /* requested buffer size */
40 size_t bytes; /* total # bytes processed */
41 size_t mmap_bytes;
42 char *buffer; /* vmallocated period */
43 size_t buffer_used; /* used length from period buffer */
Takashi Iwaie3a5d592006-11-14 13:03:19 +010044 struct mutex params_lock;
Takashi Iwai40cab6e2018-03-23 08:03:26 +010045 atomic_t rw_ref; /* concurrent read/write accesses */
Jaroslav Kysela21a34792006-01-13 09:12:11 +010046#ifdef CONFIG_SND_PCM_OSS_PLUGINS
Takashi Iwai6ac77bc2005-11-17 14:01:49 +010047 struct snd_pcm_plugin *plugin_first;
48 struct snd_pcm_plugin *plugin_last;
Jaroslav Kysela21a34792006-01-13 09:12:11 +010049#endif
Jaroslav Kyselaf2404062010-01-05 17:19:34 +010050 unsigned int prev_hw_ptr_period;
Takashi Iwai6ac77bc2005-11-17 14:01:49 +010051};
Linus Torvalds1da177e2005-04-16 15:20:36 -070052
Takashi Iwai6ac77bc2005-11-17 14:01:49 +010053struct snd_pcm_oss_file {
54 struct snd_pcm_substream *streams[2];
55};
Linus Torvalds1da177e2005-04-16 15:20:36 -070056
Takashi Iwai6ac77bc2005-11-17 14:01:49 +010057struct snd_pcm_oss_substream {
Linus Torvalds1da177e2005-04-16 15:20:36 -070058 unsigned oss: 1; /* oss mode */
Takashi Iwai060d77b2006-03-27 16:44:52 +020059 struct snd_pcm_oss_setup setup; /* active setup */
Takashi Iwai6ac77bc2005-11-17 14:01:49 +010060};
Linus Torvalds1da177e2005-04-16 15:20:36 -070061
Takashi Iwai6ac77bc2005-11-17 14:01:49 +010062struct snd_pcm_oss_stream {
63 struct snd_pcm_oss_setup *setup_list; /* setup list */
Ingo Molnar1a60d4c2006-01-16 16:29:08 +010064 struct mutex setup_mutex;
Takashi Iwaib7d90a32006-04-25 12:56:04 +020065#ifdef CONFIG_SND_VERBOSE_PROCFS
Takashi Iwai6ac77bc2005-11-17 14:01:49 +010066 struct snd_info_entry *proc_entry;
Takashi Iwaib7d90a32006-04-25 12:56:04 +020067#endif
Takashi Iwai6ac77bc2005-11-17 14:01:49 +010068};
Linus Torvalds1da177e2005-04-16 15:20:36 -070069
Takashi Iwai6ac77bc2005-11-17 14:01:49 +010070struct snd_pcm_oss {
Linus Torvalds1da177e2005-04-16 15:20:36 -070071 int reg;
72 unsigned int reg_mask;
Takashi Iwai6ac77bc2005-11-17 14:01:49 +010073};
Linus Torvalds1da177e2005-04-16 15:20:36 -070074
75#endif /* __SOUND_PCM_OSS_H */