From 93eb56c612cee00f98e67f989c490863ec5c74da Mon Sep 17 00:00:00 2001 From: malo Date: Fri, 26 Feb 2016 12:27:15 +0100 Subject: [PATCH 1/2] xtimer: Fixed case when _xtimer_set_absolute called with target < now and target has _this_high_period . Signed-off-by: malo --- sys/xtimer/xtimer_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/xtimer/xtimer_core.c b/sys/xtimer/xtimer_core.c index 852194a7a9..78a8578444 100644 --- a/sys/xtimer/xtimer_core.c +++ b/sys/xtimer/xtimer_core.c @@ -179,7 +179,7 @@ int _xtimer_set_absolute(xtimer_t *timer, uint32_t target) } unsigned state = disableIRQ(); - if ( !_this_high_period(target) ) { + if ( (timer->long_target > _long_cnt) || !_this_high_period(target) ) { DEBUG("xtimer_set_absolute(): the timer doesn't fit into the low-level timer's mask.\n"); _add_timer_to_long_list(&long_list_head, timer); } From 9b8fe52d5da016c1e4315e1168f54ea1a59dec56 Mon Sep 17 00:00:00 2001 From: malo Date: Fri, 26 Feb 2016 12:32:45 +0100 Subject: [PATCH 2/2] xtimer: Fixed _add_timer_to_long_list since timer could be added at the wrong position. Signed-off-by: malo --- sys/xtimer/xtimer_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/xtimer/xtimer_core.c b/sys/xtimer/xtimer_core.c index 78a8578444..06238f0952 100644 --- a/sys/xtimer/xtimer_core.c +++ b/sys/xtimer/xtimer_core.c @@ -217,8 +217,8 @@ static void _add_timer_to_list(xtimer_t **list_head, xtimer_t *timer) static void _add_timer_to_long_list(xtimer_t **list_head, xtimer_t *timer) { while (*list_head - && (*list_head)->long_target <= timer->long_target - && (*list_head)->target <= timer->target) { + && (((*list_head)->long_target < timer->long_target) + || (((*list_head)->long_target == timer->long_target) && ((*list_head)->target <= timer->target)))) { list_head = &((*list_head)->next); }