Files | |
file | clock.h |
file | delay.h |
file | timeout.h |
file | clock.c |
High-level clock interrupt handler. | |
file | delay.c |
Active delay function. | |
file | timeout.c |
Timeout management functions. | |
Data Structures | |
struct | timeout |
struct | ptime |
Defines | |
#define | HZ 100 |
#define | us2ticks(us) ((__u64)(((__u32) (us)/(1000000/HZ)))) |
Typedefs | |
typedef void(* | timeout_handler_t )(void *arg) |
Functions | |
void | clock (void) |
void | clock_counter_init (void) |
void | delay (__u32 microseconds) |
void | timeout_init (void) |
void | timeout_initialize (timeout_t *t) |
void | timeout_reinitialize (timeout_t *t) |
void | timeout_register (timeout_t *t, __u64 usec, timeout_handler_t f, void *arg) |
bool | timeout_unregister (timeout_t *t) |
static void | clock_update_counters (void) |
Variables | |
ptime * | public_time |
static __native | secfrag = 0 |
|
Definition at line 38 of file clock.h. Referenced by clock_update_counters(), i8254_normal_operation(), and l_apic_init(). |
|
Definition at line 43 of file timeout.h. Referenced by timeout_register(). |
|
|
|
Clock routine Clock routine executed from clock interrupt handler (assuming interrupts_disable()'d). Runs expired timeouts and preemptive scheduling. Definition at line 125 of file clock.c. References timeout::arg, clock_update_counters(), CPU, f, timeout::handler, list_get_instance, list_remove(), spinlock_lock, spinlock_unlock(), timeout::ticks, and timeout_reinitialize(). Referenced by i8254_interrupt(), and l_apic_timer_interrupt(). Here is the call graph for this function: ![]() |
|
Initialize realtime clock counter The applications (and sometimes kernel) need to access accurate information about realtime data. We allocate 1 page with these data and update it periodically. Definition at line 78 of file clock.c. References frame_alloc, FRAME_ATOMIC, NULL, panic, PFN2ADDR(), public_time, ptime::seconds1, ptime::seconds2, sysinfo_set_item_val(), and ptime::useconds. Referenced by main_bsp_separated_stack(). Here is the call graph for this function: ![]() |
|
Update public counters Update it only on first processor TODO: Do we really need so many write barriers? Definition at line 102 of file clock.c. References CPU, HZ, public_time, secfrag, ptime::seconds1, ptime::seconds2, ptime::useconds, and write_barrier. Referenced by clock(). |
|
Active delay Delay the execution for the given number of microseconds (or slightly more). The delay is implemented as CPU calibrated active loop.
Definition at line 52 of file delay.c. References asm_delay_loop(), CPU, interrupts_disable(), and interrupts_restore(). Referenced by i8254_calibrate_delay_loop(), l_apic_init(), l_apic_send_init_ipi(), and scheduler_separated_stack(). Here is the call graph for this function: ![]() |
|
Initialize timeouts Initialize kernel timeouts. Definition at line 55 of file timeout.c. References CPU, list_initialize(), and spinlock_initialize(). Referenced by main_ap_separated_stack(), and main_bsp_separated_stack(). Here is the call graph for this function: ![]() |
|
Initialize timeout Initialize all members including the lock.
Definition at line 86 of file timeout.c. References spinlock_initialize(), and timeout_reinitialize(). Referenced by thread_create(). Here is the call graph for this function: ![]() |
|
Register timeout Insert timeout handler f (with argument arg) to timeout list and make it execute in time microseconds (or slightly more).
Definition at line 106 of file timeout.c. References timeout::arg, timeout::cpu, CPU, timeout::handler, interrupts_disable(), interrupts_restore(), timeout::link, list_get_instance, list_prepend(), link::next, NULL, panic, link::prev, spinlock_lock, spinlock_unlock(), timeout::ticks, and us2ticks. Referenced by waitq_sleep_timeout_unsafe(). Here is the call graph for this function: ![]() |
|
Reinitialize timeout Initialize all members except the lock.
Definition at line 69 of file timeout.c. References timeout::arg, timeout::cpu, timeout::handler, timeout::link, link_initialize(), NULL, and timeout::ticks. Referenced by clock(), timeout_initialize(), and timeout_unregister(). Here is the call graph for this function: ![]() |
|
Unregister timeout Remove timeout from timeout list.
Definition at line 174 of file timeout.c. References timeout::cpu, interrupts_disable(), interrupts_restore(), timeout::link, list_get_instance, list_remove(), link::next, spinlock_lock, spinlock_trylock(), spinlock_unlock(), timeout::ticks, cpu::timeout_active_head, and timeout_reinitialize(). Referenced by _waitq_wakeup_unsafe(), and waitq_interrupt_sleep(). Here is the call graph for this function: ![]() |
|
Definition at line 64 of file clock.c. Referenced by clock_counter_init(), and clock_update_counters(). |
|
Definition at line 68 of file clock.c. Referenced by clock_update_counters(). |