diff options
| author | hathach <thach@tinyusb.org> | 2021-02-04 16:00:14 +0700 |
|---|---|---|
| committer | hathach <thach@tinyusb.org> | 2021-02-04 16:00:14 +0700 |
| commit | 8d7b1f9e8c9545468305443ae6cae3d653ead8d2 (patch) | |
| tree | c515494a15b2f4b28a18c88c2af78aa87c5c2cec /supervisor/shared | |
| parent | e699a598905c95eb8249e89e436030376a518239 (diff) | |
add usb_background_schedule()
unconditionally schedule usb background after
background_callback_reset()
Diffstat (limited to 'supervisor/shared')
| -rw-r--r-- | supervisor/shared/background_callback.c | 5 | ||||
| -rw-r--r-- | supervisor/shared/usb/usb.c | 13 |
2 files changed, 9 insertions, 9 deletions
diff --git a/supervisor/shared/background_callback.c b/supervisor/shared/background_callback.c index 44709b60b..68a0a9667 100644 --- a/supervisor/shared/background_callback.c +++ b/supervisor/shared/background_callback.c @@ -105,9 +105,6 @@ 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; @@ -120,8 +117,6 @@ 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 af34f2598..9cbb295c8 100644 --- a/supervisor/shared/usb/usb.c +++ b/supervisor/shared/usb/usb.c @@ -93,16 +93,21 @@ 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); \ +void usb_background_schedule(void) +{ background_callback_add(&usb_callback, usb_background_do, NULL); } +void usb_irq_handler(void) { + tud_int_handler(0); + usb_background_schedule(); +} + //--------------------------------------------------------------------+ // tinyusb callbacks //--------------------------------------------------------------------+ |
