From 46c5775ba4b9c4905f8e3f4c1842c2c6c04d8fb0 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 20 Nov 2019 10:15:44 -0600 Subject: [PATCH] supervisor: tick: add supervisor_fake_tick --- supervisor/shared/tick.c | 3 +++ supervisor/shared/tick.h | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/supervisor/shared/tick.c b/supervisor/shared/tick.c index 0be3230823..69256081c4 100644 --- a/supervisor/shared/tick.c +++ b/supervisor/shared/tick.c @@ -88,4 +88,7 @@ void supervisor_run_background_tasks_if_tick() { run_background_tasks(); } +void supervisor_fake_tick() { + uint32_t now32 = ticks_ms; + background_ticks_ms32 = (now32 - 1); } diff --git a/supervisor/shared/tick.h b/supervisor/shared/tick.h index e747de2d83..7ce8281ba9 100644 --- a/supervisor/shared/tick.h +++ b/supervisor/shared/tick.h @@ -36,6 +36,13 @@ * interrupt context. */ extern void supervisor_tick(void); +/** @brief Cause background tasks to be called soon + * + * Normally, background tasks are only run once per tick. For other cases where + * an event noticed from an interrupt context needs to be completed by a background + * task activity, the interrupt can call supervisor_fake_tick. + */ +extern void supervisor_fake_tick(void); /** @brief Get the lower 32 bits of the time in milliseconds * * This can be more efficient than supervisor_ticks_ms64, for sites where a wraparound