logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

usb_endpoints.h (3458B)


  1. // Copyright 2023 Stefan Kerkmann (@KarlK90)
  2. // SPDX-License-Identifier: GPL-3.0-or-later
  3. #pragma once
  4. #include "usb_descriptor.h"
  5. #if !defined(USB_DEFAULT_BUFFER_CAPACITY)
  6. # define USB_DEFAULT_BUFFER_CAPACITY 4
  7. #endif
  8. #if !defined(KEYBOARD_IN_CAPACITY)
  9. # define KEYBOARD_IN_CAPACITY USB_DEFAULT_BUFFER_CAPACITY
  10. #endif
  11. #if !defined(SHARED_IN_CAPACITY)
  12. # define SHARED_IN_CAPACITY USB_DEFAULT_BUFFER_CAPACITY
  13. #endif
  14. #if !defined(MOUSE_IN_CAPACITY)
  15. # define MOUSE_IN_CAPACITY USB_DEFAULT_BUFFER_CAPACITY
  16. #endif
  17. #if !defined(JOYSTICK_IN_CAPACITY)
  18. # define JOYSTICK_IN_CAPACITY USB_DEFAULT_BUFFER_CAPACITY
  19. #endif
  20. #if !defined(DIGITIZER_IN_CAPACITY)
  21. # define DIGITIZER_IN_CAPACITY USB_DEFAULT_BUFFER_CAPACITY
  22. #endif
  23. #if !defined(CONSOLE_IN_CAPACITY)
  24. # define CONSOLE_IN_CAPACITY USB_DEFAULT_BUFFER_CAPACITY
  25. #endif
  26. #if !defined(CONSOLE_OUT_CAPACITY)
  27. # define CONSOLE_OUT_CAPACITY USB_DEFAULT_BUFFER_CAPACITY
  28. #endif
  29. #if !defined(RAW_IN_CAPACITY)
  30. # define RAW_IN_CAPACITY USB_DEFAULT_BUFFER_CAPACITY
  31. #endif
  32. #if !defined(RAW_OUT_CAPACITY)
  33. # define RAW_OUT_CAPACITY USB_DEFAULT_BUFFER_CAPACITY
  34. #endif
  35. #if !defined(MIDI_STREAM_IN_CAPACITY)
  36. # define MIDI_STREAM_IN_CAPACITY USB_DEFAULT_BUFFER_CAPACITY
  37. #endif
  38. #if !defined(MIDI_STREAM_OUT_CAPACITY)
  39. # define MIDI_STREAM_OUT_CAPACITY USB_DEFAULT_BUFFER_CAPACITY
  40. #endif
  41. #if !defined(CDC_IN_CAPACITY)
  42. # define CDC_IN_CAPACITY USB_DEFAULT_BUFFER_CAPACITY
  43. #endif
  44. #if !defined(CDC_OUT_CAPACITY)
  45. # define CDC_OUT_CAPACITY USB_DEFAULT_BUFFER_CAPACITY
  46. #endif
  47. #define CDC_SIGNALING_DUMMY_CAPACITY 1
  48. typedef enum {
  49. #if defined(SHARED_EP_ENABLE)
  50. USB_ENDPOINT_IN_SHARED,
  51. #endif
  52. #if !defined(KEYBOARD_SHARED_EP)
  53. USB_ENDPOINT_IN_KEYBOARD,
  54. #endif
  55. #if defined(MOUSE_ENABLE) && !defined(MOUSE_SHARED_EP)
  56. USB_ENDPOINT_IN_MOUSE,
  57. #endif
  58. #if defined(JOYSTICK_ENABLE) && !defined(JOYSTICK_SHARED_EP)
  59. USB_ENDPOINT_IN_JOYSTICK,
  60. #endif
  61. #if defined(DIGITIZER_ENABLE) && !defined(DIGITIZER_SHARED_EP)
  62. USB_ENDPOINT_IN_DIGITIZER,
  63. #endif
  64. #if defined(CONSOLE_ENABLE)
  65. USB_ENDPOINT_IN_CONSOLE,
  66. #endif
  67. #if defined(RAW_ENABLE)
  68. USB_ENDPOINT_IN_RAW,
  69. #endif
  70. #if defined(MIDI_ENABLE)
  71. USB_ENDPOINT_IN_MIDI,
  72. #endif
  73. #if defined(VIRTSER_ENABLE)
  74. USB_ENDPOINT_IN_CDC_DATA,
  75. USB_ENDPOINT_IN_CDC_SIGNALING,
  76. #endif
  77. USB_ENDPOINT_IN_COUNT,
  78. /* All non shared endpoints have to be consequtive numbers starting from 0, so
  79. * that they can be used as array indices. The shared endpoints all point to
  80. * the same endpoint so they have to be defined last to not reset the enum
  81. * counter. */
  82. #if defined(SHARED_EP_ENABLE)
  83. # if defined(KEYBOARD_SHARED_EP)
  84. USB_ENDPOINT_IN_KEYBOARD = USB_ENDPOINT_IN_SHARED,
  85. # endif
  86. # if defined(MOUSE_SHARED_EP)
  87. USB_ENDPOINT_IN_MOUSE = USB_ENDPOINT_IN_SHARED,
  88. # endif
  89. # if defined(JOYSTICK_SHARED_EP)
  90. USB_ENDPOINT_IN_JOYSTICK = USB_ENDPOINT_IN_SHARED,
  91. # endif
  92. # if defined(DIGITIZER_SHARED_EP)
  93. USB_ENDPOINT_IN_DIGITIZER = USB_ENDPOINT_IN_SHARED,
  94. # endif
  95. #endif
  96. } usb_endpoint_in_lut_t;
  97. #define IS_VALID_USB_ENDPOINT_IN_LUT(i) ((i) >= 0 && (i) < USB_ENDPOINT_IN_COUNT)
  98. extern usb_endpoint_in_lut_t usb_endpoint_interface_lut[TOTAL_INTERFACES];
  99. typedef enum {
  100. #if defined(RAW_ENABLE)
  101. USB_ENDPOINT_OUT_RAW,
  102. #endif
  103. #if defined(MIDI_ENABLE)
  104. USB_ENDPOINT_OUT_MIDI,
  105. #endif
  106. #if defined(VIRTSER_ENABLE)
  107. USB_ENDPOINT_OUT_CDC_DATA,
  108. #endif
  109. USB_ENDPOINT_OUT_COUNT,
  110. } usb_endpoint_out_lut_t;