Altered the definition of the USB_Audio_Descriptor_Format_t descriptor so that the...
authorDean Camera <dean@fourwalledcubicle.com>
Mon, 30 May 2011 11:07:57 +0000 (11:07 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Mon, 30 May 2011 11:07:57 +0000 (11:07 +0000)
15 files changed:
Demos/Device/ClassDriver/AudioInput/Descriptors.c
Demos/Device/ClassDriver/AudioInput/Descriptors.h
Demos/Device/ClassDriver/AudioOutput/Descriptors.c
Demos/Device/ClassDriver/AudioOutput/Descriptors.h
Demos/Device/LowLevel/AudioInput/Descriptors.c
Demos/Device/LowLevel/AudioInput/Descriptors.h
Demos/Device/LowLevel/AudioOutput/Descriptors.c
Demos/Device/LowLevel/AudioOutput/Descriptors.h
LUFA/Drivers/USB/Class/Common/Audio.h
LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c
LUFA/Drivers/USB/Core/AVR8/Host_AVR8.h
LUFA/Drivers/USB/Core/UC3/Host_UC3.c
LUFA/Drivers/USB/Core/UC3/Host_UC3.h
LUFA/ManPages/ChangeLog.txt
LUFA/ManPages/MigrationInformation.txt

index 9706d55..bd31bdb 100644 (file)
@@ -199,9 +199,12 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
 
                        .SubFrameSize             = 0x02,
                        .BitResolution            = 16,
-                       .SampleFrequencyType      = AUDIO_TOTAL_SAMPLE_RATES,
-
-                       .SampleFrequencies        = {AUDIO_SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)}
+                       .TotalDiscreteSampleRates = 1,
+               },
+       
+       .Audio_AudioFormatSampleRates =
+               {
+                       AUDIO_SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)
                },
 
        .Audio_StreamEndpoint =
index fdf4835..82dbd51 100644 (file)
@@ -70,6 +70,7 @@
                        USB_Descriptor_Interface_t                Audio_StreamInterface_Alt1;
                        USB_Audio_Descriptor_Interface_AS_t       Audio_StreamInterface_SPC;
                        USB_Audio_Descriptor_Format_t             Audio_AudioFormat;
+                       USB_Audio_SampleFreq_t                    Audio_AudioFormatSampleRates[1];
                        USB_Audio_Descriptor_StreamEndpoint_Std_t Audio_StreamEndpoint;
                        USB_Audio_Descriptor_StreamEndpoint_Spc_t Audio_StreamEndpoint_SPC;
                } USB_Descriptor_Configuration_t;
index 0b1e8c1..e46c3c0 100644 (file)
@@ -200,8 +200,12 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                        .SubFrameSize             = 0x02,
                        .BitResolution            = 16,
 
-                       .SampleFrequencyType      = AUDIO_TOTAL_SAMPLE_RATES,
-                       .SampleFrequencies        = {AUDIO_SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)}
+                       .TotalDiscreteSampleRates = 1,
+               },
+       
+       .Audio_AudioFormatSampleRates =
+               {
+                       AUDIO_SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)
                },
 
        .Audio_StreamEndpoint =
index 2a9a6f6..b4b8db6 100644 (file)
@@ -70,6 +70,7 @@
                        USB_Descriptor_Interface_t                Audio_StreamInterface_Alt1;
                        USB_Audio_Descriptor_Interface_AS_t       Audio_StreamInterface_SPC;
                        USB_Audio_Descriptor_Format_t             Audio_AudioFormat;
+                       USB_Audio_SampleFreq_t                    Audio_AudioFormatSampleRates[1];
                        USB_Audio_Descriptor_StreamEndpoint_Std_t Audio_StreamEndpoint;
                        USB_Audio_Descriptor_StreamEndpoint_Spc_t Audio_StreamEndpoint_SPC;
                } USB_Descriptor_Configuration_t;
index f645d08..6c8323c 100644 (file)
@@ -199,9 +199,12 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
 
                        .SubFrameSize             = 0x02,
                        .BitResolution            = 16,
-                       .SampleFrequencyType      = AUDIO_TOTAL_SAMPLE_RATES,
-
-                       .SampleFrequencies        = {AUDIO_SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)}
+                       .TotalDiscreteSampleRates = 1,
+               },
+       
+       .Audio_AudioFormatSampleRates =
+               {
+                       AUDIO_SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)
                },
 
        .Audio_StreamEndpoint =
index fdf4835..82dbd51 100644 (file)
@@ -70,6 +70,7 @@
                        USB_Descriptor_Interface_t                Audio_StreamInterface_Alt1;
                        USB_Audio_Descriptor_Interface_AS_t       Audio_StreamInterface_SPC;
                        USB_Audio_Descriptor_Format_t             Audio_AudioFormat;
