Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/time/delay.c

    r40f606b rd99c1d2  
    3737 
    3838#include <time/delay.h>
    39 #include <proc/thread.h>
    4039#include <typedefs.h>
    4140#include <cpu.h>
     
    4342#include <arch.h>
    4443
    45 /** Delay the execution for the given number of microseconds (or slightly more).
     44/** Active delay
    4645 *
    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.
    4849 *
    4950 * @param usec Number of microseconds to sleep.
     
    5152void delay(uint32_t usec)
    5253{
     54        ipl_t ipl;
     55       
    5356        /*
    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().
    5761         */
    58         if (THREAD)
    59                 thread_migration_disable();
     62        ipl = interrupts_disable();
    6063        asm_delay_loop(usec * CPU->delay_loop_const);
    61         if (THREAD)
    62                 thread_migration_enable();
     64        interrupts_restore(ipl);
    6365}
    6466
Note: See TracChangeset for help on using the changeset viewer.