~ruther/qmk_firmware

543f54a483842474d2333581597dd4691bb77fac — Nick Brassel 3 years ago 88cfd55
[Core] `STM32_USB_USE_OTG1` => `USB_ENDPOINTS_ARE_REORDERABLE` (#17647)

M builddefs/common_rules.mk => builddefs/common_rules.mk +1 -0
@@ 371,6 371,7 @@ show_path:
dump_vars: ERROR_IF_EMPTY=""
dump_vars: ERROR_IF_NONBOOL=""
dump_vars: ERROR_IF_UNSET=""
dump_vars: CATASTROPHIC_ERROR=""
dump_vars:
	@$(foreach V,$(sort $(.VARIABLES)),$(if $(filter-out environment% default automatic,$(origin $V)),$(info $V=$($V))))


M keyboards/gmmk/gmmk2/p96/ansi/keymaps/via/config.h => keyboards/gmmk/gmmk2/p96/ansi/keymaps/via/config.h +0 -1
@@ 19,4 19,3 @@
#include "config_common.h"

#define DYNAMIC_KEYMAP_LAYER_COUNT 3
#define STM32_USB_USE_OTG1 TRUE

M keyboards/gmmk/gmmk2/p96/iso/keymaps/via/config.h => keyboards/gmmk/gmmk2/p96/iso/keymaps/via/config.h +0 -1
@@ 19,4 19,3 @@
#include "config_common.h"

#define DYNAMIC_KEYMAP_LAYER_COUNT 3
#define STM32_USB_USE_OTG1 TRUE

M platforms/chibios/boards/GENERIC_WB32_F3G71XX/configs/config.h => platforms/chibios/boards/GENERIC_WB32_F3G71XX/configs/config.h +2 -0
@@ 18,3 18,5 @@
#ifndef EARLY_INIT_PERFORM_BOOTLOADER_JUMP
#    define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE
#endif

#define USB_ENDPOINTS_ARE_REORDERABLE

M tmk_core/protocol/chibios/usb_main.c => tmk_core/protocol/chibios/usb_main.c +14 -16
@@ 177,7 177,7 @@ static const USBEndpointConfig shared_ep_config = {
};
#endif

#if STM32_USB_USE_OTG1
#ifdef USB_ENDPOINTS_ARE_REORDERABLE
typedef struct {
    size_t              queue_capacity_in;
    size_t              queue_capacity_out;


@@ 204,23 204,22 @@ typedef struct {
} usb_driver_config_t;
#endif

#if STM32_USB_USE_OTG1
#ifdef USB_ENDPOINTS_ARE_REORDERABLE
/* Reusable initialization structure - see USBEndpointConfig comment at top of file */
#    define QMK_USB_DRIVER_CONFIG(stream, notification, fixedsize)                                                              \
        {                                                                                                                       \
            .queue_capacity_in = stream##_IN_CAPACITY, .queue_capacity_out = stream##_OUT_CAPACITY,                             \
            .inout_ep_config =                                                                                                  \
                {                                                                                                               \
                    stream##_IN_MODE,      /* Interrupt EP */                                                                   \
                    NULL,                  /* SETUP packet notification callback */                                             \
                    qmkusbDataTransmitted, /* IN notification callback */                                                       \
                    qmkusbDataReceived,    /* OUT notification callback */                                                      \
                    stream##_EPSIZE,       /* IN maximum packet size */                                                         \
                    stream##_EPSIZE,       /* OUT maximum packet size */                                                        \
                    NULL,                  /* IN Endpoint state */                                                              \
                    NULL,                  /* OUT endpoint state */                                                             \
                    2,                     /* IN multiplier */                                                                  \
                    NULL                   /* SETUP buffer (not a SETUP endpoint) */                                            \
                    stream##_IN_MODE,       /* Interrupt EP */                                                                  \
                    NULL,                   /* SETUP packet notification callback */                                            \
                    qmkusbDataTransmitted,  /* IN notification callback */                                                      \
                    qmkusbDataReceived,     /* OUT notification callback */                                                     \
                    stream##_EPSIZE,        /* IN maximum packet size */                                                        \
                    stream##_EPSIZE,        /* OUT maximum packet size */                                                       \
                    NULL,                   /* IN Endpoint state */                                                             \
                    NULL,                   /* OUT endpoint state */                                                            \
                    usb_lld_endpoint_fields /* USB driver specific endpoint fields */                                           \
                },                                                                                                              \
            .int_ep_config =                                                                                                    \
                {                                                                                                               \


@@ 232,8 231,7 @@ typedef struct {
                    0,                          /* OUT maximum packet size */                                                   \
                    NULL,                       /* IN Endpoint state */                                                         \
                    NULL,                       /* OUT endpoint state */                                                        \
                    2,                          /* IN multiplier */                                                             \
                    NULL,                       /* SETUP buffer (not a SETUP endpoint) */                                       \
                    usb_lld_endpoint_fields     /* USB driver specific endpoint fields */                                       \
                },                                                                                                              \
            .config = {                                                                                                         \
                .usbp        = &USB_DRIVER,                                                                                     \


@@ 490,7 488,7 @@ static void usb_event_cb(USBDriver *usbp, usbevent_t event) {
            usbInitEndpointI(usbp, SHARED_IN_EPNUM, &shared_ep_config);
#endif
            for (int i = 0; i < NUM_USB_DRIVERS; i++) {
#if STM32_USB_USE_OTG1
#ifdef USB_ENDPOINTS_ARE_REORDERABLE
                usbInitEndpointI(usbp, drivers.array[i].config.bulk_in, &drivers.array[i].inout_ep_config);
#else
                usbInitEndpointI(usbp, drivers.array[i].config.bulk_in, &drivers.array[i].in_ep_config);


@@ 717,7 715,7 @@ static const USBConfig usbcfg = {
 */
void init_usb_driver(USBDriver *usbp) {
    for (int i = 0; i < NUM_USB_DRIVERS; i++) {
#if STM32_USB_USE_OTG1
#ifdef USB_ENDPOINTS_ARE_REORDERABLE
        QMKUSBDriver *driver                       = &drivers.array[i].driver;
        drivers.array[i].inout_ep_config.in_state  = &drivers.array[i].in_ep_state;
        drivers.array[i].inout_ep_config.out_state = &drivers.array[i].out_ep_state;

M tmk_core/protocol/usb_descriptor.h => tmk_core/protocol/usb_descriptor.h +9 -6
@@ 47,6 47,9 @@

#ifdef PROTOCOL_CHIBIOS
#    include <hal.h>
#    if STM32_USB_USE_OTG1 == TRUE
#        define USB_ENDPOINTS_ARE_REORDERABLE
#    endif
#endif

/*


@@ 216,7 219,7 @@ enum usb_endpoints {

#ifdef RAW_ENABLE
    RAW_IN_EPNUM = NEXT_EPNUM,
#    if STM32_USB_USE_OTG1
#    ifdef USB_ENDPOINTS_ARE_REORDERABLE
#        define RAW_OUT_EPNUM RAW_IN_EPNUM
#    else
    RAW_OUT_EPNUM         = NEXT_EPNUM,


@@ 234,7 237,7 @@ enum usb_endpoints {
// ChibiOS has enough memory and descriptor to actually enable the endpoint
// It could use the same endpoint numbers, as that's supported by ChibiOS
// But the QMK code currently assumes that the endpoint numbers are different
#        if STM32_USB_USE_OTG1
#        ifdef USB_ENDPOINTS_ARE_REORDERABLE
#            define CONSOLE_OUT_EPNUM CONSOLE_IN_EPNUM
#        else
    CONSOLE_OUT_EPNUM   = NEXT_EPNUM,


@@ 246,7 249,7 @@ enum usb_endpoints {

#ifdef MIDI_ENABLE
    MIDI_STREAM_IN_EPNUM = NEXT_EPNUM,
#    if STM32_USB_USE_OTG1
#    ifdef USB_ENDPOINTS_ARE_REORDERABLE
#        define MIDI_STREAM_OUT_EPNUM MIDI_STREAM_IN_EPNUM
#    else
    MIDI_STREAM_OUT_EPNUM = NEXT_EPNUM,


@@ 256,7 259,7 @@ enum usb_endpoints {
#ifdef VIRTSER_ENABLE
    CDC_NOTIFICATION_EPNUM = NEXT_EPNUM,
    CDC_IN_EPNUM           = NEXT_EPNUM,
#    if STM32_USB_USE_OTG1
#    ifdef USB_ENDPOINTS_ARE_REORDERABLE
#        define CDC_OUT_EPNUM CDC_IN_EPNUM
#    else
    CDC_OUT_EPNUM         = NEXT_EPNUM,


@@ 264,7 267,7 @@ enum usb_endpoints {
#endif
#ifdef JOYSTICK_ENABLE
    JOYSTICK_IN_EPNUM = NEXT_EPNUM,
#    if STM32_USB_USE_OTG1
#    ifdef USB_ENDPOINTS_ARE_REORDERABLE
    JOYSTICK_OUT_EPNUM = JOYSTICK_IN_EPNUM,
#    else
    JOYSTICK_OUT_EPNUM    = NEXT_EPNUM,


@@ 274,7 277,7 @@ enum usb_endpoints {
#ifdef DIGITIZER_ENABLE
#    if !defined(DIGITIZER_SHARED_EP)
    DIGITIZER_IN_EPNUM = NEXT_EPNUM,
#        if STM32_USB_USE_OTG1
#        ifdef USB_ENDPOINTS_ARE_REORDERABLE
    DIGITIZER_OUT_EPNUM = DIGITIZER_IN_EPNUM,
#        else
    DIGITIZER_OUT_EPNUM = NEXT_EPNUM,