Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 103 → Rev 107

/SPARTAN/trunk/src/time/delay.c
32,14 → 32,22
#include <arch/asm.h>
#include <arch.h>
 
/*
* Note that the delay loop is calibrated for each and every CPU in the system.
* Therefore it is necessary to cpu_priority_high() before calling the asm_delay_loop().
/** Active delay
*
* Delay the execution for the given number
* of microseconds (or slightly more). The delay
* is implemented as CPU calibrated active loop.
*
* @param microseconds Number of usec to sleep.
*
*/
void delay(__u32 microseconds)
{
pri_t pri;
 
/* The delay loop is calibrated for each and every
CPU in the system. Therefore it is necessary to
cpu_priority_high() before calling the asm_delay_loop(). */
pri = cpu_priority_high();
asm_delay_loop(microseconds * CPU->delay_loop_const);
cpu_priority_restore(pri);
/SPARTAN/trunk/src/time/timeout.c
38,6 → 38,12
#include <arch/asm.h>
#include <arch.h>
 
 
/** Initialize timeouts
*
* Initialize kernel timeouts.
*
*/
void timeout_init(void)
{
spinlock_initialize(&CPU->timeoutlock);
45,6 → 51,13
}
 
 
/** Initialize empty timeout list
*
* Initialize the timeout list to be empty.
*
* @param t Timeout list to be initialized.
*
*/
void timeout_reinitialize(timeout_t *t)
{
t->cpu = NULL;
54,6 → 67,14
link_initialize(&t->link);
}
 
 
/** Initialize timeout list
*
* Initialize the timeout list and its spinlock.
*
* @param t Timeout list to be initialized.
*
*/
void timeout_initialize(timeout_t *t)
{
spinlock_initialize(&t->lock);
60,8 → 81,19
timeout_reinitialize(t);
}
 
/*
* This function registers f for execution in about time microseconds.
 
/** Register timeout callback
*
* Insert the timeout handler f (with argument arg)
* to the timeout list and make it execute in
* time microseconds (or slightly more).
*
* @param t Timeout list.
* @patam time Number of usec in the future to execute
* the handler.
* @param f Timeout handler function.
* @param arg Timeout handler argument.
*
*/
void timeout_register(timeout_t *t, __u64 time, timeout_handler f, void *arg)
{
121,6 → 153,14
cpu_priority_restore(pri);
}
 
 
/** Unregister timeout callback
*
* Remove timeout from timeout list.
*
* @param t Timeout to unregister.
*
*/
int timeout_unregister(timeout_t *t)
{
timeout_t *hlp;
/SPARTAN/trunk/src/time/clock.c
43,8 → 43,12
#include <arch/smp/atomic.h>
#endif
 
/*
* Clock is called from an interrupt and is cpu_priority_high()'d.
/** Clock routine
*
* Clock routine executed from clock interrupt handler
* (assuming cpu_priority_high()). Runs expired timeouts
* and preemptive scheduling.
*
*/
void clock(void)
{