diff options
| author | hathach <thach@tinyusb.org> | 2021-02-03 11:01:33 +0700 |
|---|---|---|
| committer | hathach <thach@tinyusb.org> | 2021-02-03 11:01:33 +0700 |
| commit | e699a598905c95eb8249e89e436030376a518239 (patch) | |
| tree | b0b39ec2939fbe66e36bed912ae9b07d02804ac2 /supervisor/shared | |
| parent | c1c1a5d036fdb373574a0f72adf94c8752de5bb3 (diff) | |
hack to fix 3986
just a proof to show that issue analysis is correct
Diffstat (limited to 'supervisor/shared')
| -rw-r--r-- | supervisor/shared/background_callback.c | 8 | ||||
| -rw-r--r-- | supervisor/shared/usb/usb.c | 6 |
2 files changed, 9 insertions, 5 deletions
diff --git a/supervisor/shared/background_callback.c b/supervisor/shared/background_callback.c index 288c9a4df..44709b60b 100644 --- a/supervisor/shared/background_callback.c +++ b/supervisor/shared/background_callback.c @@ -33,7 +33,7 @@ #include "supervisor/shared/tick.h" #include "shared-bindings/microcontroller/__init__.h" -STATIC volatile background_callback_t *callback_head, *callback_tail; +STATIC volatile background_callback_t * volatile callback_head, * volatile callback_tail; #define CALLBACK_CRITICAL_BEGIN (common_hal_mcu_disable_interrupts()) #define CALLBACK_CRITICAL_END (common_hal_mcu_enable_interrupts()) @@ -50,7 +50,6 @@ void background_callback_add_core(background_callback_t *cb) { cb->prev = (background_callback_t*)callback_tail; if (callback_tail) { callback_tail->next = cb; - cb->prev = (background_callback_t*)callback_tail; } if (!callback_head) { callback_head = cb; @@ -106,6 +105,9 @@ void background_callback_end_critical_section() { CALLBACK_CRITICAL_END; } +extern background_callback_t usb_callback; +extern void usb_background_do(void* unused); + void background_callback_reset() { CALLBACK_CRITICAL_BEGIN; background_callback_t *cb = (background_callback_t*)callback_head; @@ -118,6 +120,8 @@ void background_callback_reset() { callback_tail = NULL; in_background_callback = false; CALLBACK_CRITICAL_END; + + background_callback_add(&usb_callback, usb_background_do, NULL); } void background_callback_gc_collect(void) { diff --git a/supervisor/shared/usb/usb.c b/supervisor/shared/usb/usb.c index 07c6aee6c..af34f2598 100644 --- a/supervisor/shared/usb/usb.c +++ b/supervisor/shared/usb/usb.c @@ -93,13 +93,13 @@ void usb_background(void) { } } -static background_callback_t usb_callback; -static void usb_background_do(void* unused) { +/*static*/ background_callback_t usb_callback; +/*static*/ void usb_background_do(void* unused) { usb_background(); } void usb_irq_handler(void) { - tud_int_handler(0); + tud_int_handler(0); \ background_callback_add(&usb_callback, usb_background_do, NULL); } |
