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_composite_cdcaud
00032  *@{
00033  */
00034 
00035 /*------------------------------------------------------------------------------
00036  *         Headers
00037  *-----------------------------------------------------------------------------*/
00038 
00039 #include <USBD_Config.h>
00040 
00041 #include <CDCAUDDDriver.h>
00042 #include <CDCDSerial.h>
00043 #include <AUDDFunction.h>
00044 
00045 /*------------------------------------------------------------------------------
00046  *         Definitions
00047  *----------------------------------------------------------------------------*/
00048 
00049 /** \addtogroup usbd_cdc_aud_dev_codes CDC(Serial) + Audio(Speaker) Device Codes
00050  *      @{
00051  * This page lists the %device IDs and release number of the USB composite
00052  * %device.
00053  *
00054  * \section Codes
00055  * - CDCAUDDDriverDescriptors_VENDORID
00056  * - CDCAUDDDriverDescriptors_PRODUCTID
00057  * - CDCAUDDDriverDescriptors_RELEASE
00058  */
00059 
00060 /** Device vendor ID. */
00061 #define CDCAUDDDriverDescriptors_VENDORID            USBD_VID_ATMEL
00062 /** Device product ID. */
00063 #define CDCAUDDDriverDescriptors_PRODUCTID           USBD_PID_CDCAUDIO
00064 /** Device release number in BCD format. */
00065 #define CDCAUDDDriverDescriptors_RELEASE             USBD_RELEASE_1_00
00066 /**      @}*/
00067 
00068 /** \addtogroup usbd_cdc_aud_eps CDC(Serial) + Audio(Speaker) Endpoints
00069  *      @{
00070  */
00071 
00072 
00073 /*---------------------------------------------------------------------------
00074  *         Macros
00075  *---------------------------------------------------------------------------*/
00076 
00077 /** Returns the minimum between two values. */
00078 #define MIN(a, b)       ((a < b) ? a : b)
00079 
00080 /*------------------------------------------------------------------------------
00081  *         Exported variables
00082  *----------------------------------------------------------------------------*/
00083 
00084 /** Device descriptor for a USB Audio Speakerphone driver. */
00085 const USBDeviceDescriptor deviceDescriptor = {
00086 
00087     sizeof(USBDeviceDescriptor),
00088     USBGenericDescriptor_DEVICE,
00089     USBDeviceDescriptor_USB2_00,
00090     0xEF,/* MI */
00091     0x02,
00092     0x01,
00093     CHIP_USB_ENDPOINTS_MAXPACKETSIZE(0),
00094     CDCAUDDDriverDescriptors_VENDORID,
00095     CDCAUDDDriverDescriptors_PRODUCTID,
00096     CDCAUDDDriverDescriptors_RELEASE,
00097     1, /* Manufacturer string descriptor index */
00098     2, /* Product string descriptor index */
00099     3, /* Index of serial number string descriptor */
00100     1  /* One possible configuration */
00101 };
00102 
00103 /** Device qualifier descriptor (Necessary to pass USB test). */
00104 static const USBDeviceQualifierDescriptor qualifierDescriptor = {
00105 
00106     sizeof(USBDeviceQualifierDescriptor),
00107     USBGenericDescriptor_DEVICEQUALIFIER,
00108     USBDeviceDescriptor_USB2_00,
00109     0xEF,
00110     0x02,
00111     0x01,
00112     CHIP_USB_ENDPOINTS_MAXPACKETSIZE(0),
00113     0, // Device has one possible configuration.
00114     0x00
00115 };
00116 
00117 /** FS Configuration descriptors for a USB Audio Speakerphone driver. */
00118 const CdcAudspkdDriverConfigurationDescriptors fsConfigurationDescriptors = {
00119 
00120     /* Configuration descriptor */
00121     {
00122         sizeof(USBConfigurationDescriptor),
00123         USBGenericDescriptor_CONFIGURATION,
00124         sizeof(CdcAudspkdDriverConfigurationDescriptors),
00125         4, /* This configuration has 5 interfaces */
00126         1, /* This is configuration #1 */
00127         0, /* No string descriptor */
00128         BOARD_USB_BMATTRIBUTES,
00129         USBConfigurationDescriptor_POWER(100)
00130     },
00131     /* CDC */
00132     /* IAD for CDC/ACM port */
00133     {
00134         sizeof(USBInterfaceAssociationDescriptor),
00135         USBGenericDescriptor_INTERFACEASSOCIATION,
00136         CDCAUDDDriverDescriptors_CDC_INTERFACE,
00137         2,
00138         CDCCommunicationInterfaceDescriptor_CLASS,
00139         CDCCommunicationInterfaceDescriptor_ABSTRACTCONTROLMODEL,
00140         CDCCommunicationInterfaceDescriptor_NOPROTOCOL,
00141         0  /* No string descriptor for this interface*/
00142     },
00143     /* Communication class interface standard descriptor*/
00144     {
00145         sizeof(USBInterfaceDescriptor),
00146         USBGenericDescriptor_INTERFACE,
00147         CDCAUDDDriverDescriptors_CDC_INTERFACE, /* This is interface #0*/
00148         0, /* This is alternate setting #0 for this interface*/
00149         1, /* This interface uses 1 endpoint*/
00150         CDCCommunicationInterfaceDescriptor_CLASS,
00151         CDCCommunicationInterfaceDescriptor_ABSTRACTCONTROLMODEL,
00152         CDCCommunicationInterfaceDescriptor_NOPROTOCOL,
00153         0  /* No string descriptor for this interface*/
00154     },
00155     /* Class-specific header functional descriptor*/
00156     {
00157         sizeof(CDCHeaderDescriptor),
00158         CDCGenericDescriptor_INTERFACE,
00159         CDCGenericDescriptor_HEADER,
00160         CDCGenericDescriptor_CDC1_10
00161     },
00162     /* Class-specific call management functional descriptor*/
00163     {
00164         sizeof(CDCCallManagementDescriptor),
00165         CDCGenericDescriptor_INTERFACE,
00166         CDCGenericDescriptor_CALLMANAGEMENT,
00167         CDCCallManagementDescriptor_SELFCALLMANAGEMENT,
00168         CDCAUDDDriverDescriptors_CDC_INTERFACE + 1 /* No associated data interface*/
00169     },
00170     /* Class-specific abstract control management functional descriptor*/
00171     {
00172         sizeof(CDCAbstractControlManagementDescriptor),
00173         CDCGenericDescriptor_INTERFACE,
00174         CDCGenericDescriptor_ABSTRACTCONTROLMANAGEMENT,
00175         CDCAbstractControlManagementDescriptor_LINE
00176     },
00177     /* Class-specific union functional descriptor with one slave interface*/
00178     {
00179         sizeof(CDCUnionDescriptor),
00180         CDCGenericDescriptor_INTERFACE,
00181         CDCGenericDescriptor_UNION,
00182         CDCAUDDDriverDescriptors_CDC_INTERFACE, /* Number of master interface is #0*/
00183         CDCAUDDDriverDescriptors_CDC_INTERFACE + 1 /* First slave interface is #1*/
00184     },
00185     /* Notification endpoint standard descriptor*/
00186     {
00187         sizeof(USBEndpointDescriptor), 
00188         USBGenericDescriptor_ENDPOINT,
00189         USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_IN,
00190                                     CDCAUDD_Descriptors_NOTIFICATION0),
00191         USBEndpointDescriptor_INTERRUPT,
00192         MIN(CHIP_USB_ENDPOINTS_MAXPACKETSIZE(CDCAUDD_Descriptors_NOTIFICATION0),
00193             CDCDSerialPort_INTERRUPT_MAXPACKETSIZE),
00194         CDCDSerialPort_INTERRUPT_INTERVAL_FS /* Endpoint is polled every 10ms*/
00195     },
00196     /* Data class interface standard descriptor*/
00197     {
00198         sizeof(USBInterfaceDescriptor),
00199         USBGenericDescriptor_INTERFACE,
00200         CDCAUDDDriverDescriptors_CDC_INTERFACE + 1, /* This is interface #1*/
00201         0, /* This is alternate setting #0 for this interface*/
00202         2, /* This interface uses 2 endpoints*/
00203         CDCDataInterfaceDescriptor_CLASS,
00204         CDCDataInterfaceDescriptor_SUBCLASS,
00205         CDCDataInterfaceDescriptor_NOPROTOCOL,
00206         0  /* No string descriptor for this interface*/
00207     },
00208     /* Bulk-OUT endpoint standard descriptor*/
00209     {
00210         sizeof(USBEndpointDescriptor), 
00211         USBGenericDescriptor_ENDPOINT,
00212         USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_OUT,
00213                                     CDCAUDD_Descriptors_DATAOUT0),
00214         USBEndpointDescriptor_BULK,
00215         MIN(CHIP_USB_ENDPOINTS_MAXPACKETSIZE(CDCAUDD_Descriptors_DATAOUT0),
00216             USBEndpointDescriptor_MAXBULKSIZE_FS),
00217         0 /* Must be 0 for full-speed bulk endpoints*/
00218     },
00219     /* Bulk-IN endpoint descriptor*/
00220     {
00221         sizeof(USBEndpointDescriptor),
00222         USBGenericDescriptor_ENDPOINT,
00223         USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_IN,
00224                                     CDCAUDD_Descriptors_DATAIN0),
00225         USBEndpointDescriptor_BULK,
00226         MIN(CHIP_USB_ENDPOINTS_MAXPACKETSIZE(CDCAUDD_Descriptors_DATAIN0),
00227             USBEndpointDescriptor_MAXBULKSIZE_FS),
00228         0 /* Must be 0 for full-speed bulk endpoints*/
00229     },
00230 
00231     /* AUDIO */
00232     /* IAD for AUDIO function */
00233     {
00234         sizeof(USBInterfaceAssociationDescriptor),
00235         USBGenericDescriptor_INTERFACEASSOCIATION,
00236         CDCAUDDDriverDescriptors_AUD_INTERFACE,
00237         2, /* AS + Spk */
00238         AUDControlInterfaceDescriptor_CLASS,
00239         AUDControlInterfaceDescriptor_SUBCLASS,
00240         AUDControlInterfaceDescriptor_PROTOCOL,
00241         0  // No string descriptor for this interface
00242     },
00243     /* Audio control interface standard descriptor */
00244     {
00245         sizeof(USBInterfaceDescriptor),
00246         USBGenericDescriptor_INTERFACE,
00247         CDCAUDDDriverDescriptors_AUD_INTERFACE,
00248         0, /* This is alternate setting #0 */
00249         0, /* This interface uses no endpoint */
00250         AUDControlInterfaceDescriptor_CLASS,
00251         AUDControlInterfaceDescriptor_SUBCLASS,
00252         AUDControlInterfaceDescriptor_PROTOCOL,
00253         0 /* No string descriptor */
00254     },
00255     /* Audio control interface descriptors */
00256     {
00257         /* Header descriptor */
00258         {
00259             {
00260                 sizeof(AUDHeaderDescriptor1),
00261                 AUDGenericDescriptor_INTERFACE,
00262                 AUDGenericDescriptor_HEADER,
00263                 AUDHeaderDescriptor_AUD1_00,
00264                 sizeof(AUDDSpeakerAcDescriptors),
00265                 1 /* One streaming interface */
00266             },
00267             CDCAUDDDriverDescriptors_AUD_INTERFACE + 1,
00268         },
00269         /* Input terminal descriptor ( speaker ) */
00270         {
00271             sizeof(AUDInputTerminalDescriptor),
00272             AUDGenericDescriptor_INTERFACE,
00273             AUDGenericDescriptor_INPUTTERMINAL,
00274             AUDDFunction_INPUTTERMINAL,
00275             AUDInputTerminalDescriptor_USBSTREAMING,
00276             AUDDFunction_OUTPUTTERMINAL,
00277             AUDDevice_NUMCHANNELS, /* L,R */
00278             AUDInputTerminalDescriptor_LEFTFRONT
00279             | AUDInputTerminalDescriptor_RIGHTFRONT,
00280             0, /* No string descriptor for channels */
00281             0 /* No string descriptor for input terminal */
00282         },
00283         /* Output terminal descriptor ( speaker ) */
00284         {
00285             sizeof(AUDOutputTerminalDescriptor),
00286             AUDGenericDescriptor_INTERFACE,
00287             AUDGenericDescriptor_OUTPUTTERMINAL,
00288             AUDDFunction_OUTPUTTERMINAL,
00289             AUDOutputTerminalDescriptor_SPEAKER,
00290             AUDDFunction_INPUTTERMINAL,
00291             AUDDFunction_FEATUREUNIT,
00292             0 /* No string descriptor */
00293         },
00294         /* Feature unit descriptor ( speaker ) */
00295         {
00296             {
00297                 sizeof(AUDFeatureUnitDescriptor3),
00298                 AUDGenericDescriptor_INTERFACE,
00299                 AUDGenericDescriptor_FEATUREUNIT,
00300                 AUDDFunction_FEATUREUNIT,
00301                 AUDDFunction_INPUTTERMINAL,
00302                 1, /* 1 byte per channel for controls */
00303             },
00304             {
00305                 AUDFeatureUnitDescriptor_MUTE, /* Master channel controls */
00306                 0, /* Right channel controls */
00307                 0  /* Left channel controls */
00308             },
00309             0 /* No string descriptor */
00310         }
00311     },
00312     /* - AUIDO OUT */
00313     /* Audio streaming interface with 0 endpoints */
00314     {
00315         sizeof(USBInterfaceDescriptor),
00316         USBGenericDescriptor_INTERFACE,
00317         CDCAUDDDriverDescriptors_AUD_INTERFACE + 1,
00318         0, /* This is alternate setting #0 */
00319         0, /* This interface uses no endpoints */
00320         AUDStreamingInterfaceDescriptor_CLASS,
00321         AUDStreamingInterfaceDescriptor_SUBCLASS,
00322         AUDStreamingInterfaceDescriptor_PROTOCOL,
00323         0 /* No string descriptor */
00324     },
00325     /* Audio streaming interface with data endpoint */
00326     {
00327         sizeof(USBInterfaceDescriptor),
00328         USBGenericDescriptor_INTERFACE,
00329         CDCAUDDDriverDescriptors_AUD_INTERFACE + 1,
00330         1, /* This is alternate setting #1 */
00331         1, /* This interface uses 1 endpoint */
00332         AUDStreamingInterfaceDescriptor_CLASS,
00333         AUDStreamingInterfaceDescriptor_SUBCLASS,
00334         AUDStreamingInterfaceDescriptor_PROTOCOL,
00335         0 /* No string descriptor */
00336     },
00337     /* Audio streaming class-specific descriptor */
00338     {
00339         sizeof(AUDStreamingInterfaceDescriptor),
00340         AUDGenericDescriptor_INTERFACE,
00341         AUDStreamingInterfaceDescriptor_GENERAL,
00342         AUDDFunction_INPUTTERMINAL,
00343         0, /* No internal delay because of data path */
00344         AUDFormatTypeOneDescriptor_PCM
00345     },
00346     /* Format type I descriptor */
00347     {
00348         {
00349             sizeof(AUDFormatTypeOneDescriptor1),
00350             AUDGenericDescriptor_INTERFACE,
00351             AUDStreamingInterfaceDescriptor_FORMATTYPE,
00352             AUDFormatTypeOneDescriptor_FORMATTYPEONE,
00353             AUDDevice_NUMCHANNELS,
00354             AUDDevice_BYTESPERSAMPLE,
00355             AUDDevice_BYTESPERSAMPLE*8,
00356             1 /* One discrete frequency supported */
00357         },
00358         {
00359             AUDDevice_SAMPLERATE & 0xFF,
00360             (AUDDevice_SAMPLERATE >> 8) & 0xFF,
00361             (AUDDevice_SAMPLERATE >> 16) & 0xFF
00362         }
00363     },
00364     /* Audio streaming endpoint standard descriptor */
00365     {
00366         sizeof(AUDEndpointDescriptor),
00367         USBGenericDescriptor_ENDPOINT,
00368         USBEndpointDescriptor_ADDRESS(
00369             USBEndpointDescriptor_OUT, CDCAUDD_Descriptors_ISO_DATAOUT),
00370         USBEndpointDescriptor_ISOCHRONOUS,
00371         AUDDevice_BYTESPERFRAME,
00372         AUDDFunction_FS_INTERVAL, /* Polling interval = 1 ms */
00373         0, /* This is not a synchronization endpoint */
00374         0 /* No associated synchronization endpoint */
00375     },
00376     /* Audio streaming endpoint class-specific descriptor */
00377     {
00378         sizeof(AUDDataEndpointDescriptor),
00379         AUDGenericDescriptor_ENDPOINT,
00380         AUDDataEndpointDescriptor_SUBTYPE,
00381         0, /* No attributes */
00382         0, /* Endpoint is not synchronized */
00383         0 /* Endpoint is not synchronized */
00384     }
00385 };
00386 
00387 /** HS Configuration descriptors for a USB Audio Speakerphone driver. */
00388 const CdcAudspkdDriverConfigurationDescriptors hsConfigurationDescriptors = {
00389 
00390     /* Configuration descriptor */
00391     {
00392         sizeof(USBConfigurationDescriptor),
00393         USBGenericDescriptor_CONFIGURATION,
00394         sizeof(CdcAudspkdDriverConfigurationDescriptors),
00395         4, /* This configuration has 5 interfaces */
00396         1, /* This is configuration #1 */
00397         0, /* No string descriptor */
00398         BOARD_USB_BMATTRIBUTES,
00399         USBConfigurationDescriptor_POWER(100)
00400     },
00401     /* CDC */
00402     /* IAD for CDC/ACM port */
00403     {
00404         sizeof(USBInterfaceAssociationDescriptor),
00405         USBGenericDescriptor_INTERFACEASSOCIATION,
00406         CDCAUDDDriverDescriptors_CDC_INTERFACE,
00407         2,
00408         CDCCommunicationInterfaceDescriptor_CLASS,
00409         CDCCommunicationInterfaceDescriptor_ABSTRACTCONTROLMODEL,
00410         CDCCommunicationInterfaceDescriptor_NOPROTOCOL,
00411         0  /* No string descriptor for this interface*/
00412     },
00413     /* Communication class interface standard descriptor*/
00414     {
00415         sizeof(USBInterfaceDescriptor),
00416         USBGenericDescriptor_INTERFACE,
00417         CDCAUDDDriverDescriptors_CDC_INTERFACE, /* This is interface #0*/
00418         0, /* This is alternate setting #0 for this interface*/
00419         1, /* This interface uses 1 endpoint*/
00420         CDCCommunicationInterfaceDescriptor_CLASS,
00421         CDCCommunicationInterfaceDescriptor_ABSTRACTCONTROLMODEL,
00422         CDCCommunicationInterfaceDescriptor_NOPROTOCOL,
00423         0  /* No string descriptor for this interface*/
00424     },
00425     /* Class-specific header functional descriptor*/
00426     {
00427         sizeof(CDCHeaderDescriptor),
00428         CDCGenericDescriptor_INTERFACE,
00429         CDCGenericDescriptor_HEADER,
00430         CDCGenericDescriptor_CDC1_10
00431     },
00432     /* Class-specific call management functional descriptor*/
00433     {
00434         sizeof(CDCCallManagementDescriptor),
00435         CDCGenericDescriptor_INTERFACE,
00436         CDCGenericDescriptor_CALLMANAGEMENT,
00437         CDCCallManagementDescriptor_SELFCALLMANAGEMENT,
00438         CDCAUDDDriverDescriptors_CDC_INTERFACE + 1 /* No associated data interface*/
00439     },
00440     /* Class-specific abstract control management functional descriptor*/
00441     {
00442         sizeof(CDCAbstractControlManagementDescriptor),
00443         CDCGenericDescriptor_INTERFACE,
00444         CDCGenericDescriptor_ABSTRACTCONTROLMANAGEMENT,
00445         CDCAbstractControlManagementDescriptor_LINE
00446     },
00447     /* Class-specific union functional descriptor with one slave interface*/
00448     {
00449         sizeof(CDCUnionDescriptor),
00450         CDCGenericDescriptor_INTERFACE,
00451         CDCGenericDescriptor_UNION,
00452         CDCAUDDDriverDescriptors_CDC_INTERFACE, /* Number of master interface is #0*/
00453         CDCAUDDDriverDescriptors_CDC_INTERFACE + 1 /* First slave interface is #1*/
00454     },
00455     /* Notification endpoint standard descriptor*/
00456     {
00457         sizeof(USBEndpointDescriptor), 
00458         USBGenericDescriptor_ENDPOINT,
00459         USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_IN,
00460                                       CDCAUDD_Descriptors_NOTIFICATION0),
00461         USBEndpointDescriptor_INTERRUPT,
00462         MIN(CHIP_USB_ENDPOINTS_MAXPACKETSIZE(CDCAUDD_Descriptors_NOTIFICATION0),
00463             CDCDSerialPort_INTERRUPT_MAXPACKETSIZE),
00464         CDCDSerialPort_INTERRUPT_INTERVAL_FS /* Endpoint is polled every 10ms*/
00465     },
00466     /* Data class interface standard descriptor*/
00467     {
00468         sizeof(USBInterfaceDescriptor),
00469         USBGenericDescriptor_INTERFACE,
00470         CDCAUDDDriverDescriptors_CDC_INTERFACE + 1, /* This is interface #1*/
00471         0, /* This is alternate setting #0 for this interface*/
00472         2, /* This interface uses 2 endpoints*/
00473         CDCDataInterfaceDescriptor_CLASS,
00474         CDCDataInterfaceDescriptor_SUBCLASS,
00475         CDCDataInterfaceDescriptor_NOPROTOCOL,
00476         0  /* No string descriptor for this interface*/
00477     },
00478     /* Bulk-OUT endpoint standard descriptor*/
00479     {
00480         sizeof(USBEndpointDescriptor), 
00481         USBGenericDescriptor_ENDPOINT,
00482         USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_OUT,
00483                                       CDCAUDD_Descriptors_DATAOUT0),
00484         USBEndpointDescriptor_BULK,
00485         MIN(CHIP_USB_ENDPOINTS_MAXPACKETSIZE(CDCAUDD_Descriptors_DATAOUT0),
00486             USBEndpointDescriptor_MAXBULKSIZE_FS),
00487         0 /* Must be 0 for full-speed bulk endpoints*/
00488     },
00489     /* Bulk-IN endpoint descriptor*/
00490     {
00491         sizeof(USBEndpointDescriptor),
00492         USBGenericDescriptor_ENDPOINT,
00493         USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_IN,
00494                                       CDCAUDD_Descriptors_DATAIN0),
00495         USBEndpointDescriptor_BULK,
00496         MIN(CHIP_USB_ENDPOINTS_MAXPACKETSIZE(CDCAUDD_Descriptors_DATAIN0),
00497             USBEndpointDescriptor_MAXBULKSIZE_FS),
00498         0 /* Must be 0 for full-speed bulk endpoints*/
00499     },
00500 
00501     /* AUDIO */
00502     /* IAD for AUDIO function */
00503     {
00504         sizeof(USBInterfaceAssociationDescriptor),
00505         USBGenericDescriptor_INTERFACEASSOCIATION,
00506         CDCAUDDDriverDescriptors_AUD_INTERFACE,
00507         2, /* AS + Spk */
00508         AUDControlInterfaceDescriptor_CLASS,
00509         AUDControlInterfaceDescriptor_SUBCLASS,
00510         AUDControlInterfaceDescriptor_PROTOCOL,
00511         0  // No string descriptor for this interface
00512     },
00513     /* Audio control interface standard descriptor */
00514     {
00515         sizeof(USBInterfaceDescriptor),
00516         USBGenericDescriptor_INTERFACE,
00517         CDCAUDDDriverDescriptors_AUD_INTERFACE,
00518         0, /* This is alternate setting #0 */
00519         0, /* This interface uses no endpoint */
00520         AUDControlInterfaceDescriptor_CLASS,
00521         AUDControlInterfaceDescriptor_SUBCLASS,
00522         AUDControlInterfaceDescriptor_PROTOCOL,
00523         0 /* No string descriptor */
00524     },
00525     /* Audio control interface descriptors */
00526     {
00527         /* Header descriptor */
00528         {
00529             {
00530                 sizeof(AUDHeaderDescriptor1),
00531                 AUDGenericDescriptor_INTERFACE,
00532                 AUDGenericDescriptor_HEADER,
00533                 AUDHeaderDescriptor_AUD1_00,
00534                 sizeof(AUDDSpeakerAcDescriptors),
00535                 1 /* One streaming interface */
00536             },
00537             CDCAUDDDriverDescriptors_AUD_INTERFACE + 1,
00538         },
00539         /* Input terminal descriptor ( speaker ) */
00540         {
00541             sizeof(AUDInputTerminalDescriptor),
00542             AUDGenericDescriptor_INTERFACE,
00543             AUDGenericDescriptor_INPUTTERMINAL,
00544             AUDDFunction_INPUTTERMINAL,
00545             AUDInputTerminalDescriptor_USBSTREAMING,
00546             AUDDFunction_OUTPUTTERMINAL,
00547             AUDDevice_NUMCHANNELS, /* L,R */
00548             AUDInputTerminalDescriptor_LEFTFRONT
00549             | AUDInputTerminalDescriptor_RIGHTFRONT,
00550             0, /* No string descriptor for channels */
00551             0 /* No string descriptor for input terminal */
00552         },
00553         /* Output terminal descriptor ( speaker ) */
00554         {
00555             sizeof(AUDOutputTerminalDescriptor),
00556             AUDGenericDescriptor_INTERFACE,
00557             AUDGenericDescriptor_OUTPUTTERMINAL,
00558             AUDDFunction_OUTPUTTERMINAL,
00559             AUDOutputTerminalDescriptor_SPEAKER,
00560             AUDDFunction_INPUTTERMINAL,
00561             AUDDFunction_FEATUREUNIT,
00562             0 /* No string descriptor */
00563         },
00564         /* Feature unit descriptor ( speaker ) */
00565         {
00566             {
00567                 sizeof(AUDFeatureUnitDescriptor3),
00568                 AUDGenericDescriptor_INTERFACE,
00569                 AUDGenericDescriptor_FEATUREUNIT,
00570                 AUDDFunction_FEATUREUNIT,
00571                 AUDDFunction_INPUTTERMINAL,
00572                 1, /* 1 byte per channel for controls */
00573             },
00574             {
00575                 AUDFeatureUnitDescriptor_MUTE, /* Master channel controls */
00576                 0, /* Right channel controls */
00577                 0  /* Left channel controls */
00578             },
00579             0 /* No string descriptor */
00580         }
00581     },
00582     /* - AUIDO OUT */
00583     /* Audio streaming interface with 0 endpoints */
00584     {
00585         sizeof(USBInterfaceDescriptor),
00586         USBGenericDescriptor_INTERFACE,
00587         CDCAUDDDriverDescriptors_AUD_INTERFACE + 1,
00588         0, /* This is alternate setting #0 */
00589         0, /* This interface uses no endpoints */
00590         AUDStreamingInterfaceDescriptor_CLASS,
00591         AUDStreamingInterfaceDescriptor_SUBCLASS,
00592         AUDStreamingInterfaceDescriptor_PROTOCOL,
00593         0 /* No string descriptor */
00594     },
00595     /* Audio streaming interface with data endpoint */
00596     {
00597         sizeof(USBInterfaceDescriptor),
00598         USBGenericDescriptor_INTERFACE,
00599         CDCAUDDDriverDescriptors_AUD_INTERFACE + 1,
00600         1, /* This is alternate setting #1 */
00601         1, /* This interface uses 1 endpoint */
00602         AUDStreamingInterfaceDescriptor_CLASS,
00603         AUDStreamingInterfaceDescriptor_SUBCLASS,
00604         AUDStreamingInterfaceDescriptor_PROTOCOL,
00605         0 /* No string descriptor */
00606     },
00607     /* Audio streaming class-specific descriptor */
00608     {
00609         sizeof(AUDStreamingInterfaceDescriptor),
00610         AUDGenericDescriptor_INTERFACE,
00611         AUDStreamingInterfaceDescriptor_GENERAL,
00612         AUDDFunction_INPUTTERMINAL,
00613         0, /* No internal delay because of data path */
00614         AUDFormatTypeOneDescriptor_PCM
00615     },
00616     /* Format type I descriptor */
00617     {
00618         {
00619             sizeof(AUDFormatTypeOneDescriptor1),
00620             AUDGenericDescriptor_INTERFACE,
00621             AUDStreamingInterfaceDescriptor_FORMATTYPE,
00622             AUDFormatTypeOneDescriptor_FORMATTYPEONE,
00623             AUDDevice_NUMCHANNELS,
00624             AUDDevice_BYTESPERSAMPLE,
00625             AUDDevice_BYTESPERSAMPLE*8,
00626             1 /* One discrete frequency supported */
00627         },
00628         {
00629             AUDDevice_SAMPLERATE & 0xFF,
00630             (AUDDevice_SAMPLERATE >> 8) & 0xFF,
00631             (AUDDevice_SAMPLERATE >> 16) & 0xFF
00632         }
00633     },
00634     /* Audio streaming endpoint standard descriptor */
00635     {
00636         sizeof(AUDEndpointDescriptor),
00637         USBGenericDescriptor_ENDPOINT,
00638         USBEndpointDescriptor_ADDRESS(
00639             USBEndpointDescriptor_OUT, CDCAUDD_Descriptors_ISO_DATAOUT),
00640         USBEndpointDescriptor_ISOCHRONOUS,
00641         AUDDevice_BYTESPERFRAME,
00642         AUDDFunction_HS_INTERVAL, /* Polling interval = 1 ms */
00643         0, /* This is not a synchronization endpoint */
00644         0 /* No associated synchronization endpoint */
00645     },
00646     /* Audio streaming endpoint class-specific descriptor */
00647     {
00648         sizeof(AUDDataEndpointDescriptor),
00649         AUDGenericDescriptor_ENDPOINT,
00650         AUDDataEndpointDescriptor_SUBTYPE,
00651         0, /* No attributes */
00652         0, /* Endpoint is not synchronized */
00653         0 /* Endpoint is not synchronized */
00654     }
00655 };
00656 
00657 /** String descriptor with the supported languages. */
00658 const unsigned char languageIdDescriptor[] = {
00659 
00660     USBStringDescriptor_LENGTH(1),
00661     USBGenericDescriptor_STRING,
00662     USBStringDescriptor_ENGLISH_US
00663 };
00664 
00665 /** Manufacturer name. */
00666 const unsigned char manufacturerDescriptor[] = {
00667 
00668     USBStringDescriptor_LENGTH(5),
00669     USBGenericDescriptor_STRING,
00670     USBStringDescriptor_UNICODE('A'),
00671     USBStringDescriptor_UNICODE('t'),
00672     USBStringDescriptor_UNICODE('m'),
00673     USBStringDescriptor_UNICODE('e'),
00674     USBStringDescriptor_UNICODE('l')
00675 };
00676 
00677 /** Product name. */
00678 const unsigned char productDescriptor[] = {
00679 
00680     USBStringDescriptor_LENGTH(15),
00681     USBGenericDescriptor_STRING,
00682     USBStringDescriptor_UNICODE('C'),
00683     USBStringDescriptor_UNICODE('D'),
00684     USBStringDescriptor_UNICODE('C'),
00685     USBStringDescriptor_UNICODE(' '),
00686     USBStringDescriptor_UNICODE('C'),
00687     USBStringDescriptor_UNICODE('O'),
00688     USBStringDescriptor_UNICODE('M'),
00689     USBStringDescriptor_UNICODE('&'),
00690     USBStringDescriptor_UNICODE('S'),
00691     USBStringDescriptor_UNICODE('p'),
00692     USBStringDescriptor_UNICODE('e'),
00693     USBStringDescriptor_UNICODE('a'),
00694     USBStringDescriptor_UNICODE('k'),
00695     USBStringDescriptor_UNICODE('e'),
00696     USBStringDescriptor_UNICODE('r')
00697 };
00698 
00699 /** Product serial number. */
00700 const unsigned char serialNumberDescriptor[] = {
00701 
00702     USBStringDescriptor_LENGTH(4),
00703     USBGenericDescriptor_STRING,
00704     USBStringDescriptor_UNICODE('0'),
00705     USBStringDescriptor_UNICODE('1'),
00706     USBStringDescriptor_UNICODE('2'),
00707     USBStringDescriptor_UNICODE('3')
00708 };
00709 
00710 /** Array of pointers to the four string descriptors. */
00711 const unsigned char *stringDescriptors[] = {
00712 
00713     languageIdDescriptor,
00714     manufacturerDescriptor,
00715     productDescriptor,
00716     serialNumberDescriptor,
00717 };
00718 
00719 /*------------------------------------------------------------------------------
00720  *         Exported functions
00721  *----------------------------------------------------------------------------*/
00722 
00723 /** List of descriptors required by an USB Audio Speakerphoneer device driver.*/
00724 const USBDDriverDescriptors cdcauddDriverDescriptors = {
00725 
00726     &deviceDescriptor,
00727     (const USBConfigurationDescriptor *) &fsConfigurationDescriptors,
00728     &qualifierDescriptor,
00729     0,
00730     0,
00731     (const USBConfigurationDescriptor *) &hsConfigurationDescriptors,
00732     &qualifierDescriptor,
00733     0,
00734     stringDescriptors, 4 /* Number of string descriptors */
00735 };
00736 
00737 /**@}*/
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines