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