Changeset f1fae414 in mainline for kernel/generic/src/time/delay.c


Ignore:
Timestamp:
2011-06-22T01:34:53Z (13 years ago)
Author:
Petr Koupy <petr.koupy@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8d7e82c1, cac458f
Parents:
72ec8cc (diff), bf172825 (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.
Message:

Merge mainline changes.

File:
1 edited

Legend:

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

    r72ec8cc rf1fae414  
    3737 
    3838#include <time/delay.h>
     39#include <proc/thread.h>
    3940#include <typedefs.h>
    4041#include <cpu.h>
     
    4243#include <arch.h>
    4344
    44 /** Active delay
     45/** Delay the execution for the given number of microseconds (or slightly more).
    4546 *
    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.
    4948 *
    5049 * @param usec Number of microseconds to sleep.
     
    5251void delay(uint32_t usec)
    5352{
    54         ipl_t ipl;
    55        
    5653        /*
    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.
    6157         */
    62         ipl = interrupts_disable();
     58        if (THREAD)
     59                thread_migration_disable();
    6360        asm_delay_loop(usec * CPU->delay_loop_const);
    64         interrupts_restore(ipl);
     61        if (THREAD)
     62                thread_migration_enable();
    6563}
    6664
Note: See TracChangeset for help on using the changeset viewer.