SAMV71 Xplained Ultra Software Package 1.4

USBDDriverDescriptors.c

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