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