|
PatchworkOS
|
#include <kernel/cpu/cpu.h>#include <kernel/cpu/interrupt.h>#include <kernel/cpu/smp.h>#include <kernel/cpu/syscalls.h>#include <kernel/drivers/apic.h>#include <kernel/drivers/hpet.h>#include <kernel/drivers/rtc.h>#include <kernel/log/log.h>#include <kernel/sched/timer.h>#include <kernel/log/panic.h>#include <kernel/sched/thread.h>#include <stdatomic.h>#include <stdbool.h>#include <stdint.h>#include <sys/math.h>Go to the source code of this file.
Functions | |
| static void | timer_acquire (void) |
| static void | timer_release (void) |
| static void | timer_accumulate (void) |
| void | timer_ctx_init (timer_ctx_t *ctx) |
| Initialize per-CPU timer context. | |
| static void | timer_init (void) |
| clock_t | timer_uptime (void) |
| Time since boot. | |
| time_t | timer_unix_epoch (void) |
| The unix epoch. | |
| void | timer_interrupt_handler (interrupt_frame_t *frame, cpu_t *self) |
| Handle timer interrupt. | |
| void | timer_subscribe (timer_ctx_t *ctx, timer_callback_t callback) |
| Subscribe to timer interrupts. | |
| void | timer_unsubscribe (timer_ctx_t *ctx, timer_callback_t callback) |
| Unsubscribe from timer interrupts. | |
| void | timer_one_shot (cpu_t *self, clock_t uptime, clock_t timeout) |
| Schedule a one-shot timer interrupt. | |
| SYSCALL_DEFINE (SYS_UPTIME, clock_t) | |
| SYSCALL_DEFINE (SYS_UNIX_EPOCH, time_t, time_t *timePtr) | |
| void | timer_notify (cpu_t *cpu) |
| Trigger timer interrupt on cpu. | |
| void | timer_notify_self (void) |
| Trigger timer interrupt on self. | |
Variables | |
| static time_t | bootEpoch |
| static bool | initialized = false |
| static atomic_int8_t | accumulatorLock = ATOMIC_VAR_INIT(0) |
| static clock_t | accumulator = 0 |
| SYSCALL_DEFINE | ( | SYS_UNIX_EPOCH | , |
| time_t | , | ||
| time_t * | timePtr | ||
| ) |
Definition at line 183 of file timer.c.
References ERR, NULL, sched_thread(), thread_copy_to_user(), and timer_unix_epoch().
| SYSCALL_DEFINE | ( | SYS_UPTIME | , |
| clock_t | |||
| ) |
Definition at line 178 of file timer.c.
References timer_uptime().
|
static |
Definition at line 41 of file timer.c.
References accumulator, hpet_nanoseconds_per_tick(), hpet_read_counter(), hpet_reset_counter(), timer_acquire(), and timer_release().
Referenced by timer_interrupt_handler().
|
static |
Definition at line 25 of file timer.c.
References accumulatorLock, atomic_compare_exchange_strong, and interrupt_disable().
Referenced by timer_accumulate(), and timer_uptime().
|
static |
Definition at line 64 of file timer.c.
References bootEpoch, initialized, mktime(), rtc_read(), and time().
Referenced by timer_unix_epoch(), and timer_uptime().
|
static |
Definition at line 35 of file timer.c.
References accumulatorLock, atomic_store, and interrupt_enable().
Referenced by timer_accumulate(), and timer_uptime().
|
static |
Definition at line 23 of file timer.c.
Referenced by timer_accumulate(), and timer_uptime().
|
static |
Definition at line 22 of file timer.c.
Referenced by timer_acquire(), and timer_release().
|
static |
Definition at line 19 of file timer.c.
Referenced by timer_init(), and timer_unix_epoch().
Definition at line 20 of file timer.c.
Referenced by timer_init(), timer_unix_epoch(), and timer_uptime().