![]() |
LUFA Library 110528
|
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_WaitForDeviceRemoval = 0, HOST_STATE_WaitForDevice = 1, HOST_STATE_Unattached = 2, HOST_STATE_Powered = 3, HOST_STATE_Powered_WaitForDeviceSettle = 4, HOST_STATE_Powered_WaitForConnect = 5, HOST_STATE_Powered_DoReset = 6, HOST_STATE_Powered_ConfigPipe = 7, HOST_STATE_Default = 8, HOST_STATE_Default_PostReset = 9, HOST_STATE_Default_PostAddressSet = 10, HOST_STATE_Addressed = 11, HOST_STATE_Configured = 12, HOST_STATE_Suspended = 15 } |
Variables | |
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. Only some states are implemented in the LUFA library - other states are left to the user to implement.
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_WaitForDeviceRemoval |
Internally implemented by the library. This state can be used by the library to wait until the attached device is removed by the user - useful for when an error occurs or further communication with the device is not needed. This allows for other code to run while the state machine is effectively disabled. |
HOST_STATE_WaitForDevice |
Internally implemented by the library. 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 |
Internally implemented by the library. 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 |
Internally implemented by the library. 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 |
Internally implemented by the library. This state indicates that the stack is waiting for the initial settling period to elapse before beginning the enumeration process.
|
HOST_STATE_Powered_WaitForConnect |
Internally implemented by the library. 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 |
Internally implemented by the library. This state indicates that a valid USB device has been attached, and that it is will now be reset to ensure it is ready for enumeration.
|
HOST_STATE_Powered_ConfigPipe |
Internally implemented by the library. 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 |
Internally implemented by the library. 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 |
Internally implemented by the library. 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 |
Internally implemented by the library. 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 user-implemented HOST_STATE_Addressed state for further communications.
|
HOST_STATE_Addressed |
May be implemented by the user project. This state should set the device configuration before progressing to the HOST_STATE_Configured state. Other processing (such as the retrieval and processing of the device descriptor) should also be placed in this state. |
HOST_STATE_Configured |
May be implemented by the user project. This state should implement the actual work performed on the attached device and changed to the HOST_STATE_Suspended or HOST_STATE_WaitForDeviceRemoval states as needed. |
HOST_STATE_Suspended |
May be implemented by the user project. This state should be maintained while the bus is suspended, and changed to either the HOST_STATE_Configured (after resuming the bus with the USB_Host_ResumeBus() macro) or the HOST_STATE_WaitForDeviceRemoval states as needed. |
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 may be altered by the user application to implement the HOST_STATE_Addressed, HOST_STATE_Configured and HOST_STATE_Suspended states which are not implemented by the library internally.
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.