Changeset a33f0a6 in mainline for kernel/generic/src/time/delay.c
- Timestamp:
- 2011-08-03T17:34:57Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1940326
- Parents:
- 52a79081 (diff), 3fab770 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/time/delay.c
r52a79081 ra33f0a6 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.