root/dev/usb/uaudioreg.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. usb_endpoint_descriptor_audio_t

    1 /*      $OpenBSD: uaudioreg.h,v 1.12 2007/06/09 11:06:53 mbalmer Exp $ */
    2 /*      $NetBSD: uaudioreg.h,v 1.11 2002/10/23 02:32:37 christos Exp $  */
    3 
    4 /*
    5  * Copyright (c) 1999 The NetBSD Foundation, Inc.
    6  * All rights reserved.
    7  *
    8  * This code is derived from software contributed to The NetBSD Foundation
    9  * by Lennart Augustsson (lennart@augustsson.net) at
   10  * Carlstedt Research & Technology.
   11  *
   12  * Redistribution and use in source and binary forms, with or without
   13  * modification, are permitted provided that the following conditions
   14  * are met:
   15  * 1. Redistributions of source code must retain the above copyright
   16  *    notice, this list of conditions and the following disclaimer.
   17  * 2. Redistributions in binary form must reproduce the above copyright
   18  *    notice, this list of conditions and the following disclaimer in the
   19  *    documentation and/or other materials provided with the distribution.
   20  * 3. All advertising materials mentioning features or use of this software
   21  *    must display the following acknowledgement:
   22  *        This product includes software developed by the NetBSD
   23  *        Foundation, Inc. and its contributors.
   24  * 4. Neither the name of The NetBSD Foundation nor the names of its
   25  *    contributors may be used to endorse or promote products derived
   26  *    from this software without specific prior written permission.
   27  *
   28  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   29  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   31  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   32  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   33  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   34  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   35  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   36  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   37  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   38  * POSSIBILITY OF SUCH DAMAGE.
   39  */
   40 
   41 #define UAUDIO_VERSION          0x100
   42 
   43 #define UDESC_CS_CONFIG         0x22
   44 #define UDESC_CS_STRING         0x23
   45 #define UDESC_CS_INTERFACE      0x24
   46 #define UDESC_CS_ENDPOINT       0x25
   47 
   48 #define UDESCSUB_AC_HEADER      1
   49 #define UDESCSUB_AC_INPUT       2
   50 #define UDESCSUB_AC_OUTPUT      3
   51 #define UDESCSUB_AC_MIXER       4
   52 #define UDESCSUB_AC_SELECTOR    5
   53 #define UDESCSUB_AC_FEATURE     6
   54 #define UDESCSUB_AC_PROCESSING  7
   55 #define UDESCSUB_AC_EXTENSION   8
   56 
   57 /* The first fields are identical to usb_endpoint_descriptor_t */
   58 typedef struct {
   59         uByte           bLength;
   60         uByte           bDescriptorType;
   61         uByte           bEndpointAddress;
   62         uByte           bmAttributes;
   63         uWord           wMaxPacketSize;
   64         uByte           bInterval;
   65         /*
   66          * The following two entries are only used by the Audio Class.
   67          * And according to the specs the Audio Class is the only one
   68          * allowed to extend the endpoint descriptor.
   69          * Who knows what goes on in the minds of the people in the USB
   70          * standardization?  :-(
   71          */
   72         uByte           bRefresh;
   73         uByte           bSynchAddress;
   74 } __packed usb_endpoint_descriptor_audio_t;
   75 
   76 struct usb_audio_control_descriptor {
   77         uByte           bLength;
   78         uByte           bDescriptorType;
   79         uByte           bDescriptorSubtype;
   80         uWord           bcdADC;
   81         uWord           wTotalLength;
   82         uByte           bInCollection;
   83         uByte           baInterfaceNr[1];
   84 } __packed;
   85 
   86 struct usb_audio_streaming_interface_descriptor {
   87         uByte           bLength;
   88         uByte           bDescriptorType;
   89         uByte           bDescriptorSubtype;
   90         uByte           bTerminalLink;
   91         uByte           bDelay;
   92         uWord           wFormatTag;
   93 } __packed;
   94 
   95 struct usb_audio_streaming_endpoint_descriptor {
   96         uByte           bLength;
   97         uByte           bDescriptorType;
   98         uByte           bDescriptorSubtype;
   99         uByte           bmAttributes;
  100 #define UA_SED_FREQ_CONTROL     0x01
  101 #define UA_SED_PITCH_CONTROL    0x02
  102 #define UA_SED_MAXPACKETSONLY   0x80
  103         uByte           bLockDelayUnits;
  104         uWord           wLockDelay;
  105 } __packed;
  106 
  107 struct usb_audio_streaming_type1_descriptor {
  108         uByte           bLength;
  109         uByte           bDescriptorType;
  110         uByte           bDescriptorSubtype;
  111         uByte           bFormatType;
  112         uByte           bNrChannels;
  113         uByte           bSubFrameSize;
  114         uByte           bBitResolution;
  115         uByte           bSamFreqType;
  116 #define UA_SAMP_CONTNUOUS 0
  117         uByte           tSamFreq[3*2]; /* room for low and high */
  118 #define UA_GETSAMP(p, n) ((p)->tSamFreq[(n)*3+0] | ((p)->tSamFreq[(n)*3+1] << 8) | ((p)->tSamFreq[(n)*3+2] << 16))
  119 #define UA_SAMP_LO(p) UA_GETSAMP(p, 0)
  120 #define UA_SAMP_HI(p) UA_GETSAMP(p, 1)
  121 } __packed;
  122 
  123 struct usb_audio_cluster {
  124         uByte           bNrChannels;
  125         uWord           wChannelConfig;
  126         uByte           iChannelNames;
  127 } __packed;
  128 
  129 /* Shared by all units and terminals */
  130 struct usb_audio_unit {
  131         uByte           bLength;
  132         uByte           bDescriptorType;
  133         uByte           bDescriptorSubtype;
  134         uByte           bUnitId;
  135 };
  136 
  137 /* UDESCSUB_AC_INPUT */
  138 struct usb_audio_input_terminal {
  139         uByte           bLength;
  140         uByte           bDescriptorType;
  141         uByte           bDescriptorSubtype;
  142         uByte           bTerminalId;
  143         uWord           wTerminalType;
  144         uByte           bAssocTerminal;
  145         uByte           bNrChannels;
  146         uWord           wChannelConfig;
  147         uByte           iChannelNames;
  148         uByte           iTerminal;
  149 } __packed;
  150 
  151 /* UDESCSUB_AC_OUTPUT */
  152 struct usb_audio_output_terminal {
  153         uByte           bLength;
  154         uByte           bDescriptorType;
  155         uByte           bDescriptorSubtype;
  156         uByte           bTerminalId;
  157         uWord           wTerminalType;
  158         uByte           bAssocTerminal;
  159         uByte           bSourceId;
  160         uByte           iTerminal;
  161 } __packed;
  162 
  163 /* UDESCSUB_AC_MIXER */
  164 struct usb_audio_mixer_unit {
  165         uByte           bLength;
  166         uByte           bDescriptorType;
  167         uByte           bDescriptorSubtype;
  168         uByte           bUnitId;
  169         uByte           bNrInPins;
  170         uByte           baSourceId[255]; /* [bNrInPins] */
  171         /* struct usb_audio_mixer_unit_1 */
  172 } __packed;
  173 struct usb_audio_mixer_unit_1 {
  174         uByte           bNrChannels;
  175         uWord           wChannelConfig;
  176         uByte           iChannelNames;
  177         uByte           bmControls[255]; /* [bNrChannels] */
  178         /*uByte         iMixer;*/
  179 } __packed;
  180 
  181 /* UDESCSUB_AC_SELECTOR */
  182 struct usb_audio_selector_unit {
  183         uByte           bLength;
  184         uByte           bDescriptorType;
  185         uByte           bDescriptorSubtype;
  186         uByte           bUnitId;
  187         uByte           bNrInPins;
  188         uByte           baSourceId[255]; /* [bNrInPins] */
  189         /* uByte        iSelector; */
  190 } __packed;
  191 
  192 /* UDESCSUB_AC_FEATURE */
  193 struct usb_audio_feature_unit {
  194         uByte           bLength;
  195         uByte           bDescriptorType;
  196         uByte           bDescriptorSubtype;
  197         uByte           bUnitId;
  198         uByte           bSourceId;
  199         uByte           bControlSize;
  200         uByte           bmaControls[255]; /* size for more than enough */
  201         /* uByte        iFeature; */
  202 } __packed;
  203 
  204 /* UDESCSUB_AC_PROCESSING */
  205 struct usb_audio_processing_unit {
  206         uByte           bLength;
  207         uByte           bDescriptorType;
  208         uByte           bDescriptorSubtype;
  209         uByte           bUnitId;
  210         uWord           wProcessType;
  211         uByte           bNrInPins;
  212         uByte           baSourceId[255]; /* [bNrInPins] */
  213         /* struct usb_audio_processing_unit_1 */
  214 } __packed;
  215 struct usb_audio_processing_unit_1{
  216         uByte           bNrChannels;
  217         uWord           wChannelConfig;
  218         uByte           iChannelNames;
  219         uByte           bControlSize;
  220         uByte           bmControls[255]; /* [bControlSize] */
  221 #define UA_PROC_ENABLE_MASK 1
  222 } __packed;
  223 
  224 struct usb_audio_processing_unit_updown {
  225         uByte           iProcessing;
  226         uByte           bNrModes;
  227         uWord           waModes[255]; /* [bNrModes] */
  228 } __packed;
  229 
  230 /* UDESCSUB_AC_EXTENSION */
  231 struct usb_audio_extension_unit {
  232         uByte           bLength;
  233         uByte           bDescriptorType;
  234         uByte           bDescriptorSubtype;
  235         uByte           bUnitId;
  236         uWord           wExtensionCode;
  237         uByte           bNrInPins;
  238         uByte           baSourceId[255]; /* [bNrInPins] */
  239         /* struct usb_audio_extension_unit_1 */
  240 } __packed;
  241 struct usb_audio_extension_unit_1 {
  242         uByte           bNrChannels;
  243         uWord           wChannelConfig;
  244         uByte           iChannelNames;
  245         uByte           bControlSize;
  246         uByte           bmControls[255]; /* [bControlSize] */
  247 #define UA_EXT_ENABLE_MASK 1
  248 #define UA_EXT_ENABLE 1
  249         /*uByte         iExtension;*/
  250 } __packed;
  251 
  252 /* USB terminal types */
  253 #define UAT_UNDEFINED           0x0100
  254 #define UAT_STREAM              0x0101
  255 #define UAT_VENDOR              0x01ff
  256 /* input terminal types */
  257 #define UATI_UNDEFINED          0x0200
  258 #define UATI_MICROPHONE         0x0201
  259 #define UATI_DESKMICROPHONE     0x0202
  260 #define UATI_PERSONALMICROPHONE 0x0203
  261 #define UATI_OMNIMICROPHONE     0x0204
  262 #define UATI_MICROPHONEARRAY    0x0205
  263 #define UATI_PROCMICROPHONEARR  0x0206
  264 /* output terminal types */
  265 #define UATO_UNDEFINED          0x0300
  266 #define UATO_SPEAKER            0x0301
  267 #define UATO_HEADPHONES         0x0302
  268 #define UATO_DISPLAYAUDIO       0x0303
  269 #define UATO_DESKTOPSPEAKER     0x0304
  270 #define UATO_ROOMSPEAKER        0x0305
  271 #define UATO_COMMSPEAKER        0x0306
  272 #define UATO_SUBWOOFER          0x0307
  273 /* bidir terminal types */
  274 #define UATB_UNDEFINED          0x0400
  275 #define UATB_HANDSET            0x0401
  276 #define UATB_HEADSET            0x0402
  277 #define UATB_SPEAKERPHONE       0x0403
  278 #define UATB_SPEAKERPHONEESUP   0x0404
  279 #define UATB_SPEAKERPHONEECANC  0x0405
  280 /* telephony terminal types */
  281 #define UATT_UNDEFINED          0x0500
  282 #define UATT_PHONELINE          0x0501
  283 #define UATT_TELEPHONE          0x0502
  284 #define UATT_DOWNLINEPHONE      0x0503
  285 /* external terminal types */
  286 #define UATE_UNDEFINED          0x0600
  287 #define UATE_ANALOGCONN         0x0601
  288 #define UATE_DIGITALAUIFC       0x0602
  289 #define UATE_LINECONN           0x0603
  290 #define UATE_LEGACYCONN         0x0604
  291 #define UATE_SPDIF              0x0605
  292 #define UATE_1394DA             0x0606
  293 #define UATE_1394DV             0x0607
  294 /* embedded function terminal types */
  295 #define UATF_UNDEFINED          0x0700
  296 #define UATF_CALIBNOISE         0x0701
  297 #define UATF_EQUNOISE           0x0702
  298 #define UATF_CDPLAYER           0x0703
  299 #define UATF_DAT                0x0704
  300 #define UATF_DCC                0x0705
  301 #define UATF_MINIDISK           0x0706
  302 #define UATF_ANALOGTAPE         0x0707
  303 #define UATF_PHONOGRAPH         0x0708
  304 #define UATF_VCRAUDIO           0x0709
  305 #define UATF_VIDEODISCAUDIO     0x070a
  306 #define UATF_DVDAUDIO           0x070b
  307 #define UATF_TVTUNERAUDIO       0x070c
  308 #define UATF_SATELLITE          0x070d
  309 #define UATF_CABLETUNER         0x070e
  310 #define UATF_DSS                0x070f
  311 #define UATF_RADIORECV          0x0710
  312 #define UATF_RADIOXMIT          0x0711
  313 #define UATF_MULTITRACK         0x0712
  314 #define UATF_SYNTHESIZER        0x0713
  315 
  316 
  317 #define SET_CUR 0x01
  318 #define GET_CUR 0x81
  319 #define SET_MIN 0x02
  320 #define GET_MIN 0x82
  321 #define SET_MAX 0x03
  322 #define GET_MAX 0x83
  323 #define SET_RES 0x04
  324 #define GET_RES 0x84
  325 #define SET_MEM 0x05
  326 #define GET_MEM 0x85
  327 #define GET_STAT 0xff
  328 
  329 #define MUTE_CONTROL    0x01
  330 #define VOLUME_CONTROL  0x02
  331 #define BASS_CONTROL    0x03
  332 #define MID_CONTROL     0x04
  333 #define TREBLE_CONTROL  0x05
  334 #define GRAPHIC_EQUALIZER_CONTROL       0x06
  335 #define AGC_CONTROL     0x07
  336 #define DELAY_CONTROL   0x08
  337 #define BASS_BOOST_CONTROL 0x09
  338 #define LOUDNESS_CONTROL 0x0a
  339 
  340 #define FU_MASK(u) (1 << ((u)-1))
  341 
  342 #define MASTER_CHAN     0
  343 
  344 #define AS_GENERAL      1
  345 #define FORMAT_TYPE     2
  346 #define FORMAT_SPECIFIC 3
  347 
  348 #define UA_FMT_PCM      1
  349 #define UA_FMT_PCM8     2
  350 #define UA_FMT_IEEE_FLOAT 3
  351 #define UA_FMT_ALAW     4
  352 #define UA_FMT_MULAW    5
  353 #define UA_FMT_MPEG     0x1001
  354 #define UA_FMT_AC3      0x1002
  355 
  356 #define SAMPLING_FREQ_CONTROL   0x01
  357 #define PITCH_CONTROL           0x02
  358 
  359 #define FORMAT_TYPE_UNDEFINED 0
  360 #define FORMAT_TYPE_I 1
  361 #define FORMAT_TYPE_II 2
  362 #define FORMAT_TYPE_III 3
  363 
  364 #define UA_PROC_MASK(n) (1<< ((n)-1))
  365 #define PROCESS_UNDEFINED               0
  366 #define  XX_ENABLE_CONTROL                      1
  367 #define UPDOWNMIX_PROCESS               1
  368 #define  UD_ENABLE_CONTROL                      1
  369 #define  UD_MODE_SELECT_CONTROL                 2
  370 #define DOLBY_PROLOGIC_PROCESS          2
  371 #define  DP_ENABLE_CONTROL                      1
  372 #define  DP_MODE_SELECT_CONTROL                 2
  373 #define P3D_STEREO_EXTENDER_PROCESS     3
  374 #define  P3D_ENABLE_CONTROL                     1
  375 #define  P3D_SPACIOUSNESS_CONTROL               2
  376 #define REVERBATION_PROCESS             4
  377 #define  RV_ENABLE_CONTROL                      1
  378 #define  RV_LEVEL_CONTROL                       2
  379 #define  RV_TIME_CONTROL                        3
  380 #define  RV_FEEDBACK_CONTROL                    4
  381 #define CHORUS_PROCESS                  5
  382 #define  CH_ENABLE_CONTROL                      1
  383 #define  CH_LEVEL_CONTROL                       2
  384 #define  CH_RATE_CONTROL                        3
  385 #define  CH_DEPTH_CONTROL                       4
  386 #define DYN_RANGE_COMP_PROCESS          6
  387 #define  DR_ENABLE_CONTROL                      1
  388 #define  DR_COMPRESSION_RATE_CONTROL            2
  389 #define  DR_MAXAMPL_CONTROL                     3
  390 #define  DR_THRESHOLD_CONTROL                   4
  391 #define  DR_ATTACK_TIME_CONTROL                 5
  392 #define  DR_RELEASE_TIME_CONTROL                6

/* [<][>][^][v][top][bottom][index][help] */