X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/137ce280c1e9c33e9393f1dfd6bb160c131bd1a4..3e044872790072838c2d1d0370b98b6ebf4fea93:/LUFA/Drivers/USB/Core/HostStandardReq.h diff --git a/LUFA/Drivers/USB/Core/HostStandardReq.h b/LUFA/Drivers/USB/Core/HostStandardReq.h index b74aa3a3e..4bc3ddad2 100644 --- a/LUFA/Drivers/USB/Core/HostStandardReq.h +++ b/LUFA/Drivers/USB/Core/HostStandardReq.h @@ -58,6 +58,18 @@ #endif /* Public Interface - May be used in end-application: */ + /* Macros: */ + #if !defined(USB_HOST_TIMEOUT_MS) || defined(__DOXYGEN__) + /** Constant for the maximum software timeout period of sent USB control transactions to an attached + * device. If a device fails to respond to a sent control request within this period, the + * library will return a timeout error code. + * + * This value may be overridden in the user project makefile as the value of the + * \ref USB_HOST_TIMEOUT_MS token, and passed to the compiler using the -D switch. + */ + #define USB_HOST_TIMEOUT_MS 1000 + #endif + /* Enums: */ /** Enum for the \ref USB_Host_SendControlRequest() return code, indicating the reason for the error * if the transfer of the request is unsuccessful. @@ -104,9 +116,7 @@ */ 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. + /** Sends a SET CONFIGURATION standard request to the attached device, with the given configuration index. * * 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. @@ -121,9 +131,9 @@ */ 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. + /** 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. * @@ -134,12 +144,11 @@ * * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. */ - uint8_t USB_Host_GetDeviceDescriptor(void* const DeviceDescriptorPtr); + uint8_t USB_Host_GetDeviceDescriptor(void* const DeviceDescriptorPtr) ATTR_NON_NULL_PTR_ARG(1); - /** 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. + /** 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. * @@ -154,7 +163,21 @@ */ uint8_t USB_Host_GetDeviceStringDescriptor(const uint8_t Index, void* const Buffer, - const uint8_t BufferLength); + const uint8_t BufferLength) ATTR_NON_NULL_PTR_ARG(2); + + /** Retrieves the current feature status of the attached device, via a GET STATUS standard request. The + * retrieved feature status can then be examined by masking the retrieved value with the various + * FEATURE_* masks for bus/self power information and remote wakeup support. + * + * \note After this routine returns, the control pipe will be selected. + * + * \ingroup Group_PipeControlReq + * + * \param[out] FeatureStatus Location where the retrieved feature status should be stored. + * + * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. + */ + uint8_t USB_Host_GetDeviceStatus(uint8_t* const FeatureStatus) ATTR_NON_NULL_PTR_ARG(1); /** Clears a stall condition on the given pipe, via a CLEAR FEATURE standard request to the attached device. * @@ -162,11 +185,11 @@ * * \ingroup Group_PipeControlReq * - * \param[in] EndpointIndex Index of the endpoint to clear, including the endpoint's direction. + * \param[in] EndpointAddress Address 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); + uint8_t USB_Host_ClearEndpointStall(const uint8_t EndpointAddress); /** Selects a given alternative setting for the specified interface, via a SET INTERFACE standard request to * the attached device.