drivers: nrf_rtc_timer: Always announce actual number of elapsed ticks

In non-tickless mode, the timeout handler always announced maximum 1
tick to kernel, but in fact it cannot be guaranteed that the handler
execution is not delayed and that the number of elapsed ticks does not
exceed 1. Use the actual number instead.
Switch also to using a 32-bit value for `dticks` to get a bit simpler
generated code (ticks delta is not supposed to be that huge).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This commit is contained in:
Andrzej Głąbek 2023-01-04 13:49:50 +01:00 committed by Carles Cufí
commit 3ffaaa989a

View file

@ -405,7 +405,7 @@ static void sys_clock_timeout_handler(int32_t chan,
void *user_data)
{
uint32_t cc_value = absolute_time_to_cc(expire_time);
uint64_t dticks = (expire_time - last_count) / CYC_PER_TICK;
uint32_t dticks = (uint32_t)(expire_time - last_count) / CYC_PER_TICK;
last_count += dticks * CYC_PER_TICK;
@ -419,8 +419,7 @@ static void sys_clock_timeout_handler(int32_t chan,
sys_clock_timeout_handler, NULL);
}
sys_clock_announce(IS_ENABLED(CONFIG_TICKLESS_KERNEL) ?
(int32_t)dticks : (dticks > 0));
sys_clock_announce(dticks);
}
static bool channel_processing_check_and_clear(int32_t chan)