|
AquilaOS documentation
How it works, and its code
|
The tick: the virtual timer of ARM's generic timer, which is each CPU's own (PPI 27). More...
Go to the source code of this file.
Functions | |
| static void | timer_irq (void *arg) |
| Handles the timer's interrupt: arms the next tick, and runs the tick's handler. | |
| uint64_t | timer_setup (uint64_t period_ns, void(*handler)(void)) |
| Starts the tick. | |
| uint64_t | arch_rtime_ns (void) |
| Reads the monotonic clock, which starts at boot. | |
| uint64_t | arch_rtime_us (void) |
| Reads the monotonic clock, in microseconds. | |
| uint64_t | arch_rtime_ms (void) |
| Reads the monotonic clock, in milliseconds. | |
| uint64_t | arch_cycles (void) |
| Reads a counter that changes as fast as the CPU runs, which the kernel uses as a source of randomness. | |
Variables | |
| static uint64_t | freq |
| static uint64_t | interval |
| static void(*) | tick (void) |
The tick: the virtual timer of ARM's generic timer, which is each CPU's own (PPI 27).
Its counter (CNTVCT_EL0) runs at CNTFRQ_EL0 from boot, so it's the kernel's clock too (arch_rtime_ns()).
References: [1] - Arm Architecture Reference Manual for A-profile, chapter D11 (The Generic Timer in AArch64 state)
Definition in file timer.c.
| uint64_t arch_cycles | ( | void | ) |
Reads a counter that changes as fast as the CPU runs, which the kernel uses as a source of randomness.
Definition at line 82 of file timer.c.
References arch_cycles(), and read_sysreg.
Referenced by arch_cycles(), random_stir(), and sched_timer_tick().
| uint64_t arch_rtime_ms | ( | void | ) |
Reads the monotonic clock, in milliseconds.
Definition at line 73 of file timer.c.
References arch_rtime_ms(), and arch_rtime_ns().
Referenced by arch_rtime_ms(), arp_lookup(), arp_update(), and procfs_uptime().
| uint64_t arch_rtime_ns | ( | void | ) |
Reads the monotonic clock, which starts at boot.
Definition at line 56 of file timer.c.
References arch_rtime_ns(), and read_sysreg.
Referenced by arch_rtime_ms(), arch_rtime_ns(), arch_rtime_us(), callout_set_on(), deadline(), flush_old(), gettime(), make_dirty(), net_main(), poll_deadline(), posix_file_read(), random_stir(), sched_alarm(), sched_alarm_get(), sched_timer_tick(), sched_wait(), socket_inet_recv(), sys_clock_gettime(), sys_nanosleep(), sys_times(), tcp_iss(), tcp_output(), tcp_send_syn(), time_resync(), and timer_calibrate().
| uint64_t arch_rtime_us | ( | void | ) |
Reads the monotonic clock, in microseconds.
Definition at line 65 of file timer.c.
References arch_rtime_ns(), and arch_rtime_us().
Referenced by arch_rtime_us().
|
static |
Handles the timer's interrupt: arms the next tick, and runs the tick's handler.
Definition at line 21 of file timer.c.
References interval, tick, timer_irq(), and write_sysreg.
Referenced by timer_irq(), and timer_setup().
Starts the tick.
| period_ns | how often it comes, in ns |
| handler | what it calls |
Definition at line 37 of file timer.c.
References freq, interval, irq_install(), isb, NULL, printk(), read_sysreg, tick, timer_irq(), timer_setup(), VIRT_TIMER_IRQ, and write_sysreg.
Referenced by arch_sched_init(), and timer_setup().
|
static |
Definition at line 16 of file timer.c.
Referenced by timer_setup().
|
static |
Definition at line 16 of file timer.c.
Referenced by sched_alarm(), sched_alarm_get(), scheduler_init(), timer_irq(), and timer_setup().
|
static |
Definition at line 17 of file timer.c.
Referenced by sys_times(), timer_irq(), and timer_setup().