From 2636bb4e4a3a3f314f966116bc3c2b00b262a3ab Mon Sep 17 00:00:00 2001 From: Przemyslaw Bida Date: Mon, 12 Sep 2022 08:27:40 +0200 Subject: [PATCH] net: openthread: priortize usec timer for openthread port. This commit prioritizes usec timer over msec. Doing so improves CSL by helping scheduling timeslots on IEEE 802.15.4 with lower miss rate. Signed-off-by: Przemyslaw Bida --- modules/openthread/platform/alarm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/openthread/platform/alarm.c b/modules/openthread/platform/alarm.c index 1ad998684c7a6d..3cbf1d033e3671 100644 --- a/modules/openthread/platform/alarm.c +++ b/modules/openthread/platform/alarm.c @@ -58,6 +58,12 @@ void platformAlarmInit(void) void platformAlarmProcess(otInstance *aInstance) { +#if OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE + if (timer_us_fired) { + timer_us_fired = false; + otPlatAlarmMicroFired(aInstance); + } +#endif if (timer_ms_fired) { timer_ms_fired = false; #if defined(CONFIG_OPENTHREAD_DIAG) @@ -69,12 +75,6 @@ void platformAlarmProcess(otInstance *aInstance) otPlatAlarmMilliFired(aInstance); } } -#if OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE - if (timer_us_fired) { - timer_us_fired = false; - otPlatAlarmMicroFired(aInstance); - } -#endif } uint32_t otPlatAlarmMilliGetNow(void)