PatchworkOS
Loading...
Searching...
No Matches
timer.h File Reference
#include <kernel/cpu/interrupt.h>
#include <kernel/sync/lock.h>
#include <sys/proc.h>
#include <time.h>

Go to the source code of this file.

Data Structures

struct  timer_ctx_t
 Per-CPU system time context. More...
 

Macros

#define TIMER_MAX_CALLBACK   16
 Maximum amount of timer callbacks.
 

Typedefs

typedef struct cpu cpu_t
 
typedef void(* timer_callback_t) (interrupt_frame_t *frame, cpu_t *self)
 Timer callback function type.
 

Functions

void timer_ctx_init (timer_ctx_t *ctx)
 Initialize per-CPU timer context.
 
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.
 
void timer_notify (cpu_t *cpu)
 Trigger timer interrupt on cpu.
 
void timer_notify_self (void)
 Trigger timer interrupt on self.
 

Typedef Documentation

◆ cpu_t

typedef struct cpu cpu_t

Definition at line 9 of file timer.h.