3 Copyright (C) Dean Camera, 2014.
5 dean [at] fourwalledcubicle [dot] com
10 Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com)
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
21 The author disclaims all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
32 * \brief Common USB Host definitions for all architectures.
33 * \copydetails Group_Host
35 * \note This file should not be included directly. It is automatically included as needed by the USB driver
36 * dispatch header located in LUFA/Drivers/USB/USB.h.
39 /** \ingroup Group_USB
40 * \defgroup Group_Host Host Management
41 * \brief USB Host management definitions for USB host mode.
43 * USB Host mode related macros and enums. This module contains macros and enums which are used when
44 * the USB controller is initialized in host mode.
53 #include "../../../Common/Common.h"
56 /* Enable C linkage for C++ Compilers: */
57 #if defined(__cplusplus)
61 /* Preprocessor Checks: */
62 #if !defined(__INCLUDE_FROM_USB_DRIVER)
63 #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
66 /* Public Interface - May be used in end-application: */
68 /** Enum for the various states of the USB Host state machine.
70 * For information on each possible USB host state, refer to the USB 2.0 specification.
71 * Several of the USB host states are broken up further into multiple smaller sub-states,
72 * so that they can be internally implemented inside the library in an efficient manner.
74 * \see \ref USB_HostState, which stores the current host state machine state.
76 enum USB_Host_States_t
78 HOST_STATE_WaitForDevice = 0, /**< This state indicates that the stack is waiting for an interval
79 * to elapse before continuing with the next step of the device
80 * enumeration process.
82 HOST_STATE_Unattached = 1, /**< This state indicates that the host state machine is waiting for
83 * a device to be attached so that it can start the enumeration process.
85 HOST_STATE_Powered = 2, /**< This state indicates that a device has been attached, and the
86 * library's internals are being configured to begin the enumeration
89 HOST_STATE_Powered_WaitForDeviceSettle = 3, /**< This state indicates that the stack is waiting for the initial
90 * settling period to elapse before beginning the enumeration process.
92 HOST_STATE_Powered_WaitForConnect = 4, /**< This state indicates that the stack is waiting for a connection event
93 * from the USB controller to indicate a valid USB device has been attached
94 * to the bus and is ready to be enumerated.
96 HOST_STATE_Powered_DoReset = 5, /**< This state indicates that a valid USB device has been attached, and that
97 * it will now be reset to ensure it is ready for enumeration.
99 HOST_STATE_Powered_ConfigPipe = 6, /**< This state indicates that the attached device is currently powered and
100 * reset, and that the control pipe is now being configured by the stack.
102 HOST_STATE_Default = 7, /**< This state indicates that the stack is currently retrieving the control
103 * endpoint's size from the device, so that the control pipe can be altered
106 HOST_STATE_Default_PostReset = 8, /**< This state indicates that the control pipe is being reconfigured to match
107 * the retrieved control endpoint size from the device, and the device's USB
108 * bus address is being set.
110 HOST_STATE_Default_PostAddressSet = 9, /**< This state indicates that the device's address has now been set, and the
111 * stack is has now completed the device enumeration process. This state causes
112 * the stack to change the current USB device address to that set for the
113 * connected device, before progressing to the \ref HOST_STATE_Addressed state
114 * ready for use in the user application.
116 HOST_STATE_Addressed = 10, /**< Indicates that the device has been enumerated and addressed, and is now waiting
117 * for the user application to configure the device ready for use.
119 HOST_STATE_Configured = 11, /**< Indicates that the device has been configured into a valid device configuration,
120 * ready for general use by the user application.
124 /* Architecture Includes: */
125 #if (ARCH == ARCH_AVR8)
126 #include "AVR8/Host_AVR8.h"
127 #elif (ARCH == ARCH_UC3)
128 #include "UC3/Host_UC3.h"
131 /* Disable C linkage for C++ Compilers: */
132 #if defined(__cplusplus)