![]() |
LUFA Library
120219
|
USB Host management definitions for USB host mode. More...
Modules | |
Host Management (AVR8) | |
USB Host definitions for the AVR8 microcontrollers. | |
Host Management (UC3B) | |
USB Host definitions for the AVR32 UC3B microcontrollers. | |
Enumerations | |
enum | USB_Host_States_t { HOST_STATE_WaitForDevice = 0, HOST_STATE_Unattached = 1, HOST_STATE_Powered = 2, HOST_STATE_Powered_WaitForDeviceSettle = 3, HOST_STATE_Powered_WaitForConnect = 4, HOST_STATE_Powered_DoReset = 5, HOST_STATE_Powered_ConfigPipe = 6, HOST_STATE_Default = 7, HOST_STATE_Default_PostReset = 8, HOST_STATE_Default_PostAddressSet = 9, HOST_STATE_Addressed = 10, HOST_STATE_Configured = 11 } |
Variables | |
uint8_t | USB_Host_ConfigurationNumber |
volatile uint8_t | USB_HostState |
USB Host mode related macros and enums. This module contains macros and enums which are used when the USB controller is initialized in host mode.
enum USB_Host_States_t |
Enum for the various states of the USB Host state machine.
For information on each possible USB host state, refer to the USB 2.0 specification. Several of the USB host states are broken up further into multiple smaller sub-states, so that they can be internally implemented inside the library in an efficient manner.
HOST_STATE_WaitForDevice |
This state indicates that the stack is waiting for an interval to elapse before continuing with the next step of the device enumeration process. |
HOST_STATE_Unattached |
This state indicates that the host state machine is waiting for a device to be attached so that it can start the enumeration process. |
HOST_STATE_Powered |
This state indicates that a device has been attached, and the library's internals are being configured to begin the enumeration process. |
HOST_STATE_Powered_WaitForDeviceSettle |
This state indicates that the stack is waiting for the initial settling period to elapse before beginning the enumeration process. |
HOST_STATE_Powered_WaitForConnect |
This state indicates that the stack is waiting for a connection event from the USB controller to indicate a valid USB device has been attached to the bus and is ready to be enumerated. |
HOST_STATE_Powered_DoReset |
This state indicates that a valid USB device has been attached, and that it will now be reset to ensure it is ready for enumeration. |
HOST_STATE_Powered_ConfigPipe |
This state indicates that the attached device is currently powered and reset, and that the control pipe is now being configured by the stack. |
HOST_STATE_Default |
This state indicates that the stack is currently retrieving the control endpoint's size from the device, so that the control pipe can be altered to match. |
HOST_STATE_Default_PostReset |
This state indicates that the control pipe is being reconfigured to match the retrieved control endpoint size from the device, and the device's USB bus address is being set. |
HOST_STATE_Default_PostAddressSet |
This state indicates that the device's address has now been set, and the stack is has now completed the device enumeration process. This state causes the stack to change the current USB device address to that set for the connected device, before progressing to the HOST_STATE_Addressed state ready for use in the user application. |
HOST_STATE_Addressed |
Indicates that the device has been enumerated and addressed, and is now waiting for the user application to configure the device ready for use. |
HOST_STATE_Configured |
Indicates that the device has been configured into a valid device configuration, ready for general use by the user application. |
uint8_t USB_Host_ConfigurationNumber |
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 USB_Host_SetDeviceConfiguration() function.
volatile uint8_t USB_HostState |
Indicates the current host state machine state. When in host mode, this indicates the state via one of the values of the USB_Host_States_t enum values.
This value should not be altered by the user application as it is handled automatically by the library.
To reduce program size and speed up checks of this global on the AVR8 architecture, it can be placed into one of the AVR's GPIOR
hardware registers instead of RAM by defining the HOST_STATE_AS_GPIOR
token to a value between 0 and 2 in the project makefile and passing it to the compiler via the -D switch. When defined, the corresponding GPIOR register should not be used in the user application except implicitly via the library APIs.