aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB/Class
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2011-06-08 02:45:32 +0000
committerDean Camera <dean@fourwalledcubicle.com>2011-06-08 02:45:32 +0000
commit0bf5064aec5ac43ba2b25d44528bebb27db2f117 (patch)
treeee5e186bc1a7121e57dd2f37faf9f43b076b2aa5 /LUFA/Drivers/USB/Class
parent34164a5550911277db03bbbc2a604bc59e0bbc99 (diff)
downloadlufa-0bf5064aec5ac43ba2b25d44528bebb27db2f117.tar.gz
lufa-0bf5064aec5ac43ba2b25d44528bebb27db2f117.tar.bz2
lufa-0bf5064aec5ac43ba2b25d44528bebb27db2f117.zip
Pipe_BoundEndpointNumber() has been renamed to Pipe_GetBoundEndpointAddress(), and now returns the correct endpoint direction as part of the endpoint address.
Add Audio_GetSetEndpointProperty() function to the Host mode Audio class driver.
Diffstat (limited to 'LUFA/Drivers/USB/Class')
-rw-r--r--LUFA/Drivers/USB/Class/Audio.h12
-rw-r--r--LUFA/Drivers/USB/Class/Device/Audio.h2
-rw-r--r--LUFA/Drivers/USB/Class/Host/Audio.c34
-rw-r--r--LUFA/Drivers/USB/Class/Host/Audio.h31
4 files changed, 66 insertions, 13 deletions
diff --git a/LUFA/Drivers/USB/Class/Audio.h b/LUFA/Drivers/USB/Class/Audio.h
index ad0150f65..5d02b4d4a 100644
--- a/LUFA/Drivers/USB/Class/Audio.h
+++ b/LUFA/Drivers/USB/Class/Audio.h
@@ -29,16 +29,16 @@
*/
/** \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:
@@ -46,12 +46,12 @@
* - 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.
*
* @{
*/
diff --git a/LUFA/Drivers/USB/Class/Device/Audio.h b/LUFA/Drivers/USB/Class/Device/Audio.h
index 4026f9092..486df72d1 100644
--- a/LUFA/Drivers/USB/Class/Device/Audio.h
+++ b/LUFA/Drivers/USB/Class/Device/Audio.h
@@ -38,7 +38,7 @@
*/
/** \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:
diff --git a/LUFA/Drivers/USB/Class/Host/Audio.c b/LUFA/Drivers/USB/Class/Host/Audio.c
index 7397ef986..0da1eb664 100644
--- a/LUFA/Drivers/USB/Class/Host/Audio.c
+++ b/LUFA/Drivers/USB/Class/Host/Audio.c
@@ -194,7 +194,7 @@ static uint8_t DComp_NextAudioInterfaceDataEndpoint(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_NotFound;
}
-uint8_t AUDIO_Host_StartStopStreaming(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo,
+uint8_t Audio_Host_StartStopStreaming(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo,
bool EnableStreaming)
{
if (!(AudioInterfaceInfo->State.IsActive))
@@ -204,5 +204,37 @@ uint8_t AUDIO_Host_StartStopStreaming(USB_ClassInfo_Audio_Host_t* const AudioInt
EnableStreaming ? AudioInterfaceInfo->State.EnabledStreamingAltIndex : 0);
}
+uint8_t Audio_GetSetEndpointProperty(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo,
+ const uint8_t DataPipeIndex,
+ const uint8_t EndpointProperty,
+ const uint8_t EndpointControl,
+ uint16_t const DataLength,
+ uint8_t* Data)
+{
+ uint8_t RequestType;
+ uint8_t EndpointAddress;
+
+ if (EndpointProperty & 0x80)
+ RequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE);
+ else
+ RequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE);
+
+ Pipe_SelectPipe(DataPipeIndex);
+ EndpointAddress = Pipe_GetBoundEndpointAddress();
+
+ USB_ControlRequest = (USB_Request_Header_t)
+ {
+ .bmRequestType = RequestType,
+ .bRequest = EndpointProperty,
+ .wValue = ((uint16_t)EndpointControl << 8),
+ .wIndex = EndpointAddress,
+ .wLength = DataLength,
+ };
+
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);
+
+ return USB_Host_SendControlRequest(Data);
+}
+
#endif
diff --git a/LUFA/Drivers/USB/Class/Host/Audio.h b/LUFA/Drivers/USB/Class/Host/Audio.h
index 0ceaf885b..7e9a48d89 100644
--- a/LUFA/Drivers/USB/Class/Host/Audio.h
+++ b/LUFA/Drivers/USB/Class/Host/Audio.h
@@ -29,23 +29,23 @@
*/
/** \file
- * \brief Host mode driver for the library USB Audio Class driver.
+ * \brief Host mode driver for the library USB Audio 1.0 Class driver.
*
- * Host mode driver for the library USB Audio Class driver.
+ * Host mode driver for the library USB Audio 1.0 Class driver.
*
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
* dispatch header located in LUFA/Drivers/USB.h.
*/
/** \ingroup Group_USBClassAudio
- * \defgroup Group_USBClassAudioHost Audio Class Host Mode Driver
+ * \defgroup Group_USBClassAudioHost Audio 1.0 Class Host Mode 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
- * Host Mode USB Class driver framework interface, for the Audio USB Class driver.
+ * Host Mode USB Class driver framework interface, for the Audio 1.0 USB Class driver.
*
* @{
*/
@@ -138,9 +138,30 @@
*
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum.
*/
- uint8_t AUDIO_Host_StartStopStreaming(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo,
+ uint8_t Audio_Host_StartStopStreaming(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo,
bool EnableStreaming);
+ /** Gets or sets the specified property of a streaming audio class endpoint that is bound to a pipe in the given
+ * class instance.
+ *
+ * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class host configuration and state.
+ * \param[in] DataPipeIndex Index of the data pipe whose bound endpoint is to be altered.
+ * \param[in] EndpointProperty Property of the endpoint to get or set, a value from \ref Audio_ClassRequests_t.
+ * \param[in] EndpointControl Parameter of the endpoint to get or set, a value from \ref Audio_EndpointControls_t.
+ * \param[in,out] DataLength For SET operations, the length of the parameter data to set. For GET operations, the maximum
+ * length of the retrieved data.
+ * \param[in,out] Data Pointer to a location where the parameter data is stored for SET operations, or where
+ * the retrieved data is to be stored for GET operations.
+ *
+ * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum.
+ */
+ uint8_t Audio_GetSetEndpointProperty(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo,
+ const uint8_t DataPipeIndex,
+ const uint8_t EndpointProperty,
+ const uint8_t EndpointControl,
+ uint16_t* const DataLength,
+ uint8_t* Data);
+
/* Inline Functions: */
/** General management task for a given Audio host class interface, required for the correct operation of
* the interface. This should be called frequently in the main program loop, before the master USB management task