| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- // Copyright 2023 Stefan Kerkmann (@KarlK90)
- // SPDX-License-Identifier: GPL-3.0-or-later
- #pragma once
- #include "usb_descriptor.h"
- #if !defined(USB_DEFAULT_BUFFER_CAPACITY)
- # define USB_DEFAULT_BUFFER_CAPACITY 4
- #endif
- #if !defined(KEYBOARD_IN_CAPACITY)
- # define KEYBOARD_IN_CAPACITY USB_DEFAULT_BUFFER_CAPACITY
- #endif
- #if !defined(SHARED_IN_CAPACITY)
- # define SHARED_IN_CAPACITY USB_DEFAULT_BUFFER_CAPACITY
- #endif
- #if !defined(MOUSE_IN_CAPACITY)
- # define MOUSE_IN_CAPACITY USB_DEFAULT_BUFFER_CAPACITY
- #endif
- #if !defined(JOYSTICK_IN_CAPACITY)
- # define JOYSTICK_IN_CAPACITY USB_DEFAULT_BUFFER_CAPACITY
- #endif
- #if !defined(DIGITIZER_IN_CAPACITY)
- # define DIGITIZER_IN_CAPACITY USB_DEFAULT_BUFFER_CAPACITY
- #endif
- #if !defined(CONSOLE_IN_CAPACITY)
- # define CONSOLE_IN_CAPACITY USB_DEFAULT_BUFFER_CAPACITY
- #endif
- #if !defined(CONSOLE_OUT_CAPACITY)
- # define CONSOLE_OUT_CAPACITY USB_DEFAULT_BUFFER_CAPACITY
- #endif
- #if !defined(RAW_IN_CAPACITY)
- # define RAW_IN_CAPACITY USB_DEFAULT_BUFFER_CAPACITY
- #endif
- #if !defined(RAW_OUT_CAPACITY)
- # define RAW_OUT_CAPACITY USB_DEFAULT_BUFFER_CAPACITY
- #endif
- #if !defined(PLOVER_HID_IN_CAPACITY)
- # define PLOVER_HID_IN_CAPACITY USB_DEFAULT_BUFFER_CAPACITY
- #endif
- #if !defined(MIDI_STREAM_IN_CAPACITY)
- # define MIDI_STREAM_IN_CAPACITY USB_DEFAULT_BUFFER_CAPACITY
- #endif
- #if !defined(MIDI_STREAM_OUT_CAPACITY)
- # define MIDI_STREAM_OUT_CAPACITY USB_DEFAULT_BUFFER_CAPACITY
- #endif
- #if !defined(CDC_IN_CAPACITY)
- # define CDC_IN_CAPACITY USB_DEFAULT_BUFFER_CAPACITY
- #endif
- #if !defined(CDC_OUT_CAPACITY)
- # define CDC_OUT_CAPACITY USB_DEFAULT_BUFFER_CAPACITY
- #endif
- #define CDC_SIGNALING_DUMMY_CAPACITY 1
- typedef enum {
- #if defined(SHARED_EP_ENABLE)
- USB_ENDPOINT_IN_SHARED,
- #endif
- #if !defined(KEYBOARD_SHARED_EP)
- USB_ENDPOINT_IN_KEYBOARD,
- #endif
- #if defined(MOUSE_ENABLE) && !defined(MOUSE_SHARED_EP)
- USB_ENDPOINT_IN_MOUSE,
- #endif
- #if defined(JOYSTICK_ENABLE) && !defined(JOYSTICK_SHARED_EP)
- USB_ENDPOINT_IN_JOYSTICK,
- #endif
- #if defined(DIGITIZER_ENABLE) && !defined(DIGITIZER_SHARED_EP)
- USB_ENDPOINT_IN_DIGITIZER,
- #endif
- #if defined(CONSOLE_ENABLE)
- USB_ENDPOINT_IN_CONSOLE,
- #endif
- #if defined(RAW_ENABLE)
- USB_ENDPOINT_IN_RAW,
- #endif
- #if defined(PLOVER_HID_ENABLE)
- USB_ENDPOINT_IN_PLOVER_HID,
- #endif
- #if defined(MIDI_ENABLE)
- USB_ENDPOINT_IN_MIDI,
- #endif
- #if defined(VIRTSER_ENABLE)
- USB_ENDPOINT_IN_CDC_DATA,
- USB_ENDPOINT_IN_CDC_SIGNALING,
- #endif
- USB_ENDPOINT_IN_COUNT,
- /* All non shared endpoints have to be consequtive numbers starting from 0, so
- * that they can be used as array indices. The shared endpoints all point to
- * the same endpoint so they have to be defined last to not reset the enum
- * counter. */
- #if defined(SHARED_EP_ENABLE)
- # if defined(KEYBOARD_SHARED_EP)
- USB_ENDPOINT_IN_KEYBOARD = USB_ENDPOINT_IN_SHARED,
- # endif
- # if defined(MOUSE_SHARED_EP)
- USB_ENDPOINT_IN_MOUSE = USB_ENDPOINT_IN_SHARED,
- # endif
- # if defined(JOYSTICK_SHARED_EP)
- USB_ENDPOINT_IN_JOYSTICK = USB_ENDPOINT_IN_SHARED,
- # endif
- # if defined(DIGITIZER_SHARED_EP)
- USB_ENDPOINT_IN_DIGITIZER = USB_ENDPOINT_IN_SHARED,
- # endif
- #endif
- } usb_endpoint_in_lut_t;
- #define IS_VALID_USB_ENDPOINT_IN_LUT(i) ((i) >= 0 && (i) < USB_ENDPOINT_IN_COUNT)
- extern usb_endpoint_in_lut_t usb_endpoint_interface_lut[TOTAL_INTERFACES];
- typedef enum {
- #if defined(RAW_ENABLE)
- USB_ENDPOINT_OUT_RAW,
- #endif
- #if defined(MIDI_ENABLE)
- USB_ENDPOINT_OUT_MIDI,
- #endif
- #if defined(VIRTSER_ENABLE)
- USB_ENDPOINT_OUT_CDC_DATA,
- #endif
- USB_ENDPOINT_OUT_COUNT,
- } usb_endpoint_out_lut_t;
|