aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB/Core/HostStandardReq.h
diff options
context:
space:
mode:
Diffstat (limited to 'LUFA/Drivers/USB/Core/HostStandardReq.h')
-rw-r--r--LUFA/Drivers/USB/Core/HostStandardReq.h92
1 files changed, 92 insertions, 0 deletions
diff --git a/LUFA/Drivers/USB/Core/HostStandardReq.h b/LUFA/Drivers/USB/Core/HostStandardReq.h
index 46822221c..b74aa3a3e 100644
--- a/LUFA/Drivers/USB/Core/HostStandardReq.h
+++ b/LUFA/Drivers/USB/Core/HostStandardReq.h
@@ -77,6 +77,19 @@
HOST_SENDCONTROL_SoftwareTimeOut = 4, /**< The request or data transfer timed out. */
};
+ /* Global Variables: */
+ /** Indicates the currently set configuration number of the attached device. This indicates the currently
+ * selected configuration value if one has been set sucessfully, or 0 if no configuration has been selected.
+ *
+ * To set a device configuration, call the \ref USB_Host_SetDeviceConfiguration() function.
+ *
+ * \note This variable should be treated as read-only in the user application, and never manually
+ * changed in value.
+ *
+ * \ingroup Group_Host
+ */
+ extern uint8_t USB_Host_ConfigurationNumber;
+
/* Function Prototypes: */
/** Sends the request stored in the \ref USB_ControlRequest global structure to the attached device,
* and transfers the data stored in the buffer to the device, or from the device to the buffer
@@ -91,6 +104,85 @@
*/
uint8_t USB_Host_SendControlRequest(void* const BufferPtr);
+ /** Convenience function. This routine sends a SET CONFIGURATION standard request to the attached
+ * device, with the given configuration index. This can be used to easily set the device
+ * configuration without creating and sending the request manually.
+ *
+ * This routine will automatically update the \ref USB_HostState and \ref USB_Host_ConfigurationNumber
+ * state variables according to the given function parameters and the result of the request.
+ *
+ * \note After this routine returns, the control pipe will be selected.
+ *
+ * \ingroup Group_PipeControlReq
+ *
+ * \param[in] ConfigNumber Configuration index to send to the device.
+ *
+ * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result.
+ */
+ uint8_t USB_Host_SetDeviceConfiguration(const uint8_t ConfigNumber);
+
+ /** Convenience function. This routine sends a GET DESCRIPTOR standard request to the attached
+ * device, requesting the device descriptor. This can be used to easily retrieve information
+ * about the device such as its VID, PID and power requirements.
+ *
+ * \note After this routine returns, the control pipe will be selected.
+ *
+ * \ingroup Group_PipeControlReq
+ *
+ * \param[out] DeviceDescriptorPtr Pointer to the destination device descriptor structure where
+ * the read data is to be stored.
+ *
+ * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result.
+ */
+ uint8_t USB_Host_GetDeviceDescriptor(void* const DeviceDescriptorPtr);
+
+ /** Convenience function. This routine sends a GET DESCRIPTOR standard request to the attached
+ * device, requesting the string descriptor of the specified index. This can be used to easily
+ * retrieve string descriptors from the device by index, after the index is obtained from the
+ * Device or Configuration descriptors.
+ *
+ * \note After this routine returns, the control pipe will be selected.
+ *
+ * \ingroup Group_PipeControlReq
+ *
+ * \param[in] Index Index of the string index to retrieve.
+ * \param[out] Buffer Pointer to the destination buffer where the retrieved string descriptor is
+ * to be stored.
+ * \param[in] BufferLength Maximum size of the string descriptor which can be stored into the buffer.
+ *
+ * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result.
+ */
+ uint8_t USB_Host_GetDeviceStringDescriptor(const uint8_t Index,
+ void* const Buffer,
+ const uint8_t BufferLength);
+
+ /** Clears a stall condition on the given pipe, via a CLEAR FEATURE standard request to the attached device.
+ *
+ * \note After this routine returns, the control pipe will be selected.
+ *
+ * \ingroup Group_PipeControlReq
+ *
+ * \param[in] EndpointIndex Index of the endpoint to clear, including the endpoint's direction.
+ *
+ * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result.
+ */
+ uint8_t USB_Host_ClearPipeStall(const uint8_t EndpointIndex);
+
+ /** Selects a given alternative setting for the specified interface, via a SET INTERFACE standard request to
+ * the attached device.
+ *
+ * \note After this routine returns, the control pipe will be selected.
+ *
+ * \ingroup Group_PipeControlReq
+ *
+ * \param[in] InterfaceIndex Index of the interface whose alternative setting is to be altered.
+ * \param[in] AltSetting Index of the interface's alternative setting which is to be selected.
+ *
+ * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result.
+ */
+ uint8_t USB_Host_SetInterfaceAltSetting(const uint8_t InterfaceIndex,
+ const uint8_t AltSetting);
+
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Enums: */