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.

EndpointStream.h 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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 Endpoint data stream transmission and reception management.
  28. * \copydetails Group_EndpointStreamRW
  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_EndpointRW
  34. * \defgroup Group_EndpointStreamRW Read/Write of Multi-Byte Streams
  35. * \brief Endpoint data stream transmission and reception management.
  36. *
  37. * Functions, macros, variables, enums and types related to data reading and writing of data streams from
  38. * and to endpoints.
  39. *
  40. * @{
  41. */
  42. #ifndef __ENDPOINT_STREAM_H__
  43. #define __ENDPOINT_STREAM_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 possible error return codes of the \c Endpoint_*_Stream_* functions. */
  58. enum Endpoint_Stream_RW_ErrorCodes_t
  59. {
  60. ENDPOINT_RWSTREAM_NoError = 0, /**< Command completed successfully, no error. */
  61. ENDPOINT_RWSTREAM_EndpointStalled = 1, /**< The endpoint was stalled during the stream
  62. * transfer by the host or device.
  63. */
  64. ENDPOINT_RWSTREAM_DeviceDisconnected = 2, /**< Device was disconnected from the host during
  65. * the transfer.
  66. */
  67. ENDPOINT_RWSTREAM_BusSuspended = 3, /**< The USB bus has been suspended by the host and
  68. * no USB endpoint traffic can occur until the bus
  69. * has resumed.
  70. */
  71. ENDPOINT_RWSTREAM_Timeout = 4, /**< The host failed to accept or send the next packet
  72. * within the software timeout period set by the
  73. * \ref USB_STREAM_TIMEOUT_MS macro.
  74. */
  75. ENDPOINT_RWSTREAM_IncompleteTransfer = 5, /**< Indicates that the endpoint bank became full or empty before
  76. * the complete contents of the current stream could be
  77. * transferred. The endpoint stream function should be called
  78. * again to process the next chunk of data in the transfer.
  79. */
  80. };
  81. /** Enum for the possible error return codes of the \c Endpoint_*_Control_Stream_* functions. */
  82. enum Endpoint_ControlStream_RW_ErrorCodes_t
  83. {
  84. ENDPOINT_RWCSTREAM_NoError = 0, /**< Command completed successfully, no error. */
  85. ENDPOINT_RWCSTREAM_HostAborted = 1, /**< The aborted the transfer prematurely. */
  86. ENDPOINT_RWCSTREAM_DeviceDisconnected = 2, /**< Device was disconnected from the host during
  87. * the transfer.
  88. */
  89. ENDPOINT_RWCSTREAM_BusSuspended = 3, /**< The USB bus has been suspended by the host and
  90. * no USB endpoint traffic can occur until the bus
  91. * has resumed.
  92. */
  93. };
  94. /* Architecture Includes: */
  95. #if (ARCH == ARCH_AVR8)
  96. #include "AVR8/EndpointStream_AVR8.h"
  97. #elif (ARCH == ARCH_UC3)
  98. #include "UC3/EndpointStream_UC3.h"
  99. #elif (ARCH == ARCH_XMEGA)
  100. #include "XMEGA/EndpointStream_XMEGA.h"
  101. #endif
  102. /* Disable C linkage for C++ Compilers: */
  103. #if defined(__cplusplus)
  104. }
  105. #endif
  106. #endif
  107. /** @} */