audio_common.h revision 88447a05f537aabe9a1bc3d5313f22581ec992a7
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (C) 4Front Technologies 1996-2008.
*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_AUDIO_AUDIO_COMMON_H
#define _SYS_AUDIO_AUDIO_COMMON_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _KERNEL
/* Shared data structures */
typedef struct audio_parms audio_parms_t;
typedef struct audio_buffer audio_buffer_t;
typedef struct audio_stream audio_stream_t;
typedef struct audio_engine audio_engine_t;
typedef struct audio_client audio_client_t;
typedef struct audio_dev audio_dev_t;
typedef struct audio_mixer_ops audio_mixer_ops_t;
typedef struct audio_engine_ops audio_engine_ops_t;
typedef struct audio_ctrl audio_ctrl_t;
typedef struct audio_ctrl_desc audio_ctrl_desc_t;
struct audio_ctrl_desc {
const char *acd_name; /* Controls Mnemonic */
/*
* Minimum and Maximum values for this control. The value
* must be between these values inclusive. For
* AUDIO_CTRL_TYPE_ENUM, the maxvalue is a bitmask of
* supported controls.
*/
/*
* Array of pointers to names for each enum position. This
* should be null for all but AUDIO_CTRL_TYPE_ENUM.
*/
const char *acd_enum[64];
};
/*
* Audio data formats. Note that these are represented int a bit
* field, to allow for multiple values to be represented in the same
* integer (in certain portions of the API.)
*/
#define AUDIO_FORMAT_NONE 0x00000000U
#define AUDIO_FORMAT_ULAW 0x00000001U
#define AUDIO_FORMAT_ALAW 0x00000002U
#define AUDIO_FORMAT_S8 0x00000004U
#define AUDIO_FORMAT_U8 0x00000008U
#define AUDIO_FORMAT_S16_LE 0x00000010U
#define AUDIO_FORMAT_S16_BE 0x00000020U
#define AUDIO_FORMAT_U16_LE 0x00000040U
#define AUDIO_FORMAT_U16_BE 0x00000080U
#define AUDIO_FORMAT_S24_LE 0x00000100U
#define AUDIO_FORMAT_S24_BE 0x00000200U
#define AUDIO_FORMAT_S32_LE 0x00000400U
#define AUDIO_FORMAT_S32_BE 0x00000800U
#define AUDIO_FORMAT_S24_PACKED 0x00001000U
#define AUDIO_FORMAT_AC3 0x00010000U
#define AUDIO_FORMAT_OPAQUE_MASK 0xffff0000U
#define AUDIO_FORMAT_CONVERTIBLE 0x0000ffffU
/*
* We only support signed 16, 24, and 32 bit format conversions in the
* engines, for simplicity. (We haven't run into any engines that
* require other formats.)
*/
#define AUDIO_FORMAT_PCM 0x00000f30
/*
* endian formats). The usage of these macros is described in the OSS
* Programmer's Manual.
*/
#if defined(_BIG_ENDIAN)
#elif defined(_LITTLE_ENDIAN)
#else
#error "Machine endianness undefined"
#endif
/*
* These are parameterized around the maximum minor number available
* for use in the filesystem. Unfortunately, we have to use 32-bit limits,
* because we could have 32-bit userland apps (we usually will, in fact).
*/
#define AUDIO_MN_TYPE_NBITS (4)
#define AUDIO_MN_TYPE_SHIFT (0)
#define AUDIO_MN_INST_SHIFT (AUDIO_MN_TYPE_NBITS)
#define AUDIO_MINOR_MIXER (0)
#define AUDIO_MINOR_DSP (1)
/* 2 is reserved for now */
#define AUDIO_MINOR_DEVAUDIO (3)
#define AUDIO_MINOR_DEVAUDIOCTL (4)
#define AUDIO_MINOR_SNDSTAT (AUDIO_MN_TYPE_MASK)
/* reserved minors for driver specific use */
/* Various controls */
#define AUDIO_CTRL_ID_VOLUME "volume"
#define AUDIO_CTRL_ID_LINEOUT "line-out"
#define AUDIO_CTRL_ID_FRONT "front"
#define AUDIO_CTRL_ID_REAR "rear"
#define AUDIO_CTRL_ID_HEADPHONE "headphones"
#define AUDIO_CTRL_ID_CENTER "center"
#define AUDIO_CTRL_ID_LFE "lfe"
#define AUDIO_CTRL_ID_SURROUND "surround"
#define AUDIO_CTRL_ID_SPEAKER "speaker"
#define AUDIO_CTRL_ID_AUX1OUT "aux1-out"
#define AUDIO_CTRL_ID_AUX2OUT "aux2-out"
#define AUDIO_CTRL_ID_BASS "bass"
#define AUDIO_CTRL_ID_TREBLE "treble"
#define AUDIO_CTRL_ID_3DDEPTH "3d-depth"
#define AUDIO_CTRL_ID_3DCENT "3d-center"
#define AUDIO_CTRL_ID_3DENHANCE "3d-enhance"
#define AUDIO_CTRL_ID_PHONE "phone"
#define AUDIO_CTRL_ID_MIC "mic"
#define AUDIO_CTRL_ID_LINEIN "line-in"
#define AUDIO_CTRL_ID_CD "cd"
#define AUDIO_CTRL_ID_VIDEO "video"
#define AUDIO_CTRL_ID_AUX1IN "aux1-in"
#define AUDIO_CTRL_ID_PCMIN "pcm"
#define AUDIO_CTRL_ID_RECGAIN "record-gain"
#define AUDIO_CTRL_ID_AUX2IN "aux2-in"
#define AUDIO_CTRL_ID_MICBOOST "micboost"
#define AUDIO_CTRL_ID_LOOPBACK "loopback"
#define AUDIO_CTRL_ID_LOUDNESS "loudness"
#define AUDIO_CTRL_ID_OUTPUTS "outputs"
#define AUDIO_CTRL_ID_INPUTS "inputs"
#define AUDIO_CTRL_ID_RECSRC "record-source"
#define AUDIO_CTRL_ID_MONSRC "monitor-source"
#define AUDIO_CTRL_ID_DIAG "diag"
#define AUDIO_CTRL_ID_BEEP "beep"
#define AUDIO_CTRL_ID_MONGAIN "monitor-gain"
#define AUDIO_CTRL_ID_JACK2 "jack2"
#define AUDIO_CTRL_ID_JACK3 "jack3"
#define AUDIO_CTRL_ID_JACK4 "jack4"
#define AUDIO_CTRL_ID_JACK5 "jack5"
#define AUDIO_CTRL_ID_JACK6 "jack6"
#define AUDIO_CTRL_ID_JACK7 "jack7"
#define AUDIO_CTRL_ID_DOWNMIX "downmix"
#define AUDIO_CTRL_ID_SPREAD "spread"
/*
* Names for ports.
*/
#define AUDIO_PORT_MIC "mic"
#define AUDIO_PORT_CD "cd"
#define AUDIO_PORT_VIDEO "video"
#define AUDIO_PORT_AUX1OUT "aux1-out"
#define AUDIO_PORT_AUX2OUT "aux2-out"
#define AUDIO_PORT_LINEOUT "line-out"
#define AUDIO_PORT_STEREOMIX "stereo-mix"
#define AUDIO_PORT_MONOMIX "mono-mix"
#define AUDIO_PORT_PHONE "phone"
#define AUDIO_PORT_REAR "rear"
#define AUDIO_PORT_CENTER "center"
#define AUDIO_PORT_SURROUND "surround"
#define AUDIO_PORT_LFE "lfe"
#define AUDIO_PORT_SPEAKER "speaker"
#define AUDIO_PORT_LINEIN "line-in"
#define AUDIO_PORT_AUX1IN "aux1-in"
#define AUDIO_PORT_AUX2IN "aux2-in"
#define AUDIO_PORT_HEADPHONES "headphones"
#define AUDIO_PORT_SPDIFIN "spdif-in"
#define AUDIO_PORT_SPDIFOUT "spdif-out"
#define AUDIO_PORT_MIC1 "mic1"
#define AUDIO_PORT_MIC2 "mic2"
#define AUDIO_PORT_DIGOUT "digital-out"
#define AUDIO_PORT_DIGIN "digital-in"
#define AUDIO_PORT_HDMI "hdmi"
#define AUDIO_PORT_MODEM "modem"
#define AUDIO_PORT_HANDSET "handset"
#define AUDIO_PORT_OTHER "other"
#define AUDIO_PORT_NONE "none"
/*
* A few common values that sometimes we see.
*/
#define AUDIO_VALUE_ON "on"
#define AUDIO_VALUE_OFF "off"
#define AUDIO_VALUE_VERYLOW "very-low"
#define AUDIO_VALUE_LOW "low"
#define AUDIO_VALUE_MEDIUM "medium"
#define AUDIO_VALUE_HIGH "high"
#define AUDIO_VALUE_VERYHIGH "very-high"
/*
* Posible return values for walk callback function
*/
/*
* Control types
*/
/*
* Control characteristics flags
*/
/*
* AUDIO_CTRL_TYPE_ENUM might allow more than a single value to be
* selected. (Value is a bitmask.)
*/
#define AUDIO_CTRL_FLAG_MULTI 0x00000040
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_AUDIO_AUDIO_COMMON_H */