diff options
| author | Ryan <fauxpark@gmail.com> | 2020-12-18 01:06:30 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-17 14:06:30 +0000 |
| commit | 6ea4b06f9fc19825605477cdc27f5bec0f3dc0a9 (patch) | |
| tree | a5266a6ea24a9dfa1627c0273a24198c5a436b3a /tmk_core/protocol/chibios | |
| parent | d9dcb716bfa9eef32560a95ecb50274a0f2b170c (diff) | |
| download | qmk_firmware-6ea4b06f9fc19825605477cdc27f5bec0f3dc0a9.tar.gz qmk_firmware-6ea4b06f9fc19825605477cdc27f5bec0f3dc0a9.zip | |
Run cformat and dos2unix manually (#11235)
Diffstat (limited to 'tmk_core/protocol/chibios')
| -rw-r--r-- | tmk_core/protocol/chibios/usb_main.c | 222 |
1 files changed, 111 insertions, 111 deletions
diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index 096e6e676..9745d147c 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c | |||
| @@ -194,107 +194,107 @@ typedef struct { | |||
| 194 | 194 | ||
| 195 | #if STM32_USB_USE_OTG1 | 195 | #if STM32_USB_USE_OTG1 |
| 196 | /* Reusable initialization structure - see USBEndpointConfig comment at top of file */ | 196 | /* Reusable initialization structure - see USBEndpointConfig comment at top of file */ |
| 197 | #define QMK_USB_DRIVER_CONFIG(stream, notification, fixedsize) \ | 197 | # define QMK_USB_DRIVER_CONFIG(stream, notification, fixedsize) \ |
| 198 | { \ | 198 | { \ |
| 199 | .queue_capacity_in = stream##_IN_CAPACITY, .queue_capacity_out = stream##_OUT_CAPACITY, \ | 199 | .queue_capacity_in = stream##_IN_CAPACITY, .queue_capacity_out = stream##_OUT_CAPACITY, \ |
| 200 | .inout_ep_config = \ | 200 | .inout_ep_config = \ |
| 201 | { \ | 201 | { \ |
| 202 | stream##_IN_MODE, /* Interrupt EP */ \ | 202 | stream##_IN_MODE, /* Interrupt EP */ \ |
| 203 | NULL, /* SETUP packet notification callback */ \ | 203 | NULL, /* SETUP packet notification callback */ \ |
| 204 | qmkusbDataTransmitted, /* IN notification callback */ \ | 204 | qmkusbDataTransmitted, /* IN notification callback */ \ |
| 205 | qmkusbDataReceived, /* OUT notification callback */ \ | 205 | qmkusbDataReceived, /* OUT notification callback */ \ |
| 206 | stream##_EPSIZE, /* IN maximum packet size */ \ | 206 | stream##_EPSIZE, /* IN maximum packet size */ \ |
| 207 | stream##_EPSIZE, /* OUT maximum packet size */ \ | 207 | stream##_EPSIZE, /* OUT maximum packet size */ \ |
| 208 | NULL, /* IN Endpoint state */ \ | 208 | NULL, /* IN Endpoint state */ \ |
| 209 | NULL, /* OUT endpoint state */ \ | 209 | NULL, /* OUT endpoint state */ \ |
| 210 | 2, /* IN multiplier */ \ | 210 | 2, /* IN multiplier */ \ |
| 211 | NULL /* SETUP buffer (not a SETUP endpoint) */ \ | 211 | NULL /* SETUP buffer (not a SETUP endpoint) */ \ |
| 212 | }, \ | 212 | }, \ |
| 213 | .int_ep_config = \ | 213 | .int_ep_config = \ |
| 214 | { \ | 214 | { \ |
| 215 | USB_EP_MODE_TYPE_INTR, /* Interrupt EP */ \ | 215 | USB_EP_MODE_TYPE_INTR, /* Interrupt EP */ \ |
| 216 | NULL, /* SETUP packet notification callback */ \ | 216 | NULL, /* SETUP packet notification callback */ \ |
| 217 | qmkusbInterruptTransmitted, /* IN notification callback */ \ | 217 | qmkusbInterruptTransmitted, /* IN notification callback */ \ |
| 218 | NULL, /* OUT notification callback */ \ | 218 | NULL, /* OUT notification callback */ \ |
| 219 | CDC_NOTIFICATION_EPSIZE, /* IN maximum packet size */ \ | 219 | CDC_NOTIFICATION_EPSIZE, /* IN maximum packet size */ \ |
| 220 | 0, /* OUT maximum packet size */ \ | 220 | 0, /* OUT maximum packet size */ \ |
| 221 | NULL, /* IN Endpoint state */ \ | 221 | NULL, /* IN Endpoint state */ \ |
| 222 | NULL, /* OUT endpoint state */ \ | 222 | NULL, /* OUT endpoint state */ \ |
| 223 | 2, /* IN multiplier */ \ | 223 | 2, /* IN multiplier */ \ |
| 224 | NULL, /* SETUP buffer (not a SETUP endpoint) */ \ | 224 | NULL, /* SETUP buffer (not a SETUP endpoint) */ \ |
| 225 | }, \ | 225 | }, \ |
| 226 | .config = { \ | 226 | .config = { \ |
| 227 | .usbp = &USB_DRIVER, \ | 227 | .usbp = &USB_DRIVER, \ |
| 228 | .bulk_in = stream##_IN_EPNUM, \ | 228 | .bulk_in = stream##_IN_EPNUM, \ |
| 229 | .bulk_out = stream##_OUT_EPNUM, \ | 229 | .bulk_out = stream##_OUT_EPNUM, \ |
| 230 | .int_in = notification, \ | 230 | .int_in = notification, \ |
| 231 | .in_buffers = stream##_IN_CAPACITY, \ | 231 | .in_buffers = stream##_IN_CAPACITY, \ |
| 232 | .out_buffers = stream##_OUT_CAPACITY, \ | 232 | .out_buffers = stream##_OUT_CAPACITY, \ |
| 233 | .in_size = stream##_EPSIZE, \ | 233 | .in_size = stream##_EPSIZE, \ |
| 234 | .out_size = stream##_EPSIZE, \ | 234 | .out_size = stream##_EPSIZE, \ |
| 235 | .fixed_size = fixedsize, \ | 235 | .fixed_size = fixedsize, \ |
| 236 | .ib = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_IN_CAPACITY, stream##_EPSIZE)]){}, \ | 236 | .ib = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_IN_CAPACITY, stream##_EPSIZE)]){}, \ |
| 237 | .ob = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_OUT_CAPACITY, stream##_EPSIZE)]){}, \ | 237 | .ob = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_OUT_CAPACITY, stream##_EPSIZE)]){}, \ |
| 238 | } \ | 238 | } \ |
| 239 | } | 239 | } |
| 240 | #else | 240 | #else |
| 241 | /* Reusable initialization structure - see USBEndpointConfig comment at top of file */ | 241 | /* Reusable initialization structure - see USBEndpointConfig comment at top of file */ |
| 242 | #define QMK_USB_DRIVER_CONFIG(stream, notification, fixedsize) \ | 242 | # define QMK_USB_DRIVER_CONFIG(stream, notification, fixedsize) \ |
| 243 | { \ | 243 | { \ |
| 244 | .queue_capacity_in = stream##_IN_CAPACITY, .queue_capacity_out = stream##_OUT_CAPACITY, \ | 244 | .queue_capacity_in = stream##_IN_CAPACITY, .queue_capacity_out = stream##_OUT_CAPACITY, \ |
| 245 | .in_ep_config = \ | 245 | .in_ep_config = \ |
| 246 | { \ | 246 | { \ |
| 247 | stream##_IN_MODE, /* Interrupt EP */ \ | 247 | stream##_IN_MODE, /* Interrupt EP */ \ |
| 248 | NULL, /* SETUP packet notification callback */ \ | 248 | NULL, /* SETUP packet notification callback */ \ |
| 249 | qmkusbDataTransmitted, /* IN notification callback */ \ | 249 | qmkusbDataTransmitted, /* IN notification callback */ \ |
| 250 | NULL, /* OUT notification callback */ \ | 250 | NULL, /* OUT notification callback */ \ |
| 251 | stream##_EPSIZE, /* IN maximum packet size */ \ | 251 | stream##_EPSIZE, /* IN maximum packet size */ \ |
| 252 | 0, /* OUT maximum packet size */ \ | 252 | 0, /* OUT maximum packet size */ \ |
| 253 | NULL, /* IN Endpoint state */ \ | 253 | NULL, /* IN Endpoint state */ \ |
| 254 | NULL, /* OUT endpoint state */ \ | 254 | NULL, /* OUT endpoint state */ \ |
| 255 | 2, /* IN multiplier */ \ | 255 | 2, /* IN multiplier */ \ |
| 256 | NULL /* SETUP buffer (not a SETUP endpoint) */ \ | 256 | NULL /* SETUP buffer (not a SETUP endpoint) */ \ |
| 257 | }, \ | 257 | }, \ |
| 258 | .out_ep_config = \ | 258 | .out_ep_config = \ |
| 259 | { \ | 259 | { \ |
| 260 | stream##_OUT_MODE, /* Interrupt EP */ \ | 260 | stream##_OUT_MODE, /* Interrupt EP */ \ |
| 261 | NULL, /* SETUP packet notification callback */ \ | 261 | NULL, /* SETUP packet notification callback */ \ |
| 262 | NULL, /* IN notification callback */ \ | 262 | NULL, /* IN notification callback */ \ |
| 263 | qmkusbDataReceived, /* OUT notification callback */ \ | 263 | qmkusbDataReceived, /* OUT notification callback */ \ |
| 264 | 0, /* IN maximum packet size */ \ | 264 | 0, /* IN maximum packet size */ \ |
| 265 | stream##_EPSIZE, /* OUT maximum packet size */ \ | 265 | stream##_EPSIZE, /* OUT maximum packet size */ \ |
| 266 | NULL, /* IN Endpoint state */ \ | 266 | NULL, /* IN Endpoint state */ \ |
| 267 | NULL, /* OUT endpoint state */ \ | 267 | NULL, /* OUT endpoint state */ \ |
| 268 | 2, /* IN multiplier */ \ | 268 | 2, /* IN multiplier */ \ |
| 269 | NULL, /* SETUP buffer (not a SETUP endpoint) */ \ | 269 | NULL, /* SETUP buffer (not a SETUP endpoint) */ \ |
| 270 | }, \ | 270 | }, \ |
| 271 | .int_ep_config = \ | 271 | .int_ep_config = \ |
| 272 | { \ | 272 | { \ |
| 273 | USB_EP_MODE_TYPE_INTR, /* Interrupt EP */ \ | 273 | USB_EP_MODE_TYPE_INTR, /* Interrupt EP */ \ |
| 274 | NULL, /* SETUP packet notification callback */ \ | 274 | NULL, /* SETUP packet notification callback */ \ |
| 275 | qmkusbInterruptTransmitted, /* IN notification callback */ \ | 275 | qmkusbInterruptTransmitted, /* IN notification callback */ \ |
| 276 | NULL, /* OUT notification callback */ \ | 276 | NULL, /* OUT notification callback */ \ |
| 277 | CDC_NOTIFICATION_EPSIZE, /* IN maximum packet size */ \ | 277 | CDC_NOTIFICATION_EPSIZE, /* IN maximum packet size */ \ |
| 278 | 0, /* OUT maximum packet size */ \ | 278 | 0, /* OUT maximum packet size */ \ |
| 279 | NULL, /* IN Endpoint state */ \ | 279 | NULL, /* IN Endpoint state */ \ |
| 280 | NULL, /* OUT endpoint state */ \ | 280 | NULL, /* OUT endpoint state */ \ |
| 281 | 2, /* IN multiplier */ \ | 281 | 2, /* IN multiplier */ \ |
| 282 | NULL, /* SETUP buffer (not a SETUP endpoint) */ \ | 282 | NULL, /* SETUP buffer (not a SETUP endpoint) */ \ |
| 283 | }, \ | 283 | }, \ |
| 284 | .config = { \ | 284 | .config = { \ |
| 285 | .usbp = &USB_DRIVER, \ | 285 | .usbp = &USB_DRIVER, \ |
| 286 | .bulk_in = stream##_IN_EPNUM, \ | 286 | .bulk_in = stream##_IN_EPNUM, \ |
| 287 | .bulk_out = stream##_OUT_EPNUM, \ | 287 | .bulk_out = stream##_OUT_EPNUM, \ |
| 288 | .int_in = notification, \ | 288 | .int_in = notification, \ |
| 289 | .in_buffers = stream##_IN_CAPACITY, \ | 289 | .in_buffers = stream##_IN_CAPACITY, \ |
| 290 | .out_buffers = stream##_OUT_CAPACITY, \ | 290 | .out_buffers = stream##_OUT_CAPACITY, \ |
| 291 | .in_size = stream##_EPSIZE, \ | 291 | .in_size = stream##_EPSIZE, \ |
| 292 | .out_size = stream##_EPSIZE, \ | 292 | .out_size = stream##_EPSIZE, \ |
| 293 | .fixed_size = fixedsize, \ | 293 | .fixed_size = fixedsize, \ |
| 294 | .ib = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_IN_CAPACITY, stream##_EPSIZE)]){}, \ | 294 | .ib = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_IN_CAPACITY, stream##_EPSIZE)]){}, \ |
| 295 | .ob = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_OUT_CAPACITY, stream##_EPSIZE)]){}, \ | 295 | .ob = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_OUT_CAPACITY, stream##_EPSIZE)]){}, \ |
| 296 | } \ | 296 | } \ |
| 297 | } | 297 | } |
| 298 | #endif | 298 | #endif |
| 299 | 299 | ||
| 300 | typedef struct { | 300 | typedef struct { |
| @@ -388,12 +388,12 @@ static void usb_event_cb(USBDriver *usbp, usbevent_t event) { | |||
| 388 | usbInitEndpointI(usbp, SHARED_IN_EPNUM, &shared_ep_config); | 388 | usbInitEndpointI(usbp, SHARED_IN_EPNUM, &shared_ep_config); |
| 389 | #endif | 389 | #endif |
| 390 | for (int i = 0; i < NUM_USB_DRIVERS; i++) { | 390 | for (int i = 0; i < NUM_USB_DRIVERS; i++) { |
| 391 | #if STM32_USB_USE_OTG1 | 391 | #if STM32_USB_USE_OTG1 |
| 392 | usbInitEndpointI(usbp, drivers.array[i].config.bulk_in, &drivers.array[i].inout_ep_config); | 392 | usbInitEndpointI(usbp, drivers.array[i].config.bulk_in, &drivers.array[i].inout_ep_config); |
| 393 | #else | 393 | #else |
| 394 | usbInitEndpointI(usbp, drivers.array[i].config.bulk_in, &drivers.array[i].in_ep_config); | 394 | usbInitEndpointI(usbp, drivers.array[i].config.bulk_in, &drivers.array[i].in_ep_config); |
| 395 | usbInitEndpointI(usbp, drivers.array[i].config.bulk_out, &drivers.array[i].out_ep_config); | 395 | usbInitEndpointI(usbp, drivers.array[i].config.bulk_out, &drivers.array[i].out_ep_config); |
| 396 | #endif | 396 | #endif |
| 397 | if (drivers.array[i].config.int_in) { | 397 | if (drivers.array[i].config.int_in) { |
| 398 | usbInitEndpointI(usbp, drivers.array[i].config.int_in, &drivers.array[i].int_ep_config); | 398 | usbInitEndpointI(usbp, drivers.array[i].config.int_in, &drivers.array[i].int_ep_config); |
| 399 | } | 399 | } |
| @@ -544,7 +544,7 @@ static bool usb_request_hook_cb(USBDriver *usbp) { | |||
| 544 | #ifdef NKRO_ENABLE | 544 | #ifdef NKRO_ENABLE |
| 545 | keymap_config.nkro = !!keyboard_protocol; | 545 | keymap_config.nkro = !!keyboard_protocol; |
| 546 | if (!keymap_config.nkro && keyboard_idle) { | 546 | if (!keymap_config.nkro && keyboard_idle) { |
| 547 | #else /* NKRO_ENABLE */ | 547 | #else /* NKRO_ENABLE */ |
| 548 | if (keyboard_idle) { | 548 | if (keyboard_idle) { |
| 549 | #endif /* NKRO_ENABLE */ | 549 | #endif /* NKRO_ENABLE */ |
| 550 | /* arm the idle timer if boot protocol & idle */ | 550 | /* arm the idle timer if boot protocol & idle */ |
| @@ -562,7 +562,7 @@ static bool usb_request_hook_cb(USBDriver *usbp) { | |||
| 562 | /* arm the timer */ | 562 | /* arm the timer */ |
| 563 | #ifdef NKRO_ENABLE | 563 | #ifdef NKRO_ENABLE |
| 564 | if (!keymap_config.nkro && keyboard_idle) { | 564 | if (!keymap_config.nkro && keyboard_idle) { |
| 565 | #else /* NKRO_ENABLE */ | 565 | #else /* NKRO_ENABLE */ |
| 566 | if (keyboard_idle) { | 566 | if (keyboard_idle) { |
| 567 | #endif /* NKRO_ENABLE */ | 567 | #endif /* NKRO_ENABLE */ |
| 568 | osalSysLockFromISR(); | 568 | osalSysLockFromISR(); |
| @@ -618,21 +618,21 @@ static const USBConfig usbcfg = { | |||
| 618 | */ | 618 | */ |
| 619 | void init_usb_driver(USBDriver *usbp) { | 619 | void init_usb_driver(USBDriver *usbp) { |
| 620 | for (int i = 0; i < NUM_USB_DRIVERS; i++) { | 620 | for (int i = 0; i < NUM_USB_DRIVERS; i++) { |
| 621 | #if STM32_USB_USE_OTG1 | 621 | #if STM32_USB_USE_OTG1 |
| 622 | QMKUSBDriver *driver = &drivers.array[i].driver; | 622 | QMKUSBDriver *driver = &drivers.array[i].driver; |
| 623 | drivers.array[i].inout_ep_config.in_state = &drivers.array[i].in_ep_state; | 623 | drivers.array[i].inout_ep_config.in_state = &drivers.array[i].in_ep_state; |
| 624 | drivers.array[i].inout_ep_config.out_state = &drivers.array[i].out_ep_state; | 624 | drivers.array[i].inout_ep_config.out_state = &drivers.array[i].out_ep_state; |
| 625 | drivers.array[i].int_ep_config.in_state = &drivers.array[i].int_ep_state; | 625 | drivers.array[i].int_ep_config.in_state = &drivers.array[i].int_ep_state; |
| 626 | qmkusbObjectInit(driver, &drivers.array[i].config); | 626 | qmkusbObjectInit(driver, &drivers.array[i].config); |
| 627 | qmkusbStart(driver, &drivers.array[i].config); | 627 | qmkusbStart(driver, &drivers.array[i].config); |
| 628 | #else | 628 | #else |
| 629 | QMKUSBDriver *driver = &drivers.array[i].driver; | 629 | QMKUSBDriver *driver = &drivers.array[i].driver; |
| 630 | drivers.array[i].in_ep_config.in_state = &drivers.array[i].in_ep_state; | 630 | drivers.array[i].in_ep_config.in_state = &drivers.array[i].in_ep_state; |
| 631 | drivers.array[i].out_ep_config.out_state = &drivers.array[i].out_ep_state; | 631 | drivers.array[i].out_ep_config.out_state = &drivers.array[i].out_ep_state; |
| 632 | drivers.array[i].int_ep_config.in_state = &drivers.array[i].int_ep_state; | 632 | drivers.array[i].int_ep_config.in_state = &drivers.array[i].int_ep_state; |
| 633 | qmkusbObjectInit(driver, &drivers.array[i].config); | 633 | qmkusbObjectInit(driver, &drivers.array[i].config); |
| 634 | qmkusbStart(driver, &drivers.array[i].config); | 634 | qmkusbStart(driver, &drivers.array[i].config); |
| 635 | #endif | 635 | #endif |
| 636 | } | 636 | } |
| 637 | 637 | ||
| 638 | /* | 638 | /* |
| @@ -689,7 +689,7 @@ static void keyboard_idle_timer_cb(void *arg) { | |||
| 689 | 689 | ||
| 690 | #ifdef NKRO_ENABLE | 690 | #ifdef NKRO_ENABLE |
| 691 | if (!keymap_config.nkro && keyboard_idle && keyboard_protocol) { | 691 | if (!keymap_config.nkro && keyboard_idle && keyboard_protocol) { |
| 692 | #else /* NKRO_ENABLE */ | 692 | #else /* NKRO_ENABLE */ |
| 693 | if (keyboard_idle && keyboard_protocol) { | 693 | if (keyboard_idle && keyboard_protocol) { |
| 694 | #endif /* NKRO_ENABLE */ | 694 | #endif /* NKRO_ENABLE */ |
| 695 | /* TODO: are we sure we want the KBD_ENDPOINT? */ | 695 | /* TODO: are we sure we want the KBD_ENDPOINT? */ |
| @@ -738,7 +738,7 @@ void send_keyboard(report_keyboard_t *report) { | |||
| 738 | usbStartTransmitI(&USB_DRIVER, SHARED_IN_EPNUM, (uint8_t *)report, sizeof(struct nkro_report)); | 738 | usbStartTransmitI(&USB_DRIVER, SHARED_IN_EPNUM, (uint8_t *)report, sizeof(struct nkro_report)); |
| 739 | } else | 739 | } else |
| 740 | #endif /* NKRO_ENABLE */ | 740 | #endif /* NKRO_ENABLE */ |
| 741 | { /* regular protocol */ | 741 | { /* regular protocol */ |
| 742 | /* need to wait until the previous packet has made it through */ | 742 | /* need to wait until the previous packet has made it through */ |
| 743 | /* busy wait, should be short and not very common */ | 743 | /* busy wait, should be short and not very common */ |
| 744 | if (usbGetTransmitStatusI(&USB_DRIVER, KEYBOARD_IN_EPNUM)) { | 744 | if (usbGetTransmitStatusI(&USB_DRIVER, KEYBOARD_IN_EPNUM)) { |
| @@ -805,7 +805,7 @@ void send_mouse(report_mouse_t *report) { | |||
| 805 | osalSysUnlock(); | 805 | osalSysUnlock(); |
| 806 | } | 806 | } |
| 807 | 807 | ||
| 808 | #else /* MOUSE_ENABLE */ | 808 | #else /* MOUSE_ENABLE */ |
| 809 | void send_mouse(report_mouse_t *report) { (void)report; } | 809 | void send_mouse(report_mouse_t *report) { (void)report; } |
| 810 | #endif /* MOUSE_ENABLE */ | 810 | #endif /* MOUSE_ENABLE */ |
| 811 | 811 | ||
| @@ -885,7 +885,7 @@ void console_task(void) { | |||
| 885 | } while (size > 0); | 885 | } while (size > 0); |
| 886 | } | 886 | } |
| 887 | 887 | ||
| 888 | #else /* CONSOLE_ENABLE */ | 888 | #else /* CONSOLE_ENABLE */ |
| 889 | int8_t sendchar(uint8_t c) { | 889 | int8_t sendchar(uint8_t c) { |
| 890 | (void)c; | 890 | (void)c; |
| 891 | return 0; | 891 | return 0; |
