Changes in kernel/generic/src/time/delay.c [40f606b:d99c1d2] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/time/delay.c
r40f606b rd99c1d2 37 37 38 38 #include <time/delay.h> 39 #include <proc/thread.h>40 39 #include <typedefs.h> 41 40 #include <cpu.h> … … 43 42 #include <arch.h> 44 43 45 /** Delay the execution for the given number of microseconds (or slightly more).44 /** Active delay 46 45 * 47 * The delay is implemented as active delay loop. 46 * Delay the execution for the given number 47 * of microseconds (or slightly more). The delay 48 * is implemented as CPU calibrated active loop. 48 49 * 49 50 * @param usec Number of microseconds to sleep. … … 51 52 void delay(uint32_t usec) 52 53 { 54 ipl_t ipl; 55 53 56 /* 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 * The delay loop is calibrated for each and every 58 * CPU in the system. Therefore it is necessary to 59 * call interrupts_disable() before calling the 60 * asm_delay_loop(). 57 61 */ 58 if (THREAD) 59 thread_migration_disable(); 62 ipl = interrupts_disable(); 60 63 asm_delay_loop(usec * CPU->delay_loop_const); 61 if (THREAD) 62 thread_migration_enable(); 64 interrupts_restore(ipl); 63 65 } 64 66
Note:
See TracChangeset
for help on using the changeset viewer.