Add Audio_GetSetEndpointProperty() function to the Host mode Audio class driver.
*/
/** \file
- * \brief Master include file for the library USB Audio Class driver.
+ * \brief Master include file for the library USB Audio 1.0 Class driver.
*
- * Master include file for the library USB Audio Class driver, for both host and device modes, where available.
+ * Master include file for the library USB Audio 1.0 Class driver, for both host and device modes, where available.
*
* This file should be included in all user projects making use of this optional class driver, instead of
* including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories.
*/
/** \ingroup Group_USBClassDrivers
- * \defgroup Group_USBClassAudio Audio Class Driver
+ * \defgroup Group_USBClassAudio Audio 1.0 Class Driver
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
* - LUFA/Drivers/USB/Class/Host/Audio.c <i>(Makefile source module name: LUFA_SRC_USBCLASS)</i>
*
* \section Sec_ModDescription Module Description
- * Audio Class Driver module. This module contains an internal implementation of the USB Audio 1.0 Class, for both
- * Device and Host USB modes. User applications can use this class driver instead of implementing the Audio class
+ * Audio 1.0 Class Driver module. This module contains an internal implementation of the USB Audio 1.0 Class, for both
+ * Device and Host USB modes. User applications can use this class driver instead of implementing the Audio 1.0 class
* manually via the low-level LUFA APIs.
*
* This module is designed to simplify the user code by exposing only the required interface needed to interface with
- * Hosts or Devices using the USB Audio Class.
+ * Hosts or Devices using the USB Audio 1.0 Class.
*
* @{
*/
*/
/** \ingroup Group_USBClassAudio
- * \defgroup Group_USBClassAudioDevice Audio Class Device Mode Driver
+ * \defgroup Group_USBClassAudioDevice Audio 1.0 Class Device Mode Driver
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
return DESCRIPTOR_SEARCH_NotFound;\r
}\r
\r
-uint8_t AUDIO_Host_StartStopStreaming(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo,\r
+uint8_t Audio_Host_StartStopStreaming(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo,\r
bool EnableStreaming)\r
{\r
if (!(AudioInterfaceInfo->State.IsActive))\r
EnableStreaming ? AudioInterfaceInfo->State.EnabledStreamingAltIndex : 0);\r
}\r
\r
+uint8_t Audio_GetSetEndpointProperty(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo,\r
+ const uint8_t DataPipeIndex,\r
+ const uint8_t EndpointProperty,\r
+ const uint8_t EndpointControl,\r
+ uint16_t const DataLength,\r
+ uint8_t* Data)\r
+{\r
+ uint8_t RequestType;\r
+ uint8_t EndpointAddress;\r
+ \r
+ if (EndpointProperty & 0x80)\r
+ RequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE);\r
+ else\r
+ RequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE); \r
+ \r
+ Pipe_SelectPipe(DataPipeIndex);\r
+ EndpointAddress = Pipe_GetBoundEndpointAddress();\r
+\r
+ USB_ControlRequest = (USB_Request_Header_t)\r
+ {\r
+ .bmRequestType = RequestType,\r
+ .bRequest = EndpointProperty,\r
+ .wValue = ((uint16_t)EndpointControl << 8),\r
+ .wIndex = EndpointAddress,\r
+ .wLength = DataLength,\r
+ };\r
+\r
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);\r
+\r
+ return USB_Host_SendControlRequest(Data); \r
+}\r
+\r
#endif\r
\r
*/\r
\r
/** \file\r
- * \brief Host mode driver for the library USB Audio Class driver.\r
+ * \brief Host mode driver for the library USB Audio 1.0 Class driver.\r
*\r
- * Host mode driver for the library USB Audio Class driver.\r
+ * Host mode driver for the library USB Audio 1.0 Class driver.\r
*\r
* \note This file should not be included directly. It is automatically included as needed by the USB module driver\r
* dispatch header located in LUFA/Drivers/USB.h.\r
*/\r
\r
/** \ingroup Group_USBClassAudio\r
- * \defgroup Group_USBClassAudioHost Audio Class Host Mode Driver\r
+ * \defgroup Group_USBClassAudioHost Audio 1.0 Class Host Mode Driver\r
*\r
* \section Sec_Dependencies Module Source Dependencies\r
* The following files must be built with any user project that uses this module:\r
* - LUFA/Drivers/USB/Class/Host/Audio.c <i>(Makefile source module name: LUFA_SRC_USBCLASS)</i>\r
*\r
* \section Sec_ModDescription Module Description\r
- * Host Mode USB Class driver framework interface, for the Audio USB Class driver.\r
+ * Host Mode USB Class driver framework interface, for the Audio 1.0 USB Class driver.\r
*\r
* @{\r
*/\r
*\r
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum.\r
*/\r
- uint8_t AUDIO_Host_StartStopStreaming(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo,\r
+ uint8_t Audio_Host_StartStopStreaming(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo,\r
bool EnableStreaming);\r
\r
+ /** Gets or sets the specified property of a streaming audio class endpoint that is bound to a pipe in the given\r
+ * class instance.\r
+ *\r
+ * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class host configuration and state.\r
+ * \param[in] DataPipeIndex Index of the data pipe whose bound endpoint is to be altered.\r
+ * \param[in] EndpointProperty Property of the endpoint to get or set, a value from \ref Audio_ClassRequests_t.\r
+ * \param[in] EndpointControl Parameter of the endpoint to get or set, a value from \ref Audio_EndpointControls_t.\r
+ * \param[in,out] DataLength For SET operations, the length of the parameter data to set. For GET operations, the maximum\r
+ * length of the retrieved data.\r
+ * \param[in,out] Data Pointer to a location where the parameter data is stored for SET operations, or where\r
+ * the retrieved data is to be stored for GET operations.\r
+ *\r
+ * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum.\r
+ */ \r
+ uint8_t Audio_GetSetEndpointProperty(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo,\r
+ const uint8_t DataPipeIndex,\r
+ const uint8_t EndpointProperty,\r
+ const uint8_t EndpointControl,\r
+ uint16_t* const DataLength,\r
+ uint8_t* Data);\r
+\r
/* Inline Functions: */\r
/** General management task for a given Audio host class interface, required for the correct operation of\r
* the interface. This should be called frequently in the main program loop, before the master USB management task\r
if (!(Pipe_IsConfigured()))
continue;
- uint8_t PipeToken = Pipe_GetPipeToken();
- bool PipeTokenCorrect = true;
-
- if (PipeToken != PIPE_TOKEN_SETUP)
- PipeTokenCorrect = (PipeToken == ((EndpointAddress & PIPE_EPDIR_MASK) ? PIPE_TOKEN_IN : PIPE_TOKEN_OUT));
-
- if (PipeTokenCorrect && (Pipe_BoundEndpointNumber() == (EndpointAddress & PIPE_EPNUM_MASK)))
+ if (Pipe_GetBoundEndpointAddress() == EndpointAddress)
return true;
}
return ((UPSTAX & (1 << CFGOK)) ? true : false);
}
- /** Retrieves the endpoint number of the endpoint within the attached device that the currently selected
+ /** Retrieves the endpoint address of the endpoint within the attached device that the currently selected
* pipe is bound to.
*
- * \return Endpoint number the currently selected pipe is bound to.
+ * \return Endpoint address the currently selected pipe is bound to.
*/
- static inline uint8_t Pipe_BoundEndpointNumber(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
- static inline uint8_t Pipe_BoundEndpointNumber(void)
+ static inline uint8_t Pipe_GetBoundEndpointAddress(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
+ static inline uint8_t Pipe_GetBoundEndpointAddress(void)
{
- return ((UPCFG0X >> PEPNUM0) & PIPE_EPNUM_MASK);
+ return (((UPCFG0X >> PEPNUM0) & PIPE_EPNUM_MASK) |
+ ((Pipe_GetPipeToken() == PIPE_TOKEN_IN) ? ENDPOINT_DESCRIPTOR_DIR_IN : 0));
}
/** Sets the period between interrupts for an INTERRUPT type pipe to a specified number of milliseconds.
if (!(Pipe_IsConfigured()))\r
continue;\r
\r
- uint8_t PipeToken = Pipe_GetPipeToken();\r
- bool PipeTokenCorrect = true;\r
-\r
- if (PipeToken != PIPE_TOKEN_SETUP)\r
- PipeTokenCorrect = (PipeToken == ((EndpointAddress & PIPE_EPDIR_MASK) ? PIPE_TOKEN_IN : PIPE_TOKEN_OUT));\r
-\r
- if (PipeTokenCorrect && (Pipe_BoundEndpointNumber() == (EndpointAddress & PIPE_EPNUM_MASK)))\r
+ if (Pipe_GetBoundEndpointAddress() == EndpointAddress)\r
return true;\r
}\r
\r
return (&AVR32_USBB.UPSTA0)[USB_SelectedPipe].cfgok;\r
}\r
\r
- /** Retrieves the endpoint number of the endpoint within the attached device that the currently selected\r
+ /** Retrieves the endpoint address of the endpoint within the attached device that the currently selected\r
* pipe is bound to.\r
*\r
- * \return Endpoint number the currently selected pipe is bound to.\r
+ * \return Endpoint address the currently selected pipe is bound to.\r
*/\r
- static inline uint8_t Pipe_BoundEndpointNumber(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
- static inline uint8_t Pipe_BoundEndpointNumber(void)\r
+ static inline uint8_t Pipe_GetBoundEndpointAddress(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
+ static inline uint8_t Pipe_GetBoundEndpointAddress(void)\r
{\r
- return (&AVR32_USBB.UPCFG0)[USB_SelectedPipe].pepnum;\r
+ return ((&AVR32_USBB.UPCFG0)[USB_SelectedPipe].pepnum |\r
+ ((Pipe_GetPipeToken() == PIPE_TOKEN_IN) ? ENDPOINT_DESCRIPTOR_DIR_IN : 0));\r
}\r
\r
/** Sets the period between interrupts for an INTERRUPT type pipe to a specified number of milliseconds.\r
* - 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
+ * - Pipe_BoundEndpointNumber() has been renamed to Pipe_GetBoundEndpointAddress(), and now returns the correct endpoint direction
+ * as part of the endpoint address
* - Library Applications:
* - Modified the Low Level and Class Driver AudioInput and AudioOutput demos to support multiple sample rates
*