Minor documentation enhancements.
[pub/USBasp.git] / Demos / Device / ClassDriver / AudioInput / Descriptors.c
index 006e45b..c01e101 100644 (file)
@@ -55,7 +55,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
 
        .VendorID               = 0x03EB,
        .ProductID              = 0x2047,
-       .ReleaseNumber          = 0x0000,
+       .ReleaseNumber          = VERSION_BCD(00.01),
 
        .ManufacturerStrIndex   = 0x01,
        .ProductStrIndex        = 0x02,
@@ -104,25 +104,25 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
 
        .Audio_ControlInterface_SPC = 
                {
-                       .Header                   = {.Size = sizeof(USB_Audio_Interface_AC_t), .Type = DTYPE_AudioInterface},
-                       .Subtype                  = DSUBTYPE_Header,
+                       .Header                   = {.Size = sizeof(USB_Audio_Descriptor_Interface_AC_t), .Type = DTYPE_CSInterface},
+                       .Subtype                  = AUDIO_DSUBTYPE_CSInterface_Header,
 
                        .ACSpecification          = VERSION_BCD(01.00),
-                       .TotalLength              = (sizeof(USB_Audio_Interface_AC_t) +
-                                                    sizeof(USB_Audio_InputTerminal_t) +
-                                                    sizeof(USB_Audio_OutputTerminal_t)),
+                       .TotalLength              = (sizeof(USB_Audio_Descriptor_Interface_AC_t) +
+                                                    sizeof(USB_Audio_Descriptor_InputTerminal_t) +
+                                                    sizeof(USB_Audio_Descriptor_OutputTerminal_t)),
                        
                        .InCollection             = 1,
-                       .InterfaceNumbers         = {1},
+                       .InterfaceNumber          = 1,
                },
 
        .Audio_InputTerminal = 
                {
-                       .Header                   = {.Size = sizeof(USB_Audio_InputTerminal_t), .Type = DTYPE_AudioInterface},
-                       .Subtype                  = DSUBTYPE_InputTerminal,
+                       .Header                   = {.Size = sizeof(USB_Audio_Descriptor_InputTerminal_t), .Type = DTYPE_CSInterface},
+                       .Subtype                  = AUDIO_DSUBTYPE_CSInterface_InputTerminal,
 
                        .TerminalID               = 0x01,
-                       .TerminalType             = TERMINAL_IN_MIC,
+                       .TerminalType             = AUDIO_TERMINAL_IN_MIC,
                        .AssociatedOutputTerminal = 0x00,
 
                        .TotalChannels            = 1,
@@ -134,11 +134,11 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
 
        .Audio_OutputTerminal = 
                {
-                       .Header                   = {.Size = sizeof(USB_Audio_OutputTerminal_t), .Type = DTYPE_AudioInterface},
-                       .Subtype                  = DSUBTYPE_OutputTerminal,
+                       .Header                   = {.Size = sizeof(USB_Audio_Descriptor_OutputTerminal_t), .Type = DTYPE_CSInterface},
+                       .Subtype                  = AUDIO_DSUBTYPE_CSInterface_OutputTerminal,
 
                        .TerminalID               = 0x02,
-                       .TerminalType             = TERMINAL_STREAMING,
+                       .TerminalType             = AUDIO_TERMINAL_STREAMING,
                        .AssociatedInputTerminal  = 0x00,
 
                        .SourceID                 = 0x01,
@@ -180,8 +180,8 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
 
        .Audio_StreamInterface_SPC = 
                {
-                       .Header                   = {.Size = sizeof(USB_Audio_Interface_AS_t), .Type = DTYPE_AudioInterface},
-                       .Subtype                  = DSUBTYPE_General,
+                       .Header                   = {.Size = sizeof(USB_Audio_Descriptor_Interface_AS_t), .Type = DTYPE_CSInterface},
+                       .Subtype                  = AUDIO_DSUBTYPE_CSInterface_General,
 
                        .TerminalLink             = 0x02,
 
@@ -191,8 +191,8 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
 
        .Audio_AudioFormat = 
                {
-                       .Header                   = {.Size = sizeof(USB_Audio_Format_t), .Type = DTYPE_AudioInterface},
-                       .Subtype                  = DSUBTYPE_Format,
+                       .Header                   = {.Size = sizeof(USB_Audio_Descriptor_Format_t), .Type = DTYPE_CSInterface},
+                       .Subtype                  = AUDIO_DSUBTYPE_CSInterface_FormatType,
 
                        .FormatType               = 0x01,
                        .Channels                 = 0x01,
@@ -208,7 +208,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .Endpoint = 
                                {
-                                       .Header              = {.Size = sizeof(USB_Audio_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
+                                       .Header              = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
 
                                        .EndpointAddress     = (ENDPOINT_DESCRIPTOR_DIR_IN | AUDIO_STREAM_EPNUM),
                                        .Attributes          = (EP_TYPE_ISOCHRONOUS | ENDPOINT_ATTR_SYNC | ENDPOINT_USAGE_DATA),
@@ -222,10 +222,10 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                
        .Audio_StreamEndpoint_SPC = 
                {
-                       .Header                   = {.Size = sizeof(USB_Audio_StreamEndpoint_Spc_t), .Type = DTYPE_AudioEndpoint},
-                       .Subtype                  = DSUBTYPE_General,
+                       .Header                   = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Spc_t), .Type = DTYPE_CSEndpoint},
+                       .Subtype                  = AUDIO_DSUBTYPE_CSEndpoint_General,
                        
-                       .Attributes               = 0x00,
+                       .Attributes               = AUDIO_EP_ACCEPTS_SMALL_PACKETS,
                        
                        .LockDelayUnits           = 0x00,
                        .LockDelay                = 0x0000
@@ -271,37 +271,39 @@ USB_Descriptor_String_t PROGMEM ProductString =
  *  is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
  *  USB host.
  */
-uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
+uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
+                                    const uint8_t wIndex,
+                                    const void** const DescriptorAddress)
 {
        const uint8_t  DescriptorType   = (wValue >> 8);
        const uint8_t  DescriptorNumber = (wValue & 0xFF);
 
-       void*    Address = NULL;
-       uint16_t Size    = NO_DESCRIPTOR;
+       const void* Address = NULL;
+       uint16_t    Size    = NO_DESCRIPTOR;
 
        switch (DescriptorType)
        {
                case DTYPE_Device:
-                       Address = (void*)&DeviceDescriptor;
+                       Address = &DeviceDescriptor;
                        Size    = sizeof(USB_Descriptor_Device_t);
                        break;
                case DTYPE_Configuration: 
-                       Address = (void*)&ConfigurationDescriptor;
+                       Address = &ConfigurationDescriptor;
                        Size    = sizeof(USB_Descriptor_Configuration_t);
                        break;
                case DTYPE_String: 
                        switch (DescriptorNumber)
                        {
                                case 0x00: 
-                                       Address = (void*)&LanguageString;
+                                       Address = &LanguageString;
                                        Size    = pgm_read_byte(&LanguageString.Header.Size);
                                        break;
                                case 0x01: 
-                                       Address = (void*)&ManufacturerString;
+                                       Address = &ManufacturerString;
                                        Size    = pgm_read_byte(&ManufacturerString.Header.Size);
                                        break;
                                case 0x02: 
-                                       Address = (void*)&ProductString;
+                                       Address = &ProductString;
                                        Size    = pgm_read_byte(&ProductString.Header.Size);
                                        break;
                        }