+                       USB_Audio_SampleFreq_t                    Audio_AudioFormatSampleRates[1];
                        USB_Audio_Descriptor_StreamEndpoint_Std_t Audio_StreamEndpoint;
                        USB_Audio_Descriptor_StreamEndpoint_Spc_t Audio_StreamEndpoint_SPC;
                } USB_Descriptor_Configuration_t;
index 3ac23c9..9c57a42 100644 (file)
@@ -200,8 +200,12 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                        .SubFrameSize             = 0x02,
                        .BitResolution            = 16,
 
-                       .SampleFrequencyType      = AUDIO_TOTAL_SAMPLE_RATES,
-                       .SampleFrequencies        = {AUDIO_SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)}
+                       .TotalDiscreteSampleRates = 1,
+               },
+       
+       .Audio_AudioFormatSampleRates =
+               {
+                       AUDIO_SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)
                },
 
        .Audio_StreamEndpoint =
index 2a9a6f6..b4b8db6 100644 (file)
@@ -70,6 +70,7 @@
                        USB_Descriptor_Interface_t                Audio_StreamInterface_Alt1;
                        USB_Audio_Descriptor_Interface_AS_t       Audio_StreamInterface_SPC;
                        USB_Audio_Descriptor_Format_t             Audio_AudioFormat;
+                       USB_Audio_SampleFreq_t                    Audio_AudioFormatSampleRates[1];
                        USB_Audio_Descriptor_StreamEndpoint_Std_t Audio_StreamEndpoint;
                        USB_Audio_Descriptor_StreamEndpoint_Spc_t Audio_StreamEndpoint_SPC;
                } USB_Descriptor_Configuration_t;
index 713c96f..cc6e8e5 100644 (file)
                #endif
 
        /* Macros: */
-               #if !defined(AUDIO_TOTAL_SAMPLE_RATES) || defined(__DOXYGEN__)
-                       /** Total number of discrete audio sample rates supported by the device. This value can be overridden by defining this
-                        *  token in the project makefile to the desired value, and passing it to the compiler via the -D switch.
-                        */
-                       #define AUDIO_TOTAL_SAMPLE_RATES    1
-               #endif
-               
                /** \name Audio Channel Masks */
                //@{
                /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
                 *  about the number of channels, the sample resolution, acceptable sample frequencies and encoding method used
                 *  in the device's audio streams. See the USB Audio specification for more details.
                 *
+                *  \note This descriptor <b>must</b> be followed by one or more \ref USB_Audio_SampleFreq_t elements containing
+                *        the continuous or discrete sample frequencies.
+                *
                 *  \see \ref USB_Audio_StdDescriptor_Format_t for the version of this type with standard element names.
                 */
                typedef struct
                        uint8_t                 SubFrameSize; /**< Size in bytes of each channel's sample data in the stream. */
                        uint8_t                 BitResolution; /**< Bits of resolution of each channel's samples in the stream. */
 
-                       uint8_t                 SampleFrequencyType; /**< Total number of sample frequencies supported by the device. */
-                       USB_Audio_SampleFreq_t  SampleFrequencies[AUDIO_TOTAL_SAMPLE_RATES]; /**< Sample frequencies supported by the device (must be 24-bit). */
+                       uint8_t                 TotalDiscreteSampleRates; /**< Total number of discrete sample frequencies supported by the device. When
+                                                                          *   zero, this must be followed by the lower and upper continuous sampling
+                                                                          *   frequencies supported by the device; otherwise, this must be followed
+                                                                          *   by the given number of discrete sampling frequencies supported.
+                                                                          */
                } ATTR_PACKED USB_Audio_Descriptor_Format_t;
 
                /** \brief Audio class-specific Format Descriptor (USB-IF naming conventions).
                 *  about the number of channels, the sample resolution, acceptable sample frequencies and encoding method used
                 *  in the device's audio streams. See the USB Audio specification for more details.
                 *
+                *  \note This descriptor <b>must</b> be followed by one or more 24-bit integer elements containing the continuous
+                *        or discrete sample frequencies.
+                *
                 *  \see \ref USB_Audio_Descriptor_Format_t for the version of this type with non-standard LUFA specific
                 *       element names.
                 */
                        uint8_t bSubFrameSize; /**< Size in bytes of each channel's sample data in the stream. */
                        uint8_t bBitResolution; /**< Bits of resolution of each channel's samples in the stream. */
 
