xref: /titanic_44/usr/src/uts/common/sys/mixer.h (revision b60f2a0b921611326383e4789e0874e9e8a2e708)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1999-2000 by Sun Microsystems, Inc.
24  * All rights reserved
25  */
26 
27 #ifndef	_SYS_MIXER_H
28 #define	_SYS_MIXER_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #include <sys/audio.h>
37 
38 #define	MIXER_NAME		"audio mixer"	/* STREAMS module name */
39 #define	MIXER_VERSION		"Rev 1"		/* 1st version of audio mixer */
40 #define	MIXER_CONFIGURATION	"Config A"	/* 1st configuration */
41 #define	MIXER_MOD_NAME		"Audio Mixer"	/* STREAMS modldrv name */
42 
43 #define	AM_MIXER_MODE			0
44 #define	AM_COMPAT_MODE			1
45 
46 #define	AM_DEFAULT_SAMPLERATE		8000
47 #define	AM_DEFAULT_CHANNELS		AUDIO_CHANNELS_MONO
48 #define	AM_DEFAULT_PRECISION		AUDIO_PRECISION_8
49 #define	AM_DEFAULT_ENCODING		AUDIO_ENCODING_ULAW
50 #define	AM_DEFAULT_GAIN			AUDIO_MID_GAIN
51 
52 /*
53  * Mixer ioctls.
54  */
55 #define	MIOC				('M'<<8)
56 #define	AUDIO_MIXER_MULTIPLE_OPEN	(MIOC|10)
57 #define	AUDIO_MIXER_SINGLE_OPEN		(MIOC|11)
58 #define	AUDIO_MIXER_GET_SAMPLE_RATES	(MIOC|12)
59 #define	AUDIO_MIXERCTL_GETINFO		(MIOC|13)
60 #define	AUDIO_MIXERCTL_SETINFO		(MIOC|14)
61 #define	AUDIO_MIXERCTL_GET_CHINFO	(MIOC|15)
62 #define	AUDIO_MIXERCTL_SET_CHINFO	(MIOC|16)
63 #define	AUDIO_MIXERCTL_GET_MODE		(MIOC|17)
64 #define	AUDIO_MIXERCTL_SET_MODE		(MIOC|18)
65 
66 #define	AUDIO_MIXER_CTL_STRUCT_SIZE(num_ch)	(sizeof (am_control_t) + \
67 					((num_ch - 1) * sizeof (int8_t)))
68 
69 #define	AUDIO_MIXER_SAMP_RATES_STRUCT_SIZE(num_srs)		\
70 					(sizeof (am_sample_rates_t) + \
71 					((num_srs - 1) * sizeof (uint_t)))
72 
73 /*
74  * Mixer software features
75  */
76 #define	AM_MIXER			0x00000001	/* audio mixer */
77 
78 /*
79  * am_control_t		- structure that holds information on the audio device
80  */
81 struct am_control {
82 	/*
83 	 * Because a particular channel may be virtual, it isn't possible
84 	 * to use the normal ioctl()s to set the some of the hardware's state.
85 	 * Only the dev_info structure's play/record gain, balance, port, and
86 	 * pause members, as well as the monitor_gain and output_muted members
87 	 * may be modified.
88 	 */
89 	audio_info_t	dev_info;
90 
91 	/*
92 	 * The mixer(7I) manual page shows an example of using the ch_open[]
93 	 * array. Each element that is set to 0 represents a channel which
94 	 * isn't allocated, and non-zero elements represent a channel that is
95 	 * alloacted. This size of this array may change, depending on the
96 	 * number of channels the audiosup module allocates per device.
97 	 */
98 	int8_t		ch_open[1];
99 };
100 typedef struct am_control am_control_t;
101 
102 /*
103  * am_sample_rates_t	- structure for a list of supported sample rates
104  */
105 struct am_sample_rates {
106 	/*
107 	 * Set this to AUIDO_PLAY or AUDIO_RECORD, but not both, to get
108 	 * the play or record sample rates, respectively.
109 	 */
110 	uint_t		type;
111 
112 	/*
113 	 * Some devices support a complete range of sample rates between the
114 	 * two provided in the samp_rates[] array. If this is so then this
115 	 * flag is set to MIXER_SR_LIMITS when AUDIO_MIXER_GET_SAMPLE_RATES
116 	 * returns this structure.
117 	 */
118 	uint_t		flags;
119 
120 	/*
121 	 * Set this number to the number of sample rates to request. The
122 	 * mixer(7I) manual page shows an example of using this structure.
123 	 * When AUDIO_MIXER_GET_SAMPLE_RATES returns the number of samples
124 	 * available is set. This may be more or less than the number requested.
125 	 * If more that only the requested number of samples is arctually
126 	 * returned in the samp_rates array.
127 	 */
128 	uint_t		num_samp_rates;
129 
130 	/*
131 	 * Variable size array for the supported sample rates. See the example
132 	 * in the mixer(7I) manual page for how to use this array.
133 	 */
134 	uint_t		samp_rates[1];
135 };
136 typedef struct am_sample_rates am_sample_rates_t;
137 
138 /* am_sample_rates.flags defines */
139 #define	MIXER_SR_LIMITS		0x00000001u	/* sample rates set limits */
140 
141 #ifdef	__cplusplus
142 }
143 #endif
144 
145 #endif	/* _SYS_MIXER_H */
146