diff options
| author | Dan Halbert <halbert@adafruit.com> | 2021-02-05 09:13:28 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-05 09:13:28 -0500 |
| commit | 5bb722b927f1b84a436921eb318d676222234358 (patch) | |
| tree | 35058519e83e17c1b5eeb1327ed7de9625273a40 /supervisor | |
| parent | 0a55cfbde80e07679ded193e85ee118c1561fc63 (diff) | |
| parent | 25d456a5b817592f16fed93ac70af4086aa45aa8 (diff) | |
Merge pull request #4122 from hathach/fix-3986
Fix 3986 background reset remove existing usb callback
Diffstat (limited to 'supervisor')
| -rw-r--r-- | supervisor/shared/background_callback.c | 3 | ||||
| -rw-r--r-- | supervisor/shared/usb/usb.c | 7 | ||||
| -rw-r--r-- | supervisor/usb.h | 3 |
3 files changed, 10 insertions, 3 deletions
diff --git a/supervisor/shared/background_callback.c b/supervisor/shared/background_callback.c index 288c9a4df..68a0a9667 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; diff --git a/supervisor/shared/usb/usb.c b/supervisor/shared/usb/usb.c index 06b9e0c4e..43564d5d5 100644 --- a/supervisor/shared/usb/usb.c +++ b/supervisor/shared/usb/usb.c @@ -111,9 +111,14 @@ static void usb_background_do(void* unused) { usb_background(); } +void usb_background_schedule(void) +{ + background_callback_add(&usb_callback, usb_background_do, NULL); +} + void usb_irq_handler(void) { tud_int_handler(0); - background_callback_add(&usb_callback, usb_background_do, NULL); + usb_background_schedule(); } //--------------------------------------------------------------------+ diff --git a/supervisor/usb.h b/supervisor/usb.h index ccb35470c..1c709926a 100644 --- a/supervisor/usb.h +++ b/supervisor/usb.h @@ -35,6 +35,9 @@ // it may be necessary to call it directly. void usb_background(void); +// Schedule usb background +void usb_background_schedule(void); + // Ports must call this from their particular USB IRQ handler void usb_irq_handler(void); |
