esp/hr_timer: Fix issue with timed-out timers

This commit is contained in:
Tiago Medicci Serrano 2024-04-18 17:55:44 -03:00 committed by Xiang Xiao
parent 35f8c19112
commit 47b0cae778

View file

@ -491,6 +491,23 @@ void esp_hr_timer_stop(struct esp_hr_timer_s *timer)
}
}
}
else if (timer->state == HR_TIMER_TIMEOUT)
{
/* If the timer is in the timeout list, remove it from the list,
* execute its callback function and set its state to idle.
*/
DEBUGASSERT(!list_is_empty(&priv->toutlist));
list_delete(&timer->list);
timer->state = HR_TIMER_IDLE;
spin_unlock_irqrestore(&priv->lock, flags);
timer->callback(timer->arg);
flags = spin_lock_irqsave(&priv->lock);
}
spin_unlock_irqrestore(&priv->lock, flags);
}