CTL with extended sleep modes

Comments

1 comment

  • Avatar
    Michael Johnson

    Something like this should do it

    CTL_TIME_t
    ctl_next_wakeup_time()
    {
      CTL_TIME_t wakeup = -1;
      int en = ctl_global_interrupts_disable();
      CTL_TASK_t *t = ctl_task_list;
      while (t)
        if (t->state & CTL_STATE_TIMER_WAIT)
          if (t->timeout < wakeup)
            wakeup = t->timeout;
      if (en)
        ctl_global_interrupts_enable();
      return wakeup;
    }

    0
    Comment actions Permalink

Please sign in to leave a comment.