Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/device/usbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -803,10 +803,8 @@ void tud_task_ext(uint32_t timeout_ms, bool in_isr) {
break;
}

#if CFG_TUSB_OS != OPT_OS_NONE && CFG_TUSB_OS != OPT_OS_PICO
// return if there is no more events, for application to run other background
if (osal_queue_empty(_usbd_q)) { return; }
#endif
// allow to exit tud_task() if there is no event in the next run
timeout_ms = 0;
}
}

Expand Down
13 changes: 11 additions & 2 deletions src/host/usbh.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,8 @@ bool usbh_defer_func_ms_async(uint32_t ms, tusb_defer_func_t func, uintptr_t par
TU_LOG_USBH("USBH schedule function after %u ms\r\n", (unsigned int)ms);
_usbh_data.call_after.func = func;
_usbh_data.call_after.arg = param;
_usbh_data.call_after.at_ms = tusb_time_millis_api() + ms;
// add one to ensure we wait at least 'ms' milliseconds
_usbh_data.call_after.at_ms = tusb_time_millis_api() + ms + 1;
return true;
}

Expand Down Expand Up @@ -610,11 +611,19 @@ bool tuh_task_event_ready(void) {
}

#if CFG_TUH_HUB
if (!osal_queue_empty(_usbh_daq)) {
if (_usbh_data.enumerating_daddr == TUSB_INDEX_INVALID_8 &&
!osal_queue_empty(_usbh_daq)) {
return true;
}
#endif

if (_usbh_data.call_after.func) {
int32_t remain_ms = (int32_t)(_usbh_data.call_after.at_ms - tusb_time_millis_api());
if (remain_ms <= 0) {
return true;
}
}

return false;
}

Expand Down
4 changes: 0 additions & 4 deletions src/tusb_option.h
Original file line number Diff line number Diff line change
Expand Up @@ -534,10 +534,6 @@
#define CFG_TUSB_OS OPT_OS_NONE
#endif

#ifndef CFG_TUSB_OS_HAS_SCHEDULER
#define CFG_TUSB_OS_HAS_SCHEDULER (CFG_TUSB_OS != OPT_OS_NONE && CFG_TUSB_OS != OPT_OS_PICO)
#endif

#ifndef CFG_TUSB_OS_INC_PATH
#ifndef CFG_TUSB_OS_INC_PATH_DEFAULT
#define CFG_TUSB_OS_INC_PATH_DEFAULT
Expand Down
Loading