Commit c9a840d2 authored by schneider's avatar schneider
Browse files

change(pycardium): Scale calls to epic_sleep based on systick interval

parent 08258739
......@@ -246,9 +246,18 @@ static void systick_delay(uint32_t us)
while (final_time - systick_get_us() > SYSTICK_INTERVAL_US) {
uint32_t sleep_time =
(final_time - systick_get_us()) / 1000;
if (sleep_time > 100)
sleep_time = 100;
/* We need to wake up at least in SYSTICK_INTERVAL_US to make
* sure we serve the systick interrupt.
* Add some error margin to avoid issues with the clock accuracy
* of epicardium */
if (sleep_time > SYSTICK_INTERVAL_US / 1000 / 2) {
sleep_time = SYSTICK_INTERVAL_US / 1000 / 2;
}
epic_sleep(sleep_time);
/* epic_sleep() can return early if there was an interrupt
* coming from epicardium side.
* Give MP a chance to handle them. */
mp_handle_pending(true);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment