1 /* $NetBSD: ossaudiovar.h,v 1.14 2008/01/22 01:05:05 jmcneill Exp $ */
4 * Copyright (c) 1997 The NetBSD Foundation, Inc.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
29 struct oss_sys_ioctl_args
{
31 syscallarg(u_long
) com
;
32 syscallarg(void *) data
;
35 #define OSS_IOCPARM_MASK 0xfff /* parameters must be < 4096 bytes */
36 #define OSS_IOC_VOID 0x00000000 /* no parameters */
37 #define OSS_IOC_IN 0x40000000 /* copy in parameters */
38 #define OSS_IOC_OUT 0x80000000 /* copy out parameters */
39 #define OSS_IOC_INOUT (OSS_IOC_IN | OSS_IOC_OUT)
40 #define _OSS_IOCTL(w,x,y,z) ((uint)((w)|(((z)&OSS_IOCPARM_MASK)<<16)|((x)<<8)|(y)))
41 #define _OSS_IO(x,y) _OSS_IOCTL(OSS_IOC_VOID, x, y, 0)
42 #define _OSS_IOR(x,y,t) _OSS_IOCTL(OSS_IOC_OUT, x, y, sizeof(t))
43 #define _OSS_IOW(x,y,t) _OSS_IOCTL(OSS_IOC_IN, x, y, sizeof(t))
44 #define _OSS_IOWR(x,y,t) _OSS_IOCTL(OSS_IOC_INOUT, x, y, sizeof(t))
46 #define OSS_IOCTL_SIZE(x) (((x) >> 16) & OSS_IOCPARM_MASK)
48 #define OSS_SNDCTL_DSP_RESET _OSS_IO ('P', 0)
49 #define OSS_SNDCTL_DSP_SYNC _OSS_IO ('P', 1)
50 #define OSS_SNDCTL_DSP_SPEED _OSS_IOWR('P', 2, int)
51 #define OSS_SOUND_PCM_READ_RATE _OSS_IOR ('P', 2, int)
52 #define OSS_SNDCTL_DSP_STEREO _OSS_IOWR('P', 3, int)
53 #define OSS_SNDCTL_DSP_GETBLKSIZE _OSS_IOWR('P', 4, int)
54 #define OSS_SNDCTL_DSP_SETFMT _OSS_IOWR('P', 5, int)
55 #define OSS_SOUND_PCM_READ_BITS _OSS_IOR ('P', 5, int)
56 #define OSS_SNDCTL_DSP_CHANNELS _OSS_IOWR('P', 6, int)
57 #define OSS_SOUND_PCM_READ_CHANNELS _OSS_IOR ('P', 6, int)
58 #define OSS_SOUND_PCM_WRITE_FILTER _OSS_IOWR('P', 7, int)
59 #define OSS_SOUND_PCM_READ_FILTER _OSS_IOR ('P', 7, int)
60 #define OSS_SNDCTL_DSP_POST _OSS_IO ('P', 8)
61 #define OSS_SNDCTL_DSP_SUBDIVIDE _OSS_IOWR('P', 9, int)
62 #define OSS_SNDCTL_DSP_SETFRAGMENT _OSS_IOWR('P', 10, int)
63 #define OSS_SNDCTL_DSP_GETFMTS _OSS_IOR ('P', 11, int)
64 #define OSS_SNDCTL_DSP_GETOSPACE _OSS_IOR ('P',12, struct oss_audio_buf_info)
65 #define OSS_SNDCTL_DSP_GETISPACE _OSS_IOR ('P',13, struct oss_audio_buf_info)
66 #define OSS_SNDCTL_DSP_NONBLOCK _OSS_IO ('P',14)
67 #define OSS_SNDCTL_DSP_GETCAPS _OSS_IOR ('P',15, int)
68 # define OSS_DSP_CAP_REVISION 0x000000ff
69 # define OSS_DSP_CAP_DUPLEX 0x00000100
70 # define OSS_DSP_CAP_REALTIME 0x00000200
71 # define OSS_DSP_CAP_BATCH 0x00000400
72 # define OSS_DSP_CAP_COPROC 0x00000800
73 # define OSS_DSP_CAP_TRIGGER 0x00001000
74 # define OSS_DSP_CAP_MMAP 0x00002000
75 #define OSS_SNDCTL_DSP_GETTRIGGER _OSS_IOR ('P', 16, int)
76 #define OSS_SNDCTL_DSP_SETTRIGGER _OSS_IOW ('P', 16, int)
77 # define OSS_PCM_ENABLE_INPUT 0x00000001
78 # define OSS_PCM_ENABLE_OUTPUT 0x00000002
79 #define OSS_SNDCTL_DSP_GETIPTR _OSS_IOR ('P', 17, struct oss_count_info)
80 #define OSS_SNDCTL_DSP_GETOPTR _OSS_IOR ('P', 18, struct oss_count_info)
81 #define OSS_SNDCTL_DSP_MAPINBUF _OSS_IOR ('P', 19, struct oss_buffmem_desc)
82 #define OSS_SNDCTL_DSP_MAPOUTBUF _OSS_IOR ('P', 20, struct oss_buffmem_desc)
83 #define OSS_SNDCTL_DSP_SETSYNCRO _OSS_IO ('P', 21)
84 #define OSS_SNDCTL_DSP_SETDUPLEX _OSS_IO ('P', 22)
85 #define OSS_SNDCTL_DSP_GETODELAY _OSS_IOR ('P', 23, int)
86 #define OSS_SNDCTL_DSP_PROFILE _OSS_IOW ('P', 23, int)
87 #define OSS_APF_NORMAL 0 /* Normal applications */
88 #define OSS_APF_NETWORK 1 /* "external" delays */
89 #define OSS_APF_CPUINTENS 2 /* CPU delays */
91 #define OSS_AFMT_QUERY 0x00000000 /* Return current fmt */
92 #define OSS_AFMT_MU_LAW 0x00000001
93 #define OSS_AFMT_A_LAW 0x00000002
94 #define OSS_AFMT_IMA_ADPCM 0x00000004
95 #define OSS_AFMT_U8 0x00000008
96 #define OSS_AFMT_S16_LE 0x00000010 /* Little endian signed 16 */
97 #define OSS_AFMT_S16_BE 0x00000020 /* Big endian signed 16 */
98 #define OSS_AFMT_S8 0x00000040
99 #define OSS_AFMT_U16_LE 0x00000080 /* Little endian U16 */
100 #define OSS_AFMT_U16_BE 0x00000100 /* Big endian U16 */
101 #define OSS_AFMT_MPEG 0x00000200 /* MPEG (2) audio */
104 #define OSS_SOUND_MIXER_FIRST 0
105 #define OSS_SOUND_MIXER_NRDEVICES 17
107 #define OSS_SOUND_MIXER_VOLUME 0
108 #define OSS_SOUND_MIXER_BASS 1
109 #define OSS_SOUND_MIXER_TREBLE 2
110 #define OSS_SOUND_MIXER_SYNTH 3
111 #define OSS_SOUND_MIXER_PCM 4
112 #define OSS_SOUND_MIXER_SPEAKER 5
113 #define OSS_SOUND_MIXER_LINE 6
114 #define OSS_SOUND_MIXER_MIC 7
115 #define OSS_SOUND_MIXER_CD 8
116 #define OSS_SOUND_MIXER_IMIX 9
117 #define OSS_SOUND_MIXER_ALTPCM 10
118 #define OSS_SOUND_MIXER_RECLEV 11
119 #define OSS_SOUND_MIXER_IGAIN 12
120 #define OSS_SOUND_MIXER_OGAIN 13
121 #define OSS_SOUND_MIXER_LINE1 14
122 #define OSS_SOUND_MIXER_LINE2 15
123 #define OSS_SOUND_MIXER_LINE3 16
125 #define OSS_SOUND_MIXER_RECSRC 0xff
126 #define OSS_SOUND_MIXER_DEVMASK 0xfe
127 #define OSS_SOUND_MIXER_RECMASK 0xfd
128 #define OSS_SOUND_MIXER_CAPS 0xfc
129 #define OSS_SOUND_CAP_EXCL_INPUT 1
130 #define OSS_SOUND_MIXER_STEREODEVS 0xfb
132 #define OSS_MIXER_READ(dev) _OSS_IOR('M', dev, int)
134 #define OSS_SOUND_MIXER_READ_RECSRC OSS_MIXER_READ(OSS_SOUND_MIXER_RECSRC)
135 #define OSS_SOUND_MIXER_READ_DEVMASK OSS_MIXER_READ(OSS_SOUND_MIXER_DEVMASK)
136 #define OSS_SOUND_MIXER_READ_RECMASK OSS_MIXER_READ(OSS_SOUND_MIXER_RECMASK)
137 #define OSS_SOUND_MIXER_READ_STEREODEVS OSS_MIXER_READ(OSS_SOUND_MIXER_STEREODEVS)
138 #define OSS_SOUND_MIXER_READ_CAPS OSS_MIXER_READ(OSS_SOUND_MIXER_CAPS)
140 #define OSS_MIXER_WRITE(dev) _OSS_IOW('M', dev, int)
141 #define OSS_MIXER_WRITE_R(dev) _OSS_IOWR('M', dev, int)
143 #define OSS_SOUND_MIXER_WRITE_RECSRC OSS_MIXER_WRITE(OSS_SOUND_MIXER_RECSRC)
144 #define OSS_SOUND_MIXER_WRITE_R_RECSRC OSS_MIXER_WRITE_R(OSS_SOUND_MIXER_RECSRC)
146 struct oss_mixer_info
{
153 struct oss_old_mixer_info
{
158 #define OSS_SOUND_MIXER_INFO _OSS_IOR('M', 101, struct oss_mixer_info)
159 #define OSS_SOUND_OLD_MIXER_INFO _OSS_IOR('M', 101, struct oss_old_mixer_info)
161 #define OSS_SOUND_VERSION 0x030000
162 #define OSS_GET_VERSION _OSS_IOR('M', 118, int)
164 #define OSS_GET_DEV(com) ((com) & 0xff)
166 struct oss_audio_buf_info
{
173 struct oss_count_info
{
179 struct oss_buffmem_desc
{
180 unsigned int *buffer
;
185 * MIDI and sequencer I/O.
187 #define OSS_SEQ_RESET _OSS_IO ('Q', 0)
188 #define OSS_SEQ_SYNC _OSS_IO ('Q', 1)
189 #define OSS_SYNTH_INFO _OSS_IOWR('Q', 2, struct oss_synth_info)
190 #define OSS_SEQ_CTRLRATE _OSS_IOWR('Q', 3, int)
191 #define OSS_SEQ_GETOUTCOUNT _OSS_IOR ('Q', 4, int)
192 #define OSS_SEQ_GETINCOUNT _OSS_IOR ('Q', 5, int)
193 #define OSS_SEQ_PERCMODE _OSS_IOW ('Q', 6, int)
194 #define OSS_SEQ_TESTMIDI _OSS_IOW ('Q', 8, int)
195 #define OSS_SEQ_RESETSAMPLES _OSS_IOW ('Q', 9, int)
196 #define OSS_SEQ_NRSYNTHS _OSS_IOR ('Q',10, int)
197 #define OSS_SEQ_NRMIDIS _OSS_IOR ('Q',11, int)
198 #define OSS_MIDI_INFO _OSS_IOWR('Q',12, struct oss_midi_info)
199 #define OSS_SEQ_THRESHOLD _OSS_IOW ('Q',13, int)
200 #define OSS_MEMAVL _OSS_IOWR('Q',14, int)
201 #define OSS_FM_4OP_ENABLE _OSS_IOW ('Q',15, int)
202 #define OSS_SEQ_PANIC _OSS_IO ('Q',17)
203 #define OSS_SEQ_OUTOFBAND _OSS_IOW ('Q',18, struct oss_seq_event_rec)
204 #define OSS_SEQ_GETTIME _OSS_IOR ('Q',19, int)
205 #define OSS_ID _OSS_IOWR('Q',20, struct oss_synth_info)
206 #define OSS_CONTROL _OSS_IOWR('Q',21, struct oss_synth_control)
207 #define OSS_REMOVESAMPLE _OSS_IOWR('Q',22, struct oss_remove_sample)
209 struct oss_synth_control
{
210 int devno
; /* Synthesizer # */
211 char data
[4000]; /* Device specific command/data record */
214 struct oss_remove_sample
{
215 int devno
; /* Synthesizer # */
216 int bankno
; /* MIDI bank # (0=General MIDI) */
217 int instrno
; /* MIDI instrument number */
220 struct oss_seq_event_rec
{
224 struct oss_synth_info
{
228 #define OSS_SYNTH_TYPE_FM 0
229 #define OSS_SYNTH_TYPE_SAMPLE 1
230 #define OSS_SYNTH_TYPE_MIDI 2
233 #define OSS_FM_TYPE_ADLIB 0x00
234 #define OSS_FM_TYPE_OPL3 0x01
235 #define OSS_MIDI_TYPE_MPU401 0x401
237 #define OSS_SAMPLE_TYPE_BASIC 0x10
238 #define OSS_SAMPLE_TYPE_GUS OSS_SAMPLE_TYPE_BASIC
245 #define OSS_SYNTH_CAP_PERCMODE 0x00000001
246 #define OSS_SYNTH_CAP_OPL3 0x00000002
247 #define OSS_SYNTH_CAP_INPUT 0x00000004
251 #define OSS_TMR_TIMEBASE _OSS_IOWR('T', 1, int)
252 #define OSS_TMR_START _OSS_IO ('T', 2)
253 #define OSS_TMR_STOP _OSS_IO ('T', 3)
254 #define OSS_TMR_CONTINUE _OSS_IO ('T', 4)
255 #define OSS_TMR_TEMPO _OSS_IOWR('T', 5, int)
256 #define OSS_TMR_SOURCE _OSS_IOWR('T', 6, int)
257 # define OSS_TMR_INTERNAL 0x00000001
258 # define OSS_TMR_EXTERNAL 0x00000002
259 # define OSS_TMR_MODE_MIDI 0x00000010
260 # define OSS_TMR_MODE_FSK 0x00000020
261 # define OSS_TMR_MODE_CLS 0x00000040
262 # define OSS_TMR_MODE_SMPTE 0x00000080
263 #define OSS_TMR_METRONOME _OSS_IOW ('T', 7, int)
264 #define OSS_TMR_SELECT _OSS_IOW ('T', 8, int)