PatchworkOS  966e257
A non-POSIX operating system.
Loading...
Searching...
No Matches
timer.c File Reference
#include <kernel/cpu/cpu.h>
#include <kernel/cpu/interrupt.h>
#include <kernel/cpu/irq.h>
#include <kernel/cpu/syscall.h>
#include <kernel/log/log.h>
#include <kernel/log/panic.h>
#include <kernel/module/symbol.h>
#include <kernel/sched/clock.h>
#include <kernel/sched/thread.h>
#include <kernel/sched/timer.h>
#include <kernel/sync/rwlock.h>
#include <stdbool.h>
#include <stdint.h>
#include <sys/math.h>
#include <time.h>
Include dependency graph for timer.c:

Go to the source code of this file.

Functions

void timer_cpu_ctx_init (timer_cpu_ctx_t *ctx)
 Initialize per-CPU timer context.
 
void timer_ack_eoi (interrupt_frame_t *frame, cpu_t *self)
 Acknowledge a timer interrupt and send EOI.
 
uint64_t timer_source_register (const timer_source_t *source)
 Register a timer source.
 
void timer_source_unregister (const timer_source_t *source)
 Unregister a timer source.
 
uint64_t timer_source_amount (void)
 Get the amount of registered timer sources.
 
void timer_set (clock_t uptime, clock_t deadline)
 Schedule a one-shot timer interrupt on the current CPU.
 

Variables

static const timer_source_tsources [TIMER_MAX_SOURCES] = {0}
 
static uint32_t sourceCount = 0
 
static const timer_source_tbestSource = NULL
 
static rwlock_t sourcesLock = RWLOCK_CREATE()
 

Variable Documentation

◆ sources

const timer_source_t* sources[TIMER_MAX_SOURCES] = {0}
static

Definition at line 18 of file timer.c.

◆ sourceCount

uint32_t sourceCount = 0
static

Definition at line 19 of file timer.c.

◆ bestSource

const timer_source_t* bestSource = NULL
static

Definition at line 20 of file timer.c.

◆ sourcesLock

rwlock_t sourcesLock = RWLOCK_CREATE()
static

Definition at line 21 of file timer.c.