soc: arm: nordic_nrf: timing: Fix wrapping
Fix wrapping case for SoC with 32 bit TIMER. Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
parent
b8bf23b707
commit
cd3dae7c2c
1 changed files with 3 additions and 3 deletions
|
@ -47,14 +47,14 @@ uint64_t soc_timing_cycles_get(volatile timing_t *const start,
|
|||
{
|
||||
#if defined(CONFIG_SOC_SERIES_NRF51X)
|
||||
#define COUNTER_SPAN BIT(16)
|
||||
#else
|
||||
#define COUNTER_SPAN BIT64(32)
|
||||
#endif
|
||||
if (*end >= *start) {
|
||||
return (*end - *start);
|
||||
} else {
|
||||
return COUNTER_SPAN + *end - *start;
|
||||
}
|
||||
#else
|
||||
return (*end - *start);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint64_t soc_timing_freq_get(void)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue