ohmu
·
2026-10-15
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/*
22 * Copyright (C) 4Front Technologies 1996-2008.
23 *
24 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
26 */
27
28#ifndef _SYS_AUDIO_OSS_H
29#define _SYS_AUDIO_OSS_H
30
31#include <sys/types.h>
32#include <sys/time.h>
33
34/*
35 * These are the ioctl calls for all Solaris /dev/dsp and /dev/mixer audio
36 * devices.
37 *
38 * Note that the contents of this file include definitions which exist
39 * primarily for compatibility. Many of the defines here are not
40 * actually implemented, but exist solely to facilitate compilation of
41 * programs from other operating systems. Other definitions here may
42 * not be fully supported or may otherwise be obsolete. There are many
43 * things in this file which should not be used on SunOS.
44 *
45 * Please read the documentation to determine which portions of the
46 * API are fully supported and recommended for use in new
47 * applications.
48 */
49
50#ifdef __cplusplus
51extern "C" {
52#endif
53
54/*
55 * Buffer status queries.
56 * SNDCTL_DSP_GETOSPACE and SNDCTL_DSP_GETISPACE
57 */
58typedef struct audio_buf_info {
59 int fragments; /* # of available fragments */
60 int fragstotal; /* Total # of fragments allocated */
61 int fragsize; /* Size of a fragment in bytes */
62 int bytes; /* Available space in bytes */
63 /* Note! 'bytes' could be more than fragments*fragsize */
64} audio_buf_info;
65
66/*
67 * Sync groups for audio devices.
68 * SNDCTL_DSP_SYNCGROUP and SNDCTL_DSP_SYNCSTART
69 */
70typedef struct oss_syncgroup {
71 int id;
72 int mode;
73 int filler[16];
74} oss_syncgroup;
75
76/*
77 * SNDCTL_DSP_GETERROR
78 */
79typedef struct audio_errinfo {
80 int play_underruns;
81 int rec_overruns;
82 unsigned int play_ptradjust;
83 unsigned int rec_ptradjust;
84 int play_errorcount;
85 int rec_errorcount;
86 int play_lasterror;
87 int rec_lasterror;
88 int play_errorparm;
89 int rec_errorparm;
90 int filler[16];
91} audio_errinfo;
92
93/*
94 * SNDCTL_DSP_GETIPTR and SNDCTL_DSP_GETOPTR
95 */
96typedef struct count_info {
97 unsigned int bytes; /* Total # of bytes processed */
98 int blocks; /* # of fragment transitions since last time */
99 int ptr; /* Current DMA pointer value */
100} count_info;
101
102/*
103 * SNDCTL_DSP_CURENT_IPTR and SNDCTL_DSP_CURRENT_OPTR
104 */
105typedef struct {
106 long long samples; /* Total # of samples */
107 int fifo_samples; /* Samples in device FIFO */
108 int filler[32]; /* For future use */
109} oss_count_t;
110
111/*
112 * SNDCTL_DSP_GET_RECSRC_NAMES and SNDCTL_DSP_GET_PLAYTGT_NAMES
113 */
114#define OSS_ENUM_MAXVALUE 255
115typedef struct oss_mixer_enuminfo {
116 int dev;
117 int ctrl;
118 int nvalues;
119 int version;
120 short strindex[OSS_ENUM_MAXVALUE];
121 char strings[3000];
122} oss_mixer_enuminfo;
123
124/*
125 * Digital interface (S/PDIF) control interface
126 * SNDCTL_DSP_READCTL and SNDCTL_DSP_WRITECTL
127 */
128typedef struct oss_digital_control {
129 unsigned int caps;
130#define DIG_CBITIN_NONE 0x00000000
131#define DIG_CBITIN_LIMITED 0x00000001
132#define DIG_CBITIN_DATA 0x00000002
133#define DIG_CBITIN_BYTE0 0x00000004
134#define DIG_CBITIN_FULL 0x00000008
135#define DIG_CBITIN_MASK 0x0000000f
136#define DIG_CBITOUT_NONE 0x00000000
137#define DIG_CBITOUT_LIMITED 0x00000010
138#define DIG_CBITOUT_BYTE0 0x00000020
139#define DIG_CBITOUT_FULL 0x00000040
140#define DIG_CBITOUT_DATA 0x00000080
141#define DIG_CBITOUT_MASK 0x000000f0
142#define DIG_UBITIN 0x00000100
143#define DIG_UBITOUT 0x00000200
144#define DIG_VBITOUT 0x00000400
145#define DIG_OUTRATE 0x00000800
146#define DIG_INRATE 0x00001000
147#define DIG_INBITS 0x00002000
148#define DIG_OUTBITS 0x00004000
149#define DIG_EXACT 0x00010000
150#define DIG_PRO 0x00020000
151#define DIG_CONSUMER 0x00040000
152#define DIG_PASSTHROUGH 0x00080000
153#define DIG_OUTSEL 0x00100000
154
155 unsigned int valid;
156#define VAL_CBITIN 0x00000001
157#define VAL_UBITIN 0x00000002
158#define VAL_CBITOUT 0x00000004
159#define VAL_UBITOUT 0x00000008
160#define VAL_ISTATUS 0x00000010
161#define VAL_IRATE 0x00000020
162#define VAL_ORATE 0x00000040
163#define VAL_INBITS 0x00000080
164#define VAL_OUTBITS 0x00000100
165#define VAL_REQUEST 0x00000200
166#define VAL_OUTSEL 0x00000400
167
168#define VAL_OUTMASK (VAL_CBITOUT | VAL_UBITOUT | VAL_ORATE | VAL_OUTBITS | VAL_OUTSEL)
169
170 unsigned int request;
171 unsigned int param;
172#define SPD_RQ_PASSTHROUGH 1
173
174 unsigned char cbitin[24];
175 unsigned char ubitin[24];
176 unsigned char cbitout[24];
177 unsigned char ubitout[24];
178
179 unsigned int outsel;
180#define OUTSEL_DIGITAL 1
181#define OUTSEL_ANALOG 2
182#define OUTSEL_BOTH (OUTSEL_DIGITAL | OUTSEL_ANALOG)
183
184 int in_data; /* Audio/data if autodetectable by receiver */
185#define IND_UNKNOWN 0
186#define IND_AUDIO 1
187#define IND_DATA 2
188
189 int in_locked; /* Receiver locked */
190#define LOCK_NOT_INDICATED 0
191#define LOCK_UNLOCKED 1
192#define LOCK_LOCKED 2
193
194 int in_quality; /* Input signal quality */
195#define IN_QUAL_NOT_INDICATED 0
196#define IN_QUAL_POOR 1
197#define IN_QUAL_GOOD 2
198
199 int in_vbit;
200 int out_vbit; /* V bits */
201#define VBIT_NOT_INDICATED 0
202#define VBIT_OFF 1
203#define VBIT_ON 2
204
205 unsigned int in_errors; /* Various input error conditions */
206#define INERR_CRC 0x0001
207#define INERR_QCODE_CRC 0x0002
208#define INERR_PARITY 0x0004
209#define INERR_BIPHASE 0x0008
210
211 int srate_in;
212 int srate_out;
213 int bits_in;
214 int bits_out;
215
216 int filler[32];
217} oss_digital_control;
218
219/*
220 * The "new" mixer API.
221 *
222 * This improved mixer API makes it possible to access every possible feature
223 * of every possible device. However you should read the mixer programming
224 * section of the OSS API Developer's Manual. There is no chance that you
225 * could use this interface correctly just by examining this header.
226 */
227#define OSS_VERSION 0x040003
228#define SOUND_VERSION OSS_VERSION
229
230typedef struct oss_sysinfo {
231 char product[32]; /* E.g. SunOS Audio */
232 char version[32]; /* E.g. 4.0a */
233 int versionnum; /* See OSS_GETVERSION */
234 char options[128]; /* NOT SUPPORTED */
235
236 int numaudios; /* # of audio/dsp devices */
237 int openedaudio[8]; /* Mask of audio devices are busy */
238
239 int numsynths; /* NOT SUPPORTED, always 0 */
240 int nummidis; /* NOT SUPPORTED, always 0 */
241 int numtimers; /* NOT SUPPORTED, always 0 */
242 int nummixers; /* # of mixer devices */
243
244 int openedmidi[8]; /* Mask of midi devices are busy */
245 int numcards; /* Number of sound cards in the system */
246 int numaudioengines; /* Number of audio engines in the system */
247 char license[16]; /* E.g. "GPL" or "CDDL" */
248 char revision_info[256]; /* For internal use */
249 int filler[172]; /* For future expansion */
250} oss_sysinfo;
251
252typedef struct oss_mixext {
253 int dev; /* Mixer device number */
254 int ctrl; /* Extension number */
255 int type; /* Entry type */
256#define MIXT_DEVROOT 0 /* Device root entry */
257#define MIXT_GROUP 1 /* Controller group */
258#define MIXT_ONOFF 2 /* OFF (0) or ON (1) */
259#define MIXT_ENUM 3 /* Enumerated (0 to maxvalue) */
260#define MIXT_MONOSLIDER 4 /* Mono slider (0 to 255) */
261#define MIXT_STEREOSLIDER 5 /* Stereo slider (dual 0 to 255) */
262#define MIXT_MESSAGE 6 /* (Readable) textual message */
263#define MIXT_MONOVU 7 /* VU meter value (mono) */
264#define MIXT_STEREOVU 8 /* VU meter value (stereo) */
265#define MIXT_MONOPEAK 9 /* VU meter peak value (mono) */
266#define MIXT_STEREOPEAK 10 /* VU meter peak value (stereo) */
267#define MIXT_RADIOGROUP 11 /* Radio button group */
268#define MIXT_MARKER 12 /* Separator between entries */
269#define MIXT_VALUE 13 /* Decimal value entry */
270#define MIXT_HEXVALUE 14 /* Hexadecimal value entry */
271#define MIXT_MONODB 15 /* OBSOLETE */
272#define MIXT_STEREODB 16 /* OBSOLETE */
273#define MIXT_SLIDER 17 /* Slider (mono, 31 bit int range) */
274#define MIXT_3D 18
275#define MIXT_MONOSLIDER16 19 /* Mono slider (0-32767) */
276#define MIXT_STEREOSLIDER16 20 /* Stereo slider (dual 0-32767) */
277#define MIXT_MUTE 21 /* Mute=1, unmute=0 */
278
279 /* Possible value range (minvalue to maxvalue) */
280 /* Note that maxvalue may also be smaller than minvalue */
281 int maxvalue;
282 int minvalue;
283
284 int flags;
285#define MIXF_READABLE 0x00000001 /* Has readable value */
286#define MIXF_WRITEABLE 0x00000002 /* Has writeable value */
287#define MIXF_POLL 0x00000004 /* May change itself */
288#define MIXF_HZ 0x00000008 /* Hertz scale */
289#define MIXF_STRING 0x00000010 /* Use dynamic extensions for value */
290#define MIXF_DYNAMIC 0x00000010 /* Supports dynamic extensions */
291#define MIXF_OKFAIL 0x00000020 /* Interpret value as 1=OK, 0=FAIL */
292#define MIXF_FLAT 0x00000040 /* NOT SUPPORTED */
293#define MIXF_LEGACY 0x00000080 /* NOT SUPPORTED */
294#define MIXF_CENTIBEL 0x00000100 /* Centibel (0.1 dB) step size */
295#define MIXF_DECIBEL 0x00000200 /* Step size of 1 dB */
296#define MIXF_MAINVOL 0x00000400 /* Main volume control */
297#define MIXF_PCMVOL 0x00000800 /* PCM output volume control */
298#define MIXF_RECVOL 0x00001000 /* PCM recording volume control */
299#define MIXF_MONVOL 0x00002000 /* Input->output monitor volume */
300#define MIXF_WIDE 0x00004000 /* NOT SUPPORTED */
301#define MIXF_DESCR 0x00008000 /* NOT SUPPORTED */
302#define MIXF_DISABLE 0x00010000 /* Control has been disabled */
303
304 char id[16]; /* Mnemonic ID (internal use) */
305 int parent; /* Entry# of parent (-1 if root) */
306
307 int dummy; /* NOT SUPPORTED */
308
309 int timestamp;
310
311 char data[64]; /* Misc data (entry type dependent) */
312 unsigned char enum_present[32]; /* Mask of allowed enum values */
313 int control_no; /* NOT SUPPORTED, always -1 */
314
315 unsigned int desc; /* Scope flags, etc */
316#define MIXEXT_SCOPE_MASK 0x0000003f
317#define MIXEXT_SCOPE_OTHER 0x00000000
318#define MIXEXT_SCOPE_INPUT 0x00000001
319#define MIXEXT_SCOPE_OUTPUT 0x00000002
320#define MIXEXT_SCOPE_MONITOR 0x00000003
321#define MIXEXT_SCOPE_RECSWITCH 0x00000004
322
323 char extname[32];
324 int update_counter;
325#ifdef _KERNEL
326 int filler[6];
327 int enumbit;
328#else
329 int filler[7];
330#endif
331} oss_mixext;
332
333typedef struct oss_mixext_root {
334 char id[16];
335 char name[48];
336} oss_mixext_root;
337
338typedef struct oss_mixer_value {
339 int dev;
340 int ctrl;
341 int value;
342 int flags; /* Reserved for future use. Initialize to 0 */
343 int timestamp; /* Must be set to oss_mixext.timestamp */
344 int filler[8]; /* Reserved for future use. Initialize to 0 */
345} oss_mixer_value;
346
347#define OSS_LONGNAME_SIZE 64
348#define OSS_LABEL_SIZE 16
349#define OSS_DEVNODE_SIZE 32
350typedef char oss_longname_t[OSS_LONGNAME_SIZE];
351typedef char oss_label_t[OSS_LABEL_SIZE];
352typedef char oss_devnode_t[OSS_DEVNODE_SIZE];
353
354typedef struct oss_audioinfo {
355 int dev; /* Audio device number */
356 char name[64];
357 int busy; /* 0, OPEN_READ, OPEN_WRITE, OPEN_READWRITE */
358 int pid; /* Process ID, not used in SunOS */
359 int caps; /* PCM_CAP_INPUT, PCM_CAP_OUTPUT */
360 int iformats; /* Supported input formats */
361 int oformats; /* Supported output formats */
362 int magic; /* Internal use only */
363 char cmd[64]; /* Command using the device (if known) */
364 int card_number;
365 int port_number;
366 int mixer_dev;
367 int legacy_device; /* Obsolete field. Replaced by devnode */
368 int enabled; /* 1=enabled, 0=device not ready */
369 int flags; /* internal use only - no practical meaning */
370 int min_rate; /* Minimum sample rate */
371 int max_rate; /* Maximum sample rate */
372 int min_channels; /* Minimum number of channels */
373 int max_channels; /* Maximum number of channels */
374 int binding; /* DSP_BIND_FRONT, etc. 0 means undefined */
375 int rate_source;
376 char handle[32];
377#define OSS_MAX_SAMPLE_RATES 20 /* Cannot be changed */
378 unsigned int nrates; /* Array of supported sample rates */
379 unsigned int rates[OSS_MAX_SAMPLE_RATES];
380 oss_longname_t song_name; /* Song name (if given) */
381 oss_label_t label; /* Device label (if given) */
382 int latency; /* In usecs, -1=unknown */
383 oss_devnode_t devnode; /* Device special file name (absolute path) */
384 int next_play_engine;
385 int next_rec_engine;
386 int filler[184];
387} oss_audioinfo;
388
389typedef struct oss_mixerinfo {
390 int dev;
391 char id[16];
392 char name[32];
393 int modify_counter;
394 int card_number;
395 int port_number;
396 char handle[32];
397 int magic; /* Reserved */
398 int enabled; /* Reserved */
399 int caps;
400#define MIXER_CAP_VIRTUAL 0x00000001
401#define MIXER_CAP_LAYOUT_B 0x00000002 /* For internal use only */
402#define MIXER_CAP_NARROW 0x00000004 /* Conserve horiz space */
403 int flags; /* Reserved */
404 int nrext;
405 /*
406 * The priority field can be used to select the default
407 * (motherboard) mixer device. The mixer with the highest
408 * priority is the most preferred one. -2 or less means that
409 * this device cannot be used as the default mixer.
410 */
411 int priority;
412 oss_devnode_t devnode; /* Device special file name (absolute path) */
413 int legacy_device;
414 int filler[245]; /* Reserved */
415} oss_mixerinfo;
416
417typedef struct oss_card_info {
418 int card;
419 char shortname[16];
420 char longname[128];
421 int flags;
422 char hw_info[400];
423 int intr_count;
424 int ack_count;
425 int filler[154];
426} oss_card_info;
427
428typedef struct mixer_info { /* OBSOLETE */
429 char id[16];
430 char name[32];
431 int modify_counter;
432 int card_number;
433 int port_number;
434 char handle[32];
435} mixer_info;
436
437#define MAX_PEAK_CHANNELS 128
438typedef unsigned short oss_peaks_t[MAX_PEAK_CHANNELS];
439
440/* For use with SNDCTL_DSP_GET_CHNORDER */
441#define CHID_UNDEF 0
442#define CHID_L 1
443#define CHID_R 2
444#define CHID_C 3
445#define CHID_LFE 4
446#define CHID_LS 5
447#define CHID_RS 6
448#define CHID_LR 7
449#define CHID_RR 8
450#define CHNORDER_UNDEF 0x0000000000000000ULL
451#define CHNORDER_NORMAL 0x0000000087654321ULL
452
453#define OSSIOCPARM_MASK 0x1fff /* parameters must be < 8192 bytes */
454#define OSSIOC_VOID 0x00000000 /* no parameters */
455#define OSSIOC_OUT 0x20000000 /* copy out parameters */
456#define OSSIOC_IN 0x40000000 /* copy in parameters */
457#define OSSIOC_INOUT (OSSIOC_IN | OSSIOC_OUT)
458#define OSSIOC_SZ(t) ((sizeof(t) & OSSIOCPARM_MASK) << 16)
459#define OSSIOC_GETSZ(x) (((x) >> 16) & OSSIOCPARM_MASK)
460
461#define __OSSIO(x, y) ((int) (OSSIOC_VOID | (x << 8) | y))
462#define __OSSIOR(x, y, t) ((int) (OSSIOC_OUT | OSSIOC_SZ(t) | (x << 8) | y))
463#define __OSSIOW(x, y, t) ((int) (OSSIOC_IN | OSSIOC_SZ(t) | (x << 8) | y))
464#define __OSSIOWR(x, y, t) ((int) (OSSIOC_INOUT | OSSIOC_SZ(t) | (x << 8) | y))
465
466#define SNDCTL_SYSINFO __OSSIOR('X', 1, oss_sysinfo)
467#define OSS_SYSINFO SNDCTL_SYSINFO /* Old name */
468
469#define SNDCTL_MIX_NRMIX __OSSIOR('X', 2, int)
470#define SNDCTL_MIX_NREXT __OSSIOWR('X', 3, int)
471#define SNDCTL_MIX_EXTINFO __OSSIOWR('X', 4, oss_mixext)
472#define SNDCTL_MIX_READ __OSSIOWR('X', 5, oss_mixer_value)
473#define SNDCTL_MIX_WRITE __OSSIOWR('X', 6, oss_mixer_value)
474
475#define SNDCTL_AUDIOINFO __OSSIOWR('X', 7, oss_audioinfo)
476#define SNDCTL_MIX_ENUMINFO __OSSIOWR('X', 8, oss_mixer_enuminfo)
477#define SNDCTL_MIDIINFO __OSSIO('X', 9)
478#define SNDCTL_MIXERINFO __OSSIOWR('X', 10, oss_mixerinfo)
479#define SNDCTL_CARDINFO __OSSIOWR('X', 11, oss_card_info)
480#define SNDCTL_ENGINEINFO __OSSIOWR('X', 12, oss_audioinfo)
481#define SNDCTL_AUDIOINFO_EX __OSSIOWR('X', 13, oss_audioinfo)
482#define SNDCTL_MIX_DESCRIPTION __OSSIOWR('X', 14, oss_mixer_enuminfo)
483
484/* ioctl codes 'X', 200-255 are reserved for internal use */
485
486/*
487 * Few more "globally" available ioctl calls.
488 */
489#define SNDCTL_SETSONG __OSSIOW('Y', 2, oss_longname_t)
490#define SNDCTL_GETSONG __OSSIOR('Y', 2, oss_longname_t)
491#define SNDCTL_SETNAME __OSSIOW('Y', 3, oss_longname_t)
492#define SNDCTL_SETLABEL __OSSIOW('Y', 4, oss_label_t)
493#define SNDCTL_GETLABEL __OSSIOR('Y', 4, oss_label_t)
494
495/*
496 * IOCTL commands for /dev/dsp
497 */
498#define SNDCTL_DSP_HALT __OSSIO('P', 0)
499#define SNDCTL_DSP_RESET SNDCTL_DSP_HALT /* Old name */
500#define SNDCTL_DSP_SYNC __OSSIO('P', 1)
501#define SNDCTL_DSP_SPEED __OSSIOWR('P', 2, int)
502
503#define SNDCTL_DSP_STEREO __OSSIOWR('P', 3, int) /* OBSOLETE */
504
505#define SNDCTL_DSP_GETBLKSIZE __OSSIOWR('P', 4, int)
506#define SNDCTL_DSP_SAMPLESIZE SNDCTL_DSP_SETFMT
507#define SNDCTL_DSP_CHANNELS __OSSIOWR('P', 6, int)
508#define SNDCTL_DSP_POST __OSSIO('P', 8)
509#define SNDCTL_DSP_SUBDIVIDE __OSSIOWR('P', 9, int)
510#define SNDCTL_DSP_SETFRAGMENT __OSSIOWR('P', 10, int)
511
512#define SNDCTL_DSP_GETFMTS __OSSIOR('P', 11, int) /* Returns a mask */
513#define SNDCTL_DSP_SETFMT __OSSIOWR('P', 5, int) /* Selects ONE fmt */
514
515#define SNDCTL_DSP_GETOSPACE __OSSIOR('P', 12, audio_buf_info)
516#define SNDCTL_DSP_GETISPACE __OSSIOR('P', 13, audio_buf_info)
517#define SNDCTL_DSP_NONBLOCK __OSSIO('P', 14) /* Obsolete */
518#define SNDCTL_DSP_GETCAPS __OSSIOR('P', 15, int)
519
520#define SNDCTL_DSP_GETTRIGGER __OSSIOR('P', 16, int)
521#define SNDCTL_DSP_SETTRIGGER __OSSIOW('P', 16, int)
522
523#define SNDCTL_DSP_GETIPTR __OSSIOR('P', 17, count_info)
524#define SNDCTL_DSP_GETOPTR __OSSIOR('P', 18, count_info)
525
526#define SNDCTL_DSP_SETSYNCRO __OSSIO('P', 21)
527#define SNDCTL_DSP_SETDUPLEX __OSSIO('P', 22)
528
529#define SNDCTL_DSP_PROFILE __OSSIOW('P', 23, int) /* OBSOLETE */
530#define APF_NORMAL 0 /* Normal applications */
531#define APF_NETWORK 1 /* Underruns caused by "external" delay */
532#define APF_CPUINTENS 2 /* Underruns caused by "overheating" the CPU */
533
534#define SNDCTL_DSP_GETODELAY __OSSIOR('P', 23, int)
535
536#define SNDCTL_DSP_GETPLAYVOL __OSSIOR('P', 24, int)
537#define SNDCTL_DSP_SETPLAYVOL __OSSIOWR('P', 24, int)
538#define SNDCTL_DSP_GETERROR __OSSIOR('P', 25, audio_errinfo)
539
540#define SNDCTL_DSP_READCTL __OSSIOWR('P', 26, oss_digital_control)
541#define SNDCTL_DSP_WRITECTL __OSSIOWR('P', 27, oss_digital_control)
542
543#define SNDCTL_DSP_SYNCGROUP __OSSIOWR('P', 28, oss_syncgroup)
544#define SNDCTL_DSP_SYNCSTART __OSSIOW('P', 29, int)
545
546#define SNDCTL_DSP_COOKEDMODE __OSSIOW('P', 30, int)
547
548#define SNDCTL_DSP_SILENCE __OSSIO('P', 31)
549#define SNDCTL_DSP_SKIP __OSSIO('P', 32)
550
551#define SNDCTL_DSP_HALT_INPUT __OSSIO('P', 33)
552#define SNDCTL_DSP_RESET_INPUT SNDCTL_DSP_HALT_INPUT /* Old name */
553#define SNDCTL_DSP_HALT_OUTPUT __OSSIO('P', 34)
554#define SNDCTL_DSP_RESET_OUTPUT SNDCTL_DSP_HALT_OUTPUT /* Old name */
555
556#define SNDCTL_DSP_LOW_WATER __OSSIOW('P', 34, int)
557
558#define SNDCTL_DSP_CURRENT_IPTR __OSSIOR('P', 35, oss_count_t)
559#define SNDCTL_DSP_CURRENT_OPTR __OSSIOR('P', 36, oss_count_t)
560
561#define SNDCTL_DSP_GET_RECSRC_NAMES __OSSIOR('P', 37, oss_mixer_enuminfo)
562#define SNDCTL_DSP_GET_RECSRC __OSSIOR('P', 38, int)
563#define SNDCTL_DSP_SET_RECSRC __OSSIOWR('P', 38, int)
564
565#define SNDCTL_DSP_GET_PLAYTGT_NAMES __OSSIOR('P', 39, oss_mixer_enuminfo)
566#define SNDCTL_DSP_GET_PLAYTGT __OSSIOR('P', 40, int)
567#define SNDCTL_DSP_SET_PLAYTGT __OSSIOWR('P', 40, int)
568#define SNDCTL_DSP_GETRECVOL __OSSIOR('P', 41, int)
569#define SNDCTL_DSP_SETRECVOL __OSSIOWR('P', 41, int)
570
571#define SNDCTL_DSP_GET_CHNORDER __OSSIOR('P', 42, unsigned long long)
572#define SNDCTL_DSP_SET_CHNORDER __OSSIOWR('P', 42, unsigned long long)
573
574#define SNDCTL_DSP_GETIPEAKS __OSSIOR('P', 43, oss_peaks_t)
575#define SNDCTL_DSP_GETOPEAKS __OSSIOR('P', 44, oss_peaks_t)
576
577#define SNDCTL_DSP_POLICY __OSSIOW('P', 45, int) /* See the manual */
578
579#define SNDCTL_DSP_GETCHANNELMASK __OSSIOWR('P', 64, int)
580#define SNDCTL_DSP_BIND_CHANNEL __OSSIOWR('P', 65, int)
581
582/*
583 * These definitions are here for the benefit of compiling application
584 * code. Most of these are NOT implemented in the Solaris code,
585 * however. This is the older 3.x OSS API, and only the master input and
586 * output levels are actually supported.
587 */
588#define SOUND_MIXER_NRDEVICES 28
589#define SOUND_MIXER_VOLUME 0
590#define SOUND_MIXER_BASS 1
591#define SOUND_MIXER_TREBLE 2
592#define SOUND_MIXER_SYNTH 3
593#define SOUND_MIXER_PCM 4
594#define SOUND_MIXER_SPEAKER 5
595#define SOUND_MIXER_LINE 6
596#define SOUND_MIXER_MIC 7
597#define SOUND_MIXER_CD 8
598#define SOUND_MIXER_IMIX 9 /* Recording monitor */
599#define SOUND_MIXER_ALTPCM 10
600#define SOUND_MIXER_RECLEV 11 /* Recording level */
601#define SOUND_MIXER_IGAIN 12 /* Input gain */
602#define SOUND_MIXER_OGAIN 13 /* Output gain */
603#define SOUND_MIXER_LINE1 14 /* Input source 1 (aux1) */
604#define SOUND_MIXER_LINE2 15 /* Input source 2 (aux2) */
605#define SOUND_MIXER_LINE3 16 /* Input source 3 (line) */
606#define SOUND_MIXER_DIGITAL1 17 /* Digital I/O 1 */
607#define SOUND_MIXER_DIGITAL2 18 /* Digital I/O 2 */
608#define SOUND_MIXER_DIGITAL3 19 /* Digital I/O 3 */
609#define SOUND_MIXER_PHONE 20 /* Phone */
610#define SOUND_MIXER_MONO 21 /* Mono Output */
611#define SOUND_MIXER_VIDEO 22 /* Video/TV (audio) in */
612#define SOUND_MIXER_RADIO 23 /* Radio in */
613#define SOUND_MIXER_DEPTH 24 /* Surround depth */
614#define SOUND_MIXER_REARVOL 25 /* Rear/Surround speaker vol */
615#define SOUND_MIXER_CENTERVOL 26 /* Center/LFE speaker vol */
616#define SOUND_MIXER_SIDEVOL 27 /* Side-Surround (8speaker) vol */
617#define SOUND_MIXER_SURRVOL SOUND_MIXER_SIDEVOL
618#define SOUND_ONOFF_MIN 28
619#define SOUND_ONOFF_MAX 30
620#define SOUND_MIXER_NONE 31
621
622#define SOUND_MIXER_RECSRC 0xff /* Recording sources */
623#define SOUND_MIXER_DEVMASK 0xfe /* Supported devices */
624#define SOUND_MIXER_RECMASK 0xfd /* Recording sources */
625#define SOUND_MIXER_CAPS 0xfc /* Mixer capabilities (do not use) */
626#define SOUND_MIXER_STEREODEVS 0xfb /* Mixer channels supporting stereo */
627#define SOUND_MIXER_OUTSRC 0xfa
628#define SOUND_MIXER_OUTMASK 0xf9
629
630#define SOUND_MIXER_ENHANCE SOUND_MIXER_NONE
631#define SOUND_MIXER_MUTE SOUND_MIXER_NONE
632#define SOUND_MIXER_LOUD SOUND_MIXER_NONE
633
634#define SOUND_MASK_VOLUME (1 << SOUND_MIXER_VOLUME)
635#define SOUND_MASK_BASS (1 << SOUND_MIXER_BASS)
636#define SOUND_MASK_TREBLE (1 << SOUND_MIXER_TREBLE)
637#define SOUND_MASK_SYNTH (1 << SOUND_MIXER_SYNTH)
638#define SOUND_MASK_PCM (1 << SOUND_MIXER_PCM)
639#define SOUND_MASK_SPEAKER (1 << SOUND_MIXER_SPEAKER)
640#define SOUND_MASK_LINE (1 << SOUND_MIXER_LINE)
641#define SOUND_MASK_MIC (1 << SOUND_MIXER_MIC)
642#define SOUND_MASK_CD (1 << SOUND_MIXER_CD)
643#define SOUND_MASK_IMIX (1 << SOUND_MIXER_IMIX)
644#define SOUND_MASK_ALTPCM (1 << SOUND_MIXER_ALTPCM)
645#define SOUND_MASK_RECLEV (1 << SOUND_MIXER_RECLEV)
646#define SOUND_MASK_IGAIN (1 << SOUND_MIXER_IGAIN)
647#define SOUND_MASK_OGAIN (1 << SOUND_MIXER_OGAIN)
648#define SOUND_MASK_LINE1 (1 << SOUND_MIXER_LINE1)
649#define SOUND_MASK_LINE2 (1 << SOUND_MIXER_LINE2)
650#define SOUND_MASK_LINE3 (1 << SOUND_MIXER_LINE3)
651#define SOUND_MASK_DIGITAL1 (1 << SOUND_MIXER_DIGITAL1)
652#define SOUND_MASK_DIGITAL2 (1 << SOUND_MIXER_DIGITAL2)
653#define SOUND_MASK_DIGITAL3 (1 << SOUND_MIXER_DIGITAL3)
654#define SOUND_MASK_MONO (1 << SOUND_MIXER_MONO)
655#define SOUND_MASK_PHONE (1 << SOUND_MIXER_PHONE)
656#define SOUND_MASK_RADIO (1 << SOUND_MIXER_RADIO)
657#define SOUND_MASK_VIDEO (1 << SOUND_MIXER_VIDEO)
658#define SOUND_MASK_DEPTH (1 << SOUND_MIXER_DEPTH)
659#define SOUND_MASK_REARVOL (1 << SOUND_MIXER_REARVOL)
660#define SOUND_MASK_CENTERVOL (1 << SOUND_MIXER_CENTERVOL)
661#define SOUND_MASK_SIDEVOL (1 << SOUND_MIXER_SIDEVOL)
662#define SOUND_MASK_SURRVOL SOUND_MASK_SIDEVOL
663#define SOUND_MASK_MUTE (1 << SOUND_MIXER_MUTE)
664#define SOUND_MASK_ENHANCE (1 << SOUND_MIXER_ENHANCE)
665#define SOUND_MASK_LOUD (1 << SOUND_MIXER_LOUD)
666
667/*
668 * Again, DO NOT USE the following two macros. They are here for SOURCE
669 * COMPATIBILITY ONLY.
670 */
671#define SOUND_DEVICE_LABELS { \
672 "Vol ", "Bass ", "Treble", "Synth", "Pcm ", "Speaker ", "Line ", "Mic ", "CD ", "Mix ", "Pcm2 ", "Rec ", "IGain", "OGain", "Aux1", "Aux2", "Aux3", "Digital1", "Digital2", "Digital3", "Phone", "Mono", "Video", "Radio", "Depth", "Rear", "Center", "Side" \
673}
674
675#define SOUND_DEVICE_NAMES { \
676 "vol", "bass", "treble", "synth", "pcm", "speaker", "line", "mic", "cd", "mix", "pcm2", "rec", "igain", "ogain", "aux1", "aux2", "aux3", "dig1", "dig2", "dig3", "phone", "mono", "video", "radio", "depth", "rear", "center", "side" \
677}
678
679#define MIXER_READ(dev) __OSSIOR('M', dev, int)
680#define MIXER_WRITE(dev) __OSSIOWR('M', dev, int)
681#define SOUND_MIXER_INFO __OSSIOR('M', 101, mixer_info)
682#define OSS_GETVERSION __OSSIOR('M', 118, int)
683
684/*
685 * These macros are useful for some applications. They are implemented
686 * as soft values for the application, and do not affect real hardware.
687 */
688#define SOUND_MIXER_READ_VOLUME MIXER_READ(SOUND_MIXER_VOLUME)
689#define SOUND_MIXER_READ_OGAIN MIXER_READ(SOUND_MIXER_OGAIN)
690#define SOUND_MIXER_READ_PCM MIXER_READ(SOUND_MIXER_PCM)
691#define SOUND_MIXER_READ_IGAIN MIXER_READ(SOUND_MIXER_IGAIN)
692#define SOUND_MIXER_READ_RECLEV MIXER_READ(SOUND_MIXER_RECLEV)
693#define SOUND_MIXER_READ_RECSRC MIXER_READ(SOUND_MIXER_RECSRC)
694#define SOUND_MIXER_READ_DEVMASK MIXER_READ(SOUND_MIXER_DEVMASK)
695#define SOUND_MIXER_READ_RECMASK MIXER_READ(SOUND_MIXER_RECMASK)
696#define SOUND_MIXER_READ_CAPS MIXER_READ(SOUND_MIXER_CAPS)
697#define SOUND_MIXER_READ_STEREODEVS MIXER_READ(SOUND_MIXER_STEREODEVS)
698#define SOUND_MIXER_READ_RECGAIN __OSSIOR('M', 119, int)
699#define SOUND_MIXER_READ_MONGAIN __OSSIOR('M', 120, int)
700
701#define SOUND_MIXER_WRITE_VOLUME MIXER_WRITE(SOUND_MIXER_VOLUME)
702#define SOUND_MIXER_WRITE_OGAIN MIXER_WRITE(SOUND_MIXER_OGAIN)
703#define SOUND_MIXER_WRITE_PCM MIXER_WRITE(SOUND_MIXER_PCM)
704#define SOUND_MIXER_WRITE_IGAIN MIXER_WRITE(SOUND_MIXER_IGAIN)
705#define SOUND_MIXER_WRITE_RECLEV MIXER_WRITE(SOUND_MIXER_RECLEV)
706#define SOUND_MIXER_WRITE_RECSRC MIXER_WRITE(SOUND_MIXER_RECSRC)
707#define SOUND_MIXER_WRITE_RECGAIN __OSSIOWR('M', 119, int)
708#define SOUND_MIXER_WRITE_MONGAIN __OSSIOWR('M', 120, int)
709
710/*
711 * These macros are here for source compatibility. They intentionally don't
712 * map to any real hardware. NOT SUPPORTED!
713 */
714#define SOUND_MIXER_READ_BASS MIXER_READ(SOUND_MIXER_BASS)
715#define SOUND_MIXER_READ_TREBLE MIXER_READ(SOUND_MIXER_TREBLE)
716#define SOUND_MIXER_READ_SYNTH MIXER_READ(SOUND_MIXER_SYNTH)
717#define SOUND_MIXER_READ_SPEAKER MIXER_READ(SOUND_MIXER_SPEAKER)
718#define SOUND_MIXER_READ_LINE MIXER_READ(SOUND_MIXER_LINE)
719#define SOUND_MIXER_READ_MIC MIXER_READ(SOUND_MIXER_MIC)
720#define SOUND_MIXER_READ_CD MIXER_READ(SOUND_MIXER_CD)
721#define SOUND_MIXER_READ_IMIX MIXER_READ(SOUND_MIXER_IMIX)
722#define SOUND_MIXER_READ_ALTPCM MIXER_READ(SOUND_MIXER_ALTPCM)
723#define SOUND_MIXER_READ_LINE1 MIXER_READ(SOUND_MIXER_LINE1)
724#define SOUND_MIXER_READ_LINE2 MIXER_READ(SOUND_MIXER_LINE2)
725#define SOUND_MIXER_READ_LINE3 MIXER_READ(SOUND_MIXER_LINE3)
726
727#define SOUND_MIXER_WRITE_BASS MIXER_WRITE(SOUND_MIXER_BASS)
728#define SOUND_MIXER_WRITE_TREBLE MIXER_WRITE(SOUND_MIXER_TREBLE)
729#define SOUND_MIXER_WRITE_SYNTH MIXER_WRITE(SOUND_MIXER_SYNTH)
730#define SOUND_MIXER_WRITE_SPEAKER MIXER_WRITE(SOUND_MIXER_SPEAKER)
731#define SOUND_MIXER_WRITE_LINE MIXER_WRITE(SOUND_MIXER_LINE)
732#define SOUND_MIXER_WRITE_MIC MIXER_WRITE(SOUND_MIXER_MIC)
733#define SOUND_MIXER_WRITE_CD MIXER_WRITE(SOUND_MIXER_CD)
734#define SOUND_MIXER_WRITE_IMIX MIXER_WRITE(SOUND_MIXER_IMIX)
735#define SOUND_MIXER_WRITE_ALTPCM MIXER_WRITE(SOUND_MIXER_ALTPCM)
736#define SOUND_MIXER_WRITE_LINE1 MIXER_WRITE(SOUND_MIXER_LINE1)
737#define SOUND_MIXER_WRITE_LINE2 MIXER_WRITE(SOUND_MIXER_LINE2)
738#define SOUND_MIXER_WRITE_LINE3 MIXER_WRITE(SOUND_MIXER_LINE3)
739
740/*
741 * Audio encoding types (Note! U8=8 and S16_LE=16 for compatibility)
742 */
743#define AFMT_QUERY 0x00000000 /* Return current fmt */
744#define AFMT_MU_LAW 0x00000001
745#define AFMT_A_LAW 0x00000002
746#define AFMT_IMA_ADPCM 0x00000004
747#define AFMT_U8 0x00000008
748#define AFMT_S16_LE 0x00000010
749#define AFMT_S16_BE 0x00000020
750#define AFMT_S8 0x00000040
751#define AFMT_U16_LE 0x00000080
752#define AFMT_U16_BE 0x00000100
753#define AFMT_MPEG 0x00000200 /* NOT SUPPORTED: MPEG (2) audio */
754#define AFMT_AC3 0x00000400 /* NOT SUPPORTED: AC3 compressed */
755#define AFMT_VORBIS 0x00000800 /* NOT SUPPORTED: Ogg Vorbis */
756#define AFMT_S32_LE 0x00001000
757#define AFMT_S32_BE 0x00002000
758#define AFMT_FLOAT 0x00004000 /* NOT SUPPORTED: IEEE double float */
759#define AFMT_S24_LE 0x00008000 /* LSB aligned in 32 bit word */
760#define AFMT_S24_BE 0x00010000 /* LSB aligned in 32 bit word */
761#define AFMT_SPDIF_RAW 0x00020000 /* NOT SUPPORTED: Raw S/PDIF frames */
762#define AFMT_S24_PACKED 0x00040000 /* 24 bit packed little endian */
763/*
764 * Some big endian/little endian handling macros (native endian and
765 * opposite endian formats).
766 */
767#if defined(_BIG_ENDIAN)
768 #define AFMT_S16_NE AFMT_S16_BE
769 #define AFMT_U16_NE AFMT_U16_BE
770 #define AFMT_S32_NE AFMT_S32_BE
771 #define AFMT_S24_NE AFMT_S24_BE
772 #define AFMT_S16_OE AFMT_S16_LE
773 #define AFMT_S32_OE AFMT_S32_LE
774 #define AFMT_S24_OE AFMT_S24_LE
775#else
776 #define AFMT_S16_NE AFMT_S16_LE
777 #define AFMT_U16_NE AFMT_U16_LE
778 #define AFMT_S32_NE AFMT_S32_LE
779 #define AFMT_S24_NE AFMT_S24_LE
780 #define AFMT_S16_OE AFMT_S16_BE
781 #define AFMT_S32_OE AFMT_S32_BE
782 #define AFMT_S24_OE AFMT_S24_BE
783#endif
784
785/*
786 * SNDCTL_DSP_GETCAPS bits
787 */
788#define PCM_CAP_REVISION 0x000000ff /* Revision level (0 to 255) */
789#define PCM_CAP_DUPLEX 0x00000100 /* Full duplex rec/play */
790#define PCM_CAP_REALTIME 0x00000200 /* NOT SUPPORTED */
791#define PCM_CAP_BATCH 0x00000400 /* NOT SUPPORTED */
792#define PCM_CAP_COPROC 0x00000800 /* NOT SUPPORTED */
793#define PCM_CAP_TRIGGER 0x00001000 /* Supports SETTRIGGER */
794#define PCM_CAP_MMAP 0x00002000 /* Supports mmap() */
795#define PCM_CAP_MULTI 0x00004000 /* Supports multiple open */
796#define PCM_CAP_BIND 0x00008000 /* Supports channel binding */
797#define PCM_CAP_INPUT 0x00010000 /* Supports recording */
798#define PCM_CAP_OUTPUT 0x00020000 /* Supports playback */
799#define PCM_CAP_VIRTUAL 0x00040000 /* Virtual device */
800#define PCM_CAP_ANALOGOUT 0x00100000 /* NOT SUPPORTED */
801#define PCM_CAP_ANALOGIN 0x00200000 /* NOT SUPPORTED */
802#define PCM_CAP_DIGITALOUT 0x00400000 /* NOT SUPPORTED */
803#define PCM_CAP_DIGITALIN 0x00800000 /* NOT SUPPORTED */
804#define PCM_CAP_ADMASK 0x00f00000 /* NOT SUPPORTED */
805#define PCM_CAP_SHADOW 0x01000000 /* "Shadow" device */
806#define PCM_CAP_CH_MASK 0x06000000 /* See DSP_CH_MASK below */
807#define PCM_CAP_HIDDEN 0x08000000 /* NOT SUPPORTED */
808#define PCM_CAP_FREERATE 0x10000000
809#define PCM_CAP_MODEM 0x20000000 /* NOT SUPPORTED */
810#define PCM_CAP_DEFAULT 0x40000000 /* "Default" device */
811
812/*
813 * Preferred channel usage. These bits can be used to give
814 * recommendations to the application. Used by few drivers. For
815 * example if ((caps & DSP_CH_MASK) == DSP_CH_MONO) means that the
816 * device works best in mono mode. However it doesn't necessarily mean
817 * that the device cannot be used in stereo. These bits should only be
818 * used by special applications such as multi track hard disk
819 * recorders to find out the initial setup. However the user should be
820 * able to override this selection.
821 *
822 * To find out which modes are actually supported the application
823 * should try to select them using SNDCTL_DSP_CHANNELS.
824 */
825#define DSP_CH_MASK 0x06000000 /* Mask */
826#define DSP_CH_ANY 0x00000000 /* No preferred mode */
827#define DSP_CH_MONO 0x02000000
828#define DSP_CH_STEREO 0x04000000
829#define DSP_CH_MULTI 0x06000000 /* More than two channels */
830
831/*
832 * The PCM_CAP_* capability names used to be known as DSP_CAP_*, so
833 * it's necessary to define the older names too.
834 */
835#define DSP_CAP_ADMASK PCM_CAP_ADMASK
836#define DSP_CAP_ANALOGIN PCM_CAP_ANALOGIN
837#define DSP_CAP_ANALOGOUT PCM_CAP_ANALOGOUT
838#define DSP_CAP_BATCH PCM_CAP_BATCH
839#define DSP_CAP_BIND PCM_CAP_BIND
840#define DSP_CAP_COPROC PCM_CAP_COPROC
841#define DSP_CAP_DEFAULT PCM_CAP_DEFAULT
842#define DSP_CAP_DIGITALIN PCM_CAP_DIGITALIN
843#define DSP_CAP_DIGITALOUT PCM_CAP_DIGITALOUT
844#define DSP_CAP_DUPLEX PCM_CAP_DUPLEX
845#define DSP_CAP_FREERATE PCM_CAP_FREERATE
846#define DSP_CAP_HIDDEN PCM_CAP_HIDDEN
847#define DSP_CAP_INPUT PCM_CAP_INPUT
848#define DSP_CAP_MMAP PCM_CAP_MMAP
849#define DSP_CAP_MODEM PCM_CAP_MODEM
850#define DSP_CAP_MULTI PCM_CAP_MULTI
851#define DSP_CAP_OUTPUT PCM_CAP_OUTPUT
852#define DSP_CAP_REALTIME PCM_CAP_REALTIME
853#define DSP_CAP_REVISION PCM_CAP_REVISION
854#define DSP_CAP_SHADOW PCM_CAP_SHADOW
855#define DSP_CAP_TRIGGER PCM_CAP_TRIGGER
856#define DSP_CAP_VIRTUAL PCM_CAP_VIRTUAL
857
858/*
859 * SNDCTL_DSP_GETTRIGGER and SNDCTL_DSP_SETTRIGGER
860 */
861#define PCM_ENABLE_INPUT 0x00000001
862#define PCM_ENABLE_OUTPUT 0x00000002
863
864/*
865 * SNDCTL_DSP_BIND_CHANNEL
866 */
867#define DSP_BIND_QUERY 0x00000000
868#define DSP_BIND_FRONT 0x00000001
869#define DSP_BIND_SURR 0x00000002
870#define DSP_BIND_CENTER_LFE 0x00000004
871#define DSP_BIND_HANDSET 0x00000008
872#define DSP_BIND_MIC 0x00000010
873#define DSP_BIND_MODEM1 0x00000020
874#define DSP_BIND_MODEM2 0x00000040
875#define DSP_BIND_I2S 0x00000080
876#define DSP_BIND_SPDIF 0x00000100
877#define DSP_BIND_REAR 0x00000200
878
879/*
880 * SOUND_MIXER_READ_CAPS
881 */
882#define SOUND_CAP_EXCL_INPUT 0x00000001
883#define SOUND_CAP_NOLEGACY 0x00000004
884#define SOUND_CAP_NORECSRC 0x00000008
885
886/*
887 * The following ioctl is for internal use only -- it is used to
888 * coordinate /dev/sndstat numbering with file names in /dev/sound.
889 * Applications must not use it. (This is duplicated in sys/audioio.h
890 * as well.)
891 */
892#define SNDCTL_SUN_SEND_NUMBER __OSSIOW('X', 200, int)
893
894#ifdef __cplusplus
895}
896#endif
897
898#endif /* _SYS_AUDIO_OSS_H */