Delay the execution for the given number of microseconds (or slightly more). * * The delay is implemented as active delay loop. * * @param usec Number of microseconds to sleep. */
| 49 | * @param usec Number of microseconds to sleep. |
| 50 | */ |
| 51 | void delay(uint32_t usec) |
| 52 | { |
| 53 | /* |
| 54 | * The delay loop is calibrated for each and every CPU in the system. |
| 55 | * If running in a thread context, it is therefore necessary to disable |
| 56 | * thread migration. We want to do this in a lightweight manner. |
| 57 | */ |
| 58 | if (THREAD) |
| 59 | thread_migration_disable(); |
| 60 | asm_delay_loop(usec * CPU->delay_loop_const); |
| 61 | if (THREAD) |
| 62 | thread_migration_enable(); |
| 63 | } |
| 64 | |
| 65 | /** @} |
| 66 | */ |
no test coverage detected