\r
#include "../../../Common/Common.h"\r
#include "../HighLevel/USBInterrupt.h"\r
+ #include "../HighLevel/StdDescriptors.h"\r
+ #include "Pipe.h"\r
\r
/* Enable C linkage for C++ Compilers: */\r
#if defined(__cplusplus)\r
* and that the address used is not important (other than the fact that it is non-zero), a\r
* fixed value is specified by the library.\r
*/\r
- #define USB_HOST_DEVICEADDRESS 1\r
+ #define USB_HOST_DEVICEADDRESS 1\r
\r
#if !defined(USB_HOST_TIMEOUT_MS) || defined(__DOXYGEN__)\r
/** Constant for the maximum software timeout period of sent USB control transactions to an attached\r
* library will return a timeout error code.\r
*\r
* This value may be overridden in the user project makefile as the value of the \r
- * USB_HOST_TIMEOUT_MS token, and passed to the compiler using the -D switch.\r
+ * \ref USB_HOST_TIMEOUT_MS token, and passed to the compiler using the -D switch.\r
*/\r
#define USB_HOST_TIMEOUT_MS 1000\r
#endif\r
*/\r
static inline void USB_Host_ResetBus(void);\r
\r
- /** Determines if a previously issued bus reset (via the USB_Host_ResetBus() macro) has\r
+ /** Determines if a previously issued bus reset (via the \ref USB_Host_ResetBus() macro) has\r
* completed.\r
*\r
* \return Boolean true if no bus reset is currently being sent, false otherwise.\r
*/\r
static inline void USB_Host_SuspendBus(void);\r
\r
- /** Determines if the USB bus has been suspended via the use of the USB_Host_SuspendBus() macro,\r
+ /** Determines if the USB bus has been suspended via the use of the \ref USB_Host_SuspendBus() macro,\r
* false otherwise. While suspended, no USB communications can occur until the bus is resumed,\r
* except for the Remote Wakeup event from the device if supported.\r
*\r
#define USB_Host_IsResumeFromWakeupRequestSent() ((UHCON & (1 << RESUME)) ? false : true)\r
#endif\r
\r
+ /* Function Prototypes: */\r
+ /** Convenience function. This routine sends a SetConfiguration standard request to the attached\r
+ * device, with the given configuration index. This can be used to easily set the device\r
+ * configuration without creating and sending the request manually.\r
+ *\r
+ * \note After this routine returns, the control pipe will be selected.\r
+ *\r
+ * \param[in] ConfigNumber Configuration index to send to the device\r
+ *\r
+ * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result.\r
+ */\r
+ uint8_t USB_Host_SetDeviceConfiguration(uint8_t ConfigNumber);\r
+ \r
+ /** Convenience function. This routine sends a GetDescriptor standard request to the attached\r
+ * device, requesting the device descriptor. This can be used to easily retrieve information\r
+ * about the device such as its VID, PID and power requirements.\r
+ *\r
+ * \note After this routine returns, the control pipe will be selected.\r
+ *\r
+ * \param[out] DeviceDescriptorPtr Pointer to the destination device descriptor structure where\r
+ * the read data is to be stored\r
+ *\r
+ * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result.\r
+ */\r
+ uint8_t USB_Host_GetDeviceDescriptor(void* DeviceDescriptorPtr);\r
+ \r
+ /** Clears a stall condition on the given pipe, via a ClearFeature request to the attached device.\r
+ *\r
+ * \note After this routine returns, the control pipe will be selected.\r
+ *\r
+ * \param[in] EndpointIndex Index of the endpoint to clear\r
+ *\r
+ * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result.\r
+ */ \r
+ uint8_t USB_Host_ClearPipeStall(uint8_t EndpointIndex);\r
+\r
/* Enums: */\r
/** Enum for the various states of the USB Host state machine. Only some states are\r
* implemented in the LUFA library - other states are left to the user to implement.\r
*\r
* For information on each state, refer to the USB 2.0 specification. Some states have\r
*\r
- * \see USBTask.h for information on the global variable USB_HostState, which stores the\r
- * current host state machine state.\r
+ * \see \ref USB_HostState, which stores the current host state machine state.\r
*/\r
enum USB_Host_States_t\r
{\r
HOST_STATE_Suspended = 13, /**< May be implemented by the user project. */\r
};\r
\r
- /** Enum for the error codes for the USB_HostError event.\r
+ /** Enum for the error codes for the \ref EVENT_USB_HostError() event.\r
*\r
- * \see Events.h for more information on this event.\r
+ * \see \ref Group_Events for more information on this event.\r
*/\r
enum USB_Host_ErrorCodes_t\r
{\r
HOST_ERROR_VBusVoltageDip = 0, /**< VBUS voltage dipped to an unacceptable level. This\r
- * error may be the result of an attached device drawing\r
+ * error may be the result of an attached device drawing\r
* too much current from the VBUS line, or due to the\r
* AVR's power source being unable to supply sufficient\r
* current.\r
*/\r
};\r
\r
- /** Enum for the error codes for the USB_DeviceEnumerationFailed event.\r
+ /** Enum for the error codes for the \ref EVENT_USB_DeviceEnumerationFailed() event.\r
*\r
- * \see Events.h for more information on this event.\r
+ * \see \ref Group_Events for more information on this event.\r
*/\r
enum USB_Host_EnumerationErrorCodes_t\r
{\r
HOST_ENUMERROR_NoError = 0, /**< No error occurred. Used internally, this is not a valid\r
- * ErrorCode parameter value for the USB_DeviceEnumerationFailed\r
+ * ErrorCode parameter value for the \ref EVENT_USB_DeviceEnumerationFailed()\r
* event.\r
*/\r
HOST_ENUMERROR_WaitStage = 1, /**< One of the delays between enumeration steps failed\r
#define USB_Host_HostMode_On() MACROS{ USBCON |= (1 << HOST); }MACROE\r
#define USB_Host_HostMode_Off() MACROS{ USBCON &= ~(1 << HOST); }MACROE\r
\r
- #define USB_Host_VBUS_Auto_Enable() MACROS{ OTGCON &= ~(1 << VBUSHWC); UHWCON |= (1 << UVCONE); }MACROE\r
+ #define USB_Host_VBUS_Auto_Enable() MACROS{ OTGCON &= ~(1 << VBUSHWC); UHWCON |= (1 << UVCONE); }MACROE\r
#define USB_Host_VBUS_Manual_Enable() MACROS{ OTGCON |= (1 << VBUSHWC); UHWCON &= ~(1 << UVCONE); DDRE |= (1 << 7); }MACROE\r
\r
#define USB_Host_VBUS_Auto_On() MACROS{ OTGCON |= (1 << VBUSREQ); }MACROE\r
};\r
\r
/* Function Prototypes: */\r
+ void USB_Host_ProcessNextHostState(void);\r
uint8_t USB_Host_WaitMS(uint8_t MS);\r
- void USB_Host_ResetDevice(void);\r
+ \r
+ #if defined(INCLUDE_FROM_HOST_C)\r
+ static void USB_Host_ResetDevice(void);\r
+ #endif\r
#endif\r
\r
/* Disable C linkage for C++ Compilers: */\r