soundcard.h revision 162588
1652Sjkh/*
233473Sscrappy * soundcard.h
3139825Simp */
4139825Simp
5139825Simp/*-
6162588Snetchild * Copyright by Hannu Savolainen 1993 / 4Front Technologies 1993-2006
733473Sscrappy * Modified for the new FreeBSD sound driver by Luigi Rizzo, 1997
8652Sjkh *
9652Sjkh * Redistribution and use in source and binary forms, with or without
10652Sjkh * modification, are permitted provided that the following conditions
11652Sjkh * are met:
12652Sjkh * 1. Redistributions of source code must retain the above copyright
13652Sjkh *    notice, this list of conditions and the following disclaimer.
1433473Sscrappy * 2. Redistributions in binary form must reproduce the above
1533473Sscrappy *    copyright notice, this list of conditions and the following
1633473Sscrappy *    disclaimer in the documentation and/or other materials provided
1733473Sscrappy *    with the distribution.
18652Sjkh *
1933473Sscrappy * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
2033473Sscrappy * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2133473Sscrappy * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
2233473Sscrappy * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR
2333473Sscrappy * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2433473Sscrappy * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2533473Sscrappy * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
2633473Sscrappy * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
2733473Sscrappy * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2833473Sscrappy * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
2933473Sscrappy * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3033473Sscrappy * POSSIBILITY OF SUCH DAMAGE.
3150734Speter *
3250734Speter * $FreeBSD: head/sys/sys/soundcard.h 162588 2006-09-23 20:45:47Z netchild $
33652Sjkh */
34652Sjkh
35162588Snetchild/*
36162588Snetchild * Unless coordinating changes with 4Front Technologies, do NOT make any
37162588Snetchild * modifications to ioctl commands, types, etc. that would break
38162588Snetchild * compatibility with the OSS API.
39162588Snetchild */
40162588Snetchild
4150906Sdfr#ifndef _SYS_SOUNDCARD_H_
4250906Sdfr#define _SYS_SOUNDCARD_H_
4365335Scg /*
44652Sjkh  * If you make modifications to this file, please contact me before
4565335Scg  * distributing the modified version. There is already enough
4613765Smpp  * diversity in the world.
47652Sjkh  *
48652Sjkh  * Regards,
49652Sjkh  * Hannu Savolainen
503256Sswallace  * hannu@voxware.pp.fi
5130866Smarkm  *
5230866Smarkm  **********************************************************************
5365335Scg  * PS.	The Hacker's Guide to VoxWare available from
5482033Sgreid  *     nic.funet.fi:pub/Linux/ALPHA/sound. The file is
5530866Smarkm  *	snd-sdk-doc-0.1.ps.gz (gzipped postscript). It contains
5630866Smarkm  *	some useful information about programming with VoxWare.
5782033Sgreid  *	(NOTE! The pub/Linux/ALPHA/ directories are hidden. You have
5830866Smarkm  *	to cd inside them before the files are accessible.)
5930866Smarkm  **********************************************************************
60652Sjkh  */
61652Sjkh
6233530Sscrappy/*
6333530Sscrappy * SOUND_VERSION is only used by the voxware driver. Hopefully apps
6433530Sscrappy * should not depend on it, but rather look at the capabilities
6533530Sscrappy * of the driver in the kernel!
6633530Sscrappy */
6733530Sscrappy#define SOUND_VERSION  301
6833530Sscrappy#define VOXWARE		/* does this have any use ? */
6933530Sscrappy
7033530Sscrappy/*
7133530Sscrappy * Supported card ID numbers (Should be somewhere else? We keep
7233530Sscrappy * them here just for compativility with the old driver, but these
7333530Sscrappy * constants are of little or no use).
7433530Sscrappy */
7533530Sscrappy
7633530Sscrappy#define SNDCARD_ADLIB          1
7733530Sscrappy#define SNDCARD_SB             2
7833530Sscrappy#define SNDCARD_PAS            3
7933530Sscrappy#define SNDCARD_GUS            4
8033530Sscrappy#define SNDCARD_MPU401         5
8133530Sscrappy#define SNDCARD_SB16           6
8233530Sscrappy#define SNDCARD_SB16MIDI       7
8333530Sscrappy#define SNDCARD_UART6850       8
8433530Sscrappy#define SNDCARD_GUS16          9
8533530Sscrappy#define SNDCARD_MSS            10
8633530Sscrappy#define SNDCARD_PSS            11
8733530Sscrappy#define SNDCARD_SSCAPE         12
8833530Sscrappy#define SNDCARD_PSS_MPU        13
8933530Sscrappy#define SNDCARD_PSS_MSS        14
9033530Sscrappy#define SNDCARD_SSCAPE_MSS     15
9133530Sscrappy#define SNDCARD_TRXPRO         16
9233530Sscrappy#define SNDCARD_TRXPRO_SB      17
9333530Sscrappy#define SNDCARD_TRXPRO_MPU     18
9433530Sscrappy#define SNDCARD_MAD16          19
9533530Sscrappy#define SNDCARD_MAD16_MPU      20
9633530Sscrappy#define SNDCARD_CS4232         21
9733530Sscrappy#define SNDCARD_CS4232_MPU     22
9833530Sscrappy#define SNDCARD_MAUI           23
9933530Sscrappy#define SNDCARD_PSEUDO_MSS     24
10082033Sgreid#define SNDCARD_AWE32          25
10145240Skato#define SNDCARD_NSS            26
10262947Stanimura#define SNDCARD_UART16550      27
10362947Stanimura#define SNDCARD_OPL            28
10433530Sscrappy
10533473Sscrappy#include <sys/types.h>
106114181Smbr#include <machine/endian.h>
10733473Sscrappy#ifndef _IOWR
10833473Sscrappy#include <sys/ioccom.h>
10933473Sscrappy#endif  /* !_IOWR */
110652Sjkh
111652Sjkh/*
11233473Sscrappy * The first part of this file contains the new FreeBSD sound ioctl
11333473Sscrappy * interface. Tries to minimize the number of different ioctls, and
11433473Sscrappy * to be reasonably general.
11533473Sscrappy *
11633473Sscrappy * 970821: some of the new calls have not been implemented yet.
117652Sjkh */
118652Sjkh
11933473Sscrappy/*
12033473Sscrappy * the following three calls extend the generic file descriptor
12133473Sscrappy * interface. AIONWRITE is the dual of FIONREAD, i.e. returns the max
12233473Sscrappy * number of bytes for a write operation to be non-blocking.
12333473Sscrappy *
12433473Sscrappy * AIOGSIZE/AIOSSIZE are used to change the behaviour of the device,
12533473Sscrappy * from a character device (default) to a block device. In block mode,
12633473Sscrappy * (not to be confused with blocking mode) the main difference for the
12733473Sscrappy * application is that select() will return only when a complete
12833473Sscrappy * block can be read/written to the device, whereas in character mode
12933473Sscrappy * select will return true when one byte can be exchanged. For audio
13033473Sscrappy * devices, character mode makes select almost useless since one byte
13133473Sscrappy * will always be ready by the next sample time (which is often only a
13265335Scg * handful of microseconds away).
13333473Sscrappy * Use a size of 0 or 1 to return to character mode.
13433473Sscrappy */
13533473Sscrappy#define	AIONWRITE   _IOR('A', 10, int)   /* get # bytes to write */
13633473Sscrappystruct snd_size {
13733473Sscrappy    int play_size;
13833473Sscrappy    int rec_size;
13933473Sscrappy};
14033473Sscrappy#define	AIOGSIZE    _IOR('A', 11, struct snd_size)/* read current blocksize */
14133473Sscrappy#define	AIOSSIZE    _IOWR('A', 11, struct snd_size)  /* sets blocksize */
142652Sjkh
14330866Smarkm/*
14433473Sscrappy * The following constants define supported audio formats. The
14533473Sscrappy * encoding follows voxware conventions, i.e. 1 bit for each supported
14633473Sscrappy * format. We extend it by using bit 31 (RO) to indicate full-duplex
14733473Sscrappy * capability, and bit 29 (RO) to indicate that the card supports/
14833473Sscrappy * needs different formats on capture & playback channels.
14933473Sscrappy * Bit 29 (RW) is used to indicate/ask stereo.
15081891Ssobomax *
15181891Ssobomax * The number of bits required to store the sample is:
15281891Ssobomax *  o  4 bits for the IDA ADPCM format,
15381891Ssobomax *  o  8 bits for 8-bit formats, mu-law and A-law,
15481891Ssobomax *  o  16 bits for the 16-bit formats, and
15581891Ssobomax *  o  32 bits for the 24/32-bit formats.
15681891Ssobomax *  o  undefined for the MPEG audio format.
15733473Sscrappy */
15833473Sscrappy
15981891Ssobomax#define AFMT_QUERY	0x00000000	/* Return current format */
16081891Ssobomax#define AFMT_MU_LAW	0x00000001	/* Logarithmic mu-law */
16181891Ssobomax#define AFMT_A_LAW	0x00000002	/* Logarithmic A-law */
16281891Ssobomax#define AFMT_IMA_ADPCM	0x00000004	/* A 4:1 compressed format where 16-bit
16381891Ssobomax					 * squence represented using the
16481891Ssobomax					 * the average 4 bits per sample */
16581891Ssobomax#define AFMT_U8		0x00000008	/* Unsigned 8-bit */
16681891Ssobomax#define AFMT_S16_LE	0x00000010	/* Little endian signed 16-bit */
16781891Ssobomax#define AFMT_S16_BE	0x00000020	/* Big endian signed 16-bit */
16881891Ssobomax#define AFMT_S8		0x00000040	/* Signed 8-bit */
16981891Ssobomax#define AFMT_U16_LE	0x00000080	/* Little endian unsigned 16-bit */
17081891Ssobomax#define AFMT_U16_BE	0x00000100	/* Big endian unsigned 16-bit */
17181891Ssobomax#define AFMT_MPEG	0x00000200	/* MPEG MP2/MP3 audio */
17281891Ssobomax#define AFMT_AC3	0x00000400	/* Dolby Digital AC3 */
173114181Smbr
174114642Smbr#if _BYTE_ORDER == _LITTLE_ENDIAN
175114181Smbr#define AFMT_S16_NE	AFMT_S16_LE	/* native endian signed 16 */
176114181Smbr#else
177114181Smbr#define AFMT_S16_NE	AFMT_S16_BE
178114181Smbr#endif
179114181Smbr
18065335Scg/*
18181891Ssobomax * 32-bit formats below used for 24-bit audio data where the data is stored
18281891Ssobomax * in the 24 most significant bits and the least significant bits are not used
18381891Ssobomax * (should be set to 0).
18465335Scg */
18581891Ssobomax#define AFMT_S32_LE	0x00001000	/* Little endian signed 32-bit */
18681891Ssobomax#define AFMT_S32_BE	0x00002000	/* Big endian signed 32-bit */
18781891Ssobomax#define AFMT_U32_LE	0x00004000	/* Little endian unsigned 32-bit */
18881891Ssobomax#define AFMT_U32_BE	0x00008000	/* Big endian unsigned 32-bit */
189148605Snetchild#define AFMT_S24_LE	0x00010000	/* Little endian signed 24-bit */
190148605Snetchild#define AFMT_S24_BE	0x00020000	/* Big endian signed 24-bit */
191148605Snetchild#define AFMT_U24_LE	0x00040000	/* Little endian unsigned 24-bit */
192148605Snetchild#define AFMT_U24_BE	0x00080000	/* Big endian unsigned 24-bit */
19333473Sscrappy
19481891Ssobomax#define AFMT_STEREO	0x10000000	/* can do/want stereo	*/
19533473Sscrappy
19633473Sscrappy/*
19733473Sscrappy * the following are really capabilities
19833473Sscrappy */
19981891Ssobomax#define AFMT_WEIRD	0x20000000	/* weird hardware...	*/
20033473Sscrappy    /*
20133473Sscrappy     * AFMT_WEIRD reports that the hardware might need to operate
20233473Sscrappy     * with different formats in the playback and capture
20333473Sscrappy     * channels when operating in full duplex.
20433473Sscrappy     * As an example, SoundBlaster16 cards only support U8 in one
20533473Sscrappy     * direction and S16 in the other one, and applications should
20633473Sscrappy     * be aware of this limitation.
20733473Sscrappy     */
20881891Ssobomax#define AFMT_FULLDUPLEX	0x80000000	/* can do full duplex	*/
20933473Sscrappy
21033473Sscrappy/*
21133473Sscrappy * The following structure is used to get/set format and sampling rate.
21233473Sscrappy * While it would be better to have things such as stereo, bits per
21333473Sscrappy * sample, endiannes, etc split in different variables, it turns out
21433473Sscrappy * that formats are not that many, and not all combinations are possible.
21533473Sscrappy * So we followed the Voxware approach of associating one bit to each
21633473Sscrappy * format.
21733473Sscrappy */
21833473Sscrappy
21933473Sscrappytypedef struct _snd_chan_param {
22033473Sscrappy    u_long	play_rate;	/* sampling rate			*/
22133473Sscrappy    u_long	rec_rate;	/* sampling rate			*/
22233473Sscrappy    u_long	play_format;	/* everything describing the format	*/
22333473Sscrappy    u_long	rec_format;	/* everything describing the format	*/
22433473Sscrappy} snd_chan_param;
22533473Sscrappy#define	AIOGFMT    _IOR('f', 12, snd_chan_param)   /* get format */
22633473Sscrappy#define	AIOSFMT    _IOWR('f', 12, snd_chan_param)  /* sets format */
22733473Sscrappy
22833473Sscrappy/*
22933473Sscrappy * The following structure is used to get/set the mixer setting.
23033473Sscrappy * Up to 32 mixers are supported, each one with up to 32 channels.
23133473Sscrappy */
23233473Sscrappytypedef struct _snd_mix_param {
23333473Sscrappy    u_char	subdev;	/* which output				*/
23433473Sscrappy    u_char	line;	/* which input				*/
23533473Sscrappy    u_char	left,right; /* volumes, 0..255, 0 = mute	*/
23633473Sscrappy} snd_mix_param ;
23733473Sscrappy
23833473Sscrappy/* XXX AIOGMIX, AIOSMIX not implemented yet */
23933473Sscrappy#define AIOGMIX	_IOWR('A', 13, snd_mix_param)	/* return mixer status */
24033473Sscrappy#define AIOSMIX	_IOWR('A', 14, snd_mix_param)	/* sets mixer status   */
24133473Sscrappy
24233473Sscrappy/*
24333473Sscrappy * channel specifiers used in AIOSTOP and AIOSYNC
24433473Sscrappy */
24533473Sscrappy#define	AIOSYNC_PLAY	0x1	/* play chan */
24633473Sscrappy#define	AIOSYNC_CAPTURE	0x2	/* capture chan */
24733473Sscrappy/* AIOSTOP stop & flush a channel, returns the residual count */
24833473Sscrappy#define	AIOSTOP	_IOWR ('A', 15, int)
24933473Sscrappy
25033473Sscrappy/* alternate method used to notify the sync condition */
25133473Sscrappy#define	AIOSYNC_SIGNAL	0x100
25233473Sscrappy#define	AIOSYNC_SELECT	0x200
25333473Sscrappy
25433473Sscrappy/* what the 'pos' field refers to */
25533473Sscrappy#define AIOSYNC_READY	0x400
25633473Sscrappy#define AIOSYNC_FREE	0x800
25733473Sscrappy
25833473Sscrappytypedef struct _snd_sync_parm {
25933473Sscrappy    long chan ; /* play or capture channel, plus modifier */
26033473Sscrappy    long pos;
26133473Sscrappy} snd_sync_parm;
26233473Sscrappy#define	AIOSYNC	_IOWR ('A', 15, snd_sync_parm)	/* misc. synchronization */
26333473Sscrappy
26433473Sscrappy/*
26533473Sscrappy * The following is used to return device capabilities. If the structure
26633473Sscrappy * passed to the ioctl is zeroed, default values are returned for rate
26733473Sscrappy * and formats, a bitmap of available mixers is returned, and values
26833473Sscrappy * (inputs, different levels) for the first one are returned.
26933473Sscrappy *
27033473Sscrappy * If  formats, mixers, inputs are instantiated, then detailed info
27133473Sscrappy * are returned depending on the call.
27233473Sscrappy */
27333473Sscrappytypedef struct _snd_capabilities {
27433473Sscrappy    u_long	rate_min, rate_max;	/* min-max sampling rate */
27533473Sscrappy    u_long	formats;
27633473Sscrappy    u_long	bufsize; /* DMA buffer size */
27733473Sscrappy    u_long	mixers; /* bitmap of available mixers */
27833473Sscrappy    u_long	inputs; /* bitmap of available inputs (per mixer) */
27933473Sscrappy    u_short	left, right;	/* how many levels are supported */
28033473Sscrappy} snd_capabilities;
28133473Sscrappy#define AIOGCAP	_IOWR('A', 15, snd_capabilities)	/* get capabilities */
28233473Sscrappy
28333473Sscrappy/*
28433473Sscrappy * here is the old (Voxware) ioctl interface
28533473Sscrappy */
28633473Sscrappy
28733473Sscrappy/*
288652Sjkh * IOCTL Commands for /dev/sequencer
289652Sjkh */
290652Sjkh
29133473Sscrappy#define SNDCTL_SEQ_RESET	_IO  ('Q', 0)
29233473Sscrappy#define SNDCTL_SEQ_SYNC		_IO  ('Q', 1)
29333473Sscrappy#define SNDCTL_SYNTH_INFO	_IOWR('Q', 2, struct synth_info)
29433473Sscrappy#define SNDCTL_SEQ_CTRLRATE	_IOWR('Q', 3, int) /* Set/get timer res.(hz) */
29533473Sscrappy#define SNDCTL_SEQ_GETOUTCOUNT	_IOR ('Q', 4, int)
29633473Sscrappy#define SNDCTL_SEQ_GETINCOUNT	_IOR ('Q', 5, int)
29733473Sscrappy#define SNDCTL_SEQ_PERCMODE	_IOW ('Q', 6, int)
29833473Sscrappy#define SNDCTL_FM_LOAD_INSTR	_IOW ('Q', 7, struct sbi_instrument)	/* Valid for FM only */
29933473Sscrappy#define SNDCTL_SEQ_TESTMIDI	_IOW ('Q', 8, int)
30033473Sscrappy#define SNDCTL_SEQ_RESETSAMPLES	_IOW ('Q', 9, int)
30133473Sscrappy#define SNDCTL_SEQ_NRSYNTHS	_IOR ('Q',10, int)
30233473Sscrappy#define SNDCTL_SEQ_NRMIDIS	_IOR ('Q',11, int)
30333473Sscrappy#define SNDCTL_MIDI_INFO	_IOWR('Q',12, struct midi_info)
30433473Sscrappy#define SNDCTL_SEQ_THRESHOLD	_IOW ('Q',13, int)
30533473Sscrappy#define SNDCTL_SEQ_TRESHOLD	SNDCTL_SEQ_THRESHOLD	/* there was once a typo */
30633473Sscrappy#define SNDCTL_SYNTH_MEMAVL	_IOWR('Q',14, int) /* in=dev#, out=memsize */
30733473Sscrappy#define SNDCTL_FM_4OP_ENABLE	_IOW ('Q',15, int) /* in=dev# */
30833473Sscrappy#define SNDCTL_PMGR_ACCESS	_IOWR('Q',16, struct patmgr_info)
30933473Sscrappy#define SNDCTL_SEQ_PANIC	_IO  ('Q',17)
31033473Sscrappy#define SNDCTL_SEQ_OUTOFBAND	_IOW ('Q',18, struct seq_event_rec)
311122954Smatk#define SNDCTL_SEQ_GETTIME	_IOR ('Q',19, int)
3129750Sjkh
31330866Smarkmstruct seq_event_rec {
31430866Smarkm	u_char arr[8];
31530866Smarkm};
3169750Sjkh
31733473Sscrappy#define SNDCTL_TMR_TIMEBASE	_IOWR('T', 1, int)
31833473Sscrappy#define SNDCTL_TMR_START	_IO  ('T', 2)
31933473Sscrappy#define SNDCTL_TMR_STOP		_IO  ('T', 3)
32033473Sscrappy#define SNDCTL_TMR_CONTINUE	_IO  ('T', 4)
32133473Sscrappy#define SNDCTL_TMR_TEMPO	_IOWR('T', 5, int)
32233473Sscrappy#define SNDCTL_TMR_SOURCE	_IOWR('T', 6, int)
32333473Sscrappy#   define TMR_INTERNAL		0x00000001
32433473Sscrappy#   define TMR_EXTERNAL		0x00000002
32533473Sscrappy#	define TMR_MODE_MIDI	0x00000010
32633473Sscrappy#	define TMR_MODE_FSK	0x00000020
32733473Sscrappy#	define TMR_MODE_CLS	0x00000040
32833473Sscrappy#	define TMR_MODE_SMPTE	0x00000080
32933473Sscrappy#define SNDCTL_TMR_METRONOME	_IOW ('T', 7, int)
33033473Sscrappy#define SNDCTL_TMR_SELECT	_IOW ('T', 8, int)
3313256Sswallace
332652Sjkh/*
33330866Smarkm *	Endian aware patch key generation algorithm.
33430866Smarkm */
33530866Smarkm
33630866Smarkm#if defined(_AIX) || defined(AIX)
33730866Smarkm#  define _PATCHKEY(id) (0xfd00|id)
33830866Smarkm#else
33930866Smarkm#  define _PATCHKEY(id) ((id<<8)|0xfd)
34030866Smarkm#endif
34130866Smarkm
34230866Smarkm/*
343652Sjkh *	Sample loading mechanism for internal synthesizers (/dev/sequencer)
344652Sjkh *	The following patch_info structure has been designed to support
345652Sjkh *	Gravis UltraSound. It tries to be universal format for uploading
34633473Sscrappy *	sample based patches but is probably too limited.
347652Sjkh */
348652Sjkh
349652Sjkhstruct patch_info {
35030866Smarkm/*		u_short key;		 Use GUS_PATCH here */
35130866Smarkm	short key;		 /* Use GUS_PATCH here */
35230866Smarkm#define GUS_PATCH	_PATCHKEY(0x04)
35330866Smarkm#define OBSOLETE_GUS_PATCH	_PATCHKEY(0x02)
354652Sjkh
35530866Smarkm	short device_no;	/* Synthesizer number */
35630866Smarkm	short instr_no;		/* Midi pgm# */
35730866Smarkm
35830866Smarkm	u_long mode;
359652Sjkh/*
360652Sjkh * The least significant byte has the same format than the GUS .PAT
361652Sjkh * files
362652Sjkh */
363652Sjkh#define WAVE_16_BITS	0x01	/* bit 0 = 8 or 16 bit wave data. */
364652Sjkh#define WAVE_UNSIGNED	0x02	/* bit 1 = Signed - Unsigned data. */
365652Sjkh#define WAVE_LOOPING	0x04	/* bit 2 = looping enabled-1. */
366652Sjkh#define WAVE_BIDIR_LOOP	0x08	/* bit 3 = Set is bidirectional looping. */
367652Sjkh#define WAVE_LOOP_BACK	0x10	/* bit 4 = Set is looping backward. */
368652Sjkh#define WAVE_SUSTAIN_ON	0x20	/* bit 5 = Turn sustaining on. (Env. pts. 3)*/
369652Sjkh#define WAVE_ENVELOPES	0x40	/* bit 6 = Enable envelopes - 1 */
370652Sjkh				/* 	(use the env_rate/env_offs fields). */
371652Sjkh/* Linux specific bits */
372652Sjkh#define WAVE_VIBRATO	0x00010000	/* The vibrato info is valid */
373652Sjkh#define WAVE_TREMOLO	0x00020000	/* The tremolo info is valid */
374652Sjkh#define WAVE_SCALE	0x00040000	/* The scaling info is valid */
375652Sjkh/* Other bits must be zeroed */
376652Sjkh
37730866Smarkm	long len;	/* Size of the wave data in bytes */
37830866Smarkm	long loop_start, loop_end; /* Byte offsets from the beginning */
379652Sjkh
38065335Scg/*
381652Sjkh * The base_freq and base_note fields are used when computing the
382652Sjkh * playback speed for a note. The base_note defines the tone frequency
383652Sjkh * which is heard if the sample is played using the base_freq as the
384652Sjkh * playback speed.
385652Sjkh *
386652Sjkh * The low_note and high_note fields define the minimum and maximum note
387652Sjkh * frequencies for which this sample is valid. It is possible to define
388108533Sschweikh * more than one samples for an instrument number at the same time. The
389652Sjkh * low_note and high_note fields are used to select the most suitable one.
390652Sjkh *
391652Sjkh * The fields base_note, high_note and low_note should contain
392652Sjkh * the note frequency multiplied by 1000. For example value for the
393652Sjkh * middle A is 440*1000.
394652Sjkh */
395652Sjkh
39630866Smarkm	u_int base_freq;
39730866Smarkm	u_long base_note;
39830866Smarkm	u_long high_note;
39930866Smarkm	u_long low_note;
40030866Smarkm	int panning;	/* -128=left, 127=right */
40130866Smarkm	int detuning;
402652Sjkh
403652Sjkh/*	New fields introduced in version 1.99.5	*/
404652Sjkh
405652Sjkh       /* Envelope. Enabled by mode bit WAVE_ENVELOPES	*/
40630866Smarkm	u_char	env_rate[ 6 ];	 /* GUS HW ramping rate */
40730866Smarkm	u_char	env_offset[ 6 ]; /* 255 == 100% */
408652Sjkh
40965335Scg	/*
410652Sjkh	 * The tremolo, vibrato and scale info are not supported yet.
411652Sjkh	 * Enable by setting the mode bits WAVE_TREMOLO, WAVE_VIBRATO or
412652Sjkh	 * WAVE_SCALE
413652Sjkh	 */
414652Sjkh
41530866Smarkm	u_char	tremolo_sweep;
41630866Smarkm	u_char	tremolo_rate;
41730866Smarkm	u_char	tremolo_depth;
418652Sjkh
41930866Smarkm	u_char	vibrato_sweep;
42030866Smarkm	u_char	vibrato_rate;
42130866Smarkm	u_char	vibrato_depth;
42230866Smarkm
42330866Smarkm	int		scale_frequency;
42430866Smarkm	u_int	scale_factor;		/* from 0 to 2048 or 0 to 2 */
42565335Scg
42630866Smarkm	int		volume;
42730866Smarkm	int		spare[4];
42830866Smarkm	char data[1];	/* The waveform data starts here */
42930866Smarkm};
430652Sjkh
4313256Sswallacestruct sysex_info {
43230866Smarkm	short key;		/* Use GUS_PATCH here */
43330866Smarkm#define SYSEX_PATCH	_PATCHKEY(0x05)
43430866Smarkm#define MAUI_PATCH	_PATCHKEY(0x06)
43530866Smarkm	short device_no;	/* Synthesizer number */
43630866Smarkm	long len;	/* Size of the sysex data in bytes */
43730866Smarkm	u_char data[1];	/* Sysex data starts here */
43830866Smarkm};
4393256Sswallace
440652Sjkh/*
441652Sjkh * Patch management interface (/dev/sequencer, /dev/patmgr#)
442652Sjkh * Don't use these calls if you want to maintain compatibility with
443652Sjkh * the future versions of the driver.
444652Sjkh */
445652Sjkh
44633473Sscrappy#define PS_NO_PATCHES		0	/* No patch support on device */
44733473Sscrappy#define	PS_MGR_NOT_OK		1	/* Plain patch support (no mgr) */
44833473Sscrappy#define	PS_MGR_OK		2	/* Patch manager supported */
44933473Sscrappy#define	PS_MANAGED		3	/* Patch manager running */
450652Sjkh
451652Sjkh#define SNDCTL_PMGR_IFACE		_IOWR('P', 1, struct patmgr_info)
452652Sjkh
453652Sjkh/*
454652Sjkh * The patmgr_info is a fixed size structure which is used for two
455652Sjkh * different purposes. The intended use is for communication between
456652Sjkh * the application using /dev/sequencer and the patch manager daemon
457652Sjkh * associated with a synthesizer device (ioctl(SNDCTL_PMGR_ACCESS)).
458652Sjkh *
459652Sjkh * This structure is also used with ioctl(SNDCTL_PGMR_IFACE) which allows
460652Sjkh * a patch manager daemon to read and write device parameters. This
461652Sjkh * ioctl available through /dev/sequencer also. Avoid using it since it's
46265335Scg * extremely hardware dependent. In addition access trough /dev/sequencer
463652Sjkh * may confuse the patch manager daemon.
464652Sjkh */
465652Sjkh
466652Sjkhstruct patmgr_info {	/* Note! size must be < 4k since kmalloc() is used */
46730866Smarkm	  u_long key;	/* Don't worry. Reserved for communication
468652Sjkh	  			   between the patch manager and the driver. */
469652Sjkh#define PM_K_EVENT		1 /* Event from the /dev/sequencer driver */
470108533Sschweikh#define PM_K_COMMAND		2 /* Request from an application */
471652Sjkh#define PM_K_RESPONSE		3 /* From patmgr to application */
472652Sjkh#define PM_ERROR		4 /* Error returned by the patmgr */
473652Sjkh	  int device;
474652Sjkh	  int command;
475652Sjkh
47665335Scg/*
47765335Scg * Commands 0x000 to 0xfff reserved for patch manager programs
478652Sjkh */
479652Sjkh#define PM_GET_DEVTYPE	1	/* Returns type of the patch mgr interface of dev */
480652Sjkh#define		PMTYPE_FM2	1	/* 2 OP fm */
481652Sjkh#define		PMTYPE_FM4	2	/* Mixed 4 or 2 op FM (OPL-3) */
482652Sjkh#define		PMTYPE_WAVE	3	/* Wave table synthesizer (GUS) */
483652Sjkh#define PM_GET_NRPGM	2	/* Returns max # of midi programs in parm1 */
484652Sjkh#define PM_GET_PGMMAP	3	/* Returns map of loaded midi programs in data8 */
485652Sjkh#define PM_GET_PGM_PATCHES 4	/* Return list of patches of a program (parm1) */
486652Sjkh#define PM_GET_PATCH	5	/* Return patch header of patch parm1 */
487652Sjkh#define PM_SET_PATCH	6	/* Set patch header of patch parm1 */
488652Sjkh#define PM_READ_PATCH	7	/* Read patch (wave) data */
489652Sjkh#define PM_WRITE_PATCH	8	/* Write patch (wave) data */
490652Sjkh
491652Sjkh/*
492652Sjkh * Commands 0x1000 to 0xffff are for communication between the patch manager
493652Sjkh * and the client
494652Sjkh */
495652Sjkh#define _PM_LOAD_PATCH	0x100
496652Sjkh
49765335Scg/*
498652Sjkh * Commands above 0xffff reserved for device specific use
499652Sjkh */
500652Sjkh
50130866Smarkm	long parm1;
50230866Smarkm	long parm2;
50330866Smarkm	long parm3;
504652Sjkh
50530866Smarkm	union {
50630866Smarkm		u_char data8[4000];
50730866Smarkm		u_short data16[2000];
50830866Smarkm		u_long data32[1000];
509652Sjkh		struct patch_info patch;
51030866Smarkm	} data;
51130866Smarkm};
512652Sjkh
513652Sjkh/*
514652Sjkh * When a patch manager daemon is present, it will be informed by the
515652Sjkh * driver when something important happens. For example when the
516652Sjkh * /dev/sequencer is opened or closed. A record with key == PM_K_EVENT is
517652Sjkh * returned. The command field contains the event type:
518652Sjkh */
519652Sjkh#define PM_E_OPENED		1	/* /dev/sequencer opened */
520652Sjkh#define PM_E_CLOSED		2	/* /dev/sequencer closed */
521652Sjkh#define PM_E_PATCH_RESET	3	/* SNDCTL_RESETSAMPLES called */
522652Sjkh#define PM_E_PATCH_LOADED	4	/* A patch has been loaded by appl */
523652Sjkh
524652Sjkh/*
525652Sjkh * /dev/sequencer input events.
526652Sjkh *
527652Sjkh * The data written to the /dev/sequencer is a stream of events. Events
52865335Scg * are records of 4 or 8 bytes. The first byte defines the size.
529652Sjkh * Any number of events can be written with a write call. There
530652Sjkh * is a set of macros for sending these events. Use these macros if you
531652Sjkh * want to maximize portability of your program.
532652Sjkh *
533652Sjkh * Events SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO. Are also input events.
534652Sjkh * (All input events are currently 4 bytes long. Be prepared to support
5353256Sswallace * 8 byte events also. If you receive any event having first byte >= 128,
536652Sjkh * it's a 8 byte event.
537652Sjkh *
538652Sjkh * The events are documented at the end of this file.
539652Sjkh *
540652Sjkh * Normal events (4 bytes)
541652Sjkh * There is also a 8 byte version of most of the 4 byte events. The
542652Sjkh * 8 byte one is recommended.
543652Sjkh */
544652Sjkh#define SEQ_NOTEOFF		0
545652Sjkh#define SEQ_FMNOTEOFF		SEQ_NOTEOFF	/* Just old name */
546652Sjkh#define SEQ_NOTEON		1
547652Sjkh#define	SEQ_FMNOTEON		SEQ_NOTEON
5483256Sswallace#define SEQ_WAIT		TMR_WAIT_ABS
549652Sjkh#define SEQ_PGMCHANGE		3
550652Sjkh#define SEQ_FMPGMCHANGE		SEQ_PGMCHANGE
5513256Sswallace#define SEQ_SYNCTIMER		TMR_START
552652Sjkh#define SEQ_MIDIPUTC		5
553652Sjkh#define SEQ_DRUMON		6	/*** OBSOLETE ***/
554652Sjkh#define SEQ_DRUMOFF		7	/*** OBSOLETE ***/
5553256Sswallace#define SEQ_ECHO		TMR_ECHO	/* For synching programs with output */
556652Sjkh#define SEQ_AFTERTOUCH		9
557652Sjkh#define SEQ_CONTROLLER		10
5583256Sswallace
55933473Sscrappy/*
5603256Sswallace *	Midi controller numbers
56133473Sscrappy *
56233473Sscrappy * Controllers 0 to 31 (0x00 to 0x1f) and 32 to 63 (0x20 to 0x3f)
56333473Sscrappy * are continuous controllers.
56433473Sscrappy * In the MIDI 1.0 these controllers are sent using two messages.
56533473Sscrappy * Controller numbers 0 to 31 are used to send the MSB and the
56633473Sscrappy * controller numbers 32 to 63 are for the LSB. Note that just 7 bits
56733473Sscrappy * are used in MIDI bytes.
5683256Sswallace */
5693256Sswallace
57033473Sscrappy#define	CTL_BANK_SELECT		0x00
57133473Sscrappy#define	CTL_MODWHEEL		0x01
57233473Sscrappy#define CTL_BREATH		0x02
57333473Sscrappy/*	undefined		0x03 */
57433473Sscrappy#define CTL_FOOT		0x04
57533473Sscrappy#define CTL_PORTAMENTO_TIME	0x05
57633473Sscrappy#define CTL_DATA_ENTRY		0x06
57733473Sscrappy#define CTL_MAIN_VOLUME		0x07
57833473Sscrappy#define CTL_BALANCE		0x08
57933473Sscrappy/*	undefined		0x09 */
58033473Sscrappy#define CTL_PAN			0x0a
58133473Sscrappy#define CTL_EXPRESSION		0x0b
58233473Sscrappy/*	undefined		0x0c - 0x0f */
58333473Sscrappy#define CTL_GENERAL_PURPOSE1	0x10
58433473Sscrappy#define CTL_GENERAL_PURPOSE2	0x11
58533473Sscrappy#define CTL_GENERAL_PURPOSE3	0x12
58633473Sscrappy#define CTL_GENERAL_PURPOSE4	0x13
58733473Sscrappy/*	undefined		0x14 - 0x1f */
5883256Sswallace
58933473Sscrappy/*	undefined		0x20 */
5903256Sswallace
59133473Sscrappy/*
59233473Sscrappy * The controller numbers 0x21 to 0x3f are reserved for the
59333473Sscrappy * least significant bytes of the controllers 0x00 to 0x1f.
59433473Sscrappy * These controllers are not recognised by the driver.
59533473Sscrappy *
59633473Sscrappy * Controllers 64 to 69 (0x40 to 0x45) are on/off switches.
59733473Sscrappy * 0=OFF and 127=ON (intermediate values are possible)
59833473Sscrappy */
59933473Sscrappy#define CTL_DAMPER_PEDAL	0x40
60033473Sscrappy#define CTL_SUSTAIN		CTL_DAMPER_PEDAL	/* Alias */
60133473Sscrappy#define CTL_HOLD		CTL_DAMPER_PEDAL	/* Alias */
60233473Sscrappy#define CTL_PORTAMENTO		0x41
60333473Sscrappy#define CTL_SOSTENUTO		0x42
60433473Sscrappy#define CTL_SOFT_PEDAL		0x43
60533473Sscrappy/*	undefined		0x44 */
60633473Sscrappy#define CTL_HOLD2		0x45
60733473Sscrappy/*	undefined		0x46 - 0x4f */
6083256Sswallace
60933473Sscrappy#define CTL_GENERAL_PURPOSE5	0x50
61033473Sscrappy#define CTL_GENERAL_PURPOSE6	0x51
61133473Sscrappy#define CTL_GENERAL_PURPOSE7	0x52
61233473Sscrappy#define CTL_GENERAL_PURPOSE8	0x53
61333473Sscrappy/*	undefined		0x54 - 0x5a */
61433473Sscrappy#define CTL_EXT_EFF_DEPTH	0x5b
61533473Sscrappy#define CTL_TREMOLO_DEPTH	0x5c
61633473Sscrappy#define CTL_CHORUS_DEPTH	0x5d
61733473Sscrappy#define CTL_DETUNE_DEPTH	0x5e
61833473Sscrappy#define CTL_CELESTE_DEPTH	CTL_DETUNE_DEPTH /* Alias for the above one */
61933473Sscrappy#define CTL_PHASER_DEPTH	0x5f
62033473Sscrappy#define CTL_DATA_INCREMENT	0x60
62133473Sscrappy#define CTL_DATA_DECREMENT	0x61
62233473Sscrappy#define CTL_NONREG_PARM_NUM_LSB	0x62
62333473Sscrappy#define CTL_NONREG_PARM_NUM_MSB	0x63
62433473Sscrappy#define CTL_REGIST_PARM_NUM_LSB	0x64
62533473Sscrappy#define CTL_REGIST_PARM_NUM_MSB	0x65
62633473Sscrappy/*	undefined		0x66 - 0x78 */
62733473Sscrappy/*	reserved		0x79 - 0x7f */
6283256Sswallace
6293256Sswallace/* Pseudo controllers (not midi compatible) */
63033473Sscrappy#define CTRL_PITCH_BENDER	255
63133473Sscrappy#define CTRL_PITCH_BENDER_RANGE	254
63233473Sscrappy#define CTRL_EXPRESSION		253	/* Obsolete */
63333473Sscrappy#define CTRL_MAIN_VOLUME	252	/* Obsolete */
63433473Sscrappy
635652Sjkh#define SEQ_BALANCE		11
6361402Sache#define SEQ_VOLMODE             12
637652Sjkh
638652Sjkh/*
6391402Sache * Volume mode decides how volumes are used
6401402Sache */
6411402Sache
6421402Sache#define VOL_METHOD_ADAGIO	1
6431402Sache#define VOL_METHOD_LINEAR	2
6441402Sache
6451402Sache/*
646652Sjkh * Note! SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO are used also as
647652Sjkh *	 input events.
648652Sjkh */
649652Sjkh
650652Sjkh/*
651652Sjkh * Event codes 0xf0 to 0xfc are reserved for future extensions.
652652Sjkh */
653652Sjkh
654652Sjkh#define SEQ_FULLSIZE		0xfd	/* Long events */
655652Sjkh/*
65633473Sscrappy * SEQ_FULLSIZE events are used for loading patches/samples to the
65733473Sscrappy * synthesizer devices. These events are passed directly to the driver
65833473Sscrappy * of the associated synthesizer device. There is no limit to the size
65933473Sscrappy * of the extended events. These events are not queued but executed
66033473Sscrappy * immediately when the write() is called (execution can take several
66165335Scg * seconds of time).
662652Sjkh *
66333473Sscrappy * When a SEQ_FULLSIZE message is written to the device, it must
66433473Sscrappy * be written using exactly one write() call. Other events cannot
66533473Sscrappy * be mixed to the same write.
66665335Scg *
66733473Sscrappy * For FM synths (YM3812/OPL3) use struct sbi_instrument and write
66833473Sscrappy * it to the /dev/sequencer. Don't write other data together with
66933473Sscrappy * the instrument structure Set the key field of the structure to
67033473Sscrappy * FM_PATCH. The device field is used to route the patch to the
67133473Sscrappy * corresponding device.
672652Sjkh *
67333473Sscrappy * For Gravis UltraSound use struct patch_info. Initialize the key field
67433473Sscrappy * to GUS_PATCH.
675652Sjkh */
67633473Sscrappy#define SEQ_PRIVATE	0xfe	/* Low level HW dependent events (8 bytes) */
67733473Sscrappy#define SEQ_EXTENDED	0xff	/* Extended events (8 bytes) OBSOLETE */
678652Sjkh
679652Sjkh/*
680652Sjkh * Record for FM patches
681652Sjkh */
682652Sjkh
68330866Smarkmtypedef u_char sbi_instr_data[32];
684652Sjkh
685652Sjkhstruct sbi_instrument {
68630866Smarkm	u_short	key;	/* FM_PATCH or OPL3_PATCH */
68730866Smarkm#define FM_PATCH	_PATCHKEY(0x01)
68830866Smarkm#define OPL3_PATCH	_PATCHKEY(0x03)
68930866Smarkm	short		device;		/* Synth# (0-4)	*/
69030866Smarkm	int 		channel;	/* Program# to be initialized  */
69130866Smarkm	sbi_instr_data	operators;	/* Reg. settings for operator cells
69230866Smarkm					 * (.SBI format)	*/
69330866Smarkm};
694652Sjkh
695652Sjkhstruct synth_info {	/* Read only */
69645462Skato	char	name[30];
69730866Smarkm	int	device;		/* 0-N. INITIALIZE BEFORE CALLING */
69830866Smarkm	int	synth_type;
699652Sjkh#define SYNTH_TYPE_FM			0
700652Sjkh#define SYNTH_TYPE_SAMPLE		1
7013256Sswallace#define SYNTH_TYPE_MIDI			2	/* Midi interface */
702652Sjkh
70330866Smarkm	int	synth_subtype;
704652Sjkh#define FM_TYPE_ADLIB			0x00
705652Sjkh#define FM_TYPE_OPL3			0x01
706122954Smatk#define MIDI_TYPE_MPU401		0x401
707652Sjkh
70833473Sscrappy#define SAMPLE_TYPE_BASIC		0x10
70933473Sscrappy#define SAMPLE_TYPE_GUS			SAMPLE_TYPE_BASIC
71033530Sscrappy#define SAMPLE_TYPE_AWE32		0x20
711652Sjkh
71230866Smarkm	int	perc_mode;	/* No longer supported */
71330866Smarkm	int	nr_voices;
71430866Smarkm	int	nr_drums;	/* Obsolete field */
71530866Smarkm	int	instr_bank_size;
71665335Scg	u_long	capabilities;
71733473Sscrappy#define SYNTH_CAP_PERCMODE	0x00000001 /* No longer used */
71833473Sscrappy#define SYNTH_CAP_OPL3		0x00000002 /* Set if OPL3 supported */
71933473Sscrappy#define SYNTH_CAP_INPUT		0x00000004 /* Input (MIDI) device */
72030866Smarkm	int	dummies[19];	/* Reserve space */
72130866Smarkm};
722652Sjkh
7233256Sswallacestruct sound_timer_info {
72430866Smarkm	char name[32];
72530866Smarkm	int caps;
72630866Smarkm};
7273256Sswallace
728652Sjkhstruct midi_info {
72930866Smarkm	char		name[30];
73030866Smarkm	int		device;		/* 0-N. INITIALIZE BEFORE CALLING */
73130866Smarkm	u_long	capabilities;	/* To be defined later */
73230866Smarkm	int		dev_type;
73330866Smarkm	int		dummies[18];	/* Reserve space */
73430866Smarkm};
735652Sjkh
73633473Sscrappy/*
7373256Sswallace * ioctl commands for the /dev/midi##
7383256Sswallace */
7393256Sswallacetypedef struct {
74030866Smarkm	u_char cmd;
74130866Smarkm	char nr_args, nr_returns;
74230866Smarkm	u_char data[30];
74330866Smarkm} mpu_command_rec;
7443256Sswallace
74533473Sscrappy#define SNDCTL_MIDI_PRETIME	_IOWR('m', 0, int)
74633473Sscrappy#define SNDCTL_MIDI_MPUMODE	_IOWR('m', 1, int)
74733473Sscrappy#define SNDCTL_MIDI_MPUCMD	_IOWR('m', 2, mpu_command_rec)
74862947Stanimura#define MIOSPASSTHRU		_IOWR('m', 3, int)
74962947Stanimura#define MIOGPASSTHRU		_IOWR('m', 4, int)
7503256Sswallace
75133473Sscrappy/*
752652Sjkh * IOCTL commands for /dev/dsp and /dev/audio
753652Sjkh */
754652Sjkh
75533473Sscrappy#define SNDCTL_DSP_RESET	_IO  ('P', 0)
75633473Sscrappy#define SNDCTL_DSP_SYNC		_IO  ('P', 1)
75733473Sscrappy#define SNDCTL_DSP_SPEED	_IOWR('P', 2, int)
75833473Sscrappy#define SNDCTL_DSP_STEREO	_IOWR('P', 3, int)
75933473Sscrappy#define SNDCTL_DSP_GETBLKSIZE	_IOR('P', 4, int)
76033473Sscrappy#define SNDCTL_DSP_SETBLKSIZE   _IOW('P', 4, int)
76133473Sscrappy#define SNDCTL_DSP_SETFMT	_IOWR('P',5, int) /* Selects ONE fmt*/
76233473Sscrappy
76333473Sscrappy/*
76433473Sscrappy * SOUND_PCM_WRITE_CHANNELS is not that different
76533473Sscrappy * from SNDCTL_DSP_STEREO
76633473Sscrappy */
767652Sjkh#define SOUND_PCM_WRITE_CHANNELS	_IOWR('P', 6, int)
76865335Scg#define SNDCTL_DSP_CHANNELS	SOUND_PCM_WRITE_CHANNELS
76933473Sscrappy#define SOUND_PCM_WRITE_FILTER	_IOWR('P', 7, int)
77033473Sscrappy#define SNDCTL_DSP_POST		_IO  ('P', 8)
771652Sjkh
77233473Sscrappy/*
77333473Sscrappy * SNDCTL_DSP_SETBLKSIZE and the following two calls mostly do
77433473Sscrappy * the same thing, i.e. set the block size used in DMA transfers.
77533473Sscrappy */
77633473Sscrappy#define SNDCTL_DSP_SUBDIVIDE	_IOWR('P', 9, int)
77733473Sscrappy#define SNDCTL_DSP_SETFRAGMENT	_IOWR('P',10, int)
77830866Smarkm
7793256Sswallace
78033473Sscrappy#define SNDCTL_DSP_GETFMTS	_IOR ('P',11, int) /* Returns a mask */
7819750Sjkh/*
7829750Sjkh * Buffer status queries.
7839750Sjkh */
7849750Sjkhtypedef struct audio_buf_info {
78533473Sscrappy    int fragments;	/* # of avail. frags (partly used ones not counted) */
78633473Sscrappy    int fragstotal;	/* Total # of fragments allocated */
78733473Sscrappy    int fragsize;	/* Size of a fragment in bytes */
7889750Sjkh
78933473Sscrappy    int bytes;	/* Avail. space in bytes (includes partly used fragments) */
79033473Sscrappy		/* Note! 'bytes' could be more than fragments*fragsize */
79130866Smarkm} audio_buf_info;
7929750Sjkh
79333473Sscrappy#define SNDCTL_DSP_GETOSPACE	_IOR ('P',12, audio_buf_info)
79433473Sscrappy#define SNDCTL_DSP_GETISPACE	_IOR ('P',13, audio_buf_info)
7959750Sjkh
79633473Sscrappy/*
79733473Sscrappy * SNDCTL_DSP_NONBLOCK is the same (but less powerful, since the
79833473Sscrappy * action cannot be undone) of FIONBIO. The same can be achieved
79933473Sscrappy * by opening the device with O_NDELAY
80033473Sscrappy */
80133473Sscrappy#define SNDCTL_DSP_NONBLOCK	_IO  ('P',14)
80230866Smarkm
80333473Sscrappy#define SNDCTL_DSP_GETCAPS	_IOR ('P',15, int)
80433473Sscrappy#define DSP_CAP_REVISION	0x000000ff /* revision level (0 to 255) */
80533473Sscrappy#define DSP_CAP_DUPLEX		0x00000100 /* Full duplex record/playback */
80633473Sscrappy#define DSP_CAP_REALTIME	0x00000200 /* Real time capability */
80733473Sscrappy#define DSP_CAP_BATCH		0x00000400
80833473Sscrappy    /*
80933473Sscrappy     * Device has some kind of internal buffers which may
81033473Sscrappy     * cause some delays and decrease precision of timing
81133473Sscrappy     */
81233473Sscrappy#define DSP_CAP_COPROC		0x00000800
81333473Sscrappy    /* Has a coprocessor, sometimes it's a DSP but usually not */
81433473Sscrappy#define DSP_CAP_TRIGGER		0x00001000 /* Supports SETTRIGGER */
81533530Sscrappy#define DSP_CAP_MMAP 0x00002000 /* Supports mmap() */
81630866Smarkm
81733473Sscrappy/*
81833473Sscrappy * What do these function do ?
81933473Sscrappy */
82033473Sscrappy#define SNDCTL_DSP_GETTRIGGER	_IOR ('P',16, int)
82133473Sscrappy#define SNDCTL_DSP_SETTRIGGER	_IOW ('P',16, int)
82233473Sscrappy#define PCM_ENABLE_INPUT	0x00000001
82330866Smarkm#define PCM_ENABLE_OUTPUT	0x00000002
82430866Smarkm
82530866Smarkmtypedef struct count_info {
82630866Smarkm	int bytes;	/* Total # of bytes processed */
82730866Smarkm	int blocks;	/* # of fragment transitions since last time */
82830866Smarkm	int ptr;	/* Current DMA pointer value */
82930866Smarkm} count_info;
83030866Smarkm
83133473Sscrappy/*
83233473Sscrappy * GETIPTR and GETISPACE are not that different... same for out.
83333473Sscrappy */
83433473Sscrappy#define SNDCTL_DSP_GETIPTR	_IOR ('P',17, count_info)
83533473Sscrappy#define SNDCTL_DSP_GETOPTR	_IOR ('P',18, count_info)
83630866Smarkm
83730866Smarkmtypedef struct buffmem_desc {
83830866Smarkm	caddr_t buffer;
83930866Smarkm	int size;
84030866Smarkm} buffmem_desc;
84130866Smarkm
84233473Sscrappy#define SNDCTL_DSP_MAPINBUF	_IOR ('P', 19, buffmem_desc)
84333473Sscrappy#define SNDCTL_DSP_MAPOUTBUF	_IOR ('P', 20, buffmem_desc)
84433473Sscrappy#define SNDCTL_DSP_SETSYNCRO	_IO  ('P', 21)
84565335Scg#define SNDCTL_DSP_SETDUPLEX	_IO  ('P', 22)
84653901Salfred#define SNDCTL_DSP_GETODELAY	_IOR ('P', 23, int)
84730866Smarkm
84833473Sscrappy/*
84933473Sscrappy * I guess these are the readonly version of the same
85033473Sscrappy * functions that exist above as SNDCTL_DSP_...
85133473Sscrappy */
85233473Sscrappy#define SOUND_PCM_READ_RATE	_IOR ('P', 2, int)
85333473Sscrappy#define SOUND_PCM_READ_CHANNELS	_IOR ('P', 6, int)
85433473Sscrappy#define SOUND_PCM_READ_BITS	_IOR ('P', 5, int)
85533473Sscrappy#define SOUND_PCM_READ_FILTER	_IOR ('P', 7, int)
856652Sjkh
8579750Sjkh/*
8589750Sjkh * ioctl calls to be used in communication with coprocessors and
8599750Sjkh * DSP chips.
8603256Sswallace */
8613256Sswallace
8629750Sjkhtypedef struct copr_buffer {
86330866Smarkm	int command;	/* Set to 0 if not used */
86430866Smarkm	int flags;
8659750Sjkh#define CPF_NONE		0x0000
8669750Sjkh#define CPF_FIRST		0x0001	/* First block */
8679750Sjkh#define CPF_LAST		0x0002	/* Last block */
86830866Smarkm	int len;
86930866Smarkm	int offs;	/* If required by the device (0 if not used) */
8703256Sswallace
87130866Smarkm	u_char data[4000]; /* NOTE! 4000 is not 4k */
87230866Smarkm} copr_buffer;
8739750Sjkh
8749750Sjkhtypedef struct copr_debug_buf {
87530866Smarkm	int command;	/* Used internally. Set to 0 */
87630866Smarkm	int parm1;
87730866Smarkm	int parm2;
87865335Scg	int flags;
87930866Smarkm	int len;	/* Length of data in bytes */
88030866Smarkm} copr_debug_buf;
8819750Sjkh
8829750Sjkhtypedef struct copr_msg {
88330866Smarkm	int len;
88430866Smarkm	u_char data[4000];
88530866Smarkm} copr_msg;
8869750Sjkh
88733473Sscrappy#define SNDCTL_COPR_RESET       _IO  ('C',  0)
88833473Sscrappy#define SNDCTL_COPR_LOAD	_IOWR('C',  1, copr_buffer)
88933473Sscrappy#define SNDCTL_COPR_RDATA	_IOWR('C',  2, copr_debug_buf)
89033473Sscrappy#define SNDCTL_COPR_RCODE	_IOWR('C',  3, copr_debug_buf)
89133473Sscrappy#define SNDCTL_COPR_WDATA	_IOW ('C',  4, copr_debug_buf)
89233473Sscrappy#define SNDCTL_COPR_WCODE	_IOW ('C',  5, copr_debug_buf)
89333473Sscrappy#define SNDCTL_COPR_RUN		_IOWR('C',  6, copr_debug_buf)
89433473Sscrappy#define SNDCTL_COPR_HALT	_IOWR('C',  7, copr_debug_buf)
89533473Sscrappy#define SNDCTL_COPR_SENDMSG	_IOW ('C',  8, copr_msg)
89633473Sscrappy#define SNDCTL_COPR_RCVMSG	_IOR ('C',  9, copr_msg)
8979750Sjkh
89833473Sscrappy/*
899652Sjkh * IOCTL commands for /dev/mixer
900652Sjkh */
90165335Scg
90265335Scg/*
903652Sjkh * Mixer devices
904652Sjkh *
905652Sjkh * There can be up to 20 different analog mixer channels. The
90665335Scg * SOUND_MIXER_NRDEVICES gives the currently supported maximum.
907652Sjkh * The SOUND_MIXER_READ_DEVMASK returns a bitmask which tells
908652Sjkh * the devices supported by the particular mixer.
909652Sjkh */
910652Sjkh
91133473Sscrappy#define SOUND_MIXER_NRDEVICES	25
91281891Ssobomax#define SOUND_MIXER_VOLUME	0	/* Master output level */
91381891Ssobomax#define SOUND_MIXER_BASS	1	/* Treble level of all output channels */
91481891Ssobomax#define SOUND_MIXER_TREBLE	2	/* Bass level of all output channels */
91581891Ssobomax#define SOUND_MIXER_SYNTH	3	/* Volume of synthesier input */
91681891Ssobomax#define SOUND_MIXER_PCM		4	/* Output level for the audio device */
91781891Ssobomax#define SOUND_MIXER_SPEAKER	5	/* Output level for the PC speaker
91881891Ssobomax					 * signals */
91981891Ssobomax#define SOUND_MIXER_LINE	6	/* Volume level for the line in jack */
92081891Ssobomax#define SOUND_MIXER_MIC		7	/* Volume for the signal coming from
92181891Ssobomax					 * the microphone jack */
92281891Ssobomax#define SOUND_MIXER_CD		8	/* Volume level for the input signal
92381891Ssobomax					 * connected to the CD audio input */
92481891Ssobomax#define SOUND_MIXER_IMIX	9	/* Recording monitor. It controls the
92581891Ssobomax					 * output volume of the selected
92681891Ssobomax					 * recording sources while recording */
92781891Ssobomax#define SOUND_MIXER_ALTPCM	10	/* Volume of the alternative codec
92881891Ssobomax					 * device */
92981891Ssobomax#define SOUND_MIXER_RECLEV	11	/* Global recording level */
9309750Sjkh#define SOUND_MIXER_IGAIN	12	/* Input gain */
9319750Sjkh#define SOUND_MIXER_OGAIN	13	/* Output gain */
93265335Scg/*
9339750Sjkh * The AD1848 codec and compatibles have three line level inputs
9349750Sjkh * (line, aux1 and aux2). Since each card manufacturer have assigned
93530866Smarkm * different meanings to these inputs, it's inpractical to assign
9369750Sjkh * specific meanings (line, cd, synth etc.) to them.
9379750Sjkh */
9389750Sjkh#define SOUND_MIXER_LINE1	14	/* Input source 1  (aux1) */
9399750Sjkh#define SOUND_MIXER_LINE2	15	/* Input source 2  (aux2) */
9409750Sjkh#define SOUND_MIXER_LINE3	16	/* Input source 3  (line) */
94133473Sscrappy#define SOUND_MIXER_DIGITAL1    17      /* Digital (input) 1 */
94233473Sscrappy#define SOUND_MIXER_DIGITAL2    18      /* Digital (input) 2 */
94333473Sscrappy#define SOUND_MIXER_DIGITAL3    19      /* Digital (input) 3 */
94433473Sscrappy#define SOUND_MIXER_PHONEIN     20      /* Phone input */
94533473Sscrappy#define SOUND_MIXER_PHONEOUT    21      /* Phone output */
94633473Sscrappy#define SOUND_MIXER_VIDEO       22      /* Video/TV (audio) in */
94733473Sscrappy#define SOUND_MIXER_RADIO       23      /* Radio in */
94833473Sscrappy#define SOUND_MIXER_MONITOR     24      /* Monitor (usually mic) volume */
949652Sjkh
95033473Sscrappy
95133473Sscrappy/*
95233473Sscrappy * Some on/off settings (SOUND_SPECIAL_MIN - SOUND_SPECIAL_MAX)
95333473Sscrappy * Not counted to SOUND_MIXER_NRDEVICES, but use the same number space
95433473Sscrappy */
955652Sjkh#define SOUND_ONOFF_MIN		28
956652Sjkh#define SOUND_ONOFF_MAX		30
957652Sjkh#define SOUND_MIXER_MUTE	28	/* 0 or 1 */
958652Sjkh#define SOUND_MIXER_ENHANCE	29	/* Enhanced stereo (0, 40, 60 or 80) */
959652Sjkh#define SOUND_MIXER_LOUD	30	/* 0 or 1 */
960652Sjkh
961652Sjkh/* Note!	Number 31 cannot be used since the sign bit is reserved */
96233473Sscrappy#define SOUND_MIXER_NONE        31
963652Sjkh
96430866Smarkm#define SOUND_DEVICE_LABELS	{ \
96530866Smarkm	"Vol  ", "Bass ", "Trebl", "Synth", "Pcm  ", "Spkr ", "Line ", \
96633473Sscrappy	"Mic  ", "CD   ", "Mix  ", "Pcm2 ", "Rec  ", "IGain", "OGain", \
96733473Sscrappy	"Line1", "Line2", "Line3", "Digital1", "Digital2", "Digital3", \
96833473Sscrappy	"PhoneIn", "PhoneOut", "Video", "Radio", "Monitor"}
969652Sjkh
97030866Smarkm#define SOUND_DEVICE_NAMES	{ \
97130866Smarkm	"vol", "bass", "treble", "synth", "pcm", "speaker", "line", \
97230866Smarkm	"mic", "cd", "mix", "pcm2", "rec", "igain", "ogain", \
97333473Sscrappy	"line1", "line2", "line3", "dig1", "dig2", "dig3", \
97433473Sscrappy	"phin", "phout", "video", "radio", "monitor"}
975652Sjkh
976652Sjkh/*	Device bitmask identifiers	*/
977652Sjkh
97830866Smarkm#define SOUND_MIXER_RECSRC	0xff	/* 1 bit per recording source */
97930866Smarkm#define SOUND_MIXER_DEVMASK	0xfe	/* 1 bit per supported device */
98030866Smarkm#define SOUND_MIXER_RECMASK	0xfd	/* 1 bit per supp. recording source */
981652Sjkh#define SOUND_MIXER_CAPS	0xfc
98230866Smarkm#define SOUND_CAP_EXCL_INPUT	0x00000001	/* Only 1 rec. src at a time */
983652Sjkh#define SOUND_MIXER_STEREODEVS	0xfb	/* Mixer channels supporting stereo */
984652Sjkh
985652Sjkh/*	Device mask bits	*/
986652Sjkh
987652Sjkh#define SOUND_MASK_VOLUME	(1 << SOUND_MIXER_VOLUME)
988652Sjkh#define SOUND_MASK_BASS		(1 << SOUND_MIXER_BASS)
989652Sjkh#define SOUND_MASK_TREBLE	(1 << SOUND_MIXER_TREBLE)
990652Sjkh#define SOUND_MASK_SYNTH	(1 << SOUND_MIXER_SYNTH)
991652Sjkh#define SOUND_MASK_PCM		(1 << SOUND_MIXER_PCM)
992652Sjkh#define SOUND_MASK_SPEAKER	(1 << SOUND_MIXER_SPEAKER)
993652Sjkh#define SOUND_MASK_LINE		(1 << SOUND_MIXER_LINE)
994652Sjkh#define SOUND_MASK_MIC		(1 << SOUND_MIXER_MIC)
995652Sjkh#define SOUND_MASK_CD		(1 << SOUND_MIXER_CD)
996652Sjkh#define SOUND_MASK_IMIX		(1 << SOUND_MIXER_IMIX)
997652Sjkh#define SOUND_MASK_ALTPCM	(1 << SOUND_MIXER_ALTPCM)
998652Sjkh#define SOUND_MASK_RECLEV	(1 << SOUND_MIXER_RECLEV)
9999750Sjkh#define SOUND_MASK_IGAIN	(1 << SOUND_MIXER_IGAIN)
10009750Sjkh#define SOUND_MASK_OGAIN	(1 << SOUND_MIXER_OGAIN)
10019750Sjkh#define SOUND_MASK_LINE1	(1 << SOUND_MIXER_LINE1)
10029750Sjkh#define SOUND_MASK_LINE2	(1 << SOUND_MIXER_LINE2)
10039750Sjkh#define SOUND_MASK_LINE3	(1 << SOUND_MIXER_LINE3)
100433473Sscrappy#define SOUND_MASK_DIGITAL1     (1 << SOUND_MIXER_DIGITAL1)
100533473Sscrappy#define SOUND_MASK_DIGITAL2     (1 << SOUND_MIXER_DIGITAL2)
100633473Sscrappy#define SOUND_MASK_DIGITAL3     (1 << SOUND_MIXER_DIGITAL3)
100733473Sscrappy#define SOUND_MASK_PHONEIN      (1 << SOUND_MIXER_PHONEIN)
100833473Sscrappy#define SOUND_MASK_PHONEOUT     (1 << SOUND_MIXER_PHONEOUT)
100933473Sscrappy#define SOUND_MASK_RADIO        (1 << SOUND_MIXER_RADIO)
101033473Sscrappy#define SOUND_MASK_VIDEO        (1 << SOUND_MIXER_VIDEO)
101133473Sscrappy#define SOUND_MASK_MONITOR      (1 << SOUND_MIXER_MONITOR)
1012652Sjkh
101333473Sscrappy/* Obsolete macros */
1014652Sjkh#define SOUND_MASK_MUTE		(1 << SOUND_MIXER_MUTE)
1015652Sjkh#define SOUND_MASK_ENHANCE	(1 << SOUND_MIXER_ENHANCE)
1016652Sjkh#define SOUND_MASK_LOUD		(1 << SOUND_MIXER_LOUD)
1017652Sjkh
1018652Sjkh#define MIXER_READ(dev)		_IOR('M', dev, int)
1019652Sjkh#define SOUND_MIXER_READ_VOLUME		MIXER_READ(SOUND_MIXER_VOLUME)
1020652Sjkh#define SOUND_MIXER_READ_BASS		MIXER_READ(SOUND_MIXER_BASS)
1021652Sjkh#define SOUND_MIXER_READ_TREBLE		MIXER_READ(SOUND_MIXER_TREBLE)
1022652Sjkh#define SOUND_MIXER_READ_SYNTH		MIXER_READ(SOUND_MIXER_SYNTH)
1023652Sjkh#define SOUND_MIXER_READ_PCM		MIXER_READ(SOUND_MIXER_PCM)
1024652Sjkh#define SOUND_MIXER_READ_SPEAKER	MIXER_READ(SOUND_MIXER_SPEAKER)
1025652Sjkh#define SOUND_MIXER_READ_LINE		MIXER_READ(SOUND_MIXER_LINE)
1026652Sjkh#define SOUND_MIXER_READ_MIC		MIXER_READ(SOUND_MIXER_MIC)
1027652Sjkh#define SOUND_MIXER_READ_CD		MIXER_READ(SOUND_MIXER_CD)
1028652Sjkh#define SOUND_MIXER_READ_IMIX		MIXER_READ(SOUND_MIXER_IMIX)
1029652Sjkh#define SOUND_MIXER_READ_ALTPCM		MIXER_READ(SOUND_MIXER_ALTPCM)
1030652Sjkh#define SOUND_MIXER_READ_RECLEV		MIXER_READ(SOUND_MIXER_RECLEV)
10319750Sjkh#define SOUND_MIXER_READ_IGAIN		MIXER_READ(SOUND_MIXER_IGAIN)
10329750Sjkh#define SOUND_MIXER_READ_OGAIN		MIXER_READ(SOUND_MIXER_OGAIN)
10339750Sjkh#define SOUND_MIXER_READ_LINE1		MIXER_READ(SOUND_MIXER_LINE1)
10349750Sjkh#define SOUND_MIXER_READ_LINE2		MIXER_READ(SOUND_MIXER_LINE2)
10359750Sjkh#define SOUND_MIXER_READ_LINE3		MIXER_READ(SOUND_MIXER_LINE3)
1036118923Scg#define SOUND_MIXER_READ_DIGITAL1	MIXER_READ(SOUND_MIXER_DIGITAL1)
1037118923Scg#define SOUND_MIXER_READ_DIGITAL2	MIXER_READ(SOUND_MIXER_DIGITAL2)
1038118923Scg#define SOUND_MIXER_READ_DIGITAL3	MIXER_READ(SOUND_MIXER_DIGITAL3)
1039118923Scg#define SOUND_MIXER_READ_PHONEIN      	MIXER_READ(SOUND_MIXER_PHONEIN)
1040118923Scg#define SOUND_MIXER_READ_PHONEOUT	MIXER_READ(SOUND_MIXER_PHONEOUT)
1041118923Scg#define SOUND_MIXER_READ_RADIO		MIXER_READ(SOUND_MIXER_RADIO)
1042118923Scg#define SOUND_MIXER_READ_VIDEO		MIXER_READ(SOUND_MIXER_VIDEO)
1043118923Scg#define SOUND_MIXER_READ_MONITOR	MIXER_READ(SOUND_MIXER_MONITOR)
104433473Sscrappy
104533473Sscrappy/* Obsolete macros */
1046652Sjkh#define SOUND_MIXER_READ_MUTE		MIXER_READ(SOUND_MIXER_MUTE)
1047652Sjkh#define SOUND_MIXER_READ_ENHANCE	MIXER_READ(SOUND_MIXER_ENHANCE)
1048652Sjkh#define SOUND_MIXER_READ_LOUD		MIXER_READ(SOUND_MIXER_LOUD)
1049652Sjkh
1050652Sjkh#define SOUND_MIXER_READ_RECSRC		MIXER_READ(SOUND_MIXER_RECSRC)
1051652Sjkh#define SOUND_MIXER_READ_DEVMASK	MIXER_READ(SOUND_MIXER_DEVMASK)
1052652Sjkh#define SOUND_MIXER_READ_RECMASK	MIXER_READ(SOUND_MIXER_RECMASK)
1053652Sjkh#define SOUND_MIXER_READ_STEREODEVS	MIXER_READ(SOUND_MIXER_STEREODEVS)
1054652Sjkh#define SOUND_MIXER_READ_CAPS		MIXER_READ(SOUND_MIXER_CAPS)
1055652Sjkh
1056652Sjkh#define MIXER_WRITE(dev)		_IOWR('M', dev, int)
1057652Sjkh#define SOUND_MIXER_WRITE_VOLUME	MIXER_WRITE(SOUND_MIXER_VOLUME)
1058652Sjkh#define SOUND_MIXER_WRITE_BASS		MIXER_WRITE(SOUND_MIXER_BASS)
1059652Sjkh#define SOUND_MIXER_WRITE_TREBLE	MIXER_WRITE(SOUND_MIXER_TREBLE)
1060652Sjkh#define SOUND_MIXER_WRITE_SYNTH		MIXER_WRITE(SOUND_MIXER_SYNTH)
1061652Sjkh#define SOUND_MIXER_WRITE_PCM		MIXER_WRITE(SOUND_MIXER_PCM)
1062652Sjkh#define SOUND_MIXER_WRITE_SPEAKER	MIXER_WRITE(SOUND_MIXER_SPEAKER)
1063652Sjkh#define SOUND_MIXER_WRITE_LINE		MIXER_WRITE(SOUND_MIXER_LINE)
1064652Sjkh#define SOUND_MIXER_WRITE_MIC		MIXER_WRITE(SOUND_MIXER_MIC)
1065652Sjkh#define SOUND_MIXER_WRITE_CD		MIXER_WRITE(SOUND_MIXER_CD)
1066652Sjkh#define SOUND_MIXER_WRITE_IMIX		MIXER_WRITE(SOUND_MIXER_IMIX)
1067652Sjkh#define SOUND_MIXER_WRITE_ALTPCM	MIXER_WRITE(SOUND_MIXER_ALTPCM)
1068652Sjkh#define SOUND_MIXER_WRITE_RECLEV	MIXER_WRITE(SOUND_MIXER_RECLEV)
10699750Sjkh#define SOUND_MIXER_WRITE_IGAIN		MIXER_WRITE(SOUND_MIXER_IGAIN)
10709750Sjkh#define SOUND_MIXER_WRITE_OGAIN		MIXER_WRITE(SOUND_MIXER_OGAIN)
10719750Sjkh#define SOUND_MIXER_WRITE_LINE1		MIXER_WRITE(SOUND_MIXER_LINE1)
10729750Sjkh#define SOUND_MIXER_WRITE_LINE2		MIXER_WRITE(SOUND_MIXER_LINE2)
10739750Sjkh#define SOUND_MIXER_WRITE_LINE3		MIXER_WRITE(SOUND_MIXER_LINE3)
1074118923Scg#define SOUND_MIXER_WRITE_DIGITAL1	MIXER_WRITE(SOUND_MIXER_DIGITAL1)
1075118923Scg#define SOUND_MIXER_WRITE_DIGITAL2	MIXER_WRITE(SOUND_MIXER_DIGITAL2)
1076118923Scg#define SOUND_MIXER_WRITE_DIGITAL3	MIXER_WRITE(SOUND_MIXER_DIGITAL3)
1077118923Scg#define SOUND_MIXER_WRITE_PHONEIN      	MIXER_WRITE(SOUND_MIXER_PHONEIN)
1078118923Scg#define SOUND_MIXER_WRITE_PHONEOUT	MIXER_WRITE(SOUND_MIXER_PHONEOUT)
1079118923Scg#define SOUND_MIXER_WRITE_RADIO		MIXER_WRITE(SOUND_MIXER_RADIO)
1080118923Scg#define SOUND_MIXER_WRITE_VIDEO		MIXER_WRITE(SOUND_MIXER_VIDEO)
1081118923Scg#define SOUND_MIXER_WRITE_MONITOR	MIXER_WRITE(SOUND_MIXER_MONITOR)
1082118923Scg
1083652Sjkh#define SOUND_MIXER_WRITE_MUTE		MIXER_WRITE(SOUND_MIXER_MUTE)
1084652Sjkh#define SOUND_MIXER_WRITE_ENHANCE	MIXER_WRITE(SOUND_MIXER_ENHANCE)
1085652Sjkh#define SOUND_MIXER_WRITE_LOUD		MIXER_WRITE(SOUND_MIXER_LOUD)
1086652Sjkh
1087652Sjkh#define SOUND_MIXER_WRITE_RECSRC	MIXER_WRITE(SOUND_MIXER_RECSRC)
1088652Sjkh
1089118923Scgtypedef struct mixer_info {
1090118923Scg  char id[16];
1091118923Scg  char name[32];
1092118923Scg  int  modify_counter;
1093118923Scg  int fillers[10];
1094118923Scg} mixer_info;
1095118923Scg
1096118923Scg#define SOUND_MIXER_INFO		_IOR('M', 101, mixer_info)
1097118923Scg
109833473Sscrappy#define LEFT_CHN	0
109933473Sscrappy#define RIGHT_CHN	1
110033473Sscrappy
1101652Sjkh/*
11023256Sswallace * Level 2 event types for /dev/sequencer
11033256Sswallace */
11043256Sswallace
11053256Sswallace/*
11063256Sswallace * The 4 most significant bits of byte 0 specify the class of
110765335Scg * the event:
1108652Sjkh *
11093256Sswallace *	0x8X = system level events,
11103256Sswallace *	0x9X = device/port specific events, event[1] = device/port,
11113256Sswallace *		The last 4 bits give the subtype:
11123256Sswallace *			0x02	= Channel event (event[3] = chn).
11133256Sswallace *			0x01	= note event (event[4] = note).
11143256Sswallace *			(0x01 is not used alone but always with bit 0x02).
11153256Sswallace *	       event[2] = MIDI message code (0x80=note off etc.)
11163256Sswallace *
1117652Sjkh */
1118652Sjkh
11193256Sswallace#define EV_SEQ_LOCAL		0x80
11203256Sswallace#define EV_TIMING		0x81
11213256Sswallace#define EV_CHN_COMMON		0x92
11223256Sswallace#define EV_CHN_VOICE		0x93
112330866Smarkm#define EV_SYSEX		0x94
11243256Sswallace/*
11253256Sswallace * Event types 200 to 220 are reserved for application use.
11263256Sswallace * These numbers will not be used by the driver.
11273256Sswallace */
1128652Sjkh
1129652Sjkh/*
11303256Sswallace * Events for event type EV_CHN_VOICE
1131652Sjkh */
1132652Sjkh
11333256Sswallace#define MIDI_NOTEOFF		0x80
11343256Sswallace#define MIDI_NOTEON		0x90
11353256Sswallace#define MIDI_KEY_PRESSURE	0xA0
11363256Sswallace
1137652Sjkh/*
11383256Sswallace * Events for event type EV_CHN_COMMON
1139652Sjkh */
1140652Sjkh
11413256Sswallace#define MIDI_CTL_CHANGE		0xB0
11423256Sswallace#define MIDI_PGM_CHANGE		0xC0
11433256Sswallace#define MIDI_CHN_PRESSURE	0xD0
11443256Sswallace#define MIDI_PITCH_BEND		0xE0
1145652Sjkh
11463256Sswallace#define MIDI_SYSTEM_PREFIX	0xF0
11473256Sswallace
1148652Sjkh/*
11493256Sswallace * Timer event types
11503256Sswallace */
11513256Sswallace#define TMR_WAIT_REL		1	/* Time relative to the prev time */
11523256Sswallace#define TMR_WAIT_ABS		2	/* Absolute time since TMR_START */
11533256Sswallace#define TMR_STOP		3
11543256Sswallace#define TMR_START		4
11553256Sswallace#define TMR_CONTINUE		5
11563256Sswallace#define TMR_TEMPO		6
11573256Sswallace#define TMR_ECHO		8
11583256Sswallace#define TMR_CLOCK		9	/* MIDI clock */
11593256Sswallace#define TMR_SPP			10	/* Song position pointer */
11603256Sswallace#define TMR_TIMESIG		11	/* Time signature */
11613256Sswallace
116230866Smarkm/*
116330866Smarkm *	Local event types
116430866Smarkm */
116530866Smarkm#define LOCL_STARTAUDIO		1
116630866Smarkm
116765335Scg#if (!defined(_KERNEL) && !defined(INKERNEL)) || defined(USE_SEQ_MACROS)
11683256Sswallace/*
1169652Sjkh *	Some convenience macros to simplify programming of the
1170652Sjkh *	/dev/sequencer interface
1171652Sjkh *
1172652Sjkh *	These macros define the API which should be used when possible.
1173652Sjkh */
1174652Sjkh
11753256Sswallace#ifndef USE_SIMPLE_MACROS
117692719Salfredvoid seqbuf_dump(void);	/* This function must be provided by programs */
1177652Sjkh
1178652Sjkh/* Sample seqbuf_dump() implementation:
1179652Sjkh *
1180652Sjkh *	SEQ_DEFINEBUF (2048);	-- Defines a buffer for 2048 bytes
1181652Sjkh *
1182652Sjkh *	int seqfd;		-- The file descriptor for /dev/sequencer.
1183652Sjkh *
1184652Sjkh *	void
1185652Sjkh *	seqbuf_dump ()
1186652Sjkh *	{
1187652Sjkh *	  if (_seqbufptr)
1188652Sjkh *	    if (write (seqfd, _seqbuf, _seqbufptr) == -1)
1189652Sjkh *	      {
1190652Sjkh *		perror ("write /dev/sequencer");
1191652Sjkh *		exit (-1);
1192652Sjkh *	      }
1193652Sjkh *	  _seqbufptr = 0;
1194652Sjkh *	}
1195652Sjkh */
1196652Sjkh
119730866Smarkm#define SEQ_DEFINEBUF(len)		\
119830866Smarkm	u_char _seqbuf[len]; int _seqbuflen = len;int _seqbufptr = 0
119930866Smarkm#define SEQ_USE_EXTBUF()		\
120030866Smarkm	extern u_char _seqbuf[]; \
120130866Smarkm	extern int _seqbuflen;extern int _seqbufptr
12023256Sswallace#define SEQ_DECLAREBUF()		SEQ_USE_EXTBUF()
1203652Sjkh#define SEQ_PM_DEFINES			struct patmgr_info _pm_info
120430866Smarkm#define _SEQ_NEEDBUF(len)		\
120530866Smarkm	if ((_seqbufptr+(len)) > _seqbuflen) \
120630866Smarkm		seqbuf_dump()
1207652Sjkh#define _SEQ_ADVBUF(len)		_seqbufptr += len
1208652Sjkh#define SEQ_DUMPBUF			seqbuf_dump
12093256Sswallace#else
12103256Sswallace/*
12113256Sswallace * This variation of the sequencer macros is used just to format one event
12123256Sswallace * using fixed buffer.
121365335Scg *
12143256Sswallace * The program using the macro library must define the following macros before
12153256Sswallace * using this library.
12163256Sswallace *
121765335Scg * #define _seqbuf 		 name of the buffer (u_char[])
12183256Sswallace * #define _SEQ_ADVBUF(len)	 If the applic needs to know the exact
12193256Sswallace *				 size of the event, this macro can be used.
12203256Sswallace *				 Otherwise this must be defined as empty.
12213256Sswallace * #define _seqbufptr		 Define the name of index variable or 0 if
122265335Scg *				 not required.
12233256Sswallace */
12243256Sswallace#define _SEQ_NEEDBUF(len)	/* empty */
12253256Sswallace#endif
12263256Sswallace
122730866Smarkm#define PM_LOAD_PATCH(dev, bank, pgm)	\
122830866Smarkm	(SEQ_DUMPBUF(), _pm_info.command = _PM_LOAD_PATCH, \
122930866Smarkm	_pm_info.device=dev, _pm_info.data.data8[0]=pgm, \
123030866Smarkm	_pm_info.parm1 = bank, _pm_info.parm2 = 1, \
123130866Smarkm	ioctl(seqfd, SNDCTL_PMGR_ACCESS, &_pm_info))
123230866Smarkm#define PM_LOAD_PATCHES(dev, bank, pgm) \
123330866Smarkm	(SEQ_DUMPBUF(), _pm_info.command = _PM_LOAD_PATCH, \
123430866Smarkm	_pm_info.device=dev, bcopy( pgm, _pm_info.data.data8,  128), \
123530866Smarkm	_pm_info.parm1 = bank, _pm_info.parm2 = 128, \
123630866Smarkm	ioctl(seqfd, SNDCTL_PMGR_ACCESS, &_pm_info))
1237652Sjkh
123830866Smarkm#define SEQ_VOLUME_MODE(dev, mode)	{ \
123930866Smarkm	_SEQ_NEEDBUF(8);\
124030866Smarkm	_seqbuf[_seqbufptr] = SEQ_EXTENDED;\
124130866Smarkm	_seqbuf[_seqbufptr+1] = SEQ_VOLMODE;\
124230866Smarkm	_seqbuf[_seqbufptr+2] = (dev);\
124330866Smarkm	_seqbuf[_seqbufptr+3] = (mode);\
124430866Smarkm	_seqbuf[_seqbufptr+4] = 0;\
124530866Smarkm	_seqbuf[_seqbufptr+5] = 0;\
124630866Smarkm	_seqbuf[_seqbufptr+6] = 0;\
124730866Smarkm	_seqbuf[_seqbufptr+7] = 0;\
124830866Smarkm	_SEQ_ADVBUF(8);}
12491402Sache
12503256Sswallace/*
12513256Sswallace * Midi voice messages
12523256Sswallace */
1253652Sjkh
125430866Smarkm#define _CHN_VOICE(dev, event, chn, note, parm)  { \
125530866Smarkm	_SEQ_NEEDBUF(8);\
125630866Smarkm	_seqbuf[_seqbufptr] = EV_CHN_VOICE;\
125730866Smarkm	_seqbuf[_seqbufptr+1] = (dev);\
125830866Smarkm	_seqbuf[_seqbufptr+2] = (event);\
125930866Smarkm	_seqbuf[_seqbufptr+3] = (chn);\
126030866Smarkm	_seqbuf[_seqbufptr+4] = (note);\
126130866Smarkm	_seqbuf[_seqbufptr+5] = (parm);\
126230866Smarkm	_seqbuf[_seqbufptr+6] = (0);\
126330866Smarkm	_seqbuf[_seqbufptr+7] = 0;\
126430866Smarkm	_SEQ_ADVBUF(8);}
1265652Sjkh
12663256Sswallace#define SEQ_START_NOTE(dev, chn, note, vol) \
12673256Sswallace		_CHN_VOICE(dev, MIDI_NOTEON, chn, note, vol)
12683256Sswallace
12693256Sswallace#define SEQ_STOP_NOTE(dev, chn, note, vol) \
12703256Sswallace		_CHN_VOICE(dev, MIDI_NOTEOFF, chn, note, vol)
12713256Sswallace
12723256Sswallace#define SEQ_KEY_PRESSURE(dev, chn, note, pressure) \
12733256Sswallace		_CHN_VOICE(dev, MIDI_KEY_PRESSURE, chn, note, pressure)
12743256Sswallace
12753256Sswallace/*
12763256Sswallace * Midi channel messages
12773256Sswallace */
12783256Sswallace
127930866Smarkm#define _CHN_COMMON(dev, event, chn, p1, p2, w14) { \
128030866Smarkm	_SEQ_NEEDBUF(8);\
128130866Smarkm	_seqbuf[_seqbufptr] = EV_CHN_COMMON;\
128230866Smarkm	_seqbuf[_seqbufptr+1] = (dev);\
128330866Smarkm	_seqbuf[_seqbufptr+2] = (event);\
128430866Smarkm	_seqbuf[_seqbufptr+3] = (chn);\
128530866Smarkm	_seqbuf[_seqbufptr+4] = (p1);\
128630866Smarkm	_seqbuf[_seqbufptr+5] = (p2);\
128730866Smarkm	*(short *)&_seqbuf[_seqbufptr+6] = (w14);\
128830866Smarkm	_SEQ_ADVBUF(8);}
128930866Smarkm/*
129030866Smarkm * SEQ_SYSEX permits sending of sysex messages. (It may look that it permits
129130866Smarkm * sending any MIDI bytes but it's absolutely not possible. Trying to do
129230866Smarkm * so _will_ cause problems with MPU401 intelligent mode).
129330866Smarkm *
129465335Scg * Sysex messages are sent in blocks of 1 to 6 bytes. Longer messages must be
129530866Smarkm * sent by calling SEQ_SYSEX() several times (there must be no other events
129630866Smarkm * between them). First sysex fragment must have 0xf0 in the first byte
129730866Smarkm * and the last byte (buf[len-1] of the last fragment must be 0xf7. No byte
129830866Smarkm * between these sysex start and end markers cannot be larger than 0x7f. Also
129930866Smarkm * lengths of each fragments (except the last one) must be 6.
130030866Smarkm *
130130866Smarkm * Breaking the above rules may work with some MIDI ports but is likely to
130230866Smarkm * cause fatal problems with some other devices (such as MPU401).
130330866Smarkm */
130430866Smarkm#define SEQ_SYSEX(dev, buf, len) { \
130530866Smarkm	int i, l=(len); if (l>6)l=6;\
130630866Smarkm	_SEQ_NEEDBUF(8);\
130730866Smarkm	_seqbuf[_seqbufptr] = EV_SYSEX;\
130830866Smarkm	for(i=0;i<l;i++)_seqbuf[_seqbufptr+i+1] = (buf)[i];\
130930866Smarkm	for(i=l;i<6;i++)_seqbuf[_seqbufptr+i+1] = 0xff;\
131030866Smarkm	_SEQ_ADVBUF(8);}
1311652Sjkh
13123256Sswallace#define SEQ_CHN_PRESSURE(dev, chn, pressure) \
131330866Smarkm	_CHN_COMMON(dev, MIDI_CHN_PRESSURE, chn, pressure, 0, 0)
13143256Sswallace
13153256Sswallace#define SEQ_SET_PATCH(dev, chn, patch) \
131630866Smarkm	_CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0)
13173256Sswallace
13183256Sswallace#define SEQ_CONTROL(dev, chn, controller, value) \
131930866Smarkm	_CHN_COMMON(dev, MIDI_CTL_CHANGE, chn, controller, 0, value)
13203256Sswallace
13213256Sswallace#define SEQ_BENDER(dev, chn, value) \
132230866Smarkm	_CHN_COMMON(dev, MIDI_PITCH_BEND, chn, 0, 0, value)
13233256Sswallace
13249750Sjkh
132530866Smarkm#define SEQ_V2_X_CONTROL(dev, voice, controller, value)	{ \
132630866Smarkm	_SEQ_NEEDBUF(8);\
132730866Smarkm	_seqbuf[_seqbufptr] = SEQ_EXTENDED;\
132830866Smarkm	_seqbuf[_seqbufptr+1] = SEQ_CONTROLLER;\
132930866Smarkm	_seqbuf[_seqbufptr+2] = (dev);\
133030866Smarkm	_seqbuf[_seqbufptr+3] = (voice);\
133130866Smarkm	_seqbuf[_seqbufptr+4] = (controller);\
133230866Smarkm	*(short *)&_seqbuf[_seqbufptr+5] = (value);\
133330866Smarkm	_seqbuf[_seqbufptr+7] = 0;\
133430866Smarkm	_SEQ_ADVBUF(8);}
133530866Smarkm
13363256Sswallace/*
13373256Sswallace * The following 5 macros are incorrectly implemented and obsolete.
13383256Sswallace * Use SEQ_BENDER and SEQ_CONTROL (with proper controller) instead.
13393256Sswallace */
1340652Sjkh
134130866Smarkm#define SEQ_PITCHBEND(dev, voice, value) \
134230866Smarkm	SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER, value)
134330866Smarkm#define SEQ_BENDER_RANGE(dev, voice, value) \
134430866Smarkm	SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER_RANGE, value)
134530866Smarkm#define SEQ_EXPRESSION(dev, voice, value) \
134630866Smarkm	SEQ_CONTROL(dev, voice, CTL_EXPRESSION, value*128)
134730866Smarkm#define SEQ_MAIN_VOLUME(dev, voice, value) \
134830866Smarkm	SEQ_CONTROL(dev, voice, CTL_MAIN_VOLUME, (value*16383)/100)
134930866Smarkm#define SEQ_PANNING(dev, voice, pos) \
135030866Smarkm	SEQ_CONTROL(dev, voice, CTL_PAN, (pos+128) / 2)
135130866Smarkm
13523256Sswallace/*
135330866Smarkm * Timing and syncronization macros
13543256Sswallace */
1355652Sjkh
135630866Smarkm#define _TIMER_EVENT(ev, parm)		{ \
135730866Smarkm	_SEQ_NEEDBUF(8);\
135830866Smarkm	_seqbuf[_seqbufptr+0] = EV_TIMING; \
135930866Smarkm	_seqbuf[_seqbufptr+1] = (ev); \
136030866Smarkm	_seqbuf[_seqbufptr+2] = 0;\
136130866Smarkm	_seqbuf[_seqbufptr+3] = 0;\
136230866Smarkm	*(u_int *)&_seqbuf[_seqbufptr+4] = (parm); \
136330866Smarkm	_SEQ_ADVBUF(8); \
136430866Smarkm	}
1365652Sjkh
13663256Sswallace#define SEQ_START_TIMER()		_TIMER_EVENT(TMR_START, 0)
13673256Sswallace#define SEQ_STOP_TIMER()		_TIMER_EVENT(TMR_STOP, 0)
13683256Sswallace#define SEQ_CONTINUE_TIMER()		_TIMER_EVENT(TMR_CONTINUE, 0)
13693256Sswallace#define SEQ_WAIT_TIME(ticks)		_TIMER_EVENT(TMR_WAIT_ABS, ticks)
13703256Sswallace#define SEQ_DELTA_TIME(ticks)		_TIMER_EVENT(TMR_WAIT_REL, ticks)
13713256Sswallace#define SEQ_ECHO_BACK(key)		_TIMER_EVENT(TMR_ECHO, key)
13723256Sswallace#define SEQ_SET_TEMPO(value)		_TIMER_EVENT(TMR_TEMPO, value)
13733256Sswallace#define SEQ_SONGPOS(pos)		_TIMER_EVENT(TMR_SPP, pos)
13743256Sswallace#define SEQ_TIME_SIGNATURE(sig)		_TIMER_EVENT(TMR_TIMESIG, sig)
1375652Sjkh
13763256Sswallace/*
137730866Smarkm * Local control events
137830866Smarkm */
137930866Smarkm
138030866Smarkm#define _LOCAL_EVENT(ev, parm)		{ \
138130866Smarkm	_SEQ_NEEDBUF(8);\
138230866Smarkm	_seqbuf[_seqbufptr+0] = EV_SEQ_LOCAL; \
138330866Smarkm	_seqbuf[_seqbufptr+1] = (ev); \
138430866Smarkm	_seqbuf[_seqbufptr+2] = 0;\
138530866Smarkm	_seqbuf[_seqbufptr+3] = 0;\
138630866Smarkm	*(u_int *)&_seqbuf[_seqbufptr+4] = (parm); \
138730866Smarkm	_SEQ_ADVBUF(8); \
138830866Smarkm	}
138930866Smarkm
139030866Smarkm#define SEQ_PLAYAUDIO(devmask)		_LOCAL_EVENT(LOCL_STARTAUDIO, devmask)
139130866Smarkm/*
1392118923Scg * Events for the level 1 interface only
13933256Sswallace */
1394652Sjkh
139530866Smarkm#define SEQ_MIDIOUT(device, byte)	{ \
139630866Smarkm	_SEQ_NEEDBUF(4);\
139730866Smarkm	_seqbuf[_seqbufptr] = SEQ_MIDIPUTC;\
139830866Smarkm	_seqbuf[_seqbufptr+1] = (byte);\
139930866Smarkm	_seqbuf[_seqbufptr+2] = (device);\
140030866Smarkm	_seqbuf[_seqbufptr+3] = 0;\
140130866Smarkm	_SEQ_ADVBUF(4);}
14023256Sswallace
14033256Sswallace/*
14043256Sswallace * Patch loading.
14053256Sswallace */
140630866Smarkm#define SEQ_WRPATCH(patchx, len)	{ \
140730866Smarkm	if (_seqbufptr) seqbuf_dump(); \
140830866Smarkm	if (write(seqfd, (char*)(patchx), len)==-1) \
140930866Smarkm	   perror("Write patch: /dev/sequencer"); \
141030866Smarkm	}
1411652Sjkh
141230866Smarkm#define SEQ_WRPATCH2(patchx, len)	\
141330866Smarkm	( seqbuf_dump(), write(seqfd, (char*)(patchx), len) )
141418444Sbde
141530866Smarkm#endif
141633473Sscrappy
141733473Sscrappy/*
141833473Sscrappy * Here I have moved all the aliases for ioctl names.
141933473Sscrappy */
142033473Sscrappy
142133473Sscrappy#define SNDCTL_DSP_SAMPLESIZE	SNDCTL_DSP_SETFMT
142233473Sscrappy#define SOUND_PCM_WRITE_BITS	SNDCTL_DSP_SETFMT
142333473Sscrappy#define SOUND_PCM_SETFMT	SNDCTL_DSP_SETFMT
142433473Sscrappy
142533473Sscrappy#define SOUND_PCM_WRITE_RATE	SNDCTL_DSP_SPEED
142633473Sscrappy#define SOUND_PCM_POST		SNDCTL_DSP_POST
142733473Sscrappy#define SOUND_PCM_RESET		SNDCTL_DSP_RESET
142833473Sscrappy#define SOUND_PCM_SYNC		SNDCTL_DSP_SYNC
142933473Sscrappy#define SOUND_PCM_SUBDIVIDE	SNDCTL_DSP_SUBDIVIDE
143033473Sscrappy#define SOUND_PCM_SETFRAGMENT	SNDCTL_DSP_SETFRAGMENT
143133473Sscrappy#define SOUND_PCM_GETFMTS	SNDCTL_DSP_GETFMTS
143233473Sscrappy#define SOUND_PCM_GETOSPACE	SNDCTL_DSP_GETOSPACE
143333473Sscrappy#define SOUND_PCM_GETISPACE	SNDCTL_DSP_GETISPACE
143433473Sscrappy#define SOUND_PCM_NONBLOCK	SNDCTL_DSP_NONBLOCK
143533473Sscrappy#define SOUND_PCM_GETCAPS	SNDCTL_DSP_GETCAPS
143633473Sscrappy#define SOUND_PCM_GETTRIGGER	SNDCTL_DSP_GETTRIGGER
143733473Sscrappy#define SOUND_PCM_SETTRIGGER	SNDCTL_DSP_SETTRIGGER
143833473Sscrappy#define SOUND_PCM_SETSYNCRO	SNDCTL_DSP_SETSYNCRO
143933473Sscrappy#define SOUND_PCM_GETIPTR	SNDCTL_DSP_GETIPTR
144033473Sscrappy#define SOUND_PCM_GETOPTR	SNDCTL_DSP_GETOPTR
144133473Sscrappy#define SOUND_PCM_MAPINBUF	SNDCTL_DSP_MAPINBUF
144233473Sscrappy#define SOUND_PCM_MAPOUTBUF	SNDCTL_DSP_MAPOUTBUF
144333473Sscrappy
1444162588Snetchild/***********************************************************************/
1445162588Snetchild
1446162588Snetchild/**
1447162588Snetchild * XXX OSSv4 defines -- some bits taken straight out of the new
1448162588Snetchild * sys/soundcard.h bundled with recent OSS releases.
1449162588Snetchild *
1450162588Snetchild * NB:  These macros and structures will be reorganized and inserted
1451162588Snetchild * 	in appropriate places throughout this file once the code begins
1452162588Snetchild * 	to take shape.
1453162588Snetchild *
1454162588Snetchild * @todo reorganize layout more like the 4Front version
1455162588Snetchild * @todo ask about maintaining __SIOWR vs. _IOWR ioctl cmd defines
1456162588Snetchild */
1457162588Snetchild
1458162588Snetchild/**
1459162588Snetchild * @note The @c OSSV4_EXPERIMENT macro is meant to wrap new development code
1460162588Snetchild * in the sound system relevant to adopting 4Front's OSSv4 specification.
1461162588Snetchild * Users should not enable this!  Really!
1462162588Snetchild */
1463162588Snetchild#if 0
1464162588Snetchild# define OSSV4_EXPERIMENT 1
1465162588Snetchild#else
1466162588Snetchild# undef OSSV4_EXPERIMENT
1467162588Snetchild#endif
1468162588Snetchild
1469162588Snetchild#ifdef SOUND_VERSION
1470162588Snetchild# undef SOUND_VERSION
1471162588Snetchild# define SOUND_VERSION	0x040000
1472162588Snetchild#endif	/* !SOUND_VERSION */
1473162588Snetchild
1474162588Snetchild#define OSS_LONGNAME_SIZE	64
1475162588Snetchild#define OSS_LABEL_SIZE		16
1476162588Snetchild#define OSS_DEVNODE_SIZE        32
1477162588Snetchildtypedef char oss_longname_t[OSS_LONGNAME_SIZE];
1478162588Snetchildtypedef char oss_label_t[OSS_LABEL_SIZE];
1479162588Snetchildtypedef char oss_devnode_t[OSS_DEVNODE_SIZE];
1480162588Snetchild
1481162588Snetchildtypedef struct audio_errinfo
1482162588Snetchild{
1483162588Snetchild	int		play_underruns;
1484162588Snetchild	int		rec_overruns;
1485162588Snetchild	unsigned int	play_ptradjust;
1486162588Snetchild	unsigned int	rec_ptradjust;
1487162588Snetchild	int		play_errorcount;
1488162588Snetchild	int		rec_errorcount;
1489162588Snetchild	int		play_lasterror;
1490162588Snetchild	int		rec_lasterror;
1491162588Snetchild	long		play_errorparm;
1492162588Snetchild	long		rec_errorparm;
1493162588Snetchild	int		filler[16];
1494162588Snetchild} audio_errinfo;
1495162588Snetchild
1496162588Snetchild#define SNDCTL_DSP_GETPLAYVOL           _IOR ('P', 24, int)
1497162588Snetchild#define SNDCTL_DSP_SETPLAYVOL           _IOWR('P', 24, int)
1498162588Snetchild#define SNDCTL_DSP_GETERROR             _IOR ('P', 25, audio_errinfo)
1499162588Snetchild
1500162588Snetchild
1501162588Snetchild/*
1502162588Snetchild ****************************************************************************
1503162588Snetchild * Sync groups for audio devices
1504162588Snetchild */
1505162588Snetchildtypedef struct oss_syncgroup
1506162588Snetchild{
1507162588Snetchild  int id;
1508162588Snetchild  int mode;
1509162588Snetchild  int filler[16];
1510162588Snetchild} oss_syncgroup;
1511162588Snetchild
1512162588Snetchild#define SNDCTL_DSP_SYNCGROUP            _IOWR('P', 28, oss_syncgroup)
1513162588Snetchild#define SNDCTL_DSP_SYNCSTART            _IOW ('P', 29, int)
1514162588Snetchild
1515162588Snetchild/*
1516162588Snetchild **************************************************************************
1517162588Snetchild * "cooked" mode enables software based conversions for sample rate, sample
1518162588Snetchild * format (bits) and number of channels (mono/stereo). These conversions are
1519162588Snetchild * required with some devices that support only one sample rate or just stereo
1520162588Snetchild * to let the applications to use other formats. The cooked mode is enabled by
1521162588Snetchild * default. However it's necessary to disable this mode when mmap() is used or
1522162588Snetchild * when very deterministic timing is required. SNDCTL_DSP_COOKEDMODE is an
1523162588Snetchild * optional call introduced in OSS 3.9.6f. It's _error return must be ignored_
1524162588Snetchild * since normally this call will return erno=EINVAL.
1525162588Snetchild *
1526162588Snetchild * SNDCTL_DSP_COOKEDMODE must be called immediately after open before doing
1527162588Snetchild * anything else. Otherwise the call will not have any effect.
1528162588Snetchild */
1529162588Snetchild#define SNDCTL_DSP_COOKEDMODE           _IOW ('P', 30, int)
1530162588Snetchild
1531162588Snetchild/*
1532162588Snetchild **************************************************************************
1533162588Snetchild * SNDCTL_DSP_SILENCE and SNDCTL_DSP_SKIP are new calls in OSS 3.99.0
1534162588Snetchild * that can be used to implement pause/continue during playback (no effect
1535162588Snetchild * on recording).
1536162588Snetchild */
1537162588Snetchild#define SNDCTL_DSP_SILENCE              _IO  ('P', 31)
1538162588Snetchild#define SNDCTL_DSP_SKIP                 _IO  ('P', 32)
1539162588Snetchild
1540162588Snetchild/*
1541162588Snetchild ****************************************************************************
1542162588Snetchild * Abort transfer (reset) functions for input and output
1543162588Snetchild */
1544162588Snetchild#define SNDCTL_DSP_HALT_INPUT		_IO  ('P', 33)
1545162588Snetchild#define SNDCTL_DSP_RESET_INPUT	SNDCTL_DSP_HALT_INPUT	/* Old name */
1546162588Snetchild#define SNDCTL_DSP_HALT_OUTPUT		_IO  ('P', 34)
1547162588Snetchild#define SNDCTL_DSP_RESET_OUTPUT	SNDCTL_DSP_HALT_OUTPUT	/* Old name */
1548162588Snetchild
1549162588Snetchild/*
1550162588Snetchild ****************************************************************************
1551162588Snetchild * Low water level control
1552162588Snetchild */
1553162588Snetchild#define SNDCTL_DSP_LOW_WATER		_IOW ('P', 34, int)
1554162588Snetchild
1555162588Snetchild/** @todo Get rid of OSS_NO_LONG_LONG references? */
1556162588Snetchild
1557162588Snetchild/*
1558162588Snetchild ****************************************************************************
1559162588Snetchild * 64 bit pointer support. Only available in environments that support
1560162588Snetchild * the 64 bit (long long) integer type.
1561162588Snetchild */
1562162588Snetchild#ifndef OSS_NO_LONG_LONG
1563162588Snetchildtypedef struct
1564162588Snetchild{
1565162588Snetchild  long long samples;
1566162588Snetchild  int fifo_samples;
1567162588Snetchild  int filler[32];		/* For future use */
1568162588Snetchild} oss_count_t;
1569162588Snetchild
1570162588Snetchild#define SNDCTL_DSP_CURRENT_IPTR		_IOR ('P', 35, oss_count_t)
1571162588Snetchild#define SNDCTL_DSP_CURRENT_OPTR		_IOR ('P', 36, oss_count_t)
1572162588Snetchild#endif
1573162588Snetchild
1574162588Snetchild/*
1575162588Snetchild ****************************************************************************
1576162588Snetchild * Interface for selecting recording sources and playback output routings.
1577162588Snetchild */
1578162588Snetchild#define SNDCTL_DSP_GET_RECSRC_NAMES     _IOR ('P', 37, oss_mixer_enuminfo)
1579162588Snetchild#define SNDCTL_DSP_GET_RECSRC           _IOR ('P', 38, int)
1580162588Snetchild#define SNDCTL_DSP_SET_RECSRC           _IOWR('P', 38, int)
1581162588Snetchild
1582162588Snetchild#define SNDCTL_DSP_GET_PLAYTGT_NAMES    _IOR ('P', 39, oss_mixer_enuminfo)
1583162588Snetchild#define SNDCTL_DSP_GET_PLAYTGT          _IOR ('P', 40, int)
1584162588Snetchild#define SNDCTL_DSP_SET_PLAYTGT          _IOWR('P', 40, int)
1585162588Snetchild#define SNDCTL_DSP_GETRECVOL            _IOR ('P', 41, int)
1586162588Snetchild#define SNDCTL_DSP_SETRECVOL            _IOWR('P', 41, int)
1587162588Snetchild
1588162588Snetchild/*
1589162588Snetchild ***************************************************************************
1590162588Snetchild * Some calls for setting the channel assignment with multi channel devices
1591162588Snetchild * (see the manual for details).                                                 */
1592162588Snetchild#define SNDCTL_DSP_GET_CHNORDER         _IOR ('P', 42, unsigned long long)
1593162588Snetchild#define SNDCTL_DSP_SET_CHNORDER         _IOWR('P', 42, unsigned long long)
1594162588Snetchild#       define CHID_UNDEF       0
1595162588Snetchild#       define CHID_L           1                                               #       define CHID_R           2
1596162588Snetchild#       define CHID_C           3
1597162588Snetchild#       define CHID_LFE         4
1598162588Snetchild#       define CHID_LS          5
1599162588Snetchild#       define CHID_RS          6
1600162588Snetchild#       define CHID_LR          7
1601162588Snetchild#       define CHID_RR          8
1602162588Snetchild#define CHNORDER_UNDEF          0x0000000000000000ULL
1603162588Snetchild#define CHNORDER_NORMAL         0x0000000087654321ULL
1604162588Snetchild
1605162588Snetchild#define MAX_PEAK_CHANNELS	128
1606162588Snetchildtypedef unsigned short oss_peaks_t[MAX_PEAK_CHANNELS];
1607162588Snetchild#define SNDCTL_DSP_GETIPEAKS		_IOR('P', 43, oss_peaks_t)
1608162588Snetchild#define SNDCTL_DSP_GETOPEAKS		_IOR('P', 44, oss_peaks_t)
1609162588Snetchild#define SNDCTL_DSP_POLICY               _IOW('P', 45, int)    /* See the manual */
1610162588Snetchild
1611162588Snetchild/**
1612162588Snetchild * @brief	Argument for SNDCTL_SYSINFO ioctl.
1613162588Snetchild *
1614162588Snetchild * For use w/ the SNDCTL_SYSINFO ioctl available on audio (/dev/dsp*),
1615162588Snetchild * mixer, and MIDI devices.
1616162588Snetchild */
1617162588Snetchildtypedef struct oss_sysinfo
1618162588Snetchild{
1619162588Snetchild	char	product[32];	/* For example OSS/Free, OSS/Linux or
1620162588Snetchild				   OSS/Solaris */
1621162588Snetchild	char	version[32];	/* For example 4.0a */
1622162588Snetchild	int	versionnum;	/* See OSS_GETVERSION */
1623162588Snetchild	char	options[128];	/* Reserved */
1624162588Snetchild
1625162588Snetchild	int	numaudios;	/* # of audio/dsp devices */
1626162588Snetchild	int	openedaudio[8];	/* Bit mask telling which audio devices
1627162588Snetchild				   are busy */
1628162588Snetchild
1629162588Snetchild	int	numsynths;	/* # of availavle synth devices */
1630162588Snetchild	int	nummidis;	/* # of available MIDI ports */
1631162588Snetchild	int	numtimers;	/* # of available timer devices */
1632162588Snetchild	int	nummixers;	/* # of mixer devices */
1633162588Snetchild
1634162588Snetchild	int	openedmidi[8];	/* Bit mask telling which midi devices
1635162588Snetchild				   are busy */
1636162588Snetchild	int	numcards;	/* Number of sound cards in the system */
1637162588Snetchild	int	filler[241];	/* For future expansion (set to -1) */
1638162588Snetchild} oss_sysinfo;
1639162588Snetchild
1640162588Snetchildtypedef struct oss_mixext
1641162588Snetchild{
1642162588Snetchild  int dev;			/* Mixer device number */
1643162588Snetchild  int ctrl;			/* Controller number */
1644162588Snetchild  int type;			/* Entry type */
1645162588Snetchild#	define MIXT_DEVROOT	 0	/* Device root entry */
1646162588Snetchild#	define MIXT_GROUP	 1	/* Controller group */
1647162588Snetchild#	define MIXT_ONOFF	 2	/* OFF (0) or ON (1) */
1648162588Snetchild#	define MIXT_ENUM	 3	/* Enumerated (0 to maxvalue) */
1649162588Snetchild#	define MIXT_MONOSLIDER	 4	/* Mono slider (0 to 100) */
1650162588Snetchild#	define MIXT_STEREOSLIDER 5	/* Stereo slider (dual 0 to 100) */
1651162588Snetchild#	define MIXT_MESSAGE	 6	/* (Readable) textual message */
1652162588Snetchild#	define MIXT_MONOVU	 7	/* VU meter value (mono) */
1653162588Snetchild#	define MIXT_STEREOVU	 8	/* VU meter value (stereo) */
1654162588Snetchild#	define MIXT_MONOPEAK	 9	/* VU meter peak value (mono) */
1655162588Snetchild#	define MIXT_STEREOPEAK	10	/* VU meter peak value (stereo) */
1656162588Snetchild#	define MIXT_RADIOGROUP	11	/* Radio button group */
1657162588Snetchild#	define MIXT_MARKER	12	/* Separator between normal and extension entries */
1658162588Snetchild#	define MIXT_VALUE	13	/* Decimal value entry */
1659162588Snetchild#	define MIXT_HEXVALUE	14	/* Hexadecimal value entry */
1660162588Snetchild#	define MIXT_MONODB	15	/* Mono atten. slider (0 to -144) */
1661162588Snetchild#	define MIXT_STEREODB	16	/* Stereo atten. slider (dual 0 to -144) */
1662162588Snetchild#	define MIXT_SLIDER	17	/* Slider (mono) with full integer range */
1663162588Snetchild#	define MIXT_3D		18
1664162588Snetchild
1665162588Snetchild  /* Possible value range (minvalue to maxvalue) */
1666162588Snetchild  /* Note that maxvalue may also be smaller than minvalue */
1667162588Snetchild  int maxvalue;
1668162588Snetchild  int minvalue;
1669162588Snetchild
1670162588Snetchild  int flags;
1671162588Snetchild#	define MIXF_READABLE	0x00000001	/* Has readable value */
1672162588Snetchild#	define MIXF_WRITEABLE	0x00000002	/* Has writeable value */
1673162588Snetchild#	define MIXF_POLL	0x00000004	/* May change itself */
1674162588Snetchild#	define MIXF_HZ		0x00000008	/* Herz scale */
1675162588Snetchild#	define MIXF_STRING	0x00000010	/* Use dynamic extensions for value */
1676162588Snetchild#	define MIXF_DYNAMIC	0x00000010	/* Supports dynamic extensions */
1677162588Snetchild#	define MIXF_OKFAIL	0x00000020	/* Interpret value as 1=OK, 0=FAIL */
1678162588Snetchild#	define MIXF_FLAT	0x00000040	/* Flat vertical space requirements */
1679162588Snetchild#	define MIXF_LEGACY	0x00000080	/* Legacy mixer control group */
1680162588Snetchild  char id[16];			/* Mnemonic ID (mainly for internal use) */
1681162588Snetchild  int parent;			/* Entry# of parent (group) node (-1 if root) */
1682162588Snetchild
1683162588Snetchild  int dummy;			/* Internal use */
1684162588Snetchild
1685162588Snetchild  int timestamp;
1686162588Snetchild
1687162588Snetchild  char data[64];		/* Misc data (entry type dependent) */
1688162588Snetchild  unsigned char enum_present[32];	/* Mask of allowed enum values */
1689162588Snetchild  int control_no;		/* SOUND_MIXER_VOLUME..SOUND_MIXER_MIDI */
1690162588Snetchild  /* (-1 means not indicated) */
1691162588Snetchild
1692162588Snetchild/*
1693162588Snetchild * The desc field is reserved for internal purposes of OSS. It should not be
1694162588Snetchild * used by applications.
1695162588Snetchild */
1696162588Snetchild  unsigned int desc;
1697162588Snetchild#define MIXEXT_SCOPE_MASK			0x0000003f
1698162588Snetchild#define MIXEXT_SCOPE_OTHER			0x00000000
1699162588Snetchild#define MIXEXT_SCOPE_INPUT			0x00000001
1700162588Snetchild#define MIXEXT_SCOPE_OUTPUT			0x00000002
1701162588Snetchild#define MIXEXT_SCOPE_MONITOR			0x00000003
1702162588Snetchild#define MIXEXT_SCOPE_RECSWITCH			0x00000004
1703162588Snetchild
1704162588Snetchild  char extname[32];
1705162588Snetchild  int update_counter;
1706162588Snetchild  int filler[7];
1707162588Snetchild} oss_mixext;
1708162588Snetchild
1709162588Snetchildtypedef struct oss_mixext_root
1710162588Snetchild{
1711162588Snetchild  char id[16];
1712162588Snetchild  char name[48];
1713162588Snetchild} oss_mixext_root;
1714162588Snetchild
1715162588Snetchildtypedef struct oss_mixer_value
1716162588Snetchild{
1717162588Snetchild  int dev;
1718162588Snetchild  int ctrl;
1719162588Snetchild  int value;
1720162588Snetchild  int flags;			/* Reserved for future use. Initialize to 0 */
1721162588Snetchild  int timestamp;		/* Must be set to oss_mixext.timestamp */
1722162588Snetchild  int filler[8];		/* Reserved for future use. Initialize to 0 */
1723162588Snetchild} oss_mixer_value;
1724162588Snetchild
1725162588Snetchild#define OSS_ENUM_MAXVALUE       255
1726162588Snetchildtypedef struct oss_mixer_enuminfo
1727162588Snetchild{
1728162588Snetchild	int	dev;
1729162588Snetchild	int	ctrl;
1730162588Snetchild	int	nvalues;
1731162588Snetchild	int	version;                  /* Read the manual */
1732162588Snetchild	short	strindex[OSS_ENUM_MAXVALUE];
1733162588Snetchild	char	strings[3000];
1734162588Snetchild} oss_mixer_enuminfo;
1735162588Snetchild
1736162588Snetchild#define OPEN_READ       PCM_ENABLE_INPUT
1737162588Snetchild#define OPEN_WRITE      PCM_ENABLE_OUTPUT
1738162588Snetchild#define OPEN_READWRITE  (OPEN_READ|OPEN_WRITE)
1739162588Snetchild
1740162588Snetchild/**
1741162588Snetchild * @brief	Argument for SNDCTL_AUDIOINFO ioctl.
1742162588Snetchild *
1743162588Snetchild * For use w/ the SNDCTL_AUDIOINFO ioctl available on audio (/dev/dsp*)
1744162588Snetchild * devices.
1745162588Snetchild */
1746162588Snetchildtypedef struct oss_audioinfo
1747162588Snetchild{
1748162588Snetchild	int	dev;		/* Audio device number */
1749162588Snetchild	char	name[64];
1750162588Snetchild	int	busy;		/* 0, OPEN_READ, OPEN_WRITE or OPEN_READWRITE */
1751162588Snetchild	int	pid;
1752162588Snetchild	int	caps;		/* DSP_CAP_INPUT, DSP_CAP_OUTPUT */
1753162588Snetchild	int	iformats;
1754162588Snetchild	int	oformats;
1755162588Snetchild	int	magic;		/* Reserved for internal use */
1756162588Snetchild	char 	cmd[64];	/* Command using the device (if known) */
1757162588Snetchild	int	card_number;
1758162588Snetchild	int	port_number;
1759162588Snetchild	int	mixer_dev;
1760162588Snetchild	int	real_device;	/* Obsolete field. Replaced by devnode */
1761162588Snetchild	int	enabled;	/* 1=enabled, 0=device not ready at this
1762162588Snetchild				   moment */
1763162588Snetchild	int	flags;		/* For internal use only - no practical
1764162588Snetchild				   meaning */
1765162588Snetchild	int	min_rate;	/* Sample rate limits */
1766162588Snetchild	int	max_rate;
1767162588Snetchild	int	min_channels;	/* Number of channels supported */
1768162588Snetchild	int	max_channels;
1769162588Snetchild	int	binding;	/* DSP_BIND_FRONT, etc. 0 means undefined */
1770162588Snetchild	int	rate_source;
1771162588Snetchild	char	handle[32];
1772162588Snetchild	#define MAX_SAMPLE_RATES	20	/* Cannot be changed  */
1773162588Snetchild	unsigned int nrates;
1774162588Snetchild	unsigned int rates[MAX_SAMPLE_RATES]; /* Please read the manual before using these */
1775162588Snetchild	oss_longname_t	song_name;	/* Song name (if given) */
1776162588Snetchild	oss_label_t	label;		/* Device label (if given) */
1777162588Snetchild	int		latency;	/* In usecs, -1=unknown */
1778162588Snetchild	oss_devnode_t	devnode;	/* Device special file name (inside
1779162588Snetchild					   /dev) */
1780162588Snetchild	int filler[186];
1781162588Snetchild} oss_audioinfo;
1782162588Snetchild
1783162588Snetchildtypedef struct oss_mixerinfo
1784162588Snetchild{
1785162588Snetchild  int dev;
1786162588Snetchild  char id[16];
1787162588Snetchild  char name[32];
1788162588Snetchild  int modify_counter;
1789162588Snetchild  int card_number;
1790162588Snetchild  int port_number;
1791162588Snetchild  char handle[32];
1792162588Snetchild  int magic;			/* Reserved */
1793162588Snetchild  int enabled;			/* Reserved */
1794162588Snetchild  int caps;
1795162588Snetchild#define MIXER_CAP_VIRTUAL				0x00000001
1796162588Snetchild  int flags;			/* Reserved */
1797162588Snetchild  int nrext;
1798162588Snetchild  /*
1799162588Snetchild   * The priority field can be used to select the default (motherboard)
1800162588Snetchild   * mixer device. The mixer with the highest priority is the
1801162588Snetchild   * most preferred one. -2 or less means that this device cannot be used
1802162588Snetchild   * as the default mixer.
1803162588Snetchild   */
1804162588Snetchild  int priority;
1805162588Snetchild  int filler[254];		/* Reserved */
1806162588Snetchild} oss_mixerinfo;
1807162588Snetchild
1808162588Snetchildtypedef struct oss_midi_info
1809162588Snetchild{
1810162588Snetchild  int dev;			/* Midi device number */
1811162588Snetchild  char name[64];
1812162588Snetchild  int busy;			/* 0, OPEN_READ, OPEN_WRITE or OPEN_READWRITE */
1813162588Snetchild  int pid;
1814162588Snetchild  char cmd[64];			/* Command using the device (if known) */
1815162588Snetchild  int caps;
1816162588Snetchild#define MIDI_CAP_MPU401		0x00000001	/**** OBSOLETE ****/
1817162588Snetchild#define MIDI_CAP_INPUT		0x00000002
1818162588Snetchild#define MIDI_CAP_OUTPUT		0x00000004
1819162588Snetchild#define MIDI_CAP_INOUT		(MIDI_CAP_INPUT|MIDI_CAP_OUTPUT)
1820162588Snetchild#define MIDI_CAP_VIRTUAL	0x00000008	/* Pseudo device */
1821162588Snetchild#define MIDI_CAP_MTCINPUT	0x00000010	/* Supports SNDCTL_MIDI_MTCINPUT */
1822162588Snetchild#define MIDI_CAP_CLIENT		0x00000020	/* Virtual client side device */
1823162588Snetchild#define MIDI_CAP_SERVER		0x00000040	/* Virtual server side device */
1824162588Snetchild#define MIDI_CAP_INTERNAL	0x00000080	/* Internal (synth) device */
1825162588Snetchild#define MIDI_CAP_EXTERNAL	0x00000100	/* external (MIDI port) device */
1826162588Snetchild#define MIDI_CAP_PTOP		0x00000200	/* Point to point link to one device */
1827162588Snetchild#define MIDI_CAP_MTC		0x00000400	/* MTC/SMPTE (control) device */
1828162588Snetchild  int magic;			/* Reserved for internal use */
1829162588Snetchild  int card_number;
1830162588Snetchild  int port_number;
1831162588Snetchild  int enabled;			/* 1=enabled, 0=device not ready at this moment */
1832162588Snetchild  int flags;			/* For internal use only - no practical meaning */
1833162588Snetchild  char handle[32];
1834162588Snetchild  oss_longname_t song_name;	/* Song name (if known) */
1835162588Snetchild  oss_label_t label;		/* Device label (if given) */
1836162588Snetchild  int latency;			/* In usecs, -1=unknown */
1837162588Snetchild  int filler[244];
1838162588Snetchild} oss_midi_info;
1839162588Snetchild
1840162588Snetchildtypedef struct oss_card_info
1841162588Snetchild{
1842162588Snetchild  int card;
1843162588Snetchild  char shortname[16];
1844162588Snetchild  char longname[128];
1845162588Snetchild  int flags;
1846162588Snetchild  int filler[256];
1847162588Snetchild} oss_card_info;
1848162588Snetchild
1849162588Snetchild#define SNDCTL_SYSINFO          _IOR ('X', 1, oss_sysinfo)
1850162588Snetchild#define OSS_SYSINFO             SNDCTL_SYSINFO /* Old name */
1851162588Snetchild
1852162588Snetchild#define SNDCTL_MIX_NRMIX	_IOR ('X', 2, int)
1853162588Snetchild#define SNDCTL_MIX_NREXT	_IOWR('X', 3, int)
1854162588Snetchild#define SNDCTL_MIX_EXTINFO	_IOWR('X', 4, oss_mixext)
1855162588Snetchild#define SNDCTL_MIX_READ		_IOWR('X', 5, oss_mixer_value)
1856162588Snetchild#define SNDCTL_MIX_WRITE	_IOWR('X', 6, oss_mixer_value)
1857162588Snetchild
1858162588Snetchild#define SNDCTL_AUDIOINFO	_IOWR('X', 7, oss_audioinfo)
1859162588Snetchild#define SNDCTL_MIX_ENUMINFO	_IOWR('X', 8, oss_mixer_enuminfo)
1860162588Snetchild#define SNDCTL_MIDIINFO		_IOWR('X', 9, oss_midi_info)
1861162588Snetchild#define SNDCTL_MIXERINFO	_IOWR('X',10, oss_mixerinfo)
1862162588Snetchild#define SNDCTL_CARDINFO		_IOWR('X',11, oss_card_info)
1863162588Snetchild
1864162588Snetchild/*
1865162588Snetchild * Few more "globally" available ioctl calls.
1866162588Snetchild */
1867162588Snetchild#define SNDCTL_SETSONG          _IOW ('Y', 2, oss_longname_t)
1868162588Snetchild#define SNDCTL_GETSONG          _IOR ('Y', 2, oss_longname_t)
1869162588Snetchild#define SNDCTL_SETNAME          _IOW ('Y', 3, oss_longname_t)
1870162588Snetchild#define SNDCTL_SETLABEL         _IOW ('Y', 4, oss_label_t)
1871162588Snetchild#define SNDCTL_GETLABEL         _IOR ('Y', 4, oss_label_t)
1872162588Snetchild
187350906Sdfr#endif	/* !_SYS_SOUNDCARD_H_ */
1874