/* Insert given timer in given list of active timers.  */
static void RAM_CODE timer_list_insert_isr(struct timer_list_t *self_p, struct timer_t *timer_p)
/* Insert given timer in given list of active timers.  */
static void RAM_CODE timer_list_insert_isr(struct timer_list_t *self_p, struct timer_t *timer_p)
{
    struct timer_t *elem_p;
    struct timer_t *prev_p;
    elem_p = self_p->head_p;
    prev_p = NULL;
    while (elem_p->delta < timer_p->delta) {
        timer_p->delta -= elem_p->delta;
        prev_p = elem_p;
        elem_p = elem_p->next_p;
    }
    if (elem_p != &self_p->tail) {
        elem_p->delta -= timer_p->delta;
    }
    timer_p->next_p = elem_p;
    if (prev_p == NULL) {
        self_p->head_p = timer_p;
    } else {
        prev_p->next_p = timer_p;
    }
}