Skip to content

Commit d15685d

Browse files
[nrf fromlist] drivers: timer: nrf_grtc_timer: add last_count initialization
The GRTC counter is not cleared at startup, therefore the `last_count` variable needs to be initialized accordingly. This change: - Prevents overflow of the `sys_clock_announce()` int32_t parameter - Ensures the correct uptime value, which should be reset during initialization Upstream PR #: 91432 Signed-off-by: Adam Kondraciuk <[email protected]>
1 parent bcf554e commit d15685d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/timer/nrf_grtc_timer.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ static int sys_clock_driver_init(void)
485485
}
486486
#endif /* CONFIG_NRF_GRTC_START_SYSCOUNTER */
487487

488+
last_count = counter();
488489
int_mask = NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK;
489490
if (!IS_ENABLED(CONFIG_TICKLESS_KERNEL)) {
490491
system_timeout_set_relative(CYC_PER_TICK);

0 commit comments

Comments
 (0)