Home | History | Annotate | Line # | Download | only in usb
uaudioreg.h revision 1.1
      1  1.1  augustss /*	$NetBSD: uaudioreg.h,v 1.1 1999/09/09 12:28:26 augustss Exp $	*/
      2  1.1  augustss 
      3  1.1  augustss /*
      4  1.1  augustss  * Copyright (c) 1999 The NetBSD Foundation, Inc.
      5  1.1  augustss  * All rights reserved.
      6  1.1  augustss  *
      7  1.1  augustss  * Author: Lennart Augustsson <augustss (at) carlstedt.se>
      8  1.1  augustss  *         Carlstedt Research & Technology
      9  1.1  augustss  *
     10  1.1  augustss  * Redistribution and use in source and binary forms, with or without
     11  1.1  augustss  * modification, are permitted provided that the following conditions
     12  1.1  augustss  * are met:
     13  1.1  augustss  * 1. Redistributions of source code must retain the above copyright
     14  1.1  augustss  *    notice, this list of conditions and the following disclaimer.
     15  1.1  augustss  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.1  augustss  *    notice, this list of conditions and the following disclaimer in the
     17  1.1  augustss  *    documentation and/or other materials provided with the distribution.
     18  1.1  augustss  * 3. All advertising materials mentioning features or use of this software
     19  1.1  augustss  *    must display the following acknowledgement:
     20  1.1  augustss  *        This product includes software developed by the NetBSD
     21  1.1  augustss  *        Foundation, Inc. and its contributors.
     22  1.1  augustss  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  1.1  augustss  *    contributors may be used to endorse or promote products derived
     24  1.1  augustss  *    from this software without specific prior written permission.
     25  1.1  augustss  *
     26  1.1  augustss  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  1.1  augustss  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  1.1  augustss  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.1  augustss  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  1.1  augustss  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  1.1  augustss  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  1.1  augustss  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  1.1  augustss  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  1.1  augustss  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  1.1  augustss  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  1.1  augustss  * POSSIBILITY OF SUCH DAMAGE.
     37  1.1  augustss  */
     38  1.1  augustss 
     39  1.1  augustss #define UAUDIO_VERSION		0x100
     40  1.1  augustss 
     41  1.1  augustss #define UDESC_CS_DEVICE		0x21
     42  1.1  augustss #define UDESC_CS_CONFIG		0x22
     43  1.1  augustss #define UDESC_CS_STRING		0x23
     44  1.1  augustss #define UDESC_CS_INTERFACE	0x24
     45  1.1  augustss #define UDESC_CS_ENDPOINT	0x25
     46  1.1  augustss 
     47  1.1  augustss #define UDESCSUB_AC_HEADER	1
     48  1.1  augustss #define UDESCSUB_AC_INPUT	2
     49  1.1  augustss #define UDESCSUB_AC_OUTPUT	3
     50  1.1  augustss #define UDESCSUB_AC_MIXER	4
     51  1.1  augustss #define UDESCSUB_AC_SELECTOR	5
     52  1.1  augustss #define UDESCSUB_AC_FEATURE	6
     53  1.1  augustss #define UDESCSUB_AC_PROCESSING	7
     54  1.1  augustss #define UDESCSUB_AC_EXTENSION	8
     55  1.1  augustss 
     56  1.1  augustss /* The first fields are identical to usb_endpoint_descriptor_t */
     57  1.1  augustss typedef struct {
     58  1.1  augustss 	uByte		bLength;
     59  1.1  augustss 	uByte		bDescriptorType;
     60  1.1  augustss 	uByte		bEndpointAddress;
     61  1.1  augustss 	uByte		bmAttributes;
     62  1.1  augustss 	uWord		wMaxPacketSize;
     63  1.1  augustss 	uByte		bInterval;
     64  1.1  augustss 	/*
     65  1.1  augustss 	 * The following two entries are only used by the Audio Class.
     66  1.1  augustss 	 * And according to the specs the Audio Class is the only one
     67  1.1  augustss 	 * allowed to extend the endpoint descriptor.
     68  1.1  augustss 	 * Who knows what goes on in the minds of the people in the USB
     69  1.1  augustss 	 * standardization?  :-(
     70  1.1  augustss 	 */
     71  1.1  augustss 	uByte		bRefresh;
     72  1.1  augustss 	uByte		bSynchAddress;
     73  1.1  augustss } usb_endpoint_descriptor_audio_t;
     74  1.1  augustss 
     75  1.1  augustss struct usb_audio_control_descriptor {
     76  1.1  augustss 	uByte		bLength;
     77  1.1  augustss 	uByte		bDescriptorType;
     78  1.1  augustss 	uByte		bDescriptorSubtype;
     79  1.1  augustss 	uWord		bcdADC;
     80  1.1  augustss 	uWord		wTotalLength;
     81  1.1  augustss 	uByte		bInCollection;
     82  1.1  augustss 	uByte		baInterfaceNr[1];
     83  1.1  augustss };
     84  1.1  augustss 
     85  1.1  augustss struct usb_audio_streaming_interface_descriptor {
     86  1.1  augustss 	uByte		bLength;
     87  1.1  augustss 	uByte		bDescriptorType;
     88  1.1  augustss 	uByte		bDescriptorSubtype;
     89  1.1  augustss 	uByte		bTerminalLink;
     90  1.1  augustss 	uByte		bDelay;
     91  1.1  augustss 	uWord		wFormatTag;
     92  1.1  augustss };
     93  1.1  augustss 
     94  1.1  augustss struct usb_audio_streaming_endpoint_descriptor {
     95  1.1  augustss 	uByte		bLength;
     96  1.1  augustss 	uByte		bDescriptorType;
     97  1.1  augustss 	uByte		bDescriptorSubtype;
     98  1.1  augustss 	uByte		bmAttributes;
     99  1.1  augustss 	uByte		bLockDelayUnits;
    100  1.1  augustss 	uWord		wLockDelay;
    101  1.1  augustss };
    102  1.1  augustss 
    103  1.1  augustss struct usb_audio_streaming_type1_descriptor {
    104  1.1  augustss 	uByte		bLength;
    105  1.1  augustss 	uByte		bDescriptorType;
    106  1.1  augustss 	uByte		bDescriptorSubtype;
    107  1.1  augustss 	uByte		bFormatType;
    108  1.1  augustss 	uByte		bNrChannels;
    109  1.1  augustss 	uByte		bSubFrameSize;
    110  1.1  augustss 	uByte		bBitResolution;
    111  1.1  augustss 	uByte		bSamFreqType;
    112  1.1  augustss #define UA_SAMP_CONTNUOUS 0
    113  1.1  augustss 	uByte		tSamFreq[3*2]; /* room for low and high */
    114  1.1  augustss #define UA_GETSAMP(p, n) ((p)->tSamFreq[(n)*3+0] | ((p)->tSamFreq[(n)*3+1] << 8) | ((p)->tSamFreq[(n)*3+2] << 16))
    115  1.1  augustss #define UA_SAMP_LO(p) UA_GETSAMP(p, 0)
    116  1.1  augustss #define UA_SAMP_HI(p) UA_GETSAMP(p, 1)
    117  1.1  augustss };
    118  1.1  augustss 
    119  1.1  augustss struct usb_audio_cluster {
    120  1.1  augustss 	uByte		bNrChannels;
    121  1.1  augustss 	uWord		wChannelConfig;
    122  1.1  augustss 	uByte		iChannelNames;
    123  1.1  augustss };
    124  1.1  augustss 
    125  1.1  augustss /* UDESCSUB_AC_INPUT */
    126  1.1  augustss struct usb_audio_input_terminal {
    127  1.1  augustss 	uByte		bLength;
    128  1.1  augustss 	uByte		bDescriptorType;
    129  1.1  augustss 	uByte		bDescriptorSubtype;
    130  1.1  augustss 	uByte		bTerminalId;
    131  1.1  augustss 	uWord		wTerminalType;
    132  1.1  augustss 	uByte		bAssocTerminal;
    133  1.1  augustss 	uByte		bNrChannels;
    134  1.1  augustss 	uWord		wChannelConfig;
    135  1.1  augustss 	uByte		iChannelNames;
    136  1.1  augustss 	uByte		iTerminal;
    137  1.1  augustss };
    138  1.1  augustss 
    139  1.1  augustss /* UDESCSUB_AC_OUTPUT */
    140  1.1  augustss struct usb_audio_output_terminal {
    141  1.1  augustss 	uByte		bLength;
    142  1.1  augustss 	uByte		bDescriptorType;
    143  1.1  augustss 	uByte		bDescriptorSubtype;
    144  1.1  augustss 	uByte		bTerminalId;
    145  1.1  augustss 	uWord		wTerminalType;
    146  1.1  augustss 	uByte		bAssocTerminal;
    147  1.1  augustss 	uByte		bSourceId;
    148  1.1  augustss 	uByte		iTerminal;
    149  1.1  augustss };
    150  1.1  augustss 
    151  1.1  augustss /* UDESCSUB_AC_MIXER */
    152  1.1  augustss struct usb_audio_mixer_unit {
    153  1.1  augustss 	uByte		bLength;
    154  1.1  augustss 	uByte		bDescriptorType;
    155  1.1  augustss 	uByte		bDescriptorSubtype;
    156  1.1  augustss 	uByte		bUnitId;
    157  1.1  augustss 	uByte		bNrInPins;
    158  1.1  augustss 	uByte		baSourceId[255]; /* length is really bNrInPins */
    159  1.1  augustss 	/* struct usb_audio_mixer_unit_1 */
    160  1.1  augustss };
    161  1.1  augustss struct usb_audio_mixer_unit_1 {
    162  1.1  augustss 	uByte		bNrChannels;
    163  1.1  augustss 	uWord		wChannelConfig;
    164  1.1  augustss 	uByte		iChannelNames;
    165  1.1  augustss 	uByte		bmControls[255];
    166  1.1  augustss 	/*uByte		iMixer;*/
    167  1.1  augustss };
    168  1.1  augustss 
    169  1.1  augustss /* UDESCSUB_AC_SELECTOR */
    170  1.1  augustss struct usb_audio_selector_unit {
    171  1.1  augustss 	uByte		bLength;
    172  1.1  augustss 	uByte		bDescriptorType;
    173  1.1  augustss 	uByte		bDescriptorSubtype;
    174  1.1  augustss 	uByte		bUnitId;
    175  1.1  augustss 	uByte		bNrInPins;
    176  1.1  augustss 	uByte		baSourceId[255];
    177  1.1  augustss 	/* uByte	iSelector; */
    178  1.1  augustss };
    179  1.1  augustss 
    180  1.1  augustss /* UDESCSUB_AC_FEATURE */
    181  1.1  augustss struct usb_audio_feature_unit {
    182  1.1  augustss 	uByte		bLength;
    183  1.1  augustss 	uByte		bDescriptorType;
    184  1.1  augustss 	uByte		bDescriptorSubtype;
    185  1.1  augustss 	uByte		bUnitId;
    186  1.1  augustss 	uByte		bSourceId;
    187  1.1  augustss 	uByte		bControlSize;
    188  1.1  augustss 	uByte		bmaControls[255]; /* size for more than enough */
    189  1.1  augustss 	/* uByte	iFeature; */
    190  1.1  augustss };
    191  1.1  augustss 
    192  1.1  augustss /* UDESCSUB_AC_PROCESSING */
    193  1.1  augustss struct usb_audio_processing_unit {
    194  1.1  augustss 	uByte		bLength;
    195  1.1  augustss 	uByte		bDescriptorType;
    196  1.1  augustss 	uByte		bDescriptorSubtype;
    197  1.1  augustss 	uByte		bUnitId;
    198  1.1  augustss 	uWord		wProcessType;
    199  1.1  augustss 	uByte		bNrInPins;
    200  1.1  augustss 	uByte		baSourceId[255];
    201  1.1  augustss 	/* struct usb_audio_processing_unit_1 */
    202  1.1  augustss };
    203  1.1  augustss struct usb_audio_processing_unit_1{
    204  1.1  augustss 	uByte		bNrChannels;
    205  1.1  augustss 	uWord		wChannelConfig;
    206  1.1  augustss 	uByte		iChannelNames;
    207  1.1  augustss 	uByte		bControlSize;
    208  1.1  augustss 	uByte		bmControls[255];
    209  1.1  augustss 	/*uByte		iProcessing;*/
    210  1.1  augustss };
    211  1.1  augustss 
    212  1.1  augustss /* UDESCSUB_AC_EXTENSION */
    213  1.1  augustss struct usb_audio_extension_unit {
    214  1.1  augustss 	uByte		bLength;
    215  1.1  augustss 	uByte		bDescriptorType;
    216  1.1  augustss 	uByte		bDescriptorSubtype;
    217  1.1  augustss 	uByte		bUnitId;
    218  1.1  augustss 	uWord		wExtensionCode;
    219  1.1  augustss 	uByte		bNrInPins;
    220  1.1  augustss 	uByte		baSourceId[255];
    221  1.1  augustss 	/* struct usb_audio_extension_unit_1 */
    222  1.1  augustss };
    223  1.1  augustss struct usb_audio_extension_unit_1 {
    224  1.1  augustss 	uByte		bNrChannels;
    225  1.1  augustss 	uWord		wChannelConfig;
    226  1.1  augustss 	uByte		iChannelNames;
    227  1.1  augustss 	uByte		bControlSize;
    228  1.1  augustss 	uByte		bmControls[255];
    229  1.1  augustss #define UA_EXT_ENABLE 0
    230  1.1  augustss 	/*uByte		iExtension;*/
    231  1.1  augustss };
    232  1.1  augustss 
    233  1.1  augustss #define UAT_STREAM 0x0101
    234  1.1  augustss 
    235  1.1  augustss #define SET_CUR 0x01
    236  1.1  augustss #define GET_CUR 0x81
    237  1.1  augustss #define SET_MIN 0x02
    238  1.1  augustss #define GET_MIN 0x82
    239  1.1  augustss #define SET_MAX 0x03
    240  1.1  augustss #define GET_MAX 0x83
    241  1.1  augustss #define SET_RES 0x04
    242  1.1  augustss #define GET_RES 0x84
    243  1.1  augustss #define SET_MEM 0x05
    244  1.1  augustss #define GET_MEM 0x85
    245  1.1  augustss #define GET_STAT 0xff
    246  1.1  augustss 
    247  1.1  augustss #define MUTE_CONTROL	0x01
    248  1.1  augustss #define VOLUME_CONTROL	0x02
    249  1.1  augustss #define BASS_CONTROL	0x03
    250  1.1  augustss #define MID_CONTROL	0x04
    251  1.1  augustss #define TREBLE_CONTROL	0x05
    252  1.1  augustss #define GRAPHIC_EQUALIZER_CONTROL	0x06
    253  1.1  augustss #define AGC_CONTROL	0x07
    254  1.1  augustss #define DELAY_CONTROL	0x08
    255  1.1  augustss #define BASS_BOOST_CONTROL 0x09
    256  1.1  augustss #define LOUDNESS_CONTROL 0x0a
    257  1.1  augustss 
    258  1.1  augustss #define FU_MASK(u) (1 << ((u)-1))
    259  1.1  augustss 
    260  1.1  augustss #define MASTER_CHAN 0
    261  1.1  augustss 
    262  1.1  augustss #define AS_GENERAL 1
    263  1.1  augustss #define FORMAT_TYPE 2
    264  1.1  augustss #define FORMAT_SPECIFIC 3
    265  1.1  augustss 
    266  1.1  augustss #define PCM 1
    267  1.1  augustss #define PCM8 2
    268  1.1  augustss #define IEEE_FLOAT 3
    269  1.1  augustss #define ALAW 4
    270  1.1  augustss #define MULAW 5
    271  1.1  augustss 
    272  1.1  augustss #define SAMPLING_FREQ_CONTROL 0x01
    273