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.

Endpoint.h 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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 Endpoint definitions for all architectures.
  28. * \copydetails Group_EndpointManagement
  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_EndpointManagement
  34. * \defgroup Group_EndpointRW Endpoint Data Reading and Writing
  35. * \brief Endpoint data read/write definitions.
  36. *
  37. * Functions, macros, variables, enums and types related to data reading and writing from and to endpoints.
  38. */
  39. /** \ingroup Group_EndpointRW
  40. * \defgroup Group_EndpointPrimitiveRW Read/Write of Primitive Data Types
  41. * \brief Endpoint data primitive read/write definitions.
  42. *
  43. * Functions, macros, variables, enums and types related to data reading and writing of primitive data types
  44. * from and to endpoints.
  45. */
  46. /** \ingroup Group_EndpointManagement
  47. * \defgroup Group_EndpointPacketManagement Endpoint Packet Management
  48. * \brief USB Endpoint package management definitions.
  49. *
  50. * Functions, macros, variables, enums and types related to packet management of endpoints.
  51. */
  52. /** \ingroup Group_USB
  53. * \defgroup Group_EndpointManagement Endpoint Management
  54. * \brief Endpoint management definitions.
  55. *
  56. * Functions, macros and enums related to endpoint management when in USB Device mode. This
  57. * module contains the endpoint management macros, as well as endpoint interrupt and data
  58. * send/receive functions for various data types.
  59. *
  60. * @{
  61. */
  62. #ifndef __ENDPOINT_H__
  63. #define __ENDPOINT_H__
  64. /* Includes: */
  65. #include "../../../Common/Common.h"
  66. #include "USBMode.h"
  67. /* Enable C linkage for C++ Compilers: */
  68. #if defined(__cplusplus)
  69. extern "C" {
  70. #endif
  71. /* Preprocessor Checks: */
  72. #if !defined(__INCLUDE_FROM_USB_DRIVER)
  73. #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
  74. #endif
  75. /* Public Interface - May be used in end-application: */
  76. /* Type Defines: */
  77. /** Type define for a endpoint table entry, used to configure endpoints in groups via
  78. * \ref Endpoint_ConfigureEndpointTable().
  79. */
  80. typedef struct
  81. {
  82. uint8_t Address; /**< Address of the endpoint to configure, or zero if the table entry is to be unused. */
  83. uint16_t Size; /**< Size of the endpoint bank, in bytes. */
  84. uint8_t Type; /**< Type of the endpoint, a \c EP_TYPE_* mask. */
  85. uint8_t Banks; /**< Number of hardware banks to use for the endpoint. */
  86. } USB_Endpoint_Table_t;
  87. /* Macros: */
  88. /** Endpoint number mask, for masking against endpoint addresses to retrieve the endpoint's
  89. * numerical address in the device.
  90. */
  91. #define ENDPOINT_EPNUM_MASK 0x0F
  92. /** Endpoint address for the default control endpoint, which always resides in address 0. This is
  93. * defined for convenience to give more readable code when used with the endpoint macros.
  94. */
  95. #define ENDPOINT_CONTROLEP 0
  96. /* Architecture Includes: */
  97. #if (ARCH == ARCH_AVR8)
  98. #include "AVR8/Endpoint_AVR8.h"
  99. #elif (ARCH == ARCH_UC3)
  100. #include "UC3/Endpoint_UC3.h"
  101. #elif (ARCH == ARCH_XMEGA)
  102. #include "XMEGA/Endpoint_XMEGA.h"
  103. #endif
  104. /* Disable C linkage for C++ Compilers: */
  105. #if defined(__cplusplus)
  106. }
  107. #endif
  108. #endif
  109. /** @} */