/// Wait for Timeout (Time Delay). /// \param[in] millisec \ref CMSIS_RTOS_TimeOutValue "time delay" value /// \return status code that indicates the execution status of the function. osStatus osDelay (uint32_t millisec) { if (port_isr_inside()) return osErrorISR; switch (tsk_delay(millisec*MSEC)) { case E_TIMEOUT: return osEventTimeout; default: return osErrorOS; } }
void * tick_clock (void *unused) { register clock_t start, end; register int tick = 0; for (;;) { start = times (NULL); tsk_delay (0, MILLISEC_2_NANOSEC (TICK_TIMER_GRANULARITY)); end = times (NULL); tick = end - start; if (tick <= 0) tick = 1; while (tick--) { update_times (); } } return NULL; }