Skip to content
Merged
Changes from all 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
13 changes: 9 additions & 4 deletions drivers/timer/nrf_grtc_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,10 +549,6 @@ void sys_clock_set_timeout(int32_t ticks, bool idle)
{
ARG_UNUSED(idle);

if (ticks == 0) {
return;
}

if (!IS_ENABLED(CONFIG_TICKLESS_KERNEL)) {
return;
}
Expand All @@ -562,6 +558,15 @@ void sys_clock_set_timeout(int32_t ticks, bool idle)
if ((cc_value == expired_cc) && (ticks < MAX_REL_TICKS)) {
uint32_t cyc = ticks * CYC_PER_TICK;

if (cyc == 0) {
/* GRTC will expire anyway since HW ensures that past value triggers an
* event but we need to ensure to always progress the cc_value as this
* if condition expects that cc_value will change after each call to
* set_timeout function.
*/
cyc = 1;
}

/* If it's the first timeout setting after previous expiration and timeout
* is short so fast method can be used which utilizes relative CC configuration.
*/
Expand Down