-                       uint8_t bSampleFrequencyType; /**< Total number of sample frequencies supported by the device. */
-                       uint8_t SampleFrequencies[AUDIO_TOTAL_SAMPLE_RATES * 3]; /**< Sample frequencies supported by the device (must be 24-bit). */
+                       uint8_t bSampleFrequencyType; /**< Total number of sample frequencies supported by the device. When
+                                                      *   zero, this must be followed by the lower and upper continuous sampling
+                                                      *   frequencies supported by the device; otherwise, this must be followed
+                                                      *   by the given number of discrete sampling frequencies supported.
+                                                      */
                } ATTR_PACKED USB_Audio_StdDescriptor_Format_t;
 
                /** \brief Audio class-specific Streaming Endpoint Descriptor (LUFA naming conventions).
index d18e023..5f475a1 100644 (file)
@@ -351,7 +351,7 @@ uint8_t USB_Host_ClearPipeStall(const uint8_t EndpointNum)
        return USB_Host_SendControlRequest(NULL);
 }
 
-uint8_t USB_Host_SetInterfaceAltSetting(const uint8_t InterfaceNum,
+uint8_t USB_Host_SetInterfaceAltSetting(const uint8_t InterfaceIndex,
                                         const uint8_t AltSetting)
 {
        USB_ControlRequest = (USB_Request_Header_t)
@@ -359,7 +359,7 @@ uint8_t USB_Host_SetInterfaceAltSetting(const uint8_t InterfaceNum,
                        .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_INTERFACE),
                        .bRequest      = REQ_SetInterface,
                        .wValue        = AltSetting,
-                       .wIndex        = InterfaceNum,
+                       .wIndex        = InterfaceIndex,
                        .wLength       = 0,
                };
 
index 58d9804..2c2b506 100644 (file)
                         *
                         *  \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result.
                         */
-                       uint8_t USB_Host_SetInterfaceAltSetting(const uint8_t InterfaceNum,
+                       uint8_t USB_Host_SetInterfaceAltSetting(const uint8_t InterfaceIndex,
                                                                                                        const uint8_t AltSetting);
 
        /* Private Interface - For use in library only: */
index 02cb1e6..1dd2b57 100644 (file)
@@ -351,7 +351,7 @@ uint8_t USB_Host_ClearPipeStall(const uint8_t EndpointNum)
        return USB_Host_SendControlRequest(NULL);\r
 }\r
 \r
-uint8_t USB_Host_SetInterfaceAltSetting(const uint8_t InterfaceNum,\r
+uint8_t USB_Host_SetInterfaceAltSetting(const uint8_t InterfaceIndex,\r
                                         const uint8_t AltSetting)\r
 {\r
        USB_ControlRequest = (USB_Request_Header_t)\r
@@ -359,7 +359,7 @@ uint8_t USB_Host_SetInterfaceAltSetting(const uint8_t InterfaceNum,
                        .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_INTERFACE),\r
                        .bRequest      = REQ_SetInterface,\r
                        .wValue        = AltSetting,\r
-                       .wIndex        = InterfaceNum,\r
+                       .wIndex        = InterfaceIndex,\r
                        .wLength       = 0,\r
                };\r
 \r
index c5dfe76..65b8011 100644 (file)
                         *\r
                         *  \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result.\r
                         */\r
-                       uint8_t USB_Host_SetInterfaceAltSetting(const uint8_t InterfaceNum,\r
+                       uint8_t USB_Host_SetInterfaceAltSetting(const uint8_t InterfaceIndex,\r
                                                                                                        const uint8_t AltSetting);\r
 \r
        /* Private Interface - For use in library only: */\r
index 4fe3041..c4fe713 100644 (file)
@@ -22,6 +22,9 @@
   *  <b>Changed:</b>
   *  - Core:
   *   - Added support for the Audio class GET STATUS request so that it is correctly ACKed when sent by the host
+  *   - Altered the definition of the USB_Audio_Descriptor_Format_t descriptor so that the user is now responsible for supplying
+  *     the supported audio sampling rates, to allow for multiple audio interfaces with different numbers of supported rates and/or
+  *     continuous sample rates
   *  - Library Applications:
   *   - <i>None</i>
   *
index 9276223..83eb6e6 100644 (file)
  *  areas relevant to making older projects compatible with the API changes of each new release.
  *
  *  \section Sec_MigrationXXXXXX Migrating from 110528 to XXXXXX
- *  <i>None</i>
+ *  <b>Device Mode</b>
+ *    - The definition of the Audio class \ref USB_Audio_Descriptor_Format_t has been altered, to remove the fixed singular
+ *      audio sample rate in the descriptor definition, and to rename the \c SampleFrequencyType to the more appropriate
+ *      \c TotalDiscreteSampleRates. Existing applications will need to add an array of \ref USB_Audio_SampleFreq_t elements
+ *      immediately following any \ref USB_Audio_Descriptor_Format_t descriptors, and insert the appropriate sampling rates
+ *      supported by the device, as well as rename the descriptor elements to match the updated element names.
  *
  *  \section Sec_Migration110528 Migrating from 101122 to 110528
  *  <b>Non-USB Library Components</b>