| 1 | /* |
| 2 | * soundcard.h |
| 3 | */ |
| 4 | |
| 5 | /*- |
| 6 | * SPDX-License-Identifier: BSD-2-Clause |
| 7 | * |
| 8 | * Copyright by Hannu Savolainen 1993 / 4Front Technologies 1993-2006 |
| 9 | * Modified for the new FreeBSD sound driver by Luigi Rizzo, 1997 |
| 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without |
| 12 | * modification, are permitted provided that the following conditions |
| 13 | * are met: |
| 14 | * 1. Redistributions of source code must retain the above copyright |
| 15 | * notice, this list of conditions and the following disclaimer. |
| 16 | * 2. Redistributions in binary form must reproduce the above |
| 17 | * copyright notice, this list of conditions and the following |
| 18 | * disclaimer in the documentation and/or other materials provided |
| 19 | * with the distribution. |
| 20 | * |
| 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' |
| 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
| 23 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
| 24 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR |
| 25 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
| 28 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
| 29 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
| 31 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 32 | * POSSIBILITY OF SUCH DAMAGE. |
| 33 | */ |
| 34 | |
| 35 | /* |
| 36 | * Unless coordinating changes with 4Front Technologies, do NOT make any |
| 37 | * modifications to ioctl commands, types, etc. that would break |
| 38 | * compatibility with the OSS API. |
| 39 | */ |
| 40 | |
| 41 | #ifndef _SYS_SOUNDCARD_H_ |
| 42 | #define _SYS_SOUNDCARD_H_ |
| 43 | /* |
| 44 | * If you make modifications to this file, please contact me before |
| 45 | * distributing the modified version. There is already enough |
| 46 | * diversity in the world. |
| 47 | * |
| 48 | * Regards, |
| 49 | * Hannu Savolainen |
| 50 | * hannu@voxware.pp.fi |
| 51 | * |
| 52 | ********************************************************************** |
| 53 | * PS.	The Hacker's Guide to VoxWare available from |
| 54 | * nic.funet.fi:pub/Linux/ALPHA/sound. The file is |
| 55 | *	snd-sdk-doc-0.1.ps.gz (gzipped postscript). It contains |
| 56 | *	some useful information about programming with VoxWare. |
| 57 | *	(NOTE! The pub/Linux/ALPHA/ directories are hidden. You have |
| 58 | *	to cd inside them before the files are accessible.) |
| 59 | ********************************************************************** |
| 60 | */ |
| 61 | |
| 62 | /* |
| 63 | * SOUND_VERSION is only used by the voxware driver. Hopefully apps |
| 64 | * should not depend on it, but rather look at the capabilities |
| 65 | * of the driver in the kernel! |
| 66 | */ |
| 67 | #define SOUND_VERSION 301 |
| 68 | #define VOXWARE		/* does this have any use ? */ |
| 69 | |
| 70 | /* |
| 71 | * Supported card ID numbers (Should be somewhere else? We keep |
| 72 | * them here just for compativility with the old driver, but these |
| 73 | * constants are of little or no use). |
| 74 | */ |
| 75 | |
| 76 | #define SNDCARD_ADLIB 1 |
| 77 | #define SNDCARD_SB 2 |
| 78 | #define SNDCARD_PAS 3 |
| 79 | #define SNDCARD_GUS 4 |
| 80 | #define SNDCARD_MPU401 5 |
| 81 | #define SNDCARD_SB16 6 |
| 82 | #define SNDCARD_SB16MIDI 7 |
| 83 | #define SNDCARD_UART6850 8 |
| 84 | #define SNDCARD_GUS16 9 |
| 85 | #define SNDCARD_MSS 10 |
| 86 | #define SNDCARD_PSS 11 |
| 87 | #define SNDCARD_SSCAPE 12 |
| 88 | #define SNDCARD_PSS_MPU 13 |
| 89 | #define SNDCARD_PSS_MSS 14 |
| 90 | #define SNDCARD_SSCAPE_MSS 15 |
| 91 | #define SNDCARD_TRXPRO 16 |
| 92 | #define SNDCARD_TRXPRO_SB 17 |
| 93 | #define SNDCARD_TRXPRO_MPU 18 |
| 94 | #define SNDCARD_MAD16 19 |
| 95 | #define SNDCARD_MAD16_MPU 20 |
| 96 | #define SNDCARD_CS4232 21 |
| 97 | #define SNDCARD_CS4232_MPU 22 |
| 98 | #define SNDCARD_MAUI 23 |
| 99 | #define SNDCARD_PSEUDO_MSS 24 |
| 100 | #define SNDCARD_AWE32 25 |
| 101 | #define SNDCARD_NSS 26 |
| 102 | #define SNDCARD_UART16550 27 |
| 103 | #define SNDCARD_OPL 28 |
| 104 | |
| 105 | #include <sys/types.h> |
| 106 | #include <machine/endian.h> |
| 107 | #ifndef _IOWR |
| 108 | #include <sys/ioccom.h> |
| 109 | #endif /* !_IOWR */ |
| 110 | |
| 111 | /* |
| 112 | * The first part of this file contains the new FreeBSD sound ioctl |
| 113 | * interface. Tries to minimize the number of different ioctls, and |
| 114 | * to be reasonably general. |
| 115 | * |
| 116 | * 970821: some of the new calls have not been implemented yet. |
| 117 | */ |
| 118 | |
| 119 | /* |
| 120 | * the following three calls extend the generic file descriptor |
| 121 | * interface. AIONWRITE is the dual of FIONREAD, i.e. returns the max |
| 122 | * number of bytes for a write operation to be non-blocking. |
| 123 | * |
| 124 | * AIOGSIZE/AIOSSIZE are used to change the behaviour of the device, |
| 125 | * from a character device (default) to a block device. In block mode, |
| 126 | * (not to be confused with blocking mode) the main difference for the |
| 127 | * application is that select() will return only when a complete |
| 128 | * block can be read/written to the device, whereas in character mode |
| 129 | * select will return true when one byte can be exchanged. For audio |
| 130 | * devices, character mode makes select almost useless since one byte |
| 131 | * will always be ready by the next sample time (which is often only a |
| 132 | * handful of microseconds away). |
| 133 | * Use a size of 0 or 1 to return to character mode. |
| 134 | */ |
| 135 | #define	AIONWRITE _IOR('A', 10, int) /* get # bytes to write */ |
| 136 | struct snd_size { |
| 137 | int play_size; |
| 138 | int rec_size; |
| 139 | }; |
| 140 | #define	AIOGSIZE _IOR('A', 11, struct snd_size)/* read current blocksize */ |
| 141 | #define	AIOSSIZE _IOWR('A', 11, struct snd_size) /* sets blocksize */ |
| 142 | |
| 143 | /* |
| 144 | * The following constants define supported audio formats. The |
| 145 | * encoding follows voxware conventions, i.e. 1 bit for each supported |
| 146 | * format. We extend it by using bit 31 (RO) to indicate full-duplex |
| 147 | * capability, and bit 29 (RO) to indicate that the card supports/ |
| 148 | * needs different formats on capture & playback channels. |
| 149 | * Bit 29 (RW) is used to indicate/ask stereo. |
| 150 | * |
| 151 | * The number of bits required to store the sample is: |
| 152 | * o 4 bits for the IDA ADPCM format, |
| 153 | * o 8 bits for 8-bit formats, mu-law and A-law, |
| 154 | * o 16 bits for the 16-bit formats, and |
| 155 | * o 32 bits for the 24/32-bit formats. |
| 156 | * o undefined for the MPEG audio format. |
| 157 | */ |
| 158 | |
| 159 | #define AFMT_QUERY	0x00000000	/* Return current format */ |
| 160 | #define AFMT_MU_LAW	0x00000001	/* Logarithmic mu-law */ |
| 161 | #define AFMT_A_LAW	0x00000002	/* Logarithmic A-law */ |
| 162 | #define AFMT_IMA_ADPCM	0x00000004	/* A 4:1 compressed format where 16-bit |
| 163 | 					 * squence represented using the |
| 164 | 					 * the average 4 bits per sample */ |
| 165 | #define AFMT_U8		0x00000008	/* Unsigned 8-bit */ |
| 166 | #define AFMT_S16_LE	0x00000010	/* Little endian signed 16-bit */ |
| 167 | #define AFMT_S16_BE	0x00000020	/* Big endian signed 16-bit */ |
| 168 | #define AFMT_S8		0x00000040	/* Signed 8-bit */ |
| 169 | #define AFMT_U16_LE	0x00000080	/* Little endian unsigned 16-bit */ |
| 170 | #define AFMT_U16_BE	0x00000100	/* Big endian unsigned 16-bit */ |
| 171 | #define AFMT_MPEG	0x00000200	/* MPEG MP2/MP3 audio */ |
| 172 | #define AFMT_AC3	0x00000400	/* Dolby Digital AC3 */ |
| 173 | |
| 174 | /* |
| 175 | * 32-bit formats below used for 24-bit audio data where the data is stored |
| 176 | * in the 24 most significant bits and the least significant bits are not used |
| 177 | * (should be set to 0). |
| 178 | */ |
| 179 | #define AFMT_S32_LE	0x00001000	/* Little endian signed 32-bit */ |
| 180 | #define AFMT_S32_BE	0x00002000	/* Big endian signed 32-bit */ |
| 181 | #define AFMT_U32_LE	0x00004000	/* Little endian unsigned 32-bit */ |
| 182 | #define AFMT_U32_BE	0x00008000	/* Big endian unsigned 32-bit */ |
| 183 | #define AFMT_S24_LE	0x00010000	/* Little endian signed 24-bit */ |
| 184 | #define AFMT_S24_BE	0x00020000	/* Big endian signed 24-bit */ |
| 185 | #define AFMT_U24_LE	0x00040000	/* Little endian unsigned 24-bit */ |
| 186 | #define AFMT_U24_BE	0x00080000	/* Big endian unsigned 24-bit */ |
| 187 | #define AFMT_F32_LE	0x10000000	/* Little endian 32-bit floating point */ |
| 188 | #define AFMT_F32_BE	0x20000000	/* Big endian 32-bit floating point */ |
| 189 | |
| 190 | /* Machine dependent AFMT_* definitions. */ |
| 191 | #if BYTE_ORDER == LITTLE_ENDIAN |
| 192 | #define AFMT_S16_NE	AFMT_S16_LE |
| 193 | #define AFMT_S24_NE	AFMT_S24_LE |
| 194 | #define AFMT_S32_NE	AFMT_S32_LE |
| 195 | #define AFMT_U16_NE	AFMT_U16_LE |
| 196 | #define AFMT_U24_NE	AFMT_U24_LE |
| 197 | #define AFMT_U32_NE	AFMT_U32_LE |
| 198 | #define AFMT_S16_OE	AFMT_S16_BE |
| 199 | #define AFMT_S24_OE	AFMT_S24_BE |
| 200 | #define AFMT_S32_OE	AFMT_S32_BE |
| 201 | #define AFMT_U16_OE	AFMT_U16_BE |
| 202 | #define AFMT_U24_OE	AFMT_U24_BE |
| 203 | #define AFMT_U32_OE	AFMT_U32_BE |
| 204 | #define AFMT_F32_NE	AFMT_F32_LE |
| 205 | #define AFMT_F32_OE	AFMT_F32_BE |
| 206 | #else |
| 207 | #define AFMT_S16_OE	AFMT_S16_LE |
| 208 | #define AFMT_S24_OE	AFMT_S24_LE |
| 209 | #define AFMT_S32_OE	AFMT_S32_LE |
| 210 | #define AFMT_U16_OE	AFMT_U16_LE |
| 211 | #define AFMT_U24_OE	AFMT_U24_LE |
| 212 | #define AFMT_U32_OE	AFMT_U32_LE |
| 213 | #define AFMT_S16_NE	AFMT_S16_BE |
| 214 | #define AFMT_S24_NE	AFMT_S24_BE |
| 215 | #define AFMT_S32_NE	AFMT_S32_BE |
| 216 | #define AFMT_U16_NE	AFMT_U16_BE |
| 217 | #define AFMT_U24_NE	AFMT_U24_BE |
| 218 | #define AFMT_U32_NE	AFMT_U32_BE |
| 219 | #define AFMT_F32_NE	AFMT_F32_BE |
| 220 | #define AFMT_F32_OE	AFMT_F32_LE |
| 221 | #endif |
| 222 | |
| 223 | #define AFMT_FLOAT	AFMT_F32_NE	/* compatibility alias */ |
| 224 | |
| 225 | #define AFMT_STEREO	0x10000000	/* can do/want stereo	*/ |
| 226 | |
| 227 | /* |
| 228 | * the following are really capabilities |
| 229 | */ |
| 230 | #define AFMT_WEIRD	0x20000000	/* weird hardware...	*/ |
| 231 | /* |
| 232 | * AFMT_WEIRD reports that the hardware might need to operate |
| 233 | * with different formats in the playback and capture |
| 234 | * channels when operating in full duplex. |
| 235 | * As an example, SoundBlaster16 cards only support U8 in one |
| 236 | * direction and S16 in the other one, and applications should |
| 237 | * be aware of this limitation. |
| 238 | */ |
| 239 | #define AFMT_FULLDUPLEX	0x80000000	/* can do full duplex	*/ |
| 240 | |
| 241 | /* |
| 242 | * The following structure is used to get/set format and sampling rate. |
| 243 | * While it would be better to have things such as stereo, bits per |
| 244 | * sample, endiannes, etc split in different variables, it turns out |
| 245 | * that formats are not that many, and not all combinations are possible. |
| 246 | * So we followed the Voxware approach of associating one bit to each |
| 247 | * format. |
| 248 | */ |
| 249 | |
| 250 | typedef struct _snd_chan_param { |
| 251 | u_long	play_rate;	/* sampling rate			*/ |
| 252 | u_long	rec_rate;	/* sampling rate			*/ |
| 253 | u_long	play_format;	/* everything describing the format	*/ |
| 254 | u_long	rec_format;	/* everything describing the format	*/ |
| 255 | } snd_chan_param; |
| 256 | #define	AIOGFMT _IOR('f', 12, snd_chan_param) /* get format */ |
| 257 | #define	AIOSFMT _IOWR('f', 12, snd_chan_param) /* sets format */ |
| 258 | |
| 259 | /* |
| 260 | * The following structure is used to get/set the mixer setting. |
| 261 | * Up to 32 mixers are supported, each one with up to 32 channels. |
| 262 | */ |
| 263 | typedef struct _snd_mix_param { |
| 264 | u_char	subdev;	/* which output				*/ |
| 265 | u_char	line;	/* which input				*/ |
| 266 | u_char	left,right; /* volumes, 0..255, 0 = mute	*/ |
| 267 | } snd_mix_param ; |
| 268 | |
| 269 | /* XXX AIOGMIX, AIOSMIX not implemented yet */ |
| 270 | #define AIOGMIX	_IOWR('A', 13, snd_mix_param)	/* return mixer status */ |
| 271 | #define AIOSMIX	_IOWR('A', 14, snd_mix_param)	/* sets mixer status */ |
| 272 | |
| 273 | /* |
| 274 | * channel specifiers used in AIOSTOP and AIOSYNC |
| 275 | */ |
| 276 | #define	AIOSYNC_PLAY	0x1	/* play chan */ |
| 277 | #define	AIOSYNC_CAPTURE	0x2	/* capture chan */ |
| 278 | /* AIOSTOP stop & flush a channel, returns the residual count */ |
| 279 | #define	AIOSTOP	_IOWR ('A', 15, int) |
| 280 | |
| 281 | /* alternate method used to notify the sync condition */ |
| 282 | #define	AIOSYNC_SIGNAL	0x100 |
| 283 | #define	AIOSYNC_SELECT	0x200 |
| 284 | |
| 285 | /* what the 'pos' field refers to */ |
| 286 | #define AIOSYNC_READY	0x400 |
| 287 | #define AIOSYNC_FREE	0x800 |
| 288 | |
| 289 | typedef struct _snd_sync_parm { |
| 290 | long chan ; /* play or capture channel, plus modifier */ |
| 291 | long pos; |
| 292 | } snd_sync_parm; |
| 293 | #define	AIOSYNC	_IOWR ('A', 15, snd_sync_parm)	/* misc. synchronization */ |
| 294 | |
| 295 | /* |
| 296 | * The following is used to return device capabilities. If the structure |
| 297 | * passed to the ioctl is zeroed, default values are returned for rate |
| 298 | * and formats, a bitmap of available mixers is returned, and values |
| 299 | * (inputs, different levels) for the first one are returned. |
| 300 | * |
| 301 | * If formats, mixers, inputs are instantiated, then detailed info |
| 302 | * are returned depending on the call. |
| 303 | */ |
| 304 | typedef struct _snd_capabilities { |
| 305 | u_long	rate_min, rate_max;	/* min-max sampling rate */ |
| 306 | u_long	formats; |
| 307 | u_long	bufsize; /* DMA buffer size */ |
| 308 | u_long	mixers; /* bitmap of available mixers */ |
| 309 | u_long	inputs; /* bitmap of available inputs (per mixer) */ |
| 310 | u_short	left, right;	/* how many levels are supported */ |
| 311 | } snd_capabilities; |
| 312 | #define AIOGCAP	_IOWR('A', 15, snd_capabilities)	/* get capabilities */ |
| 313 | |
| 314 | /* |
| 315 | * here is the old (Voxware) ioctl interface |
| 316 | */ |
| 317 | |
| 318 | /* |
| 319 | * IOCTL Commands for /dev/sequencer |
| 320 | */ |
| 321 | |
| 322 | #define SNDCTL_SEQ_RESET	_IO ('Q', 0) |
| 323 | #define SNDCTL_SEQ_SYNC		_IO ('Q', 1) |
| 324 | #define SNDCTL_SYNTH_INFO	_IOWR('Q', 2, struct synth_info) |
| 325 | #define SNDCTL_SEQ_CTRLRATE	_IOWR('Q', 3, int) /* Set/get timer res.(hz) */ |
| 326 | #define SNDCTL_SEQ_GETOUTCOUNT	_IOR ('Q', 4, int) |
| 327 | #define SNDCTL_SEQ_GETINCOUNT	_IOR ('Q', 5, int) |
| 328 | #define SNDCTL_SEQ_PERCMODE	_IOW ('Q', 6, int) |
| 329 | #define SNDCTL_FM_LOAD_INSTR	_IOW ('Q', 7, struct sbi_instrument)	/* Valid for FM only */ |
| 330 | #define SNDCTL_SEQ_TESTMIDI	_IOW ('Q', 8, int) |
| 331 | #define SNDCTL_SEQ_RESETSAMPLES	_IOW ('Q', 9, int) |
| 332 | #define SNDCTL_SEQ_NRSYNTHS	_IOR ('Q',10, int) |
| 333 | #define SNDCTL_SEQ_NRMIDIS	_IOR ('Q',11, int) |
| 334 | #define SNDCTL_MIDI_INFO	_IOWR('Q',12, struct midi_info) |
| 335 | #define SNDCTL_SEQ_THRESHOLD	_IOW ('Q',13, int) |
| 336 | #define SNDCTL_SEQ_TRESHOLD	SNDCTL_SEQ_THRESHOLD	/* there was once a typo */ |
| 337 | #define SNDCTL_SYNTH_MEMAVL	_IOWR('Q',14, int) /* in=dev#, out=memsize */ |
| 338 | #define SNDCTL_FM_4OP_ENABLE	_IOW ('Q',15, int) /* in=dev# */ |
| 339 | #define SNDCTL_PMGR_ACCESS	_IOWR('Q',16, struct patmgr_info) |
| 340 | #define SNDCTL_SEQ_PANIC	_IO ('Q',17) |
| 341 | #define SNDCTL_SEQ_OUTOFBAND	_IOW ('Q',18, struct seq_event_rec) |
| 342 | #define SNDCTL_SEQ_GETTIME	_IOR ('Q',19, int) |
| 343 | |
| 344 | struct seq_event_rec { |
| 345 | 	u_char arr[8]; |
| 346 | }; |
| 347 | |
| 348 | #define SNDCTL_TMR_TIMEBASE	_IOWR('T', 1, int) |
| 349 | #define SNDCTL_TMR_START	_IO ('T', 2) |
| 350 | #define SNDCTL_TMR_STOP		_IO ('T', 3) |
| 351 | #define SNDCTL_TMR_CONTINUE	_IO ('T', 4) |
| 352 | #define SNDCTL_TMR_TEMPO	_IOWR('T', 5, int) |
| 353 | #define SNDCTL_TMR_SOURCE	_IOWR('T', 6, int) |
| 354 | # define TMR_INTERNAL		0x00000001 |
| 355 | # define TMR_EXTERNAL		0x00000002 |
| 356 | #	define TMR_MODE_MIDI	0x00000010 |
| 357 | #	define TMR_MODE_FSK	0x00000020 |
| 358 | #	define TMR_MODE_CLS	0x00000040 |
| 359 | #	define TMR_MODE_SMPTE	0x00000080 |
| 360 | #define SNDCTL_TMR_METRONOME	_IOW ('T', 7, int) |
| 361 | #define SNDCTL_TMR_SELECT	_IOW ('T', 8, int) |
| 362 | |
| 363 | /* |
| 364 | *	Endian aware patch key generation algorithm. |
| 365 | */ |
| 366 | |
| 367 | #if defined(_AIX) || defined(AIX) |
| 368 | # define _PATCHKEY(id) (0xfd00|id) |
| 369 | #else |
| 370 | # define _PATCHKEY(id) ((id<<8)|0xfd) |
| 371 | #endif |
| 372 | |
| 373 | /* |
| 374 | *	Sample loading mechanism for internal synthesizers (/dev/sequencer) |
| 375 | *	The following patch_info structure has been designed to support |
| 376 | *	Gravis UltraSound. It tries to be universal format for uploading |
| 377 | *	sample based patches but is probably too limited. |
| 378 | */ |
| 379 | |
| 380 | struct patch_info { |
| 381 | /*		u_short key;		 Use GUS_PATCH here */ |
| 382 | 	short key;		 /* Use GUS_PATCH here */ |
| 383 | #define GUS_PATCH	_PATCHKEY(0x04) |
| 384 | #define OBSOLETE_GUS_PATCH	_PATCHKEY(0x02) |
| 385 | |
| 386 | 	short device_no;	/* Synthesizer number */ |
| 387 | 	short instr_no;		/* Midi pgm# */ |
| 388 | |
| 389 | 	u_long mode; |
| 390 | /* |
| 391 | * The least significant byte has the same format than the GUS .PAT |
| 392 | * files |
| 393 | */ |
| 394 | #define WAVE_16_BITS	0x01	/* bit 0 = 8 or 16 bit wave data. */ |
| 395 | #define WAVE_UNSIGNED	0x02	/* bit 1 = Signed - Unsigned data. */ |
| 396 | #define WAVE_LOOPING	0x04	/* bit 2 = looping enabled-1. */ |
| 397 | #define WAVE_BIDIR_LOOP	0x08	/* bit 3 = Set is bidirectional looping. */ |
| 398 | #define WAVE_LOOP_BACK	0x10	/* bit 4 = Set is looping backward. */ |
| 399 | #define WAVE_SUSTAIN_ON	0x20	/* bit 5 = Turn sustaining on. (Env. pts. 3)*/ |
| 400 | #define WAVE_ENVELOPES	0x40	/* bit 6 = Enable envelopes - 1 */ |
| 401 | 				/* 	(use the env_rate/env_offs fields). */ |
| 402 | /* Linux specific bits */ |
| 403 | #define WAVE_VIBRATO	0x00010000	/* The vibrato info is valid */ |
| 404 | #define WAVE_TREMOLO	0x00020000	/* The tremolo info is valid */ |
| 405 | #define WAVE_SCALE	0x00040000	/* The scaling info is valid */ |
| 406 | /* Other bits must be zeroed */ |
| 407 | |
| 408 | 	long len;	/* Size of the wave data in bytes */ |
| 409 | 	long loop_start, loop_end; /* Byte offsets from the beginning */ |
| 410 | |
| 411 | /* |
| 412 | * The base_freq and base_note fields are used when computing the |
| 413 | * playback speed for a note. The base_note defines the tone frequency |
| 414 | * which is heard if the sample is played using the base_freq as the |
| 415 | * playback speed. |
| 416 | * |
| 417 | * The low_note and high_note fields define the minimum and maximum note |
| 418 | * frequencies for which this sample is valid. It is possible to define |
| 419 | * more than one samples for an instrument number at the same time. The |
| 420 | * low_note and high_note fields are used to select the most suitable one. |
| 421 | * |
| 422 | * The fields base_note, high_note and low_note should contain |
| 423 | * the note frequency multiplied by 1000. For example value for the |
| 424 | * middle A is 440*1000. |
| 425 | */ |
| 426 | |
| 427 | 	u_int base_freq; |
| 428 | 	u_long base_note; |
| 429 | 	u_long high_note; |
| 430 | 	u_long low_note; |
| 431 | 	int panning;	/* -128=left, 127=right */ |
| 432 | 	int detuning; |
| 433 | |
| 434 | /*	New fields introduced in version 1.99.5	*/ |
| 435 | |
| 436 | /* Envelope. Enabled by mode bit WAVE_ENVELOPES	*/ |
| 437 | 	u_char	env_rate[ 6 ];	 /* GUS HW ramping rate */ |
| 438 | 	u_char	env_offset[ 6 ]; /* 255 == 100% */ |
| 439 | |
| 440 | 	/* |
| 441 | 	 * The tremolo, vibrato and scale info are not supported yet. |
| 442 | 	 * Enable by setting the mode bits WAVE_TREMOLO, WAVE_VIBRATO or |
| 443 | 	 * WAVE_SCALE |
| 444 | 	 */ |
| 445 | |
| 446 | 	u_char	tremolo_sweep; |
| 447 | 	u_char	tremolo_rate; |
| 448 | 	u_char	tremolo_depth; |
| 449 | |
| 450 | 	u_char	vibrato_sweep; |
| 451 | 	u_char	vibrato_rate; |
| 452 | 	u_char	vibrato_depth; |
| 453 | |
| 454 | 	int		scale_frequency; |
| 455 | 	u_int	scale_factor;		/* from 0 to 2048 or 0 to 2 */ |
| 456 | |
| 457 | 	int		volume; |
| 458 | 	int		spare[4]; |
| 459 | 	char data[1];	/* The waveform data starts here */ |
| 460 | }; |
| 461 | |
| 462 | struct sysex_info { |
| 463 | 	short key;		/* Use GUS_PATCH here */ |
| 464 | #define SYSEX_PATCH	_PATCHKEY(0x05) |
| 465 | #define MAUI_PATCH	_PATCHKEY(0x06) |
| 466 | 	short device_no;	/* Synthesizer number */ |
| 467 | 	long len;	/* Size of the sysex data in bytes */ |
| 468 | 	u_char data[1];	/* Sysex data starts here */ |
| 469 | }; |
| 470 | |
| 471 | /* |
| 472 | * Patch management interface (/dev/sequencer, /dev/patmgr#) |
| 473 | * Don't use these calls if you want to maintain compatibility with |
| 474 | * the future versions of the driver. |
| 475 | */ |
| 476 | |
| 477 | #define PS_NO_PATCHES		0	/* No patch support on device */ |
| 478 | #define	PS_MGR_NOT_OK		1	/* Plain patch support (no mgr) */ |
| 479 | #define	PS_MGR_OK		2	/* Patch manager supported */ |
| 480 | #define	PS_MANAGED		3	/* Patch manager running */ |
| 481 | |
| 482 | #define SNDCTL_PMGR_IFACE		_IOWR('P', 1, struct patmgr_info) |
| 483 | |
| 484 | /* |
| 485 | * The patmgr_info is a fixed size structure which is used for two |
| 486 | * different purposes. The intended use is for communication between |
| 487 | * the application using /dev/sequencer and the patch manager daemon |
| 488 | * associated with a synthesizer device (ioctl(SNDCTL_PMGR_ACCESS)). |
| 489 | * |
| 490 | * This structure is also used with ioctl(SNDCTL_PGMR_IFACE) which allows |
| 491 | * a patch manager daemon to read and write device parameters. This |
| 492 | * ioctl available through /dev/sequencer also. Avoid using it since it's |
| 493 | * extremely hardware dependent. In addition access through /dev/sequencer |
| 494 | * may confuse the patch manager daemon. |
| 495 | */ |
| 496 | |
| 497 | struct patmgr_info {	/* Note! size must be < 4k since kmalloc() is used */ |
| 498 | 	 u_long key;	/* Don't worry. Reserved for communication |
| 499 | 	 			 between the patch manager and the driver. */ |
| 500 | #define PM_K_EVENT		1 /* Event from the /dev/sequencer driver */ |
| 501 | #define PM_K_COMMAND		2 /* Request from an application */ |
| 502 | #define PM_K_RESPONSE		3 /* From patmgr to application */ |
| 503 | #define PM_ERROR		4 /* Error returned by the patmgr */ |
| 504 | 	 int device; |
| 505 | 	 int command; |
| 506 | |
| 507 | /* |
| 508 | * Commands 0x000 to 0xfff reserved for patch manager programs |
| 509 | */ |
| 510 | #define PM_GET_DEVTYPE	1	/* Returns type of the patch mgr interface of dev */ |
| 511 | #define		PMTYPE_FM2	1	/* 2 OP fm */ |
| 512 | #define		PMTYPE_FM4	2	/* Mixed 4 or 2 op FM (OPL-3) */ |
| 513 | #define		PMTYPE_WAVE	3	/* Wave table synthesizer (GUS) */ |
| 514 | #define PM_GET_NRPGM	2	/* Returns max # of midi programs in parm1 */ |
| 515 | #define PM_GET_PGMMAP	3	/* Returns map of loaded midi programs in data8 */ |
| 516 | #define PM_GET_PGM_PATCHES 4	/* Return list of patches of a program (parm1) */ |
| 517 | #define PM_GET_PATCH	5	/* Return patch header of patch parm1 */ |
| 518 | #define PM_SET_PATCH	6	/* Set patch header of patch parm1 */ |
| 519 | #define PM_READ_PATCH	7	/* Read patch (wave) data */ |
| 520 | #define PM_WRITE_PATCH	8	/* Write patch (wave) data */ |
| 521 | |
| 522 | /* |
| 523 | * Commands 0x1000 to 0xffff are for communication between the patch manager |
| 524 | * and the client |
| 525 | */ |
| 526 | #define _PM_LOAD_PATCH	0x100 |
| 527 | |
| 528 | /* |
| 529 | * Commands above 0xffff reserved for device specific use |
| 530 | */ |
| 531 | |
| 532 | 	long parm1; |
| 533 | 	long parm2; |
| 534 | 	long parm3; |
| 535 | |
| 536 | 	union { |
| 537 | 		u_char data8[4000]; |
| 538 | 		u_short data16[2000]; |
| 539 | 		u_long data32[1000]; |
| 540 | 		struct patch_info patch; |
| 541 | 	} data; |
| 542 | }; |
| 543 | |
| 544 | /* |
| 545 | * When a patch manager daemon is present, it will be informed by the |
| 546 | * driver when something important happens. For example when the |
| 547 | * /dev/sequencer is opened or closed. A record with key == PM_K_EVENT is |
| 548 | * returned. The command field contains the event type: |
| 549 | */ |
| 550 | #define PM_E_OPENED		1	/* /dev/sequencer opened */ |
| 551 | #define PM_E_CLOSED		2	/* /dev/sequencer closed */ |
| 552 | #define PM_E_PATCH_RESET	3	/* SNDCTL_RESETSAMPLES called */ |
| 553 | #define PM_E_PATCH_LOADED	4	/* A patch has been loaded by appl */ |
| 554 | |
| 555 | /* |
| 556 | * /dev/sequencer input events. |
| 557 | * |
| 558 | * The data written to the /dev/sequencer is a stream of events. Events |
| 559 | * are records of 4 or 8 bytes. The first byte defines the size. |
| 560 | * Any number of events can be written with a write call. There |
| 561 | * is a set of macros for sending these events. Use these macros if you |
| 562 | * want to maximize portability of your program. |
| 563 | * |
| 564 | * Events SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO. Are also input events. |
| 565 | * (All input events are currently 4 bytes long. Be prepared to support |
| 566 | * 8 byte events also. If you receive any event having first byte >= 128, |
| 567 | * it's a 8 byte event. |
| 568 | * |
| 569 | * The events are documented at the end of this file. |
| 570 | * |
| 571 | * Normal events (4 bytes) |
| 572 | * There is also a 8 byte version of most of the 4 byte events. The |
| 573 | * 8 byte one is recommended. |
| 574 | */ |
| 575 | #define SEQ_NOTEOFF		0 |
| 576 | #define SEQ_FMNOTEOFF		SEQ_NOTEOFF	/* Just old name */ |
| 577 | #define SEQ_NOTEON		1 |
| 578 | #define	SEQ_FMNOTEON		SEQ_NOTEON |
| 579 | #define SEQ_WAIT		TMR_WAIT_ABS |
| 580 | #define SEQ_PGMCHANGE		3 |
| 581 | #define SEQ_FMPGMCHANGE		SEQ_PGMCHANGE |
| 582 | #define SEQ_SYNCTIMER		TMR_START |
| 583 | #define SEQ_MIDIPUTC		5 |
| 584 | #define SEQ_DRUMON		6	/*** OBSOLETE ***/ |
| 585 | #define SEQ_DRUMOFF		7	/*** OBSOLETE ***/ |
| 586 | #define SEQ_ECHO		TMR_ECHO	/* For synching programs with output */ |
| 587 | #define SEQ_AFTERTOUCH		9 |
| 588 | #define SEQ_CONTROLLER		10 |
| 589 | |
| 590 | /* |
| 591 | *	Midi controller numbers |
| 592 | * |
| 593 | * Controllers 0 to 31 (0x00 to 0x1f) and 32 to 63 (0x20 to 0x3f) |
| 594 | * are continuous controllers. |
| 595 | * In the MIDI 1.0 these controllers are sent using two messages. |
| 596 | * Controller numbers 0 to 31 are used to send the MSB and the |
| 597 | * controller numbers 32 to 63 are for the LSB. Note that just 7 bits |
| 598 | * are used in MIDI bytes. |
| 599 | */ |
| 600 | |
| 601 | #define	CTL_BANK_SELECT		0x00 |
| 602 | #define	CTL_MODWHEEL		0x01 |
| 603 | #define CTL_BREATH		0x02 |
| 604 | /*	undefined		0x03 */ |
| 605 | #define CTL_FOOT		0x04 |
| 606 | #define CTL_PORTAMENTO_TIME	0x05 |
| 607 | #define CTL_DATA_ENTRY		0x06 |
| 608 | #define CTL_MAIN_VOLUME		0x07 |
| 609 | #define CTL_BALANCE		0x08 |
| 610 | /*	undefined		0x09 */ |
| 611 | #define CTL_PAN			0x0a |
| 612 | #define CTL_EXPRESSION		0x0b |
| 613 | /*	undefined		0x0c - 0x0f */ |
| 614 | #define CTL_GENERAL_PURPOSE1	0x10 |
| 615 | #define CTL_GENERAL_PURPOSE2	0x11 |
| 616 | #define CTL_GENERAL_PURPOSE3	0x12 |
| 617 | #define CTL_GENERAL_PURPOSE4	0x13 |
| 618 | /*	undefined		0x14 - 0x1f */ |
| 619 | |
| 620 | /*	undefined		0x20 */ |
| 621 | |
| 622 | /* |
| 623 | * The controller numbers 0x21 to 0x3f are reserved for the |
| 624 | * least significant bytes of the controllers 0x00 to 0x1f. |
| 625 | * These controllers are not recognised by the driver. |
| 626 | * |
| 627 | * Controllers 64 to 69 (0x40 to 0x45) are on/off switches. |
| 628 | * 0=OFF and 127=ON (intermediate values are possible) |
| 629 | */ |
| 630 | #define CTL_DAMPER_PEDAL	0x40 |
| 631 | #define CTL_SUSTAIN		CTL_DAMPER_PEDAL	/* Alias */ |
| 632 | #define CTL_HOLD		CTL_DAMPER_PEDAL	/* Alias */ |
| 633 | #define CTL_PORTAMENTO		0x41 |
| 634 | #define CTL_SOSTENUTO		0x42 |
| 635 | #define CTL_SOFT_PEDAL		0x43 |
| 636 | /*	undefined		0x44 */ |
| 637 | #define CTL_HOLD2		0x45 |
| 638 | /*	undefined		0x46 - 0x4f */ |
| 639 | |
| 640 | #define CTL_GENERAL_PURPOSE5	0x50 |
| 641 | #define CTL_GENERAL_PURPOSE6	0x51 |
| 642 | #define CTL_GENERAL_PURPOSE7	0x52 |
| 643 | #define CTL_GENERAL_PURPOSE8	0x53 |
| 644 | /*	undefined		0x54 - 0x5a */ |
| 645 | #define CTL_EXT_EFF_DEPTH	0x5b |
| 646 | #define CTL_TREMOLO_DEPTH	0x5c |
| 647 | #define CTL_CHORUS_DEPTH	0x5d |
| 648 | #define CTL_DETUNE_DEPTH	0x5e |
| 649 | #define CTL_CELESTE_DEPTH	CTL_DETUNE_DEPTH /* Alias for the above one */ |
| 650 | #define CTL_PHASER_DEPTH	0x5f |
| 651 | #define CTL_DATA_INCREMENT	0x60 |
| 652 | #define CTL_DATA_DECREMENT	0x61 |
| 653 | #define CTL_NONREG_PARM_NUM_LSB	0x62 |
| 654 | #define CTL_NONREG_PARM_NUM_MSB	0x63 |
| 655 | #define CTL_REGIST_PARM_NUM_LSB	0x64 |
| 656 | #define CTL_REGIST_PARM_NUM_MSB	0x65 |
| 657 | /*	undefined		0x66 - 0x78 */ |
| 658 | /*	reserved		0x79 - 0x7f */ |
| 659 | |
| 660 | /* Pseudo controllers (not midi compatible) */ |
| 661 | #define CTRL_PITCH_BENDER	255 |
| 662 | #define CTRL_PITCH_BENDER_RANGE	254 |
| 663 | #define CTRL_EXPRESSION		253	/* Obsolete */ |
| 664 | #define CTRL_MAIN_VOLUME	252	/* Obsolete */ |
| 665 | |
| 666 | #define SEQ_BALANCE		11 |
| 667 | #define SEQ_VOLMODE 12 |
| 668 | |
| 669 | /* |
| 670 | * Volume mode decides how volumes are used |
| 671 | */ |
| 672 | |
| 673 | #define VOL_METHOD_ADAGIO	1 |
| 674 | #define VOL_METHOD_LINEAR	2 |
| 675 | |
| 676 | /* |
| 677 | * Note! SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO are used also as |
| 678 | *	 input events. |
| 679 | */ |
| 680 | |
| 681 | /* |
| 682 | * Event codes 0xf0 to 0xfc are reserved for future extensions. |
| 683 | */ |
| 684 | |
| 685 | #define SEQ_FULLSIZE		0xfd	/* Long events */ |
| 686 | /* |
| 687 | * SEQ_FULLSIZE events are used for loading patches/samples to the |
| 688 | * synthesizer devices. These events are passed directly to the driver |
| 689 | * of the associated synthesizer device. There is no limit to the size |
| 690 | * of the extended events. These events are not queued but executed |
| 691 | * immediately when the write() is called (execution can take several |
| 692 | * seconds of time). |
| 693 | * |
| 694 | * When a SEQ_FULLSIZE message is written to the device, it must |
| 695 | * be written using exactly one write() call. Other events cannot |
| 696 | * be mixed to the same write. |
| 697 | * |
| 698 | * For FM synths (YM3812/OPL3) use struct sbi_instrument and write |
| 699 | * it to the /dev/sequencer. Don't write other data together with |
| 700 | * the instrument structure Set the key field of the structure to |
| 701 | * FM_PATCH. The device field is used to route the patch to the |
| 702 | * corresponding device. |
| 703 | * |
| 704 | * For Gravis UltraSound use struct patch_info. Initialize the key field |
| 705 | * to GUS_PATCH. |
| 706 | */ |
| 707 | #define SEQ_PRIVATE	0xfe	/* Low level HW dependent events (8 bytes) */ |
| 708 | #define SEQ_EXTENDED	0xff	/* Extended events (8 bytes) OBSOLETE */ |
| 709 | |
| 710 | /* |
| 711 | * Record for FM patches |
| 712 | */ |
| 713 | |
| 714 | typedef u_char sbi_instr_data[32]; |
| 715 | |
| 716 | struct sbi_instrument { |
| 717 | 	u_short	key;	/* FM_PATCH or OPL3_PATCH */ |
| 718 | #define FM_PATCH	_PATCHKEY(0x01) |
| 719 | #define OPL3_PATCH	_PATCHKEY(0x03) |
| 720 | 	short		device;		/* Synth# (0-4)	*/ |
| 721 | 	int 		channel;	/* Program# to be initialized */ |
| 722 | 	sbi_instr_data	operators;	/* Reg. settings for operator cells |
| 723 | 					 * (.SBI format)	*/ |
| 724 | }; |
| 725 | |
| 726 | struct synth_info {	/* Read only */ |
| 727 | 	char	name[30]; |
| 728 | 	int	device;		/* 0-N. INITIALIZE BEFORE CALLING */ |
| 729 | 	int	synth_type; |
| 730 | #define SYNTH_TYPE_FM			0 |
| 731 | #define SYNTH_TYPE_SAMPLE		1 |
| 732 | #define SYNTH_TYPE_MIDI			2	/* Midi interface */ |
| 733 | |
| 734 | 	int	synth_subtype; |
| 735 | #define FM_TYPE_ADLIB			0x00 |
| 736 | #define FM_TYPE_OPL3			0x01 |
| 737 | #define MIDI_TYPE_MPU401		0x401 |
| 738 | |
| 739 | #define SAMPLE_TYPE_BASIC		0x10 |
| 740 | #define SAMPLE_TYPE_GUS			SAMPLE_TYPE_BASIC |
| 741 | #define SAMPLE_TYPE_AWE32		0x20 |
| 742 | |
| 743 | 	int	perc_mode;	/* No longer supported */ |
| 744 | 	int	nr_voices; |
| 745 | 	int	nr_drums;	/* Obsolete field */ |
| 746 | 	int	instr_bank_size; |
| 747 | 	u_long	capabilities; |
| 748 | #define SYNTH_CAP_PERCMODE	0x00000001 /* No longer used */ |
| 749 | #define SYNTH_CAP_OPL3		0x00000002 /* Set if OPL3 supported */ |
| 750 | #define SYNTH_CAP_INPUT		0x00000004 /* Input (MIDI) device */ |
| 751 | 	int	dummies[19];	/* Reserve space */ |
| 752 | }; |
| 753 | |
| 754 | struct sound_timer_info { |
| 755 | 	char name[32]; |
| 756 | 	int caps; |
| 757 | }; |
| 758 | |
| 759 | struct midi_info { |
| 760 | 	char		name[30]; |
| 761 | 	int		device;		/* 0-N. INITIALIZE BEFORE CALLING */ |
| 762 | 	u_long	capabilities;	/* To be defined later */ |
| 763 | 	int		dev_type; |
| 764 | 	int		dummies[18];	/* Reserve space */ |
| 765 | }; |
| 766 | |
| 767 | /* |
| 768 | * ioctl commands for the /dev/midi## |
| 769 | */ |
| 770 | typedef struct { |
| 771 | 	u_char cmd; |
| 772 | 	char nr_args, nr_returns; |
| 773 | 	u_char data[30]; |
| 774 | } mpu_command_rec; |
| 775 | |
| 776 | #define SNDCTL_MIDI_PRETIME	_IOWR('m', 0, int) |
| 777 | #define SNDCTL_MIDI_MPUMODE	_IOWR('m', 1, int) |
| 778 | #define SNDCTL_MIDI_MPUCMD	_IOWR('m', 2, mpu_command_rec) |
| 779 | #define MIOSPASSTHRU		_IOWR('m', 3, int) |
| 780 | #define MIOGPASSTHRU		_IOWR('m', 4, int) |
| 781 | |
| 782 | /* |
| 783 | * IOCTL commands for /dev/dsp and /dev/audio |
| 784 | */ |
| 785 | |
| 786 | #define SNDCTL_DSP_HALT		_IO ('P', 0) |
| 787 | #define SNDCTL_DSP_RESET	SNDCTL_DSP_HALT |
| 788 | #define SNDCTL_DSP_SYNC		_IO ('P', 1) |
| 789 | #define SNDCTL_DSP_SPEED	_IOWR('P', 2, int) |
| 790 | #define SNDCTL_DSP_STEREO	_IOWR('P', 3, int) |
| 791 | #define SNDCTL_DSP_GETBLKSIZE	_IOR('P', 4, int) |
| 792 | #define SNDCTL_DSP_SETBLKSIZE _IOW('P', 4, int) |
| 793 | #define SNDCTL_DSP_SETFMT	_IOWR('P',5, int) /* Selects ONE fmt*/ |
| 794 | |
| 795 | /* |
| 796 | * SOUND_PCM_WRITE_CHANNELS is not that different |
| 797 | * from SNDCTL_DSP_STEREO |
| 798 | */ |
| 799 | #define SOUND_PCM_WRITE_CHANNELS	_IOWR('P', 6, int) |
| 800 | #define SNDCTL_DSP_CHANNELS	SOUND_PCM_WRITE_CHANNELS |
| 801 | #define SOUND_PCM_WRITE_FILTER	_IOWR('P', 7, int) |
| 802 | #define SNDCTL_DSP_POST		_IO ('P', 8) |
| 803 | |
| 804 | /* |
| 805 | * SNDCTL_DSP_SETBLKSIZE and the following two calls mostly do |
| 806 | * the same thing, i.e. set the block size used in DMA transfers. |
| 807 | */ |
| 808 | #define SNDCTL_DSP_SUBDIVIDE	_IOWR('P', 9, int) |
| 809 | #define SNDCTL_DSP_SETFRAGMENT	_IOWR('P',10, int) |
| 810 | |
| 811 | #define SNDCTL_DSP_GETFMTS	_IOR ('P',11, int) /* Returns a mask */ |
| 812 | /* |
| 813 | * Buffer status queries. |
| 814 | */ |
| 815 | typedef struct audio_buf_info { |
| 816 | int fragments;	/* # of avail. frags (partly used ones not counted) */ |
| 817 | int fragstotal;	/* Total # of fragments allocated */ |
| 818 | int fragsize;	/* Size of a fragment in bytes */ |
| 819 | |
| 820 | int bytes;	/* Avail. space in bytes (includes partly used fragments) */ |
| 821 | 		/* Note! 'bytes' could be more than fragments*fragsize */ |
| 822 | } audio_buf_info; |
| 823 | |
| 824 | #define SNDCTL_DSP_GETOSPACE	_IOR ('P',12, audio_buf_info) |
| 825 | #define SNDCTL_DSP_GETISPACE	_IOR ('P',13, audio_buf_info) |
| 826 | |
| 827 | /* |
| 828 | * SNDCTL_DSP_NONBLOCK is the same (but less powerful, since the |
| 829 | * action cannot be undone) of FIONBIO. The same can be achieved |
| 830 | * by opening the device with O_NDELAY |
| 831 | */ |
| 832 | #define SNDCTL_DSP_NONBLOCK	_IO ('P',14) |
| 833 | |
| 834 | #define SNDCTL_DSP_GETCAPS	_IOR ('P',15, int) |
| 835 | #	define PCM_CAP_REVISION		0x000000ff	/* Bits for revision level (0 to 255) */ |
| 836 | #	define PCM_CAP_DUPLEX		0x00000100	/* Full duplex record/playback */ |
| 837 | #	define PCM_CAP_REALTIME		0x00000200	/* Not in use */ |
| 838 | #	define PCM_CAP_BATCH		0x00000400	/* Device has some kind of */ |
| 839 | 							/* internal buffers which may */ |
| 840 | 							/* cause some delays and */ |
| 841 | 							/* decrease precision of timing */ |
| 842 | #	define PCM_CAP_COPROC		0x00000800	/* Has a coprocessor */ |
| 843 | 							/* Sometimes it's a DSP */ |
| 844 | 							/* but usually not */ |
| 845 | #	define PCM_CAP_TRIGGER		0x00001000	/* Supports SETTRIGGER */ |
| 846 | #	define PCM_CAP_MMAP		0x00002000	/* Supports mmap() */ |
| 847 | #	define PCM_CAP_MULTI		0x00004000	/* Supports multiple open */ |
| 848 | #	define PCM_CAP_BIND		0x00008000	/* Supports binding to front/rear/center/lfe */ |
| 849 | # 	define PCM_CAP_INPUT		0x00010000	/* Supports recording */ |
| 850 | # 	define PCM_CAP_OUTPUT		0x00020000	/* Supports playback */ |
| 851 | #	define PCM_CAP_VIRTUAL		0x00040000	/* Virtual device */ |
| 852 | /* 0x00040000 and 0x00080000 reserved for future use */ |
| 853 | |
| 854 | /* Analog/digital control capabilities */ |
| 855 | #	define PCM_CAP_ANALOGOUT	0x00100000 |
| 856 | #	define PCM_CAP_ANALOGIN		0x00200000 |
| 857 | #	define PCM_CAP_DIGITALOUT	0x00400000 |
| 858 | #	define PCM_CAP_DIGITALIN	0x00800000 |
| 859 | #	define PCM_CAP_ADMASK		0x00f00000 |
| 860 | /* |
| 861 | * NOTE! (capabilities & PCM_CAP_ADMASK)==0 means just that the |
| 862 | * digital/analog interface control features are not supported by the |
| 863 | * device/driver. However the device still supports analog, digital or |
| 864 | * both inputs/outputs (depending on the device). See the OSS Programmer's |
| 865 | * Guide for full details. |
| 866 | */ |
| 867 | #	define PCM_CAP_SPECIAL		0x01000000	/* Not for ordinary "multimedia" use */ |
| 868 | #	define PCM_CAP_SHADOW		0x00000000	/* OBSOLETE */ |
| 869 | |
| 870 | /* |
| 871 | * Preferred channel usage. These bits can be used to |
| 872 | * give recommendations to the application. Used by few drivers. |
| 873 | * For example if ((caps & DSP_CH_MASK) == DSP_CH_MONO) means that |
| 874 | * the device works best in mono mode. However it doesn't necessarily mean |
| 875 | * that the device cannot be used in stereo. These bits should only be used |
| 876 | * by special applications such as multi track hard disk recorders to find |
| 877 | * out the initial setup. However the user should be able to override this |
| 878 | * selection. |
| 879 | * |
| 880 | * To find out which modes are actually supported the application should |
| 881 | * try to select them using SNDCTL_DSP_CHANNELS. |
| 882 | */ |
| 883 | #	define DSP_CH_MASK		0x06000000	/* Mask */ |
| 884 | #	define DSP_CH_ANY		0x00000000	/* No preferred mode */ |
| 885 | #	define DSP_CH_MONO		0x02000000 |
| 886 | #	define DSP_CH_STEREO		0x04000000 |
| 887 | #	define DSP_CH_MULTI		0x06000000	/* More than two channels */ |
| 888 | |
| 889 | #	define PCM_CAP_HIDDEN		0x08000000	/* Hidden device */ |
| 890 | #	define PCM_CAP_FREERATE		0x10000000 |
| 891 | #	define PCM_CAP_MODEM		0x20000000	/* Modem device */ |
| 892 | #	define PCM_CAP_DEFAULT		0x40000000	/* "Default" device */ |
| 893 | |
| 894 | /* |
| 895 | * The PCM_CAP_* capability names were known as DSP_CAP_* prior OSS 4.0 |
| 896 | * so it's necessary to define the older names too. |
| 897 | */ |
| 898 | #define DSP_CAP_ADMASK		PCM_CAP_ADMASK |
| 899 | #define DSP_CAP_ANALOGIN	PCM_CAP_ANALOGIN |
| 900 | #define DSP_CAP_ANALOGOUT	PCM_CAP_ANALOGOUT |
| 901 | #define DSP_CAP_BATCH		PCM_CAP_BATCH |
| 902 | #define DSP_CAP_BIND		PCM_CAP_BIND |
| 903 | #define DSP_CAP_COPROC		PCM_CAP_COPROC |
| 904 | #define DSP_CAP_DEFAULT		PCM_CAP_DEFAULT |
| 905 | #define DSP_CAP_DIGITALIN	PCM_CAP_DIGITALIN |
| 906 | #define DSP_CAP_DIGITALOUT	PCM_CAP_DIGITALOUT |
| 907 | #define DSP_CAP_DUPLEX		PCM_CAP_DUPLEX |
| 908 | #define DSP_CAP_FREERATE	PCM_CAP_FREERATE |
| 909 | #define DSP_CAP_HIDDEN		PCM_CAP_HIDDEN |
| 910 | #define DSP_CAP_INPUT		PCM_CAP_INPUT |
| 911 | #define DSP_CAP_MMAP		PCM_CAP_MMAP |
| 912 | #define DSP_CAP_MODEM		PCM_CAP_MODEM |
| 913 | #define DSP_CAP_MULTI		PCM_CAP_MULTI |
| 914 | #define DSP_CAP_OUTPUT		PCM_CAP_OUTPUT |
| 915 | #define DSP_CAP_REALTIME	PCM_CAP_REALTIME |
| 916 | #define DSP_CAP_REVISION	PCM_CAP_REVISION |
| 917 | #define DSP_CAP_SHADOW		PCM_CAP_SHADOW |
| 918 | #define DSP_CAP_TRIGGER		PCM_CAP_TRIGGER |
| 919 | #define DSP_CAP_VIRTUAL		PCM_CAP_VIRTUAL |
| 920 | |
| 921 | /* |
| 922 | * What do these function do ? |
| 923 | */ |
| 924 | #define SNDCTL_DSP_GETTRIGGER	_IOR ('P',16, int) |
| 925 | #define SNDCTL_DSP_SETTRIGGER	_IOW ('P',16, int) |
| 926 | #define PCM_ENABLE_INPUT	0x00000001 |
| 927 | #define PCM_ENABLE_OUTPUT	0x00000002 |
| 928 | |
| 929 | typedef struct count_info { |
| 930 | 	int bytes;	/* Total # of bytes processed */ |
| 931 | 	int blocks;	/* # of fragment transitions since last time */ |
| 932 | 	int ptr;	/* Current DMA pointer value */ |
| 933 | } count_info; |
| 934 | |
| 935 | /* |
| 936 | * GETIPTR and GETISPACE are not that different... same for out. |
| 937 | */ |
| 938 | #define SNDCTL_DSP_GETIPTR	_IOR ('P',17, count_info) |
| 939 | #define SNDCTL_DSP_GETOPTR	_IOR ('P',18, count_info) |
| 940 | |
| 941 | typedef struct buffmem_desc { |
| 942 | 	caddr_t buffer; |
| 943 | 	int size; |
| 944 | } buffmem_desc; |
| 945 | |
| 946 | #define SNDCTL_DSP_MAPINBUF	_IOR ('P', 19, buffmem_desc) |
| 947 | #define SNDCTL_DSP_MAPOUTBUF	_IOR ('P', 20, buffmem_desc) |
| 948 | #define SNDCTL_DSP_SETSYNCRO	_IO ('P', 21) |
| 949 | #define SNDCTL_DSP_SETDUPLEX	_IO ('P', 22) |
| 950 | #define SNDCTL_DSP_GETODELAY	_IOR ('P', 23, int) |
| 951 | |
| 952 | /* |
| 953 | * I guess these are the readonly version of the same |
| 954 | * functions that exist above as SNDCTL_DSP_... |
| 955 | */ |
| 956 | #define SOUND_PCM_READ_RATE	_IOR ('P', 2, int) |
| 957 | #define SOUND_PCM_READ_CHANNELS	_IOR ('P', 6, int) |
| 958 | #define SOUND_PCM_READ_BITS	_IOR ('P', 5, int) |
| 959 | #define SOUND_PCM_READ_FILTER	_IOR ('P', 7, int) |
| 960 | |
| 961 | /* |
| 962 | * ioctl calls to be used in communication with coprocessors and |
| 963 | * DSP chips. |
| 964 | */ |
| 965 | |
| 966 | typedef struct copr_buffer { |
| 967 | 	int command;	/* Set to 0 if not used */ |
| 968 | 	int flags; |
| 969 | #define CPF_NONE		0x0000 |
| 970 | #define CPF_FIRST		0x0001	/* First block */ |
| 971 | #define CPF_LAST		0x0002	/* Last block */ |
| 972 | 	int len; |
| 973 | 	int offs;	/* If required by the device (0 if not used) */ |
| 974 | |
| 975 | 	u_char data[4000]; /* NOTE! 4000 is not 4k */ |
| 976 | } copr_buffer; |
| 977 | |
| 978 | typedef struct copr_debug_buf { |
| 979 | 	int command;	/* Used internally. Set to 0 */ |
| 980 | 	int parm1; |
| 981 | 	int parm2; |
| 982 | 	int flags; |
| 983 | 	int len;	/* Length of data in bytes */ |
| 984 | } copr_debug_buf; |
| 985 | |
| 986 | typedef struct copr_msg { |
| 987 | 	int len; |
| 988 | 	u_char data[4000]; |
| 989 | } copr_msg; |
| 990 | |
| 991 | #define SNDCTL_COPR_RESET _IO ('C', 0) |
| 992 | #define SNDCTL_COPR_LOAD	_IOWR('C', 1, copr_buffer) |
| 993 | #define SNDCTL_COPR_RDATA	_IOWR('C', 2, copr_debug_buf) |
| 994 | #define SNDCTL_COPR_RCODE	_IOWR('C', 3, copr_debug_buf) |
| 995 | #define SNDCTL_COPR_WDATA	_IOW ('C', 4, copr_debug_buf) |
| 996 | #define SNDCTL_COPR_WCODE	_IOW ('C', 5, copr_debug_buf) |
| 997 | #define SNDCTL_COPR_RUN		_IOWR('C', 6, copr_debug_buf) |
| 998 | #define SNDCTL_COPR_HALT	_IOWR('C', 7, copr_debug_buf) |
| 999 | #define SNDCTL_COPR_SENDMSG	_IOW ('C', 8, copr_msg) |
| 1000 | #define SNDCTL_COPR_RCVMSG	_IOR ('C', 9, copr_msg) |
| 1001 | |
| 1002 | /* |
| 1003 | * IOCTL commands for /dev/mixer |
| 1004 | */ |
| 1005 | |
| 1006 | /* |
| 1007 | * Mixer devices |
| 1008 | * |
| 1009 | * There can be up to 20 different analog mixer channels. The |
| 1010 | * SOUND_MIXER_NRDEVICES gives the currently supported maximum. |
| 1011 | * The SOUND_MIXER_READ_DEVMASK returns a bitmask which tells |
| 1012 | * the devices supported by the particular mixer. |
| 1013 | */ |
| 1014 | |
| 1015 | #define SOUND_MIXER_NRDEVICES	25 |
| 1016 | #define SOUND_MIXER_VOLUME	0	/* Master output level */ |
| 1017 | #define SOUND_MIXER_BASS	1	/* Treble level of all output channels */ |
| 1018 | #define SOUND_MIXER_TREBLE	2	/* Bass level of all output channels */ |
| 1019 | #define SOUND_MIXER_SYNTH	3	/* Volume of synthesier input */ |
| 1020 | #define SOUND_MIXER_PCM		4	/* Output level for the audio device */ |
| 1021 | #define SOUND_MIXER_SPEAKER	5	/* Output level for the PC speaker |
| 1022 | 					 * signals */ |
| 1023 | #define SOUND_MIXER_LINE	6	/* Volume level for the line in jack */ |
| 1024 | #define SOUND_MIXER_MIC		7	/* Volume for the signal coming from |
| 1025 | 					 * the microphone jack */ |
| 1026 | #define SOUND_MIXER_CD		8	/* Volume level for the input signal |
| 1027 | 					 * connected to the CD audio input */ |
| 1028 | #define SOUND_MIXER_IMIX	9	/* Recording monitor. It controls the |
| 1029 | 					 * output volume of the selected |
| 1030 | 					 * recording sources while recording */ |
| 1031 | #define SOUND_MIXER_ALTPCM	10	/* Volume of the alternative codec |
| 1032 | 					 * device */ |
| 1033 | #define SOUND_MIXER_RECLEV	11	/* Global recording level */ |
| 1034 | #define SOUND_MIXER_IGAIN	12	/* Input gain */ |
| 1035 | #define SOUND_MIXER_OGAIN	13	/* Output gain */ |
| 1036 | /* |
| 1037 | * The AD1848 codec and compatibles have three line level inputs |
| 1038 | * (line, aux1 and aux2). Since each card manufacturer have assigned |
| 1039 | * different meanings to these inputs, it's inpractical to assign |
| 1040 | * specific meanings (line, cd, synth etc.) to them. |
| 1041 | */ |
| 1042 | #define SOUND_MIXER_LINE1	14	/* Input source 1 (aux1) */ |
| 1043 | #define SOUND_MIXER_LINE2	15	/* Input source 2 (aux2) */ |
| 1044 | #define SOUND_MIXER_LINE3	16	/* Input source 3 (line) */ |
| 1045 | #define SOUND_MIXER_DIGITAL1 17 /* Digital (input) 1 */ |
| 1046 | #define SOUND_MIXER_DIGITAL2 18 /* Digital (input) 2 */ |
| 1047 | #define SOUND_MIXER_DIGITAL3 19 /* Digital (input) 3 */ |
| 1048 | #define SOUND_MIXER_PHONEIN 20 /* Phone input */ |
| 1049 | #define SOUND_MIXER_PHONEOUT 21 /* Phone output */ |
| 1050 | #define SOUND_MIXER_VIDEO 22 /* Video/TV (audio) in */ |
| 1051 | #define SOUND_MIXER_RADIO 23 /* Radio in */ |
| 1052 | #define SOUND_MIXER_MONITOR 24 /* Monitor (usually mic) volume */ |
| 1053 | |
| 1054 | /* |
| 1055 | * Some on/off settings (SOUND_SPECIAL_MIN - SOUND_SPECIAL_MAX) |
| 1056 | * Not counted to SOUND_MIXER_NRDEVICES, but use the same number space |
| 1057 | */ |
| 1058 | #define SOUND_ONOFF_MIN		28 |
| 1059 | #define SOUND_ONOFF_MAX		30 |
| 1060 | #define SOUND_MIXER_MUTE	28	/* 0 or 1 */ |
| 1061 | #define SOUND_MIXER_ENHANCE	29	/* Enhanced stereo (0, 40, 60 or 80) */ |
| 1062 | #define SOUND_MIXER_LOUD	30	/* 0 or 1 */ |
| 1063 | |
| 1064 | /* Note!	Number 31 cannot be used since the sign bit is reserved */ |
| 1065 | #define SOUND_MIXER_NONE 31 |
| 1066 | |
| 1067 | #define SOUND_DEVICE_LABELS	{ \ |
| 1068 | 	"Vol ", "Bass ", "Trebl", "Synth", "Pcm ", "Spkr ", "Line ", \ |
| 1069 | 	"Mic ", "CD ", "Mix ", "Pcm2 ", "Rec ", "IGain", "OGain", \ |
| 1070 | 	"Line1", "Line2", "Line3", "Digital1", "Digital2", "Digital3", \ |
| 1071 | 	"PhoneIn", "PhoneOut", "Video", "Radio", "Monitor"} |
| 1072 | |
| 1073 | #define SOUND_DEVICE_NAMES	{ \ |
| 1074 | 	"vol", "bass", "treble", "synth", "pcm", "speaker", "line", \ |
| 1075 | 	"mic", "cd", "mix", "pcm2", "rec", "igain", "ogain", \ |
| 1076 | 	"line1", "line2", "line3", "dig1", "dig2", "dig3", \ |
| 1077 | 	"phin", "phout", "video", "radio", "monitor"} |
| 1078 | |
| 1079 | /*	Device bitmask identifiers	*/ |
| 1080 | |
| 1081 | #define SOUND_MIXER_RECSRC	0xff	/* 1 bit per recording source */ |
| 1082 | #define SOUND_MIXER_DEVMASK	0xfe	/* 1 bit per supported device */ |
| 1083 | #define SOUND_MIXER_RECMASK	0xfd	/* 1 bit per supp. recording source */ |
| 1084 | #define SOUND_MIXER_CAPS	0xfc |
| 1085 | #define SOUND_CAP_EXCL_INPUT	0x00000001	/* Only 1 rec. src at a time */ |
| 1086 | #define SOUND_MIXER_STEREODEVS	0xfb	/* Mixer channels supporting stereo */ |
| 1087 | |
| 1088 | /*	Device mask bits	*/ |
| 1089 | |
| 1090 | #define SOUND_MASK_VOLUME	(1 << SOUND_MIXER_VOLUME) |
| 1091 | #define SOUND_MASK_BASS		(1 << SOUND_MIXER_BASS) |
| 1092 | #define SOUND_MASK_TREBLE	(1 << SOUND_MIXER_TREBLE) |
| 1093 | #define SOUND_MASK_SYNTH	(1 << SOUND_MIXER_SYNTH) |
| 1094 | #define SOUND_MASK_PCM		(1 << SOUND_MIXER_PCM) |
| 1095 | #define SOUND_MASK_SPEAKER	(1 << SOUND_MIXER_SPEAKER) |
| 1096 | #define SOUND_MASK_LINE		(1 << SOUND_MIXER_LINE) |
| 1097 | #define SOUND_MASK_MIC		(1 << SOUND_MIXER_MIC) |
| 1098 | #define SOUND_MASK_CD		(1 << SOUND_MIXER_CD) |
| 1099 | #define SOUND_MASK_IMIX		(1 << SOUND_MIXER_IMIX) |
| 1100 | #define SOUND_MASK_ALTPCM	(1 << SOUND_MIXER_ALTPCM) |
| 1101 | #define SOUND_MASK_RECLEV	(1 << SOUND_MIXER_RECLEV) |
| 1102 | #define SOUND_MASK_IGAIN	(1 << SOUND_MIXER_IGAIN) |
| 1103 | #define SOUND_MASK_OGAIN	(1 << SOUND_MIXER_OGAIN) |
| 1104 | #define SOUND_MASK_LINE1	(1 << SOUND_MIXER_LINE1) |
| 1105 | #define SOUND_MASK_LINE2	(1 << SOUND_MIXER_LINE2) |
| 1106 | #define SOUND_MASK_LINE3	(1 << SOUND_MIXER_LINE3) |
| 1107 | #define SOUND_MASK_DIGITAL1 (1 << SOUND_MIXER_DIGITAL1) |
| 1108 | #define SOUND_MASK_DIGITAL2 (1 << SOUND_MIXER_DIGITAL2) |
| 1109 | #define SOUND_MASK_DIGITAL3 (1 << SOUND_MIXER_DIGITAL3) |
| 1110 | #define SOUND_MASK_PHONEIN (1 << SOUND_MIXER_PHONEIN) |
| 1111 | #define SOUND_MASK_PHONEOUT (1 << SOUND_MIXER_PHONEOUT) |
| 1112 | #define SOUND_MASK_RADIO (1 << SOUND_MIXER_RADIO) |
| 1113 | #define SOUND_MASK_VIDEO (1 << SOUND_MIXER_VIDEO) |
| 1114 | #define SOUND_MASK_MONITOR (1 << SOUND_MIXER_MONITOR) |
| 1115 | |
| 1116 | /* Obsolete macros */ |
| 1117 | #define SOUND_MASK_MUTE		(1 << SOUND_MIXER_MUTE) |
| 1118 | #define SOUND_MASK_ENHANCE	(1 << SOUND_MIXER_ENHANCE) |
| 1119 | #define SOUND_MASK_LOUD		(1 << SOUND_MIXER_LOUD) |
| 1120 | |
| 1121 | #define MIXER_READ(dev)		_IOR('M', dev, int) |
| 1122 | #define SOUND_MIXER_READ_VOLUME		MIXER_READ(SOUND_MIXER_VOLUME) |
| 1123 | #define SOUND_MIXER_READ_BASS		MIXER_READ(SOUND_MIXER_BASS) |
| 1124 | #define SOUND_MIXER_READ_TREBLE		MIXER_READ(SOUND_MIXER_TREBLE) |
| 1125 | #define SOUND_MIXER_READ_SYNTH		MIXER_READ(SOUND_MIXER_SYNTH) |
| 1126 | #define SOUND_MIXER_READ_PCM		MIXER_READ(SOUND_MIXER_PCM) |
| 1127 | #define SOUND_MIXER_READ_SPEAKER	MIXER_READ(SOUND_MIXER_SPEAKER) |
| 1128 | #define SOUND_MIXER_READ_LINE		MIXER_READ(SOUND_MIXER_LINE) |
| 1129 | #define SOUND_MIXER_READ_MIC		MIXER_READ(SOUND_MIXER_MIC) |
| 1130 | #define SOUND_MIXER_READ_CD		MIXER_READ(SOUND_MIXER_CD) |
| 1131 | #define SOUND_MIXER_READ_IMIX		MIXER_READ(SOUND_MIXER_IMIX) |
| 1132 | #define SOUND_MIXER_READ_ALTPCM		MIXER_READ(SOUND_MIXER_ALTPCM) |
| 1133 | #define SOUND_MIXER_READ_RECLEV		MIXER_READ(SOUND_MIXER_RECLEV) |
| 1134 | #define SOUND_MIXER_READ_IGAIN		MIXER_READ(SOUND_MIXER_IGAIN) |
| 1135 | #define SOUND_MIXER_READ_OGAIN		MIXER_READ(SOUND_MIXER_OGAIN) |
| 1136 | #define SOUND_MIXER_READ_LINE1		MIXER_READ(SOUND_MIXER_LINE1) |
| 1137 | #define SOUND_MIXER_READ_LINE2		MIXER_READ(SOUND_MIXER_LINE2) |
| 1138 | #define SOUND_MIXER_READ_LINE3		MIXER_READ(SOUND_MIXER_LINE3) |
| 1139 | #define SOUND_MIXER_READ_DIGITAL1	MIXER_READ(SOUND_MIXER_DIGITAL1) |
| 1140 | #define SOUND_MIXER_READ_DIGITAL2	MIXER_READ(SOUND_MIXER_DIGITAL2) |
| 1141 | #define SOUND_MIXER_READ_DIGITAL3	MIXER_READ(SOUND_MIXER_DIGITAL3) |
| 1142 | #define SOUND_MIXER_READ_PHONEIN 	MIXER_READ(SOUND_MIXER_PHONEIN) |
| 1143 | #define SOUND_MIXER_READ_PHONEOUT	MIXER_READ(SOUND_MIXER_PHONEOUT) |
| 1144 | #define SOUND_MIXER_READ_RADIO		MIXER_READ(SOUND_MIXER_RADIO) |
| 1145 | #define SOUND_MIXER_READ_VIDEO		MIXER_READ(SOUND_MIXER_VIDEO) |
| 1146 | #define SOUND_MIXER_READ_MONITOR	MIXER_READ(SOUND_MIXER_MONITOR) |
| 1147 | |
| 1148 | /* Obsolete macros */ |
| 1149 | #define SOUND_MIXER_READ_MUTE		MIXER_READ(SOUND_MIXER_MUTE) |
| 1150 | #define SOUND_MIXER_READ_ENHANCE	MIXER_READ(SOUND_MIXER_ENHANCE) |
| 1151 | #define SOUND_MIXER_READ_LOUD		MIXER_READ(SOUND_MIXER_LOUD) |
| 1152 | |
| 1153 | #define SOUND_MIXER_READ_RECSRC		MIXER_READ(SOUND_MIXER_RECSRC) |
| 1154 | #define SOUND_MIXER_READ_DEVMASK	MIXER_READ(SOUND_MIXER_DEVMASK) |
| 1155 | #define SOUND_MIXER_READ_RECMASK	MIXER_READ(SOUND_MIXER_RECMASK) |
| 1156 | #define SOUND_MIXER_READ_STEREODEVS	MIXER_READ(SOUND_MIXER_STEREODEVS) |
| 1157 | #define SOUND_MIXER_READ_CAPS		MIXER_READ(SOUND_MIXER_CAPS) |
| 1158 | |
| 1159 | #define MIXER_WRITE(dev)		_IOWR('M', dev, int) |
| 1160 | #define SOUND_MIXER_WRITE_VOLUME	MIXER_WRITE(SOUND_MIXER_VOLUME) |
| 1161 | #define SOUND_MIXER_WRITE_BASS		MIXER_WRITE(SOUND_MIXER_BASS) |
| 1162 | #define SOUND_MIXER_WRITE_TREBLE	MIXER_WRITE(SOUND_MIXER_TREBLE) |
| 1163 | #define SOUND_MIXER_WRITE_SYNTH		MIXER_WRITE(SOUND_MIXER_SYNTH) |
| 1164 | #define SOUND_MIXER_WRITE_PCM		MIXER_WRITE(SOUND_MIXER_PCM) |
| 1165 | #define SOUND_MIXER_WRITE_SPEAKER	MIXER_WRITE(SOUND_MIXER_SPEAKER) |
| 1166 | #define SOUND_MIXER_WRITE_LINE		MIXER_WRITE(SOUND_MIXER_LINE) |
| 1167 | #define SOUND_MIXER_WRITE_MIC		MIXER_WRITE(SOUND_MIXER_MIC) |
| 1168 | #define SOUND_MIXER_WRITE_CD		MIXER_WRITE(SOUND_MIXER_CD) |
| 1169 | #define SOUND_MIXER_WRITE_IMIX		MIXER_WRITE(SOUND_MIXER_IMIX) |
| 1170 | #define SOUND_MIXER_WRITE_ALTPCM	MIXER_WRITE(SOUND_MIXER_ALTPCM) |
| 1171 | #define SOUND_MIXER_WRITE_RECLEV	MIXER_WRITE(SOUND_MIXER_RECLEV) |
| 1172 | #define SOUND_MIXER_WRITE_IGAIN		MIXER_WRITE(SOUND_MIXER_IGAIN) |
| 1173 | #define SOUND_MIXER_WRITE_OGAIN		MIXER_WRITE(SOUND_MIXER_OGAIN) |
| 1174 | #define SOUND_MIXER_WRITE_LINE1		MIXER_WRITE(SOUND_MIXER_LINE1) |
| 1175 | #define SOUND_MIXER_WRITE_LINE2		MIXER_WRITE(SOUND_MIXER_LINE2) |
| 1176 | #define SOUND_MIXER_WRITE_LINE3		MIXER_WRITE(SOUND_MIXER_LINE3) |
| 1177 | #define SOUND_MIXER_WRITE_DIGITAL1	MIXER_WRITE(SOUND_MIXER_DIGITAL1) |
| 1178 | #define SOUND_MIXER_WRITE_DIGITAL2	MIXER_WRITE(SOUND_MIXER_DIGITAL2) |
| 1179 | #define SOUND_MIXER_WRITE_DIGITAL3	MIXER_WRITE(SOUND_MIXER_DIGITAL3) |
| 1180 | #define SOUND_MIXER_WRITE_PHONEIN 	MIXER_WRITE(SOUND_MIXER_PHONEIN) |
| 1181 | #define SOUND_MIXER_WRITE_PHONEOUT	MIXER_WRITE(SOUND_MIXER_PHONEOUT) |
| 1182 | #define SOUND_MIXER_WRITE_RADIO		MIXER_WRITE(SOUND_MIXER_RADIO) |
| 1183 | #define SOUND_MIXER_WRITE_VIDEO		MIXER_WRITE(SOUND_MIXER_VIDEO) |
| 1184 | #define SOUND_MIXER_WRITE_MONITOR	MIXER_WRITE(SOUND_MIXER_MONITOR) |
| 1185 | |
| 1186 | #define SOUND_MIXER_WRITE_MUTE		MIXER_WRITE(SOUND_MIXER_MUTE) |
| 1187 | #define SOUND_MIXER_WRITE_ENHANCE	MIXER_WRITE(SOUND_MIXER_ENHANCE) |
| 1188 | #define SOUND_MIXER_WRITE_LOUD		MIXER_WRITE(SOUND_MIXER_LOUD) |
| 1189 | |
| 1190 | #define SOUND_MIXER_WRITE_RECSRC	MIXER_WRITE(SOUND_MIXER_RECSRC) |
| 1191 | |
| 1192 | typedef struct mixer_info { |
| 1193 | char id[16]; |
| 1194 | char name[32]; |
| 1195 | int modify_counter; |
| 1196 | int fillers[10]; |
| 1197 | } mixer_info; |
| 1198 | |
| 1199 | #define SOUND_MIXER_INFO		_IOR('M', 101, mixer_info) |
| 1200 | |
| 1201 | #define LEFT_CHN	0 |
| 1202 | #define RIGHT_CHN	1 |
| 1203 | |
| 1204 | /* |
| 1205 | * Level 2 event types for /dev/sequencer |
| 1206 | */ |
| 1207 | |
| 1208 | /* |
| 1209 | * The 4 most significant bits of byte 0 specify the class of |
| 1210 | * the event: |
| 1211 | * |
| 1212 | *	0x8X = system level events, |
| 1213 | *	0x9X = device/port specific events, event[1] = device/port, |
| 1214 | *		The last 4 bits give the subtype: |
| 1215 | *			0x02	= Channel event (event[3] = chn). |
| 1216 | *			0x01	= note event (event[4] = note). |
| 1217 | *			(0x01 is not used alone but always with bit 0x02). |
| 1218 | *	 event[2] = MIDI message code (0x80=note off etc.) |
| 1219 | * |
| 1220 | */ |
| 1221 | |
| 1222 | #define EV_SEQ_LOCAL		0x80 |
| 1223 | #define EV_TIMING		0x81 |
| 1224 | #define EV_CHN_COMMON		0x92 |
| 1225 | #define EV_CHN_VOICE		0x93 |
| 1226 | #define EV_SYSEX		0x94 |
| 1227 | /* |
| 1228 | * Event types 200 to 220 are reserved for application use. |
| 1229 | * These numbers will not be used by the driver. |
| 1230 | */ |
| 1231 | |
| 1232 | /* |
| 1233 | * Events for event type EV_CHN_VOICE |
| 1234 | */ |
| 1235 | |
| 1236 | #define MIDI_NOTEOFF		0x80 |
| 1237 | #define MIDI_NOTEON		0x90 |
| 1238 | #define MIDI_KEY_PRESSURE	0xA0 |
| 1239 | |
| 1240 | /* |
| 1241 | * Events for event type EV_CHN_COMMON |
| 1242 | */ |
| 1243 | |
| 1244 | #define MIDI_CTL_CHANGE		0xB0 |
| 1245 | #define MIDI_PGM_CHANGE		0xC0 |
| 1246 | #define MIDI_CHN_PRESSURE	0xD0 |
| 1247 | #define MIDI_PITCH_BEND		0xE0 |
| 1248 | |
| 1249 | #define MIDI_SYSTEM_PREFIX	0xF0 |
| 1250 | |
| 1251 | /* |
| 1252 | * Timer event types |
| 1253 | */ |
| 1254 | #define TMR_WAIT_REL		1	/* Time relative to the prev time */ |
| 1255 | #define TMR_WAIT_ABS		2	/* Absolute time since TMR_START */ |
| 1256 | #define TMR_STOP		3 |
| 1257 | #define TMR_START		4 |
| 1258 | #define TMR_CONTINUE		5 |
| 1259 | #define TMR_TEMPO		6 |
| 1260 | #define TMR_ECHO		8 |
| 1261 | #define TMR_CLOCK		9	/* MIDI clock */ |
| 1262 | #define TMR_SPP			10	/* Song position pointer */ |
| 1263 | #define TMR_TIMESIG		11	/* Time signature */ |
| 1264 | |
| 1265 | /* |
| 1266 | *	Local event types |
| 1267 | */ |
| 1268 | #define LOCL_STARTAUDIO		1 |
| 1269 | |
| 1270 | #if !defined(_KERNEL) || defined(USE_SEQ_MACROS) |
| 1271 | /* |
| 1272 | *	Some convenience macros to simplify programming of the |
| 1273 | *	/dev/sequencer interface |
| 1274 | * |
| 1275 | *	These macros define the API which should be used when possible. |
| 1276 | */ |
| 1277 | |
| 1278 | #ifndef USE_SIMPLE_MACROS |
| 1279 | void seqbuf_dump(void);	/* This function must be provided by programs */ |
| 1280 | |
| 1281 | /* Sample seqbuf_dump() implementation: |
| 1282 | * |
| 1283 | *	SEQ_DEFINEBUF (2048);	-- Defines a buffer for 2048 bytes |
| 1284 | * |
| 1285 | *	int seqfd;		-- The file descriptor for /dev/sequencer. |
| 1286 | * |
| 1287 | *	void |
| 1288 | *	seqbuf_dump () |
| 1289 | *	{ |
| 1290 | *	 if (_seqbufptr) |
| 1291 | *	 if (write (seqfd, _seqbuf, _seqbufptr) == -1) |
| 1292 | *	 { |
| 1293 | *		perror ("write /dev/sequencer"); |
| 1294 | *		exit (-1); |
| 1295 | *	 } |
| 1296 | *	 _seqbufptr = 0; |
| 1297 | *	} |
| 1298 | */ |
| 1299 | |
| 1300 | #define SEQ_DEFINEBUF(len)		\ |
| 1301 | 	u_char _seqbuf[len]; int _seqbuflen = len;int _seqbufptr = 0 |
| 1302 | #define SEQ_USE_EXTBUF()		\ |
| 1303 | 	extern u_char _seqbuf[]; \ |
| 1304 | 	extern int _seqbuflen;extern int _seqbufptr |
| 1305 | #define SEQ_DECLAREBUF()		SEQ_USE_EXTBUF() |
| 1306 | #define SEQ_PM_DEFINES			struct patmgr_info _pm_info |
| 1307 | #define _SEQ_NEEDBUF(len)		\ |
| 1308 | 	if ((_seqbufptr+(len)) > _seqbuflen) \ |
| 1309 | 		seqbuf_dump() |
| 1310 | #define _SEQ_ADVBUF(len)		_seqbufptr += len |
| 1311 | #define SEQ_DUMPBUF			seqbuf_dump |
| 1312 | #else |
| 1313 | /* |
| 1314 | * This variation of the sequencer macros is used just to format one event |
| 1315 | * using fixed buffer. |
| 1316 | * |
| 1317 | * The program using the macro library must define the following macros before |
| 1318 | * using this library. |
| 1319 | * |
| 1320 | * #define _seqbuf 		 name of the buffer (u_char[]) |
| 1321 | * #define _SEQ_ADVBUF(len)	 If the applic needs to know the exact |
| 1322 | *				 size of the event, this macro can be used. |
| 1323 | *				 Otherwise this must be defined as empty. |
| 1324 | * #define _seqbufptr		 Define the name of index variable or 0 if |
| 1325 | *				 not required. |
| 1326 | */ |
| 1327 | #define _SEQ_NEEDBUF(len)	/* empty */ |
| 1328 | #endif |
| 1329 | |
| 1330 | #define PM_LOAD_PATCH(dev, bank, pgm)	\ |
| 1331 | 	(SEQ_DUMPBUF(), _pm_info.command = _PM_LOAD_PATCH, \ |
| 1332 | 	_pm_info.device=dev, _pm_info.data.data8[0]=pgm, \ |
| 1333 | 	_pm_info.parm1 = bank, _pm_info.parm2 = 1, \ |
| 1334 | 	ioctl(seqfd, SNDCTL_PMGR_ACCESS, &_pm_info)) |
| 1335 | #define PM_LOAD_PATCHES(dev, bank, pgm) \ |
| 1336 | 	(SEQ_DUMPBUF(), _pm_info.command = _PM_LOAD_PATCH, \ |
| 1337 | 	_pm_info.device=dev, bcopy( pgm, _pm_info.data.data8, 128), \ |
| 1338 | 	_pm_info.parm1 = bank, _pm_info.parm2 = 128, \ |
| 1339 | 	ioctl(seqfd, SNDCTL_PMGR_ACCESS, &_pm_info)) |
| 1340 | |
| 1341 | #define SEQ_VOLUME_MODE(dev, mode)	{ \ |
| 1342 | 	_SEQ_NEEDBUF(8);\ |
| 1343 | 	_seqbuf[_seqbufptr] = SEQ_EXTENDED;\ |
| 1344 | 	_seqbuf[_seqbufptr+1] = SEQ_VOLMODE;\ |
| 1345 | 	_seqbuf[_seqbufptr+2] = (dev);\ |
| 1346 | 	_seqbuf[_seqbufptr+3] = (mode);\ |
| 1347 | 	_seqbuf[_seqbufptr+4] = 0;\ |
| 1348 | 	_seqbuf[_seqbufptr+5] = 0;\ |
| 1349 | 	_seqbuf[_seqbufptr+6] = 0;\ |
| 1350 | 	_seqbuf[_seqbufptr+7] = 0;\ |
| 1351 | 	_SEQ_ADVBUF(8);} |
| 1352 | |
| 1353 | /* |
| 1354 | * Midi voice messages |
| 1355 | */ |
| 1356 | |
| 1357 | #define _CHN_VOICE(dev, event, chn, note, parm) { \ |
| 1358 | 	_SEQ_NEEDBUF(8);\ |
| 1359 | 	_seqbuf[_seqbufptr] = EV_CHN_VOICE;\ |
| 1360 | 	_seqbuf[_seqbufptr+1] = (dev);\ |
| 1361 | 	_seqbuf[_seqbufptr+2] = (event);\ |
| 1362 | 	_seqbuf[_seqbufptr+3] = (chn);\ |
| 1363 | 	_seqbuf[_seqbufptr+4] = (note);\ |
| 1364 | 	_seqbuf[_seqbufptr+5] = (parm);\ |
| 1365 | 	_seqbuf[_seqbufptr+6] = (0);\ |
| 1366 | 	_seqbuf[_seqbufptr+7] = 0;\ |
| 1367 | 	_SEQ_ADVBUF(8);} |
| 1368 | |
| 1369 | #define SEQ_START_NOTE(dev, chn, note, vol) \ |
| 1370 | 		_CHN_VOICE(dev, MIDI_NOTEON, chn, note, vol) |
| 1371 | |
| 1372 | #define SEQ_STOP_NOTE(dev, chn, note, vol) \ |
| 1373 | 		_CHN_VOICE(dev, MIDI_NOTEOFF, chn, note, vol) |
| 1374 | |
| 1375 | #define SEQ_KEY_PRESSURE(dev, chn, note, pressure) \ |
| 1376 | 		_CHN_VOICE(dev, MIDI_KEY_PRESSURE, chn, note, pressure) |
| 1377 | |
| 1378 | /* |
| 1379 | * Midi channel messages |
| 1380 | */ |
| 1381 | |
| 1382 | #define _CHN_COMMON(dev, event, chn, p1, p2, w14) { \ |
| 1383 | 	_SEQ_NEEDBUF(8);\ |
| 1384 | 	_seqbuf[_seqbufptr] = EV_CHN_COMMON;\ |
| 1385 | 	_seqbuf[_seqbufptr+1] = (dev);\ |
| 1386 | 	_seqbuf[_seqbufptr+2] = (event);\ |
| 1387 | 	_seqbuf[_seqbufptr+3] = (chn);\ |
| 1388 | 	_seqbuf[_seqbufptr+4] = (p1);\ |
| 1389 | 	_seqbuf[_seqbufptr+5] = (p2);\ |
| 1390 | 	*(short *)&_seqbuf[_seqbufptr+6] = (w14);\ |
| 1391 | 	_SEQ_ADVBUF(8);} |
| 1392 | /* |
| 1393 | * SEQ_SYSEX permits sending of sysex messages. (It may look that it permits |
| 1394 | * sending any MIDI bytes but it's absolutely not possible. Trying to do |
| 1395 | * so _will_ cause problems with MPU401 intelligent mode). |
| 1396 | * |
| 1397 | * Sysex messages are sent in blocks of 1 to 6 bytes. Longer messages must be |
| 1398 | * sent by calling SEQ_SYSEX() several times (there must be no other events |
| 1399 | * between them). First sysex fragment must have 0xf0 in the first byte |
| 1400 | * and the last byte (buf[len-1] of the last fragment must be 0xf7. No byte |
| 1401 | * between these sysex start and end markers cannot be larger than 0x7f. Also |
| 1402 | * lengths of each fragments (except the last one) must be 6. |
| 1403 | * |
| 1404 | * Breaking the above rules may work with some MIDI ports but is likely to |
| 1405 | * cause fatal problems with some other devices (such as MPU401). |
| 1406 | */ |
| 1407 | #define SEQ_SYSEX(dev, buf, len) { \ |
| 1408 | 	int i, l=(len); if (l>6)l=6;\ |
| 1409 | 	_SEQ_NEEDBUF(8);\ |
| 1410 | 	_seqbuf[_seqbufptr] = EV_SYSEX;\ |
| 1411 | 	_seqbuf[_seqbufptr+1] = (dev);\ |
| 1412 | 	for(i=0;i<l;i++)_seqbuf[_seqbufptr+i+2] = (buf)[i];\ |
| 1413 | 	for(i=l;i<6;i++)_seqbuf[_seqbufptr+i+2] = 0xff;\ |
| 1414 | 	_SEQ_ADVBUF(8);} |
| 1415 | |
| 1416 | #define SEQ_CHN_PRESSURE(dev, chn, pressure) \ |
| 1417 | 	_CHN_COMMON(dev, MIDI_CHN_PRESSURE, chn, pressure, 0, 0) |
| 1418 | |
| 1419 | #define SEQ_SET_PATCH(dev, chn, patch) \ |
| 1420 | 	_CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0) |
| 1421 | |
| 1422 | #define SEQ_CONTROL(dev, chn, controller, value) \ |
| 1423 | 	_CHN_COMMON(dev, MIDI_CTL_CHANGE, chn, controller, 0, value) |
| 1424 | |
| 1425 | #define SEQ_BENDER(dev, chn, value) \ |
| 1426 | 	_CHN_COMMON(dev, MIDI_PITCH_BEND, chn, 0, 0, value) |
| 1427 | |
| 1428 | #define SEQ_V2_X_CONTROL(dev, voice, controller, value)	{ \ |
| 1429 | 	_SEQ_NEEDBUF(8);\ |
| 1430 | 	_seqbuf[_seqbufptr] = SEQ_EXTENDED;\ |
| 1431 | 	_seqbuf[_seqbufptr+1] = SEQ_CONTROLLER;\ |
| 1432 | 	_seqbuf[_seqbufptr+2] = (dev);\ |
| 1433 | 	_seqbuf[_seqbufptr+3] = (voice);\ |
| 1434 | 	_seqbuf[_seqbufptr+4] = (controller);\ |
| 1435 | 	*(short *)&_seqbuf[_seqbufptr+5] = (value);\ |
| 1436 | 	_seqbuf[_seqbufptr+7] = 0;\ |
| 1437 | 	_SEQ_ADVBUF(8);} |
| 1438 | |
| 1439 | /* |
| 1440 | * The following 5 macros are incorrectly implemented and obsolete. |
| 1441 | * Use SEQ_BENDER and SEQ_CONTROL (with proper controller) instead. |
| 1442 | */ |
| 1443 | |
| 1444 | #define SEQ_PITCHBEND(dev, voice, value) \ |
| 1445 | 	SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER, value) |
| 1446 | #define SEQ_BENDER_RANGE(dev, voice, value) \ |
| 1447 | 	SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER_RANGE, value) |
| 1448 | #define SEQ_EXPRESSION(dev, voice, value) \ |
| 1449 | 	SEQ_CONTROL(dev, voice, CTL_EXPRESSION, value*128) |
| 1450 | #define SEQ_MAIN_VOLUME(dev, voice, value) \ |
| 1451 | 	SEQ_CONTROL(dev, voice, CTL_MAIN_VOLUME, (value*16383)/100) |
| 1452 | #define SEQ_PANNING(dev, voice, pos) \ |
| 1453 | 	SEQ_CONTROL(dev, voice, CTL_PAN, (pos+128) / 2) |
| 1454 | |
| 1455 | /* |
| 1456 | * Timing and synchronization macros |
| 1457 | */ |
| 1458 | |
| 1459 | #define _TIMER_EVENT(ev, parm)		{ \ |
| 1460 | 	_SEQ_NEEDBUF(8);\ |
| 1461 | 	_seqbuf[_seqbufptr+0] = EV_TIMING; \ |
| 1462 | 	_seqbuf[_seqbufptr+1] = (ev); \ |
| 1463 | 	_seqbuf[_seqbufptr+2] = 0;\ |
| 1464 | 	_seqbuf[_seqbufptr+3] = 0;\ |
| 1465 | 	*(u_int *)&_seqbuf[_seqbufptr+4] = (parm); \ |
| 1466 | 	_SEQ_ADVBUF(8); \ |
| 1467 | 	} |
| 1468 | |
| 1469 | #define SEQ_START_TIMER()		_TIMER_EVENT(TMR_START, 0) |
| 1470 | #define SEQ_STOP_TIMER()		_TIMER_EVENT(TMR_STOP, 0) |
| 1471 | #define SEQ_CONTINUE_TIMER()		_TIMER_EVENT(TMR_CONTINUE, 0) |
| 1472 | #define SEQ_WAIT_TIME(ticks)		_TIMER_EVENT(TMR_WAIT_ABS, ticks) |
| 1473 | #define SEQ_DELTA_TIME(ticks)		_TIMER_EVENT(TMR_WAIT_REL, ticks) |
| 1474 | #define SEQ_ECHO_BACK(key)		_TIMER_EVENT(TMR_ECHO, key) |
| 1475 | #define SEQ_SET_TEMPO(value)		_TIMER_EVENT(TMR_TEMPO, value) |
| 1476 | #define SEQ_SONGPOS(pos)		_TIMER_EVENT(TMR_SPP, pos) |
| 1477 | #define SEQ_TIME_SIGNATURE(sig)		_TIMER_EVENT(TMR_TIMESIG, sig) |
| 1478 | |
| 1479 | /* |
| 1480 | * Local control events |
| 1481 | */ |
| 1482 | |
| 1483 | #define _LOCAL_EVENT(ev, parm)		{ \ |
| 1484 | 	_SEQ_NEEDBUF(8);\ |
| 1485 | 	_seqbuf[_seqbufptr+0] = EV_SEQ_LOCAL; \ |
| 1486 | 	_seqbuf[_seqbufptr+1] = (ev); \ |
| 1487 | 	_seqbuf[_seqbufptr+2] = 0;\ |
| 1488 | 	_seqbuf[_seqbufptr+3] = 0;\ |
| 1489 | 	*(u_int *)&_seqbuf[_seqbufptr+4] = (parm); \ |
| 1490 | 	_SEQ_ADVBUF(8); \ |
| 1491 | 	} |
| 1492 | |
| 1493 | #define SEQ_PLAYAUDIO(devmask)		_LOCAL_EVENT(LOCL_STARTAUDIO, devmask) |
| 1494 | /* |
| 1495 | * Events for the level 1 interface only |
| 1496 | */ |
| 1497 | |
| 1498 | #define SEQ_MIDIOUT(device, byte)	{ \ |
| 1499 | 	_SEQ_NEEDBUF(4);\ |
| 1500 | 	_seqbuf[_seqbufptr] = SEQ_MIDIPUTC;\ |
| 1501 | 	_seqbuf[_seqbufptr+1] = (byte);\ |
| 1502 | 	_seqbuf[_seqbufptr+2] = (device);\ |
| 1503 | 	_seqbuf[_seqbufptr+3] = 0;\ |
| 1504 | 	_SEQ_ADVBUF(4);} |
| 1505 | |
| 1506 | /* |
| 1507 | * Patch loading. |
| 1508 | */ |
| 1509 | #define SEQ_WRPATCH(patchx, len)	{ \ |
| 1510 | 	if (_seqbufptr) seqbuf_dump(); \ |
| 1511 | 	if (write(seqfd, (char*)(patchx), len)==-1) \ |
| 1512 | 	 perror("Write patch: /dev/sequencer"); \ |
| 1513 | 	} |
| 1514 | |
| 1515 | #define SEQ_WRPATCH2(patchx, len)	\ |
| 1516 | 	( seqbuf_dump(), write(seqfd, (char*)(patchx), len) ) |
| 1517 | |
| 1518 | #endif |
| 1519 | |
| 1520 | /* |
| 1521 | * Here I have moved all the aliases for ioctl names. |
| 1522 | */ |
| 1523 | |
| 1524 | #define SNDCTL_DSP_SAMPLESIZE	SNDCTL_DSP_SETFMT |
| 1525 | #define SOUND_PCM_WRITE_BITS	SNDCTL_DSP_SETFMT |
| 1526 | #define SOUND_PCM_SETFMT	SNDCTL_DSP_SETFMT |
| 1527 | |
| 1528 | #define SOUND_PCM_WRITE_RATE	SNDCTL_DSP_SPEED |
| 1529 | #define SOUND_PCM_POST		SNDCTL_DSP_POST |
| 1530 | #define SOUND_PCM_RESET		SNDCTL_DSP_RESET |
| 1531 | #define SOUND_PCM_SYNC		SNDCTL_DSP_SYNC |
| 1532 | #define SOUND_PCM_SUBDIVIDE	SNDCTL_DSP_SUBDIVIDE |
| 1533 | #define SOUND_PCM_SETFRAGMENT	SNDCTL_DSP_SETFRAGMENT |
| 1534 | #define SOUND_PCM_GETFMTS	SNDCTL_DSP_GETFMTS |
| 1535 | #define SOUND_PCM_GETOSPACE	SNDCTL_DSP_GETOSPACE |
| 1536 | #define SOUND_PCM_GETISPACE	SNDCTL_DSP_GETISPACE |
| 1537 | #define SOUND_PCM_NONBLOCK	SNDCTL_DSP_NONBLOCK |
| 1538 | #define SOUND_PCM_GETCAPS	SNDCTL_DSP_GETCAPS |
| 1539 | #define SOUND_PCM_GETTRIGGER	SNDCTL_DSP_GETTRIGGER |
| 1540 | #define SOUND_PCM_SETTRIGGER	SNDCTL_DSP_SETTRIGGER |
| 1541 | #define SOUND_PCM_SETSYNCRO	SNDCTL_DSP_SETSYNCRO |
| 1542 | #define SOUND_PCM_GETIPTR	SNDCTL_DSP_GETIPTR |
| 1543 | #define SOUND_PCM_GETOPTR	SNDCTL_DSP_GETOPTR |
| 1544 | #define SOUND_PCM_MAPINBUF	SNDCTL_DSP_MAPINBUF |
| 1545 | #define SOUND_PCM_MAPOUTBUF	SNDCTL_DSP_MAPOUTBUF |
| 1546 | |
| 1547 | /***********************************************************************/ |
| 1548 | |
| 1549 | /** |
| 1550 | * XXX OSSv4 defines -- some bits taken straight out of the new |
| 1551 | * sys/soundcard.h bundled with recent OSS releases. |
| 1552 | * |
| 1553 | * NB: These macros and structures will be reorganized and inserted |
| 1554 | * 	in appropriate places throughout this file once the code begins |
| 1555 | * 	to take shape. |
| 1556 | * |
| 1557 | * @todo reorganize layout more like the 4Front version |
| 1558 | * @todo ask about maintaining __SIOWR vs. _IOWR ioctl cmd defines |
| 1559 | */ |
| 1560 | |
| 1561 | /** |
| 1562 | * @note The @c OSSV4_EXPERIMENT macro is meant to wrap new development code |
| 1563 | * in the sound system relevant to adopting 4Front's OSSv4 specification. |
| 1564 | * Users should not enable this! Really! |
| 1565 | */ |
| 1566 | #if 0 |
| 1567 | # define OSSV4_EXPERIMENT 1 |
| 1568 | #else |
| 1569 | # undef OSSV4_EXPERIMENT |
| 1570 | #endif |
| 1571 | |
| 1572 | #ifdef SOUND_VERSION |
| 1573 | # undef SOUND_VERSION |
| 1574 | # define SOUND_VERSION	0x040000 |
| 1575 | #endif	/* !SOUND_VERSION */ |
| 1576 | |
| 1577 | #define OSS_LONGNAME_SIZE	64 |
| 1578 | #define OSS_LABEL_SIZE		16 |
| 1579 | #define OSS_DEVNODE_SIZE 32 |
| 1580 | typedef char oss_longname_t[OSS_LONGNAME_SIZE]; |
| 1581 | typedef char oss_label_t[OSS_LABEL_SIZE]; |
| 1582 | typedef char oss_devnode_t[OSS_DEVNODE_SIZE]; |
| 1583 | |
| 1584 | typedef struct audio_errinfo |
| 1585 | { |
| 1586 | 	int		play_underruns; |
| 1587 | 	int		rec_overruns; |
| 1588 | 	unsigned int	play_ptradjust; |
| 1589 | 	unsigned int	rec_ptradjust; |
| 1590 | 	int		play_errorcount; |
| 1591 | 	int		rec_errorcount; |
| 1592 | 	int		play_lasterror; |
| 1593 | 	int		rec_lasterror; |
| 1594 | 	long		play_errorparm; |
| 1595 | 	long		rec_errorparm; |
| 1596 | 	int		filler[16]; |
| 1597 | } audio_errinfo; |
| 1598 | |
| 1599 | #define SNDCTL_DSP_GETPLAYVOL _IOR ('P', 24, int) |
| 1600 | #define SNDCTL_DSP_SETPLAYVOL _IOWR('P', 24, int) |
| 1601 | #define SNDCTL_DSP_GETERROR _IOR ('P', 25, audio_errinfo) |
| 1602 | |
| 1603 | /* |
| 1604 | **************************************************************************** |
| 1605 | * Sync groups for audio devices |
| 1606 | */ |
| 1607 | typedef struct oss_syncgroup |
| 1608 | { |
| 1609 | int id; |
| 1610 | int mode; |
| 1611 | int filler[16]; |
| 1612 | } oss_syncgroup; |
| 1613 | |
| 1614 | #define SNDCTL_DSP_SYNCGROUP _IOWR('P', 28, oss_syncgroup) |
| 1615 | #define SNDCTL_DSP_SYNCSTART _IOW ('P', 29, int) |
| 1616 | |
| 1617 | /* |
| 1618 | ************************************************************************** |
| 1619 | * "cooked" mode enables software based conversions for sample rate, sample |
| 1620 | * format (bits) and number of channels (mono/stereo). These conversions are |
| 1621 | * required with some devices that support only one sample rate or just stereo |
| 1622 | * to let the applications to use other formats. The cooked mode is enabled by |
| 1623 | * default. However it's necessary to disable this mode when mmap() is used or |
| 1624 | * when very deterministic timing is required. SNDCTL_DSP_COOKEDMODE is an |
| 1625 | * optional call introduced in OSS 3.9.6f. It's _error return must be ignored_ |
| 1626 | * since normally this call will return erno=EINVAL. |
| 1627 | * |
| 1628 | * SNDCTL_DSP_COOKEDMODE must be called immediately after open before doing |
| 1629 | * anything else. Otherwise the call will not have any effect. |
| 1630 | */ |
| 1631 | #define SNDCTL_DSP_COOKEDMODE _IOW ('P', 30, int) |
| 1632 | |
| 1633 | /* |
| 1634 | ************************************************************************** |
| 1635 | * SNDCTL_DSP_SILENCE and SNDCTL_DSP_SKIP are new calls in OSS 3.99.0 |
| 1636 | * that can be used to implement pause/continue during playback (no effect |
| 1637 | * on recording). |
| 1638 | */ |
| 1639 | #define SNDCTL_DSP_SILENCE _IO ('P', 31) |
| 1640 | #define SNDCTL_DSP_SKIP _IO ('P', 32) |
| 1641 | |
| 1642 | /* |
| 1643 | **************************************************************************** |
| 1644 | * Abort transfer (reset) functions for input and output |
| 1645 | */ |
| 1646 | #define SNDCTL_DSP_HALT_INPUT		_IO ('P', 33) |
| 1647 | #define SNDCTL_DSP_RESET_INPUT	SNDCTL_DSP_HALT_INPUT	/* Old name */ |
| 1648 | #define SNDCTL_DSP_HALT_OUTPUT		_IO ('P', 34) |
| 1649 | #define SNDCTL_DSP_RESET_OUTPUT	SNDCTL_DSP_HALT_OUTPUT	/* Old name */ |
| 1650 | |
| 1651 | /* |
| 1652 | **************************************************************************** |
| 1653 | * Low water level control |
| 1654 | */ |
| 1655 | #define SNDCTL_DSP_LOW_WATER		_IOW ('P', 34, int) |
| 1656 | |
| 1657 | /** @todo Get rid of OSS_NO_LONG_LONG references? */ |
| 1658 | |
| 1659 | /* |
| 1660 | **************************************************************************** |
| 1661 | * 64 bit pointer support. Only available in environments that support |
| 1662 | * the 64 bit (long long) integer type. |
| 1663 | */ |
| 1664 | #ifndef OSS_NO_LONG_LONG |
| 1665 | typedef struct |
| 1666 | { |
| 1667 | long long samples; |
| 1668 | int fifo_samples; |
| 1669 | int filler[32];		/* For future use */ |
| 1670 | } oss_count_t; |
| 1671 | |
| 1672 | #define SNDCTL_DSP_CURRENT_IPTR		_IOR ('P', 35, oss_count_t) |
| 1673 | #define SNDCTL_DSP_CURRENT_OPTR		_IOR ('P', 36, oss_count_t) |
| 1674 | #endif |
| 1675 | |
| 1676 | /* |
| 1677 | **************************************************************************** |
| 1678 | * Interface for selecting recording sources and playback output routings. |
| 1679 | */ |
| 1680 | #define SNDCTL_DSP_GET_RECSRC_NAMES _IOR ('P', 37, oss_mixer_enuminfo) |
| 1681 | #define SNDCTL_DSP_GET_RECSRC _IOR ('P', 38, int) |
| 1682 | #define SNDCTL_DSP_SET_RECSRC _IOWR('P', 38, int) |
| 1683 | |
| 1684 | #define SNDCTL_DSP_GET_PLAYTGT_NAMES _IOR ('P', 39, oss_mixer_enuminfo) |
| 1685 | #define SNDCTL_DSP_GET_PLAYTGT _IOR ('P', 40, int) |
| 1686 | #define SNDCTL_DSP_SET_PLAYTGT _IOWR('P', 40, int) |
| 1687 | #define SNDCTL_DSP_GETRECVOL _IOR ('P', 41, int) |
| 1688 | #define SNDCTL_DSP_SETRECVOL _IOWR('P', 41, int) |
| 1689 | |
| 1690 | /* |
| 1691 | *************************************************************************** |
| 1692 | * Some calls for setting the channel assignment with multi channel devices |
| 1693 | * (see the manual for details). */ |
| 1694 | #define SNDCTL_DSP_GET_CHNORDER _IOR ('P', 42, unsigned long long) |
| 1695 | #define SNDCTL_DSP_SET_CHNORDER _IOWR('P', 42, unsigned long long) |
| 1696 | # define CHID_UNDEF 0 |
| 1697 | # define CHID_L 1 |
| 1698 | # define CHID_R 2 |
| 1699 | # define CHID_C 3 |
| 1700 | # define CHID_LFE 4 |
| 1701 | # define CHID_LS 5 |
| 1702 | # define CHID_RS 6 |
| 1703 | # define CHID_LR 7 |
| 1704 | # define CHID_RR 8 |
| 1705 | #define CHNORDER_UNDEF 0x0000000000000000ULL |
| 1706 | #define CHNORDER_NORMAL 0x0000000087654321ULL |
| 1707 | |
| 1708 | #define MAX_PEAK_CHANNELS	128 |
| 1709 | typedef unsigned short oss_peaks_t[MAX_PEAK_CHANNELS]; |
| 1710 | #define SNDCTL_DSP_GETIPEAKS		_IOR('P', 43, oss_peaks_t) |
| 1711 | #define SNDCTL_DSP_GETOPEAKS		_IOR('P', 44, oss_peaks_t) |
| 1712 | #define SNDCTL_DSP_POLICY _IOW('P', 45, int) /* See the manual */ |
| 1713 | |
| 1714 | /* |
| 1715 | **************************************************************************** |
| 1716 | * Few ioctl calls that are not official parts of OSS. They have been used |
| 1717 | * by few freeware implementations of OSS. |
| 1718 | */ |
| 1719 | #define SNDCTL_DSP_GETCHANNELMASK	_IOWR('P', 64, int) |
| 1720 | #define SNDCTL_DSP_BIND_CHANNEL		_IOWR('P', 65, int) |
| 1721 | #define DSP_BIND_QUERY			0x00000000 |
| 1722 | #define DSP_BIND_FRONT			0x00000001 |
| 1723 | #define DSP_BIND_SURR			0x00000002 |
| 1724 | #define DSP_BIND_CENTER_LFE		0x00000004 |
| 1725 | #define DSP_BIND_HANDSET		0x00000008 |
| 1726 | #define DSP_BIND_MIC			0x00000010 |
| 1727 | #define DSP_BIND_MODEM1			0x00000020 |
| 1728 | #define DSP_BIND_MODEM2			0x00000040 |
| 1729 | #define DSP_BIND_I2S			0x00000080 |
| 1730 | #define DSP_BIND_SPDIF			0x00000100 |
| 1731 | #define DSP_BIND_REAR			0x00000200 |
| 1732 | |
| 1733 | /* |
| 1734 | * OSS_SYSIFO is obsolete. Use SNDCTL_SYSINFO insteads. |
| 1735 | */ |
| 1736 | #define OSS_GETVERSION _IOR ('M', 118, int) |
| 1737 | |
| 1738 | /** |
| 1739 | * @brief	Argument for SNDCTL_SYSINFO ioctl. |
| 1740 | * |
| 1741 | * For use w/ the SNDCTL_SYSINFO ioctl available on audio (/dev/dsp*), |
| 1742 | * mixer, and MIDI devices. |
| 1743 | */ |
| 1744 | typedef struct oss_sysinfo |
| 1745 | { |
| 1746 | 	char	product[32];	/* For example OSS/Free, OSS/Linux or |
| 1747 | 				 OSS/Solaris */ |
| 1748 | 	char	version[32];	/* For example 4.0a */ |
| 1749 | 	int	versionnum;	/* See OSS_GETVERSION */ |
| 1750 | 	char	options[128];	/* Reserved */ |
| 1751 | |
| 1752 | 	int	numaudios;	/* # of audio/dsp devices */ |
| 1753 | 	int	openedaudio[8];	/* Bit mask telling which audio devices |
| 1754 | 				 are busy */ |
| 1755 | |
| 1756 | 	int	numsynths;	/* # of available synth devices */ |
| 1757 | 	int	nummidis;	/* # of available MIDI ports */ |
| 1758 | 	int	numtimers;	/* # of available timer devices */ |
| 1759 | 	int	nummixers;	/* # of mixer devices */ |
| 1760 | |
| 1761 | 	int	openedmidi[8];	/* Bit mask telling which midi devices |
| 1762 | 				 are busy */ |
| 1763 | 	int	numcards;	/* Number of sound cards in the system */ |
| 1764 | 	int	numaudioengines;	/* Number of audio engines in the system */ |
| 1765 | 	char	license[16];	/* For example "GPL" or "CDDL" */ |
| 1766 | 	char	revision_info[256];	/* For internal use */ |
| 1767 | 	int	filler[172];	/* For future expansion (set to -1) */ |
| 1768 | } oss_sysinfo; |
| 1769 | |
| 1770 | typedef struct oss_mixext |
| 1771 | { |
| 1772 | int dev;			/* Mixer device number */ |
| 1773 | int ctrl;			/* Controller number */ |
| 1774 | int type;			/* Entry type */ |
| 1775 | #	define MIXT_DEVROOT	 0	/* Device root entry */ |
| 1776 | #	define MIXT_GROUP	 1	/* Controller group */ |
| 1777 | #	define MIXT_ONOFF	 2	/* OFF (0) or ON (1) */ |
| 1778 | #	define MIXT_ENUM	 3	/* Enumerated (0 to maxvalue) */ |
| 1779 | #	define MIXT_MONOSLIDER	 4	/* Mono slider (0 to 100) */ |
| 1780 | #	define MIXT_STEREOSLIDER 5	/* Stereo slider (dual 0 to 100) */ |
| 1781 | #	define MIXT_MESSAGE	 6	/* (Readable) textual message */ |
| 1782 | #	define MIXT_MONOVU	 7	/* VU meter value (mono) */ |
| 1783 | #	define MIXT_STEREOVU	 8	/* VU meter value (stereo) */ |
| 1784 | #	define MIXT_MONOPEAK	 9	/* VU meter peak value (mono) */ |
| 1785 | #	define MIXT_STEREOPEAK	10	/* VU meter peak value (stereo) */ |
| 1786 | #	define MIXT_RADIOGROUP	11	/* Radio button group */ |
| 1787 | #	define MIXT_MARKER	12	/* Separator between normal and extension entries */ |
| 1788 | #	define MIXT_VALUE	13	/* Decimal value entry */ |
| 1789 | #	define MIXT_HEXVALUE	14	/* Hexadecimal value entry */ |
| 1790 | #	define MIXT_MONODB	15	/* Mono atten. slider (0 to -144) */ |
| 1791 | #	define MIXT_STEREODB	16	/* Stereo atten. slider (dual 0 to -144) */ |
| 1792 | #	define MIXT_SLIDER	17	/* Slider (mono) with full integer range */ |
| 1793 | #	define MIXT_3D		18 |
| 1794 | |
| 1795 | /* Possible value range (minvalue to maxvalue) */ |
| 1796 | /* Note that maxvalue may also be smaller than minvalue */ |
| 1797 | int maxvalue; |
| 1798 | int minvalue; |
| 1799 | |
| 1800 | int flags; |
| 1801 | #	define MIXF_READABLE	0x00000001	/* Has readable value */ |
| 1802 | #	define MIXF_WRITEABLE	0x00000002	/* Has writeable value */ |
| 1803 | #	define MIXF_POLL	0x00000004	/* May change itself */ |
| 1804 | #	define MIXF_HZ		0x00000008	/* Herz scale */ |
| 1805 | #	define MIXF_STRING	0x00000010	/* Use dynamic extensions for value */ |
| 1806 | #	define MIXF_DYNAMIC	0x00000010	/* Supports dynamic extensions */ |
| 1807 | #	define MIXF_OKFAIL	0x00000020	/* Interpret value as 1=OK, 0=FAIL */ |
| 1808 | #	define MIXF_FLAT	0x00000040	/* Flat vertical space requirements */ |
| 1809 | #	define MIXF_LEGACY	0x00000080	/* Legacy mixer control group */ |
| 1810 | char id[16];			/* Mnemonic ID (mainly for internal use) */ |
| 1811 | int parent;			/* Entry# of parent (group) node (-1 if root) */ |
| 1812 | |
| 1813 | int dummy;			/* Internal use */ |
| 1814 | |
| 1815 | int timestamp; |
| 1816 | |
| 1817 | char data[64];		/* Misc data (entry type dependent) */ |
| 1818 | unsigned char enum_present[32];	/* Mask of allowed enum values */ |
| 1819 | int control_no;		/* SOUND_MIXER_VOLUME..SOUND_MIXER_MIDI */ |
| 1820 | /* (-1 means not indicated) */ |
| 1821 | |
| 1822 | /* |
| 1823 | * The desc field is reserved for internal purposes of OSS. It should not be |
| 1824 | * used by applications. |
| 1825 | */ |
| 1826 | unsigned int desc; |
| 1827 | #define MIXEXT_SCOPE_MASK			0x0000003f |
| 1828 | #define MIXEXT_SCOPE_OTHER			0x00000000 |
| 1829 | #define MIXEXT_SCOPE_INPUT			0x00000001 |
| 1830 | #define MIXEXT_SCOPE_OUTPUT			0x00000002 |
| 1831 | #define MIXEXT_SCOPE_MONITOR			0x00000003 |
| 1832 | #define MIXEXT_SCOPE_RECSWITCH			0x00000004 |
| 1833 | |
| 1834 | char extname[32]; |
| 1835 | int update_counter; |
| 1836 | int filler[7]; |
| 1837 | } oss_mixext; |
| 1838 | |
| 1839 | typedef struct oss_mixext_root |
| 1840 | { |
| 1841 | char id[16]; |
| 1842 | char name[48]; |
| 1843 | } oss_mixext_root; |
| 1844 | |
| 1845 | typedef struct oss_mixer_value |
| 1846 | { |
| 1847 | int dev; |
| 1848 | int ctrl; |
| 1849 | int value; |
| 1850 | int flags;			/* Reserved for future use. Initialize to 0 */ |
| 1851 | int timestamp;		/* Must be set to oss_mixext.timestamp */ |
| 1852 | int filler[8];		/* Reserved for future use. Initialize to 0 */ |
| 1853 | } oss_mixer_value; |
| 1854 | |
| 1855 | #define OSS_ENUM_MAXVALUE 255 |
| 1856 | typedef struct oss_mixer_enuminfo |
| 1857 | { |
| 1858 | 	int	dev; |
| 1859 | 	int	ctrl; |
| 1860 | 	int	nvalues; |
| 1861 | 	int	version; /* Read the manual */ |
| 1862 | 	short	strindex[OSS_ENUM_MAXVALUE]; |
| 1863 | 	char	strings[3000]; |
| 1864 | } oss_mixer_enuminfo; |
| 1865 | |
| 1866 | #define OPEN_READ PCM_ENABLE_INPUT |
| 1867 | #define OPEN_WRITE PCM_ENABLE_OUTPUT |
| 1868 | #define OPEN_READWRITE (OPEN_READ|OPEN_WRITE) |
| 1869 | |
| 1870 | /** |
| 1871 | * @brief	Argument for SNDCTL_AUDIOINFO ioctl. |
| 1872 | * |
| 1873 | * For use w/ the SNDCTL_AUDIOINFO ioctl available on audio (/dev/dsp*) |
| 1874 | * devices. |
| 1875 | */ |
| 1876 | typedef struct oss_audioinfo |
| 1877 | { |
| 1878 | 	int	dev;		/* Audio device number */ |
| 1879 | 	char	name[64]; |
| 1880 | 	int	busy;		/* 0, OPEN_READ, OPEN_WRITE or OPEN_READWRITE */ |
| 1881 | 	int	pid; |
| 1882 | 	int	caps;		/* DSP_CAP_INPUT, DSP_CAP_OUTPUT */ |
| 1883 | 	int	iformats; |
| 1884 | 	int	oformats; |
| 1885 | 	int	magic;		/* Reserved for internal use */ |
| 1886 | 	char 	cmd[64];	/* Command using the device (if known) */ |
| 1887 | 	int	card_number; |
| 1888 | 	int	port_number; |
| 1889 | 	int	mixer_dev; |
| 1890 | 	int	legacy_device;	/* Obsolete field. Replaced by devnode */ |
| 1891 | 	int	enabled;	/* 1=enabled, 0=device not ready at this |
| 1892 | 				 moment */ |
| 1893 | 	int	flags;		/* For internal use only - no practical |
| 1894 | 				 meaning */ |
| 1895 | 	int	min_rate;	/* Sample rate limits */ |
| 1896 | 	int	max_rate; |
| 1897 | 	int	min_channels;	/* Number of channels supported */ |
| 1898 | 	int	max_channels; |
| 1899 | 	int	binding;	/* DSP_BIND_FRONT, etc. 0 means undefined */ |
| 1900 | 	int	rate_source; |
| 1901 | 	char	handle[32]; |
| 1902 | 	#define OSS_MAX_SAMPLE_RATES	20	/* Cannot be changed */ |
| 1903 | 	unsigned int nrates; |
| 1904 | 	unsigned int rates[OSS_MAX_SAMPLE_RATES]; /* Please read the manual before using these */ |
| 1905 | 	oss_longname_t	song_name;	/* Song name (if given) */ |
| 1906 | 	oss_label_t	label;		/* Device label (if given) */ |
| 1907 | 	int		latency;	/* In usecs, -1=unknown */ |
| 1908 | 	oss_devnode_t	devnode;	/* Device special file name (inside |
| 1909 | 					 /dev) */ |
| 1910 | 	int next_play_engine; |
| 1911 | 	int next_rec_engine; |
| 1912 | 	int filler[184]; |
| 1913 | } oss_audioinfo; |
| 1914 | |
| 1915 | typedef struct oss_mixerinfo |
| 1916 | { |
| 1917 | int dev; |
| 1918 | char id[16]; |
| 1919 | char name[32]; |
| 1920 | int modify_counter; |
| 1921 | int card_number; |
| 1922 | int port_number; |
| 1923 | char handle[32]; |
| 1924 | int magic;			/* Reserved */ |
| 1925 | int enabled;			/* Reserved */ |
| 1926 | int caps; |
| 1927 | #define MIXER_CAP_VIRTUAL				0x00000001 |
| 1928 | int flags;			/* Reserved */ |
| 1929 | int nrext; |
| 1930 | /* |
| 1931 | * The priority field can be used to select the default (motherboard) |
| 1932 | * mixer device. The mixer with the highest priority is the |
| 1933 | * most preferred one. -2 or less means that this device cannot be used |
| 1934 | * as the default mixer. |
| 1935 | */ |
| 1936 | int priority; |
| 1937 | oss_devnode_t devnode; |
| 1938 | int legacy_device; |
| 1939 | int filler[245];		/* Reserved */ |
| 1940 | } oss_mixerinfo; |
| 1941 | |
| 1942 | typedef struct oss_midi_info |
| 1943 | { |
| 1944 | int dev;			/* Midi device number */ |
| 1945 | char name[64]; |
| 1946 | int busy;			/* 0, OPEN_READ, OPEN_WRITE or OPEN_READWRITE */ |
| 1947 | int pid; |
| 1948 | char cmd[64];			/* Command using the device (if known) */ |
| 1949 | int caps; |
| 1950 | #define MIDI_CAP_MPU401		0x00000001	/**** OBSOLETE ****/ |
| 1951 | #define MIDI_CAP_INPUT		0x00000002 |
| 1952 | #define MIDI_CAP_OUTPUT		0x00000004 |
| 1953 | #define MIDI_CAP_INOUT		(MIDI_CAP_INPUT|MIDI_CAP_OUTPUT) |
| 1954 | #define MIDI_CAP_VIRTUAL	0x00000008	/* Pseudo device */ |
| 1955 | #define MIDI_CAP_MTCINPUT	0x00000010	/* Supports SNDCTL_MIDI_MTCINPUT */ |
| 1956 | #define MIDI_CAP_CLIENT		0x00000020	/* Virtual client side device */ |
| 1957 | #define MIDI_CAP_SERVER		0x00000040	/* Virtual server side device */ |
| 1958 | #define MIDI_CAP_INTERNAL	0x00000080	/* Internal (synth) device */ |
| 1959 | #define MIDI_CAP_EXTERNAL	0x00000100	/* external (MIDI port) device */ |
| 1960 | #define MIDI_CAP_PTOP		0x00000200	/* Point to point link to one device */ |
| 1961 | #define MIDI_CAP_MTC		0x00000400	/* MTC/SMPTE (control) device */ |
| 1962 | int magic;			/* Reserved for internal use */ |
| 1963 | int card_number; |
| 1964 | int port_number; |
| 1965 | int enabled;			/* 1=enabled, 0=device not ready at this moment */ |
| 1966 | int flags;			/* For internal use only - no practical meaning */ |
| 1967 | char handle[32]; |
| 1968 | oss_longname_t song_name;	/* Song name (if known) */ |
| 1969 | oss_label_t label;		/* Device label (if given) */ |
| 1970 | int latency;			/* In usecs, -1=unknown */ |
| 1971 | int filler[244]; |
| 1972 | } oss_midi_info; |
| 1973 | |
| 1974 | typedef struct oss_card_info |
| 1975 | { |
| 1976 | int card; |
| 1977 | char shortname[16]; |
| 1978 | char longname[128]; |
| 1979 | int flags; |
| 1980 | char hw_info[400]; |
| 1981 | int intr_count, ack_count; |
| 1982 | int filler[154]; |
| 1983 | } oss_card_info; |
| 1984 | |
| 1985 | #define SNDCTL_SYSINFO _IOR ('X', 1, oss_sysinfo) |
| 1986 | #define OSS_SYSINFO SNDCTL_SYSINFO /* Old name */ |
| 1987 | |
| 1988 | #define SNDCTL_MIX_NRMIX	_IOR ('X', 2, int) |
| 1989 | #define SNDCTL_MIX_NREXT	_IOWR('X', 3, int) |
| 1990 | #define SNDCTL_MIX_EXTINFO	_IOWR('X', 4, oss_mixext) |
| 1991 | #define SNDCTL_MIX_READ		_IOWR('X', 5, oss_mixer_value) |
| 1992 | #define SNDCTL_MIX_WRITE	_IOWR('X', 6, oss_mixer_value) |
| 1993 | |
| 1994 | #define SNDCTL_AUDIOINFO	_IOWR('X', 7, oss_audioinfo) |
| 1995 | #define SNDCTL_MIX_ENUMINFO	_IOWR('X', 8, oss_mixer_enuminfo) |
| 1996 | #define SNDCTL_MIDIINFO		_IOWR('X', 9, oss_midi_info) |
| 1997 | #define SNDCTL_MIXERINFO	_IOWR('X',10, oss_mixerinfo) |
| 1998 | #define SNDCTL_CARDINFO		_IOWR('X',11, oss_card_info) |
| 1999 | #define SNDCTL_ENGINEINFO	_IOWR('X',12, oss_audioinfo) |
| 2000 | #define SNDCTL_AUDIOINFO_EX	_IOWR('X',13, oss_audioinfo) |
| 2001 | |
| 2002 | /* |
| 2003 | * Few more "globally" available ioctl calls. |
| 2004 | */ |
| 2005 | #define SNDCTL_SETSONG _IOW ('Y', 2, oss_longname_t) |
| 2006 | #define SNDCTL_GETSONG _IOR ('Y', 2, oss_longname_t) |
| 2007 | #define SNDCTL_SETNAME _IOW ('Y', 3, oss_longname_t) |
| 2008 | #define SNDCTL_SETLABEL _IOW ('Y', 4, oss_label_t) |
| 2009 | #define SNDCTL_GETLABEL _IOR ('Y', 4, oss_label_t) |
| 2010 | |
| 2011 | #endif	/* !_SYS_SOUNDCARD_H_ */ |