Subversion Repositories HelenOS-historic

Rev

Rev 15 | Rev 404 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 15 Rev 107
Line 30... Line 30...
30
#include <arch/types.h>
30
#include <arch/types.h>
31
#include <cpu.h>
31
#include <cpu.h>
32
#include <arch/asm.h>
32
#include <arch/asm.h>
33
#include <arch.h>
33
#include <arch.h>
34
 
34
 
-
 
35
/** Active delay
35
/*
36
 *
36
 * Note that the delay loop is calibrated for each and every CPU in the system.
37
 * Delay the execution for the given number
37
 * Therefore it is necessary to cpu_priority_high() before calling the asm_delay_loop().
38
 * of microseconds (or slightly more). The delay
-
 
39
 * is implemented as CPU calibrated active loop.
-
 
40
 *
-
 
41
 * @param microseconds Number of usec to sleep.
-
 
42
 *
38
 */
43
 */
39
void delay(__u32 microseconds)
44
void delay(__u32 microseconds)
40
{
45
{
41
    pri_t pri;
46
    pri_t pri;
42
 
47
   
-
 
48
    /* The delay loop is calibrated for each and every
-
 
49
       CPU in the system. Therefore it is necessary to
-
 
50
       cpu_priority_high() before calling the asm_delay_loop(). */
43
    pri = cpu_priority_high();
51
    pri = cpu_priority_high();
44
    asm_delay_loop(microseconds * CPU->delay_loop_const);
52
    asm_delay_loop(microseconds * CPU->delay_loop_const);
45
    cpu_priority_restore(pri);
53
    cpu_priority_restore(pri);
46
}
54
}