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.

USBMode.h 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  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 USB mode and feature support definitions.
  28. * \copydetails Group_USBMode
  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_USBMode USB Mode Tokens
  35. * \brief USB mode and feature support definitions.
  36. *
  37. * This file defines macros indicating the type of USB controller the library is being compiled for, and its
  38. * capabilities. These macros may then be referenced in the user application to selectively enable or disable
  39. * code sections depending on if they are defined or not.
  40. *
  41. * After the inclusion of the master USB driver header, one or more of the following tokens may be defined, to
  42. * allow the user code to conditionally enable or disable code based on the USB controller family and allowable
  43. * USB modes. These tokens may be tested against to eliminate code relating to a USB mode which is not enabled for
  44. * the given compilation.
  45. *
  46. * @{
  47. */
  48. #ifndef __USBMODE_H__
  49. #define __USBMODE_H__
  50. /* Enable C linkage for C++ Compilers: */
  51. #if defined(__cplusplus)
  52. extern "C" {
  53. #endif
  54. /* Preprocessor Checks: */
  55. #if !defined(__INCLUDE_FROM_USB_DRIVER)
  56. #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
  57. #endif
  58. /* Includes: */
  59. #include "../../../Common/Common.h"
  60. /* Public Interface - May be used in end-application: */
  61. #if defined(__DOXYGEN__)
  62. /** Indicates that the target AVR microcontroller belongs to the Series 2 AVR8 USB controller
  63. * (i.e. AT90USBxxx2 or ATMEGAxxU2) when defined.
  64. */
  65. #define USB_SERIES_2_AVR
  66. /** Indicates that the target AVR microcontroller belongs to the Series 4 AVR8 USB controller
  67. * (i.e. ATMEGAxxU4) when defined.
  68. */
  69. #define USB_SERIES_4_AVR
  70. /** Indicates that the target AVR microcontroller belongs to the Series 6 AVR8 USB controller
  71. * (i.e. AT90USBxxx6) when defined.
  72. */
  73. #define USB_SERIES_6_AVR
  74. /** Indicates that the target AVR microcontroller belongs to the Series 7 AVR8 USB controller
  75. * (i.e. AT90USBxxx7) when defined.
  76. */
  77. #define USB_SERIES_7_AVR
  78. /** Indicates that the target AVR microcontroller belongs to the AVR32 UC3A0 Series USB controller
  79. * (i.e. AT32UC3A0*) when defined.
  80. */
  81. #define USB_SERIES_UC3A0_AVR
  82. /** Indicates that the target AVR microcontroller belongs to the AVR32 UC3A1 Series USB controller
  83. * (i.e. AT32UC3A1*) when defined.
  84. */
  85. #define USB_SERIES_UC3A1_AVR
  86. /** Indicates that the target AVR microcontroller belongs to the AVR32 UC3A3 Series USB controller
  87. * (i.e. AT32UC3A3*) when defined.
  88. */
  89. #define USB_SERIES_UC3A3_AVR
  90. /** Indicates that the target AVR microcontroller belongs to the AVR32 UC3A4 Series USB controller
  91. * (i.e. AT32UC3A4*) when defined.
  92. */
  93. #define USB_SERIES_UC3A4_AVR
  94. /** Indicates that the target AVR microcontroller belongs to the AVR32 UC3B0 Series USB controller
  95. * (i.e. AT32UC3B0*) when defined.
  96. */
  97. #define USB_SERIES_UC3B0_AVR
  98. /** Indicates that the target AVR microcontroller belongs to the AVR32 UC3B1 Series USB controller
  99. * (i.e. AT32UC3B1*) when defined.
  100. */
  101. #define USB_SERIES_UC3B1_AVR
  102. /** Indicates that the target AVR microcontroller belongs to the XMEGA A1U Series USB controller
  103. * (i.e. ATXMEGA*A1U) when defined.
  104. */
  105. #define USB_SERIES_A1U_XMEGA
  106. /** Indicates that the target AVR microcontroller belongs to the XMEGA A3U Series USB controller
  107. * (i.e. ATXMEGA*A3U) when defined.
  108. */
  109. #define USB_SERIES_A3U_XMEGA
  110. /** Indicates that the target AVR microcontroller belongs to the XMEGA A4U Series USB controller
  111. * (i.e. ATXMEGA*A4U) when defined.
  112. */
  113. #define USB_SERIES_A4U_XMEGA
  114. /** Indicates that the target AVR microcontroller belongs to the XMEGA B1 Series USB controller
  115. * (i.e. ATXMEGA*B1) when defined.
  116. */
  117. #define USB_SERIES_B1_XMEGA
  118. /** Indicates that the target AVR microcontroller belongs to the XMEGA B3 Series USB controller
  119. * (i.e. ATXMEGA*B3) when defined.
  120. */
  121. #define USB_SERIES_B3_XMEGA
  122. /** Indicates that the target AVR microcontroller belongs to the XMEGA C3 Series USB controller
  123. * (i.e. ATXMEGA*C3) when defined.
  124. */
  125. #define USB_SERIES_C3_XMEGA
  126. /** Indicates that the target AVR microcontroller belongs to the XMEGA C4 Series USB controller
  127. * (i.e. ATXMEGA*C4) when defined.
  128. */
  129. #define USB_SERIES_C4_XMEGA
  130. /** Indicates that the target microcontroller and compilation settings allow for the
  131. * target to be configured in USB Device mode when defined.
  132. */
  133. #define USB_CAN_BE_DEVICE
  134. /** Indicates that the target microcontroller and compilation settings allow for the
  135. * target to be configured in USB Host mode when defined.
  136. */
  137. #define USB_CAN_BE_HOST
  138. /** Indicates that the target microcontroller and compilation settings allow for the
  139. * target to be configured in either USB Device or Host mode when defined.
  140. */
  141. #define USB_CAN_BE_BOTH
  142. #else
  143. /* Macros: */
  144. #if (defined(__AVR_AT90USB162__) || defined(__AVR_AT90USB82__) || \
  145. defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega8U2__))
  146. #define USB_SERIES_2_AVR
  147. #define USB_CAN_BE_DEVICE
  148. #elif (defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega16U4__))
  149. #define USB_SERIES_4_AVR
  150. #define USB_CAN_BE_DEVICE
  151. #elif (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__))
  152. #define USB_SERIES_6_AVR
  153. #define USB_CAN_BE_DEVICE
  154. #elif (defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1287__))
  155. #define USB_SERIES_7_AVR
  156. #define USB_CAN_BE_DEVICE
  157. #define USB_CAN_BE_HOST
  158. #elif (defined(__AVR32_UC3A0512__) || defined(__AVR32_UC3A0256__) || \
  159. defined(__AVR32_UC3A0128__) || defined(__AVR32_UC3A064__))
  160. #define USB_SERIES_UC3A0_AVR32
  161. #define USB_CAN_BE_DEVICE
  162. #define USB_CAN_BE_HOST
  163. #elif (defined(__AVR32_UC3A1512__) || defined(__AVR32_UC3A1256__) || \
  164. defined(__AVR32_UC3A1128__) || defined(__AVR32_UC3A164__))
  165. #define USB_SERIES_UC3A1_AVR32
  166. #define USB_CAN_BE_DEVICE
  167. #define USB_CAN_BE_HOST
  168. #elif (defined(__AVR32_UC3A3256__) || defined(__AVR32_UC3A3256S__) || \
  169. defined(__AVR32_UC3A3128__) || defined(__AVR32_UC3A3128S__) || \
  170. defined(__AVR32_UC3A364__) || defined(__AVR32_UC3A364S__))
  171. #define USB_SERIES_UC3A3_AVR32
  172. #define USB_CAN_BE_DEVICE
  173. #define USB_CAN_BE_HOST
  174. #elif (defined(__AVR32_UC3A4256__) || defined(__AVR32_UC3A4256S__) || \
  175. defined(__AVR32_UC3A4128__) || defined(__AVR32_UC3A4128S__) || \
  176. defined(__AVR32_UC3A464__) || defined(__AVR32_UC3A464S__))
  177. #define USB_SERIES_UC3A4_AVR32
  178. #define USB_CAN_BE_DEVICE
  179. #define USB_CAN_BE_HOST
  180. #elif (defined(__AVR32_UC3B0512__) || defined(__AVR32_UC3B0256__) || \
  181. defined(__AVR32_UC3B0128__) || defined(__AVR32_UC3B064__))
  182. #define USB_SERIES_UC3B0_AVR32
  183. #define USB_CAN_BE_DEVICE
  184. #define USB_CAN_BE_HOST
  185. #elif (defined(__AVR32_UC3B1512__) || defined(__AVR32_UC3B1256__) || \
  186. defined(__AVR32_UC3B1128__) || defined(__AVR32_UC3B164__))
  187. #define USB_SERIES_UC3B1_AVR32
  188. #define USB_CAN_BE_DEVICE
  189. #define USB_CAN_BE_HOST
  190. #elif (defined(__AVR_ATxmega128A1U__) || defined(__AVR_ATxmega64A1U__))
  191. #define USB_SERIES_A1U_XMEGA
  192. #define USB_CAN_BE_DEVICE
  193. #elif (defined(__AVR_ATxmega64A3U__) || defined(__AVR_ATxmega128A3U__) || \
  194. defined(__AVR_ATxmega192A3U__) || defined(__AVR_ATxmega256A3U__))
  195. #define USB_SERIES_A3U_XMEGA
  196. #define USB_CAN_BE_DEVICE
  197. #elif (defined(__AVR_ATxmega256A3BU__))
  198. #define USB_SERIES_A3BU_XMEGA
  199. #define USB_CAN_BE_DEVICE
  200. #elif (defined(__AVR_ATxmega16A4U__) || defined(__AVR_ATxmega32A4U__) || \
  201. defined(__AVR_ATxmega64A4U__) || defined(__AVR_ATxmega128A4U__))
  202. #define USB_SERIES_A4U_XMEGA
  203. #define USB_CAN_BE_DEVICE
  204. #elif (defined(__AVR_ATxmega128B1__) || defined(__AVR_ATxmega64B1__))
  205. #define USB_SERIES_B1_XMEGA
  206. #define USB_CAN_BE_DEVICE
  207. #elif (defined(__AVR_ATxmega128B3__) || defined(__AVR_ATxmega64B3__))
  208. #define USB_SERIES_B3_XMEGA
  209. #define USB_CAN_BE_DEVICE
  210. #elif (defined(__AVR_ATxmega128C3__) || defined(__AVR_ATxmega64C3__) || \
  211. defined(__AVR_ATxmega192C3__) || defined(__AVR_ATxmega256C3__) || \
  212. defined(__AVR_ATxmega384C3__))
  213. #define USB_SERIES_C3_XMEGA
  214. #define USB_CAN_BE_DEVICE
  215. #elif (defined(__AVR_ATxmega16C4__) || defined(__AVR_ATxmega32C4__))
  216. #define USB_SERIES_C4_XMEGA
  217. #define USB_CAN_BE_DEVICE
  218. #endif
  219. #if (defined(USB_HOST_ONLY) && defined(USB_DEVICE_ONLY))
  220. #error USB_HOST_ONLY and USB_DEVICE_ONLY are mutually exclusive.
  221. #elif defined(USB_HOST_ONLY)
  222. #if !defined(USB_CAN_BE_HOST)
  223. #error USB_HOST_ONLY is not available for the currently selected microcontroller model.
  224. #else
  225. #undef USB_CAN_BE_DEVICE
  226. #endif
  227. #elif defined(USB_DEVICE_ONLY)
  228. #if !defined(USB_CAN_BE_DEVICE)
  229. #error USB_DEVICE_ONLY is not available for the currently selected microcontroller model.
  230. #else
  231. #undef USB_CAN_BE_HOST
  232. #endif
  233. #endif
  234. #if (defined(USB_CAN_BE_DEVICE) && defined(USB_CAN_BE_HOST))
  235. #define USB_CAN_BE_BOTH
  236. #endif
  237. #if (!defined(USB_CAN_BE_DEVICE) && !defined(USB_CAN_BE_HOST))
  238. #error The currently selected device, USB mode or architecture is not supported.
  239. #endif
  240. #endif
  241. /* Disable C linkage for C++ Compilers: */
  242. #if defined(__cplusplus)
  243. }
  244. #endif
  245. #endif
  246. /** @} */