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.

Pipe.h 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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 Pipe definitions for all architectures.
  28. * \copydetails Group_PipeManagement
  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_PipeManagement
  34. * \defgroup Group_PipeRW Pipe Data Reading and Writing
  35. * \brief Pipe data read/write definitions.
  36. *
  37. * Functions, macros, variables, enums and types related to data reading and writing from and to pipes.
  38. */
  39. /** \ingroup Group_PipeRW
  40. * \defgroup Group_PipePrimitiveRW Read/Write of Primitive Data Types
  41. * \brief Pipe 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 pipes.
  45. */
  46. /** \ingroup Group_PipeManagement
  47. * \defgroup Group_PipePacketManagement Pipe Packet Management
  48. * \brief Pipe packet management definitions.
  49. *
  50. * Functions, macros, variables, enums and types related to packet management of pipes.
  51. */
  52. /** \ingroup Group_PipeManagement
  53. * \defgroup Group_PipeControlReq Pipe Control Request Management
  54. * \brief Pipe control request definitions.
  55. *
  56. * Module for host mode request processing. This module allows for the transmission of standard, class and
  57. * vendor control requests to the default control endpoint of an attached device while in host mode.
  58. *
  59. * \see Chapter 9 of the USB 2.0 specification.
  60. */
  61. /** \ingroup Group_USB
  62. * \defgroup Group_PipeManagement Pipe Management
  63. * \brief Pipe management definitions.
  64. *
  65. * This module contains functions, macros and enums related to pipe management when in USB Host mode. This
  66. * module contains the pipe management macros, as well as pipe interrupt and data send/receive functions
  67. * for various data types.
  68. *
  69. * @{
  70. */
  71. #ifndef __PIPE_H__
  72. #define __PIPE_H__
  73. /* Includes: */
  74. #include "../../../Common/Common.h"
  75. #include "USBMode.h"
  76. /* Enable C linkage for C++ Compilers: */
  77. #if defined(__cplusplus)
  78. extern "C" {
  79. #endif
  80. /* Preprocessor Checks: */
  81. #if !defined(__INCLUDE_FROM_USB_DRIVER)
  82. #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
  83. #endif
  84. /* Public Interface - May be used in end-application: */
  85. /* Type Defines: */
  86. /** Type define for a pipe table entry, used to configure pipes in groups via
  87. * \ref Pipe_ConfigurePipeTable().
  88. */
  89. typedef struct
  90. {
  91. uint8_t Address; /**< Address of the pipe to configure, or zero if the table entry is to be unused. */
  92. uint16_t Size; /**< Size of the pipe bank, in bytes. */
  93. uint8_t EndpointAddress; /**< Address of the endpoint in the connected device. */
  94. uint8_t Type; /**< Type of the endpoint, a \c EP_TYPE_* mask. */
  95. uint8_t Banks; /**< Number of hardware banks to use for the pipe. */
  96. } USB_Pipe_Table_t;
  97. /* Macros: */
  98. /** Pipe address for the default control pipe, which always resides in address 0. This is
  99. * defined for convenience to give more readable code when used with the pipe macros.
  100. */
  101. #define PIPE_CONTROLPIPE 0
  102. /** Pipe number mask, for masking against pipe addresses to retrieve the pipe's numerical address
  103. * in the device.
  104. */
  105. #define PIPE_PIPENUM_MASK 0x0F
  106. /** Endpoint number mask, for masking against endpoint addresses to retrieve the endpoint's
  107. * numerical address in the attached device.
  108. */
  109. #define PIPE_EPNUM_MASK 0x0F
  110. /* Architecture Includes: */
  111. #if (ARCH == ARCH_AVR8)
  112. #include "AVR8/Pipe_AVR8.h"
  113. #elif (ARCH == ARCH_UC3)
  114. #include "UC3/Pipe_UC3.h"
  115. #endif
  116. /* Disable C linkage for C++ Compilers: */
  117. #if defined(__cplusplus)
  118. }
  119. #endif
  120. #endif
  121. /** @} */