SAMV71 Xplained Ultra Software Package 1.5

USBDDriverDescriptors.c

Go to the documentation of this file.
00001 /* ---------------------------------------------------------------------------- */
00002 /*                  Atmel Microcontroller Software Support                      */
00003 /*                       SAM Software Package License                           */
00004 /* ---------------------------------------------------------------------------- */
00005 /* Copyright (c) 2015, Atmel Corporation                                        */
00006 /*                                                                              */
00007 /* All rights reserved.                                                         */
00008 /*                                                                              */
00009 /* Redistribution and use in source and binary forms, with or without           */
00010 /* modification, are permitted provided that the following condition is met:    */
00011 /*                                                                              */
00012 /* - Redistributions of source code must retain the above copyright notice,     */
00013 /* this list of conditions and the disclaimer below.                            */
00014 /*                                                                              */
00015 /* Atmel's name may not be used to endorse or promote products derived from     */
00016 /* this software without specific prior written permission.                     */
00017 /*                                                                              */
00018 /* DISCLAIMER:  THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR   */
00019 /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
00020 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE   */
00021 /* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,      */
00022 /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
00023 /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,  */
00024 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF    */
00025 /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING         */
00026 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
00027 /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                           */
00028 /* ---------------------------------------------------------------------------- */
00029 
00030 /** \file
00031  * \addtogroup usbd_audio_speakerphone
00032  *@{
00033  */
00034 
00035 /*------------------------------------------------------------------------------
00036  *         Headers
00037  *-----------------------------------------------------------------------------*/
00038 
00039 #include "board.h"
00040 #include "USBD_Config.h"
00041 #include "AUDDSpeakerPhoneDriver.h"
00042 
00043 /*------------------------------------------------------------------------------
00044  *         Definitions
00045  *-----------------------------------------------------------------------------*/
00046 
00047 /**
00048  * \addtogroup usbd_aud_speakerphone_stream_info Audio SpeakerPhone stream
00049  * information
00050  *      @{
00051  * This page lists codes for USB Audio Speakerphone stream information.
00052  *
00053  * \section Code
00054  * - AUDDSpeakerPhoneDriver_SAMPLERATE
00055  * - AUDDSpeakerPhoneDriver_NUMCHANNELS
00056  * - AUDDSpeakerPhoneDriver_BYTESPERSAMPLE
00057  * - AUDDSpeakerPhoneDriver_BITSPERSAMPLE
00058  * - AUDDSpeakerPhoneDriver_SAMPLESPERFRAME
00059  * - AUDDSpeakerPhoneDriver_BYTESPERFRAME
00060  */
00061 
00062 /** Sample rate in Hz. */
00063 #define AUDDSpeakerPhoneDriver_SAMPLERATE        AUDDevice_SAMPLERATE
00064 /** Number of channels in audio stream. */
00065 #define AUDDSpeakerPhoneDriver_NUMCHANNELS       AUDDevice_NUMCHANNELS
00066 /** Number of bytes in one sample. */
00067 #define AUDDSpeakerPhoneDriver_BYTESPERSAMPLE    AUDDevice_BYTESPERSAMPLE
00068 /** Number of bits in one sample. */
00069 #define AUDDSpeakerPhoneDriver_BITSPERSAMPLE     AUDDevice_BITSPERSAMPLE
00070 /** Number of bytes in one USB subframe. */
00071 #define AUDDSpeakerPhoneDriver_BYTESPERSUBFRAME  AUDDevice_BYTESPERSUBFRAME
00072 /** Number of samples in one USB frame. */
00073 #define AUDDSpeakerPhoneDriver_SAMPLESPERFRAME   AUDDevice_SAMPLESPERFRAME
00074 /** Number of bytes in one USB frame. */
00075 #define AUDDSpeakerPhoneDriver_BYTESPERFRAME     AUDDevice_BYTESPERFRAME
00076 /**      @}*/
00077 
00078 /** \addtogroup usbd_audio_loop_record_device_codes Audio SpeakerPhone Device Codes
00079  *      @{
00080  * This page lists the %device IDs and release number of the USB Audio
00081  * Speakerphone %device.
00082  *
00083  * \section Codes
00084  * - AUDDSpeakerPhoneDriverDescriptors_VENDORID
00085  * - AUDDSpeakerPhoneDriverDescriptors_PRODUCTID
00086  * - AUDDSpeakerPhoneDriverDescriptors_RELEASE
00087  */
00088 
00089 /** Device vendor ID. */
00090 #define AUDDSpeakerPhoneDriverDescriptors_VENDORID            USBD_VID_ATMEL
00091 /** Device product ID. */
00092 #define AUDDSpeakerPhoneDriverDescriptors_PRODUCTID           USBD_PID_AUDIO
00093 /** Device release number in BCD format. */
00094 #define AUDDSpeakerPhoneDriverDescriptors_RELEASE             USBD_RELEASE_1_00
00095 /**      @}*/
00096 
00097 /*------------------------------------------------------------------------------
00098  *         Exported variables
00099  *----------------------------------------------------------------------------*/
00100 
00101 /** Device descriptor for a USB Audio Speakerphone driver. */
00102 const USBDeviceDescriptor deviceDescriptor = {
00103 
00104     sizeof(USBDeviceDescriptor),
00105     USBGenericDescriptor_DEVICE,
00106     USBDeviceDescriptor_USB2_00,
00107     AUDDeviceDescriptor_CLASS,
00108     AUDDeviceDescriptor_SUBCLASS,
00109     AUDDeviceDescriptor_PROTOCOL,
00110     CHIP_USB_ENDPOINTS_MAXPACKETSIZE(0),
00111     AUDDSpeakerPhoneDriverDescriptors_VENDORID,
00112     AUDDSpeakerPhoneDriverDescriptors_PRODUCTID,
00113     AUDDSpeakerPhoneDriverDescriptors_RELEASE,
00114     1, /* Manufacturer string descriptor index */
00115     2, /* Product string descriptor index */
00116     3, /* Index of serial number string descriptor */
00117     1  /* One possible configuration */
00118 };
00119 
00120 /** Device qualifier descriptor (to pass USB test). */
00121 static const USBDeviceQualifierDescriptor qualifierDescriptor = {
00122 
00123     sizeof(USBDeviceQualifierDescriptor),
00124     USBGenericDescriptor_DEVICEQUALIFIER,
00125     USBDeviceDescriptor_USB2_00,
00126     AUDDeviceDescriptor_CLASS,
00127     AUDDeviceDescriptor_SUBCLASS,
00128     AUDDeviceDescriptor_PROTOCOL,
00129     CHIP_USB_ENDPOINTS_MAXPACKETSIZE(0),
00130     0, // Device has one possible configuration.
00131     0x00
00132 };
00133 
00134 /** FS Configuration descriptors for a USB Audio Speakerphone driver. */
00135 const AUDDSpeakerPhoneDriverConfigurationDescriptors fsConfigurationDescriptors
00136 = {
00137 
00138     /* Configuration descriptor */
00139     {
00140         sizeof(USBConfigurationDescriptor),
00141         USBGenericDescriptor_CONFIGURATION,
00142         sizeof(AUDDSpeakerPhoneDriverConfigurationDescriptors),
00143         3, /* This configuration has 3 interfaces */
00144         1, /* This is configuration #1 */
00145         0, /* No string descriptor */
00146         BOARD_USB_BMATTRIBUTES,
00147         USBConfigurationDescriptor_POWER(100)
00148     },
00149     /* Audio control interface standard descriptor */
00150     {
00151         sizeof(USBInterfaceDescriptor),
00152         USBGenericDescriptor_INTERFACE,
00153         AUDDSpeakerPhoneDriverDescriptors_CONTROL,
00154         0, /* This is alternate setting #0 */
00155         0, /* This interface uses no endpoint */
00156         AUDControlInterfaceDescriptor_CLASS,
00157         AUDControlInterfaceDescriptor_SUBCLASS,
00158         AUDControlInterfaceDescriptor_PROTOCOL,
00159         0 /* No string descriptor */
00160     },
00161     /* Audio control interface descriptors */
00162     {
00163         /* Header descriptor */
00164         {
00165             {
00166                 sizeof(AUDHeaderDescriptor2),
00167                 AUDGenericDescriptor_INTERFACE,
00168                 AUDGenericDescriptor_HEADER,
00169                 AUDHeaderDescriptor_AUD1_00,
00170                 sizeof(AUDDSpeakerPhoneDriverAudioControlDescriptors),
00171                 2 /* Two streaming interface */
00172             },
00173             AUDDSpeakerPhoneDriverDescriptors_STREAMING,
00174             AUDDSpeakerPhoneDriverDescriptors_STREAMINGIN
00175         },
00176         /* Input terminal descriptor (speaker) */
00177         {
00178             sizeof(AUDInputTerminalDescriptor),
00179             AUDGenericDescriptor_INTERFACE,
00180             AUDGenericDescriptor_INPUTTERMINAL,
00181             AUDDSpeakerPhoneDriverDescriptors_INPUTTERMINAL,
00182             AUDInputTerminalDescriptor_USBSTREAMING,
00183             AUDDSpeakerPhoneDriverDescriptors_OUTPUTTERMINAL,
00184             AUDDSpeakerPhoneDriver_NUMCHANNELS,
00185             AUDInputTerminalDescriptor_LEFTFRONT
00186             | AUDInputTerminalDescriptor_RIGHTFRONT,
00187             0, /* No string descriptor for channels */
00188             0 /* No string descriptor for input terminal */
00189         },
00190         /* Output terminal descriptor (speaker) */
00191         {
00192             sizeof(AUDOutputTerminalDescriptor),
00193             AUDGenericDescriptor_INTERFACE,
00194             AUDGenericDescriptor_OUTPUTTERMINAL,
00195             AUDDSpeakerPhoneDriverDescriptors_OUTPUTTERMINAL,
00196             AUDOutputTerminalDescriptor_SPEAKER,
00197             AUDDSpeakerPhoneDriverDescriptors_INPUTTERMINAL,
00198             AUDDSpeakerPhoneDriverDescriptors_FEATUREUNIT,
00199             0 /* No string descriptor */
00200         },
00201         /* Feature unit descriptor (speaker) */
00202         {
00203             {
00204                 sizeof(AUDFeatureUnitDescriptor3),
00205                 AUDGenericDescriptor_INTERFACE,
00206                 AUDGenericDescriptor_FEATUREUNIT,
00207                 AUDDSpeakerPhoneDriverDescriptors_FEATUREUNIT,
00208                 AUDDSpeakerPhoneDriverDescriptors_INPUTTERMINAL,
00209                 1, /* 1 byte per channel for controls */
00210             },
00211             {
00212                 AUDFeatureUnitDescriptor_MUTE, /* Master channel controls */
00213                 0, /* Right channel controls */
00214                 0  /* Left channel controls */
00215             },
00216             0 /* No string descriptor */
00217         },
00218         /* Input terminal descriptor (speakerphone) */
00219         {
00220             sizeof(AUDInputTerminalDescriptor),
00221             AUDGenericDescriptor_INTERFACE,
00222             AUDGenericDescriptor_INPUTTERMINAL,
00223             AUDDSpeakerPhoneDriverDescriptors_INPUTTERMINAL_REC,
00224             AUDInputTerminalDescriptor_SPEAKERPHONE,
00225             AUDDSpeakerPhoneDriverDescriptors_OUTPUTTERMINAL_REC,
00226             AUDDSpeakerPhoneDriver_NUMCHANNELS,
00227             AUDInputTerminalDescriptor_LEFTFRONT
00228             | AUDInputTerminalDescriptor_RIGHTFRONT,
00229             0, /* No string descriptor for channels */
00230             0 /* No string descriptor for input terminal */
00231         },
00232         /* Output terminal descriptor (speakerphone) */
00233         {
00234             sizeof(AUDOutputTerminalDescriptor),
00235             AUDGenericDescriptor_INTERFACE,
00236             AUDGenericDescriptor_OUTPUTTERMINAL,
00237             AUDDSpeakerPhoneDriverDescriptors_OUTPUTTERMINAL_REC,
00238             AUDOutputTerminalDescriptor_USBTREAMING,
00239             AUDDSpeakerPhoneDriverDescriptors_INPUTTERMINAL_REC,
00240             AUDDSpeakerPhoneDriverDescriptors_FEATUREUNIT_REC,
00241             0 /* No string descriptor */
00242         },
00243         /* Feature unit descriptor (speakerphone) */
00244         {
00245             {
00246                 sizeof(AUDFeatureUnitDescriptor3),
00247                 AUDGenericDescriptor_INTERFACE,
00248                 AUDGenericDescriptor_FEATUREUNIT,
00249                 AUDDSpeakerPhoneDriverDescriptors_FEATUREUNIT_REC,
00250                 AUDDSpeakerPhoneDriverDescriptors_INPUTTERMINAL_REC,
00251                 1
00252             },
00253             {
00254                 AUDFeatureUnitDescriptor_MUTE, /* Mic controls */
00255                 0,
00256                 0
00257             },
00258             0 /* No string descriptor */
00259         }
00260     },
00261     /* - AUIDO OUT */
00262     /* Audio streaming interface with 0 endpoints */
00263     {
00264         sizeof(USBInterfaceDescriptor),
00265         USBGenericDescriptor_INTERFACE,
00266         AUDDSpeakerPhoneDriverDescriptors_STREAMING,
00267         0, /* This is alternate setting #0 */
00268         0, /* This interface uses no endpoints */
00269         AUDStreamingInterfaceDescriptor_CLASS,
00270         AUDStreamingInterfaceDescriptor_SUBCLASS,
00271         AUDStreamingInterfaceDescriptor_PROTOCOL,
00272         0 /* No string descriptor */
00273     },
00274     /* Audio streaming interface with data endpoint */
00275     {
00276         sizeof(USBInterfaceDescriptor),
00277         USBGenericDescriptor_INTERFACE,
00278         AUDDSpeakerPhoneDriverDescriptors_STREAMING,
00279         1, /* This is alternate setting #1 */
00280         1, /* This interface uses 1 endpoint */
00281         AUDStreamingInterfaceDescriptor_CLASS,
00282         AUDStreamingInterfaceDescriptor_SUBCLASS,
00283         AUDStreamingInterfaceDescriptor_PROTOCOL,
00284         0 /* No string descriptor */
00285     },
00286     /* Audio streaming class-specific descriptor */
00287     {
00288         sizeof(AUDStreamingInterfaceDescriptor),
00289         AUDGenericDescriptor_INTERFACE,
00290         AUDStreamingInterfaceDescriptor_GENERAL,
00291         AUDDSpeakerPhoneDriverDescriptors_INPUTTERMINAL,
00292         0, /* No internal delay because of data path */
00293         AUDFormatTypeOneDescriptor_PCM
00294     },
00295     /* Format type I descriptor */
00296     {
00297         {
00298             sizeof(AUDFormatTypeOneDescriptor1),
00299             AUDGenericDescriptor_INTERFACE,
00300             AUDStreamingInterfaceDescriptor_FORMATTYPE,
00301             AUDFormatTypeOneDescriptor_FORMATTYPEONE,
00302             AUDDSpeakerPhoneDriver_NUMCHANNELS,
00303             AUDDSpeakerPhoneDriver_BYTESPERSAMPLE,
00304             AUDDSpeakerPhoneDriver_BYTESPERSAMPLE * 8,
00305             1 /* One discrete frequency supported */
00306         },
00307         {
00308             AUDDSpeakerPhoneDriver_SAMPLERATE & 0xFF,
00309             (AUDDSpeakerPhoneDriver_SAMPLERATE >> 8) & 0xFF,
00310             (AUDDSpeakerPhoneDriver_SAMPLERATE >> 16) & 0xFF
00311         }
00312     },
00313     /* Audio streaming endpoint standard descriptor */
00314     {
00315         sizeof(AUDEndpointDescriptor),
00316         USBGenericDescriptor_ENDPOINT,
00317         USBEndpointDescriptor_ADDRESS(
00318             USBEndpointDescriptor_OUT,
00319             AUDDSpeakerPhoneDriverDescriptors_DATAOUT),
00320         USBEndpointDescriptor_ISOCHRONOUS,
00321         AUDDSpeakerPhoneDriver_BYTESPERFRAME,
00322         AUDDSpeakerPhoneDriverDescriptors_FS_INTERVAL, /* Polling interval = 1 ms */
00323         0, /* This is not a synchronization endpoint */
00324         0 /* No associated synchronization endpoint */
00325     },
00326     /* Audio streaming endpoint class-specific descriptor */
00327     {
00328         sizeof(AUDDataEndpointDescriptor),
00329         AUDGenericDescriptor_ENDPOINT,
00330         AUDDataEndpointDescriptor_SUBTYPE,
00331         0, /* No attributes */
00332         0, /* Endpoint is not synchronized */
00333         0 /* Endpoint is not synchronized */
00334     },
00335     /*- AUDIO IN */
00336     /* Audio streaming interface with 0 endpoints */
00337     {
00338         sizeof(USBInterfaceDescriptor),
00339         USBGenericDescriptor_INTERFACE,
00340         AUDDSpeakerPhoneDriverDescriptors_STREAMINGIN,
00341         0, /* This is alternate setting #0 */
00342         0, /* This interface uses no endpoints */
00343         AUDStreamingInterfaceDescriptor_CLASS,
00344         AUDStreamingInterfaceDescriptor_SUBCLASS,
00345         AUDStreamingInterfaceDescriptor_PROTOCOL,
00346         0 /* No string descriptor */
00347     },
00348     /* Audio streaming interface with data endpoint */
00349     {
00350         sizeof(USBInterfaceDescriptor),
00351         USBGenericDescriptor_INTERFACE,
00352         AUDDSpeakerPhoneDriverDescriptors_STREAMINGIN,
00353         1, /* This is alternate setting #1 */
00354         1, /* This interface uses 1 endpoint */
00355         AUDStreamingInterfaceDescriptor_CLASS,
00356         AUDStreamingInterfaceDescriptor_SUBCLASS,
00357         AUDStreamingInterfaceDescriptor_PROTOCOL,
00358         0 /* No string descriptor */
00359     },
00360     /* Audio streaming class-specific descriptor */
00361     {
00362         sizeof(AUDStreamingInterfaceDescriptor),
00363         AUDGenericDescriptor_INTERFACE,
00364         AUDStreamingInterfaceDescriptor_GENERAL,
00365         AUDDSpeakerPhoneDriverDescriptors_OUTPUTTERMINAL_REC,
00366         0, /* No internal delay because of data path */
00367         AUDFormatTypeOneDescriptor_PCM
00368     },
00369     /* Format type I descriptor */
00370     {
00371         {
00372             sizeof(AUDFormatTypeOneDescriptor1),
00373             AUDGenericDescriptor_INTERFACE,
00374             AUDStreamingInterfaceDescriptor_FORMATTYPE,
00375             AUDFormatTypeOneDescriptor_FORMATTYPEONE,
00376             AUDDSpeakerPhoneDriver_NUMCHANNELS,
00377             AUDDSpeakerPhoneDriver_BYTESPERSAMPLE,
00378             AUDDSpeakerPhoneDriver_BYTESPERSAMPLE * 8,
00379             1 /* One discrete frequency supported */
00380         },
00381         {
00382             AUDDSpeakerPhoneDriver_SAMPLERATE & 0xFF,
00383             (AUDDSpeakerPhoneDriver_SAMPLERATE >> 8) & 0xFF,
00384             (AUDDSpeakerPhoneDriver_SAMPLERATE >> 16) & 0xFF
00385         }
00386     },
00387     /* Audio streaming endpoint standard descriptor */
00388     {
00389         sizeof(AUDEndpointDescriptor),
00390         USBGenericDescriptor_ENDPOINT,
00391         USBEndpointDescriptor_ADDRESS(
00392             USBEndpointDescriptor_IN,
00393             AUDDSpeakerPhoneDriverDescriptors_DATAIN),
00394         USBEndpointDescriptor_ISOCHRONOUS,
00395         AUDDSpeakerPhoneDriver_BYTESPERFRAME,
00396         AUDDSpeakerPhoneDriverDescriptors_FS_INTERVAL, /* Polling interval = 1 ms */
00397         0, /* This is not a synchronization endpoint */
00398         0 /* No associated synchronization endpoint */
00399     },
00400     /* Audio streaming endpoint class-specific descriptor */
00401     {
00402         sizeof(AUDDataEndpointDescriptor),
00403         AUDGenericDescriptor_ENDPOINT,
00404         AUDDataEndpointDescriptor_SUBTYPE,
00405         0, /* No attributes */
00406         0, /* Endpoint is not synchronized */
00407         0 /* Endpoint is not synchronized */
00408     }
00409 };
00410 
00411 /** HS Configuration descriptors for a USB Audio Speakerphone driver. */
00412 const AUDDSpeakerPhoneDriverConfigurationDescriptors hsConfigurationDescriptors
00413 = {
00414 
00415     /* Configuration descriptor */
00416     {
00417         sizeof(USBConfigurationDescriptor),
00418         USBGenericDescriptor_CONFIGURATION,
00419         sizeof(AUDDSpeakerPhoneDriverConfigurationDescriptors),
00420         3, /* This configuration has 3 interfaces */
00421         1, /* This is configuration #1 */
00422         0, /* No string descriptor */
00423         BOARD_USB_BMATTRIBUTES,
00424         USBConfigurationDescriptor_POWER(100)
00425     },
00426     /* Audio control interface standard descriptor */
00427     {
00428         sizeof(USBInterfaceDescriptor),
00429         USBGenericDescriptor_INTERFACE,
00430         AUDDSpeakerPhoneDriverDescriptors_CONTROL,
00431         0, /* This is alternate setting #0 */
00432         0, /* This interface uses no endpoint */
00433         AUDControlInterfaceDescriptor_CLASS,
00434         AUDControlInterfaceDescriptor_SUBCLASS,
00435         AUDControlInterfaceDescriptor_PROTOCOL,
00436         0 /* No string descriptor */
00437     },
00438     /* Audio control interface descriptors */
00439     {
00440         /* Header descriptor */
00441         {
00442             {
00443                 sizeof(AUDHeaderDescriptor2),
00444                 AUDGenericDescriptor_INTERFACE,
00445                 AUDGenericDescriptor_HEADER,
00446                 AUDHeaderDescriptor_AUD1_00,
00447                 sizeof(AUDDSpeakerPhoneDriverAudioControlDescriptors),
00448                 2 /* Two streaming interface */
00449             },
00450             AUDDSpeakerPhoneDriverDescriptors_STREAMING,
00451             AUDDSpeakerPhoneDriverDescriptors_STREAMINGIN
00452         },
00453         /* Input terminal descriptor (speaker) */
00454         {
00455             sizeof(AUDInputTerminalDescriptor),
00456             AUDGenericDescriptor_INTERFACE,
00457             AUDGenericDescriptor_INPUTTERMINAL,
00458             AUDDSpeakerPhoneDriverDescriptors_INPUTTERMINAL,
00459             AUDInputTerminalDescriptor_USBSTREAMING,
00460             AUDDSpeakerPhoneDriverDescriptors_OUTPUTTERMINAL,
00461             AUDDSpeakerPhoneDriver_NUMCHANNELS,
00462             AUDInputTerminalDescriptor_LEFTFRONT
00463             | AUDInputTerminalDescriptor_RIGHTFRONT,
00464             0, /* No string descriptor for channels */
00465             0 /* No string descriptor for input terminal */
00466         },
00467         /* Output terminal descriptor (speaker) */
00468         {
00469             sizeof(AUDOutputTerminalDescriptor),
00470             AUDGenericDescriptor_INTERFACE,
00471             AUDGenericDescriptor_OUTPUTTERMINAL,
00472             AUDDSpeakerPhoneDriverDescriptors_OUTPUTTERMINAL,
00473             AUDOutputTerminalDescriptor_SPEAKER,
00474             AUDDSpeakerPhoneDriverDescriptors_INPUTTERMINAL,
00475             AUDDSpeakerPhoneDriverDescriptors_FEATUREUNIT,
00476             0 /* No string descriptor */
00477         },
00478         /* Feature unit descriptor (speaker) */
00479         {
00480             {
00481                 sizeof(AUDFeatureUnitDescriptor3),
00482                 AUDGenericDescriptor_INTERFACE,
00483                 AUDGenericDescriptor_FEATUREUNIT,
00484                 AUDDSpeakerPhoneDriverDescriptors_FEATUREUNIT,
00485                 AUDDSpeakerPhoneDriverDescriptors_INPUTTERMINAL,
00486                 1, /* 1 byte per channel for controls */
00487             },
00488             {
00489                 AUDFeatureUnitDescriptor_MUTE, /* Master channel controls */
00490                 0, /* Right channel controls */
00491                 0  /* Left channel controls */
00492             },
00493             0 /* No string descriptor */
00494         },
00495         /* Input terminal descriptor (speakerphone) */
00496         {
00497             sizeof(AUDInputTerminalDescriptor),
00498             AUDGenericDescriptor_INTERFACE,
00499             AUDGenericDescriptor_INPUTTERMINAL,
00500             AUDDSpeakerPhoneDriverDescriptors_INPUTTERMINAL_REC,
00501             AUDInputTerminalDescriptor_SPEAKERPHONE,
00502             AUDDSpeakerPhoneDriverDescriptors_OUTPUTTERMINAL_REC,
00503             AUDDSpeakerPhoneDriver_NUMCHANNELS,
00504             AUDInputTerminalDescriptor_LEFTFRONT
00505             | AUDInputTerminalDescriptor_RIGHTFRONT,
00506             0, /* No string descriptor for channels */
00507             0 /* No string descriptor for input terminal */
00508         },
00509         /* Output terminal descriptor (speakerphone) */
00510         {
00511             sizeof(AUDOutputTerminalDescriptor),
00512             AUDGenericDescriptor_INTERFACE,
00513             AUDGenericDescriptor_OUTPUTTERMINAL,
00514             AUDDSpeakerPhoneDriverDescriptors_OUTPUTTERMINAL_REC,
00515             AUDOutputTerminalDescriptor_USBTREAMING,
00516             AUDDSpeakerPhoneDriverDescriptors_INPUTTERMINAL_REC,
00517             AUDDSpeakerPhoneDriverDescriptors_FEATUREUNIT_REC,
00518             0 /* No string descriptor */
00519         },
00520         /* Feature unit descriptor (speakerphone) */
00521         {
00522             {
00523                 sizeof(AUDFeatureUnitDescriptor3),
00524                 AUDGenericDescriptor_INTERFACE,
00525                 AUDGenericDescriptor_FEATUREUNIT,
00526                 AUDDSpeakerPhoneDriverDescriptors_FEATUREUNIT_REC,
00527                 AUDDSpeakerPhoneDriverDescriptors_INPUTTERMINAL_REC,
00528                 1
00529             },
00530             {
00531                 AUDFeatureUnitDescriptor_MUTE, /* Mic controls */
00532                 0,
00533                 0
00534             },
00535             0 /* No string descriptor */
00536         }
00537     },
00538     /* - AUIDO OUT */
00539     /* Audio streaming interface with 0 endpoints */
00540     {
00541         sizeof(USBInterfaceDescriptor),
00542         USBGenericDescriptor_INTERFACE,
00543         AUDDSpeakerPhoneDriverDescriptors_STREAMING,
00544         0, /* This is alternate setting #0 */
00545         0, /* This interface uses no endpoints */
00546         AUDStreamingInterfaceDescriptor_CLASS,
00547         AUDStreamingInterfaceDescriptor_SUBCLASS,
00548         AUDStreamingInterfaceDescriptor_PROTOCOL,
00549         0 /* No string descriptor */
00550     },
00551     /* Audio streaming interface with data endpoint */
00552     {
00553         sizeof(USBInterfaceDescriptor),
00554         USBGenericDescriptor_INTERFACE,
00555         AUDDSpeakerPhoneDriverDescriptors_STREAMING,
00556         1, /* This is alternate setting #1 */
00557         1, /* This interface uses 1 endpoint */
00558         AUDStreamingInterfaceDescriptor_CLASS,
00559         AUDStreamingInterfaceDescriptor_SUBCLASS,
00560         AUDStreamingInterfaceDescriptor_PROTOCOL,
00561         0 /* No string descriptor */
00562     },
00563     /* Audio streaming class-specific descriptor */
00564     {
00565         sizeof(AUDStreamingInterfaceDescriptor),
00566         AUDGenericDescriptor_INTERFACE,
00567         AUDStreamingInterfaceDescriptor_GENERAL,
00568         AUDDSpeakerPhoneDriverDescriptors_INPUTTERMINAL,
00569         0, /* No internal delay because of data path */
00570         AUDFormatTypeOneDescriptor_PCM
00571     },
00572     /* Format type I descriptor */
00573     {
00574         {
00575             sizeof(AUDFormatTypeOneDescriptor1),
00576             AUDGenericDescriptor_INTERFACE,
00577             AUDStreamingInterfaceDescriptor_FORMATTYPE,
00578             AUDFormatTypeOneDescriptor_FORMATTYPEONE,
00579             AUDDSpeakerPhoneDriver_NUMCHANNELS,
00580             AUDDSpeakerPhoneDriver_BYTESPERSAMPLE,
00581             AUDDSpeakerPhoneDriver_BYTESPERSAMPLE * 8,
00582             1 /* One discrete frequency supported */
00583         },
00584         {
00585             AUDDSpeakerPhoneDriver_SAMPLERATE & 0xFF,
00586             (AUDDSpeakerPhoneDriver_SAMPLERATE >> 8) & 0xFF,
00587             (AUDDSpeakerPhoneDriver_SAMPLERATE >> 16) & 0xFF
00588         }
00589     },
00590     /* Audio streaming endpoint standard descriptor */
00591     {
00592         sizeof(AUDEndpointDescriptor),
00593         USBGenericDescriptor_ENDPOINT,
00594         USBEndpointDescriptor_ADDRESS(
00595             USBEndpointDescriptor_OUT,
00596             AUDDSpeakerPhoneDriverDescriptors_DATAOUT),
00597         USBEndpointDescriptor_ISOCHRONOUS,
00598         AUDDSpeakerPhoneDriver_BYTESPERFRAME,
00599         AUDDSpeakerPhoneDriverDescriptors_HS_INTERVAL, /* Polling interval = 1 ms */
00600         0, /* This is not a synchronization endpoint */
00601         0 /* No associated synchronization endpoint */
00602     },
00603     /* Audio streaming endpoint class-specific descriptor */
00604     {
00605         sizeof(AUDDataEndpointDescriptor),
00606         AUDGenericDescriptor_ENDPOINT,
00607         AUDDataEndpointDescriptor_SUBTYPE,
00608         0, /* No attributes */
00609         0, /* Endpoint is not synchronized */
00610         0 /* Endpoint is not synchronized */
00611     },
00612     /*- AUDIO IN */
00613     /* Audio streaming interface with 0 endpoints */
00614     {
00615         sizeof(USBInterfaceDescriptor),
00616         USBGenericDescriptor_INTERFACE,
00617         AUDDSpeakerPhoneDriverDescriptors_STREAMINGIN,
00618         0, /* This is alternate setting #0 */
00619         0, /* This interface uses no endpoints */
00620         AUDStreamingInterfaceDescriptor_CLASS,
00621         AUDStreamingInterfaceDescriptor_SUBCLASS,
00622         AUDStreamingInterfaceDescriptor_PROTOCOL,
00623         0 /* No string descriptor */
00624     },
00625     /* Audio streaming interface with data endpoint */
00626     {
00627         sizeof(USBInterfaceDescriptor),
00628         USBGenericDescriptor_INTERFACE,
00629         AUDDSpeakerPhoneDriverDescriptors_STREAMINGIN,
00630         1, /* This is alternate setting #1 */
00631         1, /* This interface uses 1 endpoint */
00632         AUDStreamingInterfaceDescriptor_CLASS,
00633         AUDStreamingInterfaceDescriptor_SUBCLASS,
00634         AUDStreamingInterfaceDescriptor_PROTOCOL,
00635         0 /* No string descriptor */
00636     },
00637     /* Audio streaming class-specific descriptor */
00638     {
00639         sizeof(AUDStreamingInterfaceDescriptor),
00640         AUDGenericDescriptor_INTERFACE,
00641         AUDStreamingInterfaceDescriptor_GENERAL,
00642         AUDDSpeakerPhoneDriverDescriptors_OUTPUTTERMINAL_REC,
00643         0, /* No internal delay because of data path */
00644         AUDFormatTypeOneDescriptor_PCM
00645     },
00646     /* Format type I descriptor */
00647     {
00648         {
00649             sizeof(AUDFormatTypeOneDescriptor1),
00650             AUDGenericDescriptor_INTERFACE,
00651             AUDStreamingInterfaceDescriptor_FORMATTYPE,
00652             AUDFormatTypeOneDescriptor_FORMATTYPEONE,
00653             AUDDSpeakerPhoneDriver_NUMCHANNELS,
00654             AUDDSpeakerPhoneDriver_BYTESPERSAMPLE,
00655             AUDDSpeakerPhoneDriver_BYTESPERSAMPLE * 8,
00656             1 /* One discrete frequency supported */
00657         },
00658         {
00659             AUDDSpeakerPhoneDriver_SAMPLERATE & 0xFF,
00660             (AUDDSpeakerPhoneDriver_SAMPLERATE >> 8) & 0xFF,
00661             (AUDDSpeakerPhoneDriver_SAMPLERATE >> 16) & 0xFF
00662         }
00663     },
00664     /* Audio streaming endpoint standard descriptor */
00665     {
00666         sizeof(AUDEndpointDescriptor),
00667         USBGenericDescriptor_ENDPOINT,
00668         USBEndpointDescriptor_ADDRESS(
00669             USBEndpointDescriptor_IN,
00670             AUDDSpeakerPhoneDriverDescriptors_DATAIN),
00671         USBEndpointDescriptor_ISOCHRONOUS,
00672         AUDDSpeakerPhoneDriver_BYTESPERFRAME,
00673         AUDDSpeakerPhoneDriverDescriptors_HS_INTERVAL, /* Polling interval = 1 ms */
00674         0, /* This is not a synchronization endpoint */
00675         0 /* No associated synchronization endpoint */
00676     },
00677     /* Audio streaming endpoint class-specific descriptor */
00678     {
00679         sizeof(AUDDataEndpointDescriptor),
00680         AUDGenericDescriptor_ENDPOINT,
00681         AUDDataEndpointDescriptor_SUBTYPE,
00682         0, /* No attributes */
00683         0, /* Endpoint is not synchronized */
00684         0 /* Endpoint is not synchronized */
00685     }
00686 };
00687 
00688 /** String descriptor with the supported languages. */
00689 const unsigned char languageIdDescriptor[] = {
00690 
00691     USBStringDescriptor_LENGTH(1),
00692     USBGenericDescriptor_STRING,
00693     USBStringDescriptor_ENGLISH_US
00694 };
00695 
00696 /** Manufacturer name. */
00697 const unsigned char manufacturerDescriptor[] = {
00698 
00699     USBStringDescriptor_LENGTH(5),
00700     USBGenericDescriptor_STRING,
00701     USBStringDescriptor_UNICODE('A'),
00702     USBStringDescriptor_UNICODE('t'),
00703     USBStringDescriptor_UNICODE('m'),
00704     USBStringDescriptor_UNICODE('e'),
00705     USBStringDescriptor_UNICODE('l')
00706 };
00707 
00708 /** Product name. */
00709 const unsigned char productDescriptor[] = {
00710 
00711     USBStringDescriptor_LENGTH(15),
00712     USBGenericDescriptor_STRING,
00713     USBStringDescriptor_UNICODE('D'),
00714     USBStringDescriptor_UNICODE('e'),
00715     USBStringDescriptor_UNICODE('s'),
00716     USBStringDescriptor_UNICODE('k'),
00717     USBStringDescriptor_UNICODE('t'),
00718     USBStringDescriptor_UNICODE('o'),
00719     USBStringDescriptor_UNICODE('p'),
00720     USBStringDescriptor_UNICODE(' '),
00721     USBStringDescriptor_UNICODE('s'),
00722     USBStringDescriptor_UNICODE('p'),
00723     USBStringDescriptor_UNICODE('e'),
00724     USBStringDescriptor_UNICODE('a'),
00725     USBStringDescriptor_UNICODE('k'),
00726     USBStringDescriptor_UNICODE('e'),
00727     USBStringDescriptor_UNICODE('r')
00728 };
00729 
00730 /** Product serial number. */
00731 const unsigned char serialNumberDescriptor[] = {
00732 
00733     USBStringDescriptor_LENGTH(4),
00734     USBGenericDescriptor_STRING,
00735     USBStringDescriptor_UNICODE('0'),
00736     USBStringDescriptor_UNICODE('1'),
00737     USBStringDescriptor_UNICODE('2'),
00738     USBStringDescriptor_UNICODE('3')
00739 };
00740 
00741 /** Array of pointers to the four string descriptors. */
00742 const unsigned char *stringDescriptors[] = {
00743 
00744     languageIdDescriptor,
00745     manufacturerDescriptor,
00746     productDescriptor,
00747     serialNumberDescriptor,
00748 };
00749 
00750 /*------------------------------------------------------------------------------
00751  *         Exported functions
00752  *----------------------------------------------------------------------------*/
00753 
00754 /** List of descriptors required by an USB Audio Speakerphoneer device driver.*/
00755 const USBDDriverDescriptors auddSpeakerPhoneDriverDescriptors = {
00756 
00757     &deviceDescriptor,
00758     (const USBConfigurationDescriptor *) &fsConfigurationDescriptors,
00759     &qualifierDescriptor,
00760     0,
00761     0,
00762     (const USBConfigurationDescriptor *) &hsConfigurationDescriptors,
00763     &qualifierDescriptor,
00764     0,
00765     stringDescriptors, 4 /* Number of string descriptors */
00766 };
00767 
00768 /**@}*/
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines