Skip to content

Commit cd3dae7

Browse files
nordic-krchnashif
authored andcommitted
soc: arm: nordic_nrf: timing: Fix wrapping
Fix wrapping case for SoC with 32 bit TIMER. Signed-off-by: Krzysztof Chruściński <[email protected]>
1 parent b8bf23b commit cd3dae7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

soc/nordic/timing.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ uint64_t soc_timing_cycles_get(volatile timing_t *const start,
4747
{
4848
#if defined(CONFIG_SOC_SERIES_NRF51X)
4949
#define COUNTER_SPAN BIT(16)
50+
#else
51+
#define COUNTER_SPAN BIT64(32)
52+
#endif
5053
if (*end >= *start) {
5154
return (*end - *start);
5255
} else {
5356
return COUNTER_SPAN + *end - *start;
5457
}
55-
#else
56-
return (*end - *start);
57-
#endif
5858
}
5959

6060
uint64_t soc_timing_freq_get(void)

0 commit comments

Comments
 (0)