blob: 12bbf8c8111209f134387d7380a1b7f8e06050ec [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __SOUND_PCM_OSS_H
2#define __SOUND_PCM_OSS_H
3
4/*
5 * Digital Audio (PCM) - OSS compatibility abstract layer
Jaroslav Kyselac1017a42007-10-15 09:50:19 +02006 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 *
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
Takashi Iwai6ac77bc2005-11-17 14:01:49 +010025struct snd_pcm_oss_setup {
Linus Torvalds1da177e2005-04-16 15:20:36 -070026 char *task_name;
27 unsigned int disable:1,
28 direct:1,
29 block:1,
30 nonblock:1,
31 partialfrag:1,
Takashi Iwai10f69f92005-09-08 13:48:34 +020032 nosilence:1,
33 buggyptr:1;
Linus Torvalds1da177e2005-04-16 15:20:36 -070034 unsigned int periods;
35 unsigned int period_size;
Takashi Iwai6ac77bc2005-11-17 14:01:49 +010036 struct snd_pcm_oss_setup *next;
Linus Torvalds1da177e2005-04-16 15:20:36 -070037};
38
Takashi Iwai6ac77bc2005-11-17 14:01:49 +010039struct snd_pcm_oss_runtime {
Linus Torvalds1da177e2005-04-16 15:20:36 -070040 unsigned params: 1, /* format/parameter change */
41 prepare: 1, /* need to prepare the operation */
42 trigger: 1, /* trigger flag */
43 sync_trigger: 1; /* sync trigger flag */
44 int rate; /* requested rate */
45 int format; /* requested OSS format */
46 unsigned int channels; /* requested channels */
47 unsigned int fragshift;
48 unsigned int maxfrags;
49 unsigned int subdivision; /* requested subdivision */
50 size_t period_bytes; /* requested period size */
51 size_t period_frames; /* period frames for poll */
52 size_t period_ptr; /* actual write pointer to period */
53 unsigned int periods;
54 size_t buffer_bytes; /* requested buffer size */
55 size_t bytes; /* total # bytes processed */
56 size_t mmap_bytes;
57 char *buffer; /* vmallocated period */
58 size_t buffer_used; /* used length from period buffer */
Takashi Iwaie3a5d592006-11-14 13:03:19 +010059 struct mutex params_lock;
Takashi Iwai3724f9c2018-03-23 08:03:26 +010060 atomic_t rw_ref; /* concurrent read/write accesses */
Jaroslav Kysela21a34792006-01-13 09:12:11 +010061#ifdef CONFIG_SND_PCM_OSS_PLUGINS
Takashi Iwai6ac77bc2005-11-17 14:01:49 +010062 struct snd_pcm_plugin *plugin_first;
63 struct snd_pcm_plugin *plugin_last;
Jaroslav Kysela21a34792006-01-13 09:12:11 +010064#endif
Jaroslav Kyselaf2404062010-01-05 17:19:34 +010065 unsigned int prev_hw_ptr_period;
Takashi Iwai6ac77bc2005-11-17 14:01:49 +010066};
Linus Torvalds1da177e2005-04-16 15:20:36 -070067
Takashi Iwai6ac77bc2005-11-17 14:01:49 +010068struct snd_pcm_oss_file {
69 struct snd_pcm_substream *streams[2];
70};
Linus Torvalds1da177e2005-04-16 15:20:36 -070071
Takashi Iwai6ac77bc2005-11-17 14:01:49 +010072struct snd_pcm_oss_substream {
Linus Torvalds1da177e2005-04-16 15:20:36 -070073 unsigned oss: 1; /* oss mode */
Takashi Iwai060d77b2006-03-27 16:44:52 +020074 struct snd_pcm_oss_setup setup; /* active setup */
Takashi Iwai6ac77bc2005-11-17 14:01:49 +010075};
Linus Torvalds1da177e2005-04-16 15:20:36 -070076
Takashi Iwai6ac77bc2005-11-17 14:01:49 +010077struct snd_pcm_oss_stream {
78 struct snd_pcm_oss_setup *setup_list; /* setup list */
Ingo Molnar1a60d4c2006-01-16 16:29:08 +010079 struct mutex setup_mutex;
Takashi Iwaib7d90a32006-04-25 12:56:04 +020080#ifdef CONFIG_SND_VERBOSE_PROCFS
Takashi Iwai6ac77bc2005-11-17 14:01:49 +010081 struct snd_info_entry *proc_entry;
Takashi Iwaib7d90a32006-04-25 12:56:04 +020082#endif
Takashi Iwai6ac77bc2005-11-17 14:01:49 +010083};
Linus Torvalds1da177e2005-04-16 15:20:36 -070084
Takashi Iwai6ac77bc2005-11-17 14:01:49 +010085struct snd_pcm_oss {
Linus Torvalds1da177e2005-04-16 15:20:36 -070086 int reg;
87 unsigned int reg_mask;
Takashi Iwai6ac77bc2005-11-17 14:01:49 +010088};
Linus Torvalds1da177e2005-04-16 15:20:36 -070089
90#endif /* __SOUND_PCM_OSS_H */