Keyboard firmwares for Atmel AVR and Cortex-M
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Host.h 7.1KB

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