* @brief Delays the execution of the current thread for the specified number of microseconds. * * @param usec The number of microseconds to sleep. * * @return Returns 0 on success. */
| 101 | * @return Returns 0 on success. |
| 102 | */ |
| 103 | int usleep(useconds_t usec) |
| 104 | { |
| 105 | if (rt_thread_self() != RT_NULL) |
| 106 | { |
| 107 | msleep(usec / 1000u); |
| 108 | udelay(usec % 1000u); |
| 109 | } |
| 110 | else /* scheduler has not run yet */ |
| 111 | { |
| 112 | udelay(usec); |
| 113 | } |
| 114 | |
| 115 | return 0; |
| 116 | } |
| 117 | RTM_EXPORT(usleep); |
no test coverage detected