diff options
author | fauxpark <fauxpark@gmail.com> | 2020-12-18 02:15:28 +1100 |
---|---|---|
committer | fauxpark <fauxpark@gmail.com> | 2020-12-18 02:15:28 +1100 |
commit | 7797070b376ff18a5d540ccc2a95033fc548c611 (patch) | |
tree | e3092fed02c154ed104c5fa541a604c9ed8643cb /tmk_core/protocol | |
parent | 973057cfe4ac0ddc23b7ed1016245e6fc939c456 (diff) | |
parent | 6ea4b06f9fc19825605477cdc27f5bec0f3dc0a9 (diff) |
Merge remote-tracking branch 'upstream/master' into develop
Diffstat (limited to 'tmk_core/protocol')
-rw-r--r-- | tmk_core/protocol/arm_atsam/usb/udi_device_conf.h | 4 | ||||
-rw-r--r-- | tmk_core/protocol/arm_atsam/usb/udi_hid_kbd_desc.c | 4 | ||||
-rw-r--r-- | tmk_core/protocol/chibios/usb_main.c | 222 | ||||
-rw-r--r-- | tmk_core/protocol/usb_descriptor.h | 52 |
4 files changed, 141 insertions, 141 deletions
diff --git a/tmk_core/protocol/arm_atsam/usb/udi_device_conf.h b/tmk_core/protocol/arm_atsam/usb/udi_device_conf.h index 505db47b06..9c9d94789d 100644 --- a/tmk_core/protocol/arm_atsam/usb/udi_device_conf.h +++ b/tmk_core/protocol/arm_atsam/usb/udi_device_conf.h @@ -291,7 +291,7 @@ typedef struct { extern uint8_t udi_hid_kbd_report_set; // report buffer (to host) -# define UDI_HID_KBD_REPORT_SIZE 8 +#define UDI_HID_KBD_REPORT_SIZE 8 extern uint8_t udi_hid_kbd_report[UDI_HID_KBD_REPORT_SIZE]; COMPILER_PACK_RESET() @@ -784,7 +784,7 @@ COMPILER_PACK_RESET() COMPILER_PACK_SET(1) typedef struct { - usb_conf_desc_t conf; + usb_conf_desc_t conf; udi_hid_kbd_desc_t hid_kbd; #ifdef MOUSE_ENABLE udi_hid_mou_desc_t hid_mou; diff --git a/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd_desc.c b/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd_desc.c index a3fb46a3d4..814389b6e7 100644 --- a/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd_desc.c +++ b/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd_desc.c @@ -83,7 +83,7 @@ UDC_DESC_STORAGE usb_dev_desc_t udc_device_desc = {.bLength = sizeof(usb #ifdef USB_DEVICE_PRODUCT_NAME .iProduct = 2, #else - .iProduct = 0, // No product string + .iProduct = 0, // No product string #endif #if (defined USB_DEVICE_SERIAL_NAME || defined USB_DEVICE_GET_SERIAL_NAME_POINTER) .iSerialNumber = 3, @@ -120,7 +120,7 @@ UDC_DESC_STORAGE udc_desc_t udc_desc = { .conf.iConfiguration = 0, .conf.bmAttributes = /* USB_CONFIG_ATTR_MUST_SET | */ USB_DEVICE_ATTR, .conf.bMaxPower = USB_CONFIG_MAX_POWER(USB_DEVICE_POWER), - .hid_kbd = UDI_HID_KBD_DESC, + .hid_kbd = UDI_HID_KBD_DESC, #ifdef RAW_ENABLE .hid_raw = UDI_HID_RAW_DESC, #endif diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index 096e6e676e..9745d147c3 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -194,107 +194,107 @@ typedef struct { #if STM32_USB_USE_OTG1 /* 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) */ \ - }, \ - .int_ep_config = \ - { \ - USB_EP_MODE_TYPE_INTR, /* Interrupt EP */ \ - NULL, /* SETUP packet notification callback */ \ - qmkusbInterruptTransmitted, /* IN notification callback */ \ - NULL, /* OUT notification callback */ \ - CDC_NOTIFICATION_EPSIZE, /* IN maximum packet size */ \ - 0, /* OUT maximum packet size */ \ - NULL, /* IN Endpoint state */ \ - NULL, /* OUT endpoint state */ \ - 2, /* IN multiplier */ \ - NULL, /* SETUP buffer (not a SETUP endpoint) */ \ - }, \ - .config = { \ - .usbp = &USB_DRIVER, \ - .bulk_in = stream##_IN_EPNUM, \ - .bulk_out = stream##_OUT_EPNUM, \ - .int_in = notification, \ - .in_buffers = stream##_IN_CAPACITY, \ - .out_buffers = stream##_OUT_CAPACITY, \ - .in_size = stream##_EPSIZE, \ - .out_size = stream##_EPSIZE, \ - .fixed_size = fixedsize, \ - .ib = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_IN_CAPACITY, stream##_EPSIZE)]){}, \ - .ob = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_OUT_CAPACITY, stream##_EPSIZE)]){}, \ - } \ - } +# 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) */ \ + }, \ + .int_ep_config = \ + { \ + USB_EP_MODE_TYPE_INTR, /* Interrupt EP */ \ + NULL, /* SETUP packet notification callback */ \ + qmkusbInterruptTransmitted, /* IN notification callback */ \ + NULL, /* OUT notification callback */ \ + CDC_NOTIFICATION_EPSIZE, /* IN maximum packet size */ \ + 0, /* OUT maximum packet size */ \ + NULL, /* IN Endpoint state */ \ + NULL, /* OUT endpoint state */ \ + 2, /* IN multiplier */ \ + NULL, /* SETUP buffer (not a SETUP endpoint) */ \ + }, \ + .config = { \ + .usbp = &USB_DRIVER, \ + .bulk_in = stream##_IN_EPNUM, \ + .bulk_out = stream##_OUT_EPNUM, \ + .int_in = notification, \ + .in_buffers = stream##_IN_CAPACITY, \ + .out_buffers = stream##_OUT_CAPACITY, \ + .in_size = stream##_EPSIZE, \ + .out_size = stream##_EPSIZE, \ + .fixed_size = fixedsize, \ + .ib = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_IN_CAPACITY, stream##_EPSIZE)]){}, \ + .ob = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_OUT_CAPACITY, stream##_EPSIZE)]){}, \ + } \ + } #else /* 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, \ - .in_ep_config = \ - { \ - stream##_IN_MODE, /* Interrupt EP */ \ - NULL, /* SETUP packet notification callback */ \ - qmkusbDataTransmitted, /* IN notification callback */ \ - NULL, /* OUT notification callback */ \ - stream##_EPSIZE, /* IN maximum packet size */ \ - 0, /* OUT maximum packet size */ \ - NULL, /* IN Endpoint state */ \ - NULL, /* OUT endpoint state */ \ - 2, /* IN multiplier */ \ - NULL /* SETUP buffer (not a SETUP endpoint) */ \ - }, \ - .out_ep_config = \ - { \ - stream##_OUT_MODE, /* Interrupt EP */ \ - NULL, /* SETUP packet notification callback */ \ - NULL, /* IN notification callback */ \ - qmkusbDataReceived, /* OUT notification callback */ \ - 0, /* 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) */ \ - }, \ - .int_ep_config = \ - { \ - USB_EP_MODE_TYPE_INTR, /* Interrupt EP */ \ - NULL, /* SETUP packet notification callback */ \ - qmkusbInterruptTransmitted, /* IN notification callback */ \ - NULL, /* OUT notification callback */ \ - CDC_NOTIFICATION_EPSIZE, /* IN maximum packet size */ \ - 0, /* OUT maximum packet size */ \ - NULL, /* IN Endpoint state */ \ - NULL, /* OUT endpoint state */ \ - 2, /* IN multiplier */ \ - NULL, /* SETUP buffer (not a SETUP endpoint) */ \ - }, \ - .config = { \ - .usbp = &USB_DRIVER, \ - .bulk_in = stream##_IN_EPNUM, \ - .bulk_out = stream##_OUT_EPNUM, \ - .int_in = notification, \ - .in_buffers = stream##_IN_CAPACITY, \ - .out_buffers = stream##_OUT_CAPACITY, \ - .in_size = stream##_EPSIZE, \ - .out_size = stream##_EPSIZE, \ - .fixed_size = fixedsize, \ - .ib = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_IN_CAPACITY, stream##_EPSIZE)]){}, \ - .ob = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_OUT_CAPACITY, stream##_EPSIZE)]){}, \ - } \ - } +# define QMK_USB_DRIVER_CONFIG(stream, notification, fixedsize) \ + { \ + .queue_capacity_in = stream##_IN_CAPACITY, .queue_capacity_out = stream##_OUT_CAPACITY, \ + .in_ep_config = \ + { \ + stream##_IN_MODE, /* Interrupt EP */ \ + NULL, /* SETUP packet notification callback */ \ + qmkusbDataTransmitted, /* IN notification callback */ \ + NULL, /* OUT notification callback */ \ + stream##_EPSIZE, /* IN maximum packet size */ \ + 0, /* OUT maximum packet size */ \ + NULL, /* IN Endpoint state */ \ + NULL, /* OUT endpoint state */ \ + 2, /* IN multiplier */ \ + NULL /* SETUP buffer (not a SETUP endpoint) */ \ + }, \ + .out_ep_config = \ + { \ + stream##_OUT_MODE, /* Interrupt EP */ \ + NULL, /* SETUP packet notification callback */ \ + NULL, /* IN notification callback */ \ + qmkusbDataReceived, /* OUT notification callback */ \ + 0, /* 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) */ \ + }, \ + .int_ep_config = \ + { \ + USB_EP_MODE_TYPE_INTR, /* Interrupt EP */ \ + NULL, /* SETUP packet notification callback */ \ + qmkusbInterruptTransmitted, /* IN notification callback */ \ + NULL, /* OUT notification callback */ \ + CDC_NOTIFICATION_EPSIZE, /* IN maximum packet size */ \ + 0, /* OUT maximum packet size */ \ + NULL, /* IN Endpoint state */ \ + NULL, /* OUT endpoint state */ \ + 2, /* IN multiplier */ \ + NULL, /* SETUP buffer (not a SETUP endpoint) */ \ + }, \ + .config = { \ + .usbp = &USB_DRIVER, \ + .bulk_in = stream##_IN_EPNUM, \ + .bulk_out = stream##_OUT_EPNUM, \ + .int_in = notification, \ + .in_buffers = stream##_IN_CAPACITY, \ + .out_buffers = stream##_OUT_CAPACITY, \ + .in_size = stream##_EPSIZE, \ + .out_size = stream##_EPSIZE, \ + .fixed_size = fixedsize, \ + .ib = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_IN_CAPACITY, stream##_EPSIZE)]){}, \ + .ob = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_OUT_CAPACITY, stream##_EPSIZE)]){}, \ + } \ + } #endif typedef struct { @@ -388,12 +388,12 @@ 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 +#if STM32_USB_USE_OTG1 usbInitEndpointI(usbp, drivers.array[i].config.bulk_in, &drivers.array[i].inout_ep_config); - #else +#else usbInitEndpointI(usbp, drivers.array[i].config.bulk_in, &drivers.array[i].in_ep_config); usbInitEndpointI(usbp, drivers.array[i].config.bulk_out, &drivers.array[i].out_ep_config); - #endif +#endif if (drivers.array[i].config.int_in) { usbInitEndpointI(usbp, drivers.array[i].config.int_in, &drivers.array[i].int_ep_config); } @@ -544,7 +544,7 @@ static bool usb_request_hook_cb(USBDriver *usbp) { #ifdef NKRO_ENABLE keymap_config.nkro = !!keyboard_protocol; if (!keymap_config.nkro && keyboard_idle) { -#else /* NKRO_ENABLE */ +#else /* NKRO_ENABLE */ if (keyboard_idle) { #endif /* NKRO_ENABLE */ /* arm the idle timer if boot protocol & idle */ @@ -562,7 +562,7 @@ static bool usb_request_hook_cb(USBDriver *usbp) { /* arm the timer */ #ifdef NKRO_ENABLE if (!keymap_config.nkro && keyboard_idle) { -#else /* NKRO_ENABLE */ +#else /* NKRO_ENABLE */ if (keyboard_idle) { #endif /* NKRO_ENABLE */ osalSysLockFromISR(); @@ -618,21 +618,21 @@ static const USBConfig usbcfg = { */ void init_usb_driver(USBDriver *usbp) { for (int i = 0; i < NUM_USB_DRIVERS; i++) { - #if STM32_USB_USE_OTG1 +#if STM32_USB_USE_OTG1 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; drivers.array[i].int_ep_config.in_state = &drivers.array[i].int_ep_state; qmkusbObjectInit(driver, &drivers.array[i].config); qmkusbStart(driver, &drivers.array[i].config); - #else +#else QMKUSBDriver *driver = &drivers.array[i].driver; drivers.array[i].in_ep_config.in_state = &drivers.array[i].in_ep_state; drivers.array[i].out_ep_config.out_state = &drivers.array[i].out_ep_state; drivers.array[i].int_ep_config.in_state = &drivers.array[i].int_ep_state; qmkusbObjectInit(driver, &drivers.array[i].config); qmkusbStart(driver, &drivers.array[i].config); - #endif +#endif } /* @@ -689,7 +689,7 @@ static void keyboard_idle_timer_cb(void *arg) { #ifdef NKRO_ENABLE if (!keymap_config.nkro && keyboard_idle && keyboard_protocol) { -#else /* NKRO_ENABLE */ +#else /* NKRO_ENABLE */ if (keyboard_idle && keyboard_protocol) { #endif /* NKRO_ENABLE */ /* TODO: are we sure we want the KBD_ENDPOINT? */ @@ -738,7 +738,7 @@ void send_keyboard(report_keyboard_t *report) { usbStartTransmitI(&USB_DRIVER, SHARED_IN_EPNUM, (uint8_t *)report, sizeof(struct nkro_report)); } else #endif /* NKRO_ENABLE */ - { /* regular protocol */ + { /* regular protocol */ /* need to wait until the previous packet has made it through */ /* busy wait, should be short and not very common */ if (usbGetTransmitStatusI(&USB_DRIVER, KEYBOARD_IN_EPNUM)) { @@ -805,7 +805,7 @@ void send_mouse(report_mouse_t *report) { osalSysUnlock(); } -#else /* MOUSE_ENABLE */ +#else /* MOUSE_ENABLE */ void send_mouse(report_mouse_t *report) { (void)report; } #endif /* MOUSE_ENABLE */ @@ -885,7 +885,7 @@ void console_task(void) { } while (size > 0); } -#else /* CONSOLE_ENABLE */ +#else /* CONSOLE_ENABLE */ int8_t sendchar(uint8_t c) { (void)c; return 0; diff --git a/tmk_core/protocol/usb_descriptor.h b/tmk_core/protocol/usb_descriptor.h index 1b43cbf3b2..3a7c0bdbac 100644 --- a/tmk_core/protocol/usb_descriptor.h +++ b/tmk_core/protocol/usb_descriptor.h @@ -204,12 +204,12 @@ enum usb_endpoints { #endif #ifdef RAW_ENABLE - RAW_IN_EPNUM = NEXT_EPNUM, - #if STM32_USB_USE_OTG1 - #define RAW_OUT_EPNUM RAW_IN_EPNUM - #else + RAW_IN_EPNUM = NEXT_EPNUM, +# if STM32_USB_USE_OTG1 +# define RAW_OUT_EPNUM RAW_IN_EPNUM +# else RAW_OUT_EPNUM = NEXT_EPNUM, - #endif +# endif #endif #ifdef SHARED_EP_ENABLE @@ -220,44 +220,44 @@ enum usb_endpoints { CONSOLE_IN_EPNUM = NEXT_EPNUM, # ifdef PROTOCOL_CHIBIOS - // 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 - #define CONSOLE_OUT_EPNUM CONSOLE_IN_EPNUM - #else +// 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 +# define CONSOLE_OUT_EPNUM CONSOLE_IN_EPNUM +# else CONSOLE_OUT_EPNUM = NEXT_EPNUM, - #endif +# endif # else # define CONSOLE_OUT_EPNUM CONSOLE_IN_EPNUM # endif #endif #ifdef MIDI_ENABLE - MIDI_STREAM_IN_EPNUM = NEXT_EPNUM, - #if STM32_USB_USE_OTG1 - #define MIDI_STREAM_OUT_EPNUM MIDI_STREAM_IN_EPNUM - #else + MIDI_STREAM_IN_EPNUM = NEXT_EPNUM, +# if STM32_USB_USE_OTG1 +# define MIDI_STREAM_OUT_EPNUM MIDI_STREAM_IN_EPNUM +# else MIDI_STREAM_OUT_EPNUM = NEXT_EPNUM, - #endif +# endif #endif #ifdef VIRTSER_ENABLE CDC_NOTIFICATION_EPNUM = NEXT_EPNUM, CDC_IN_EPNUM = NEXT_EPNUM, - #if STM32_USB_USE_OTG1 - #define CDC_OUT_EPNUM CDC_IN_EPNUM - #else - CDC_OUT_EPNUM = NEXT_EPNUM, - #endif +# if STM32_USB_USE_OTG1 +# define CDC_OUT_EPNUM CDC_IN_EPNUM +# else + CDC_OUT_EPNUM = NEXT_EPNUM, +# endif #endif #ifdef JOYSTICK_ENABLE - JOYSTICK_IN_EPNUM = NEXT_EPNUM, - #if STM32_USB_USE_OTG1 + JOYSTICK_IN_EPNUM = NEXT_EPNUM, +# if STM32_USB_USE_OTG1 JOYSTICK_OUT_EPNUM = JOYSTICK_IN_EPNUM, - #else +# else JOYSTICK_OUT_EPNUM = NEXT_EPNUM, - #endif +# endif #endif }; |