Expand description
Timer Implementation
Provides timer functionality for the kernel:
- PIT (Programmable Interval Timer) for legacy fallback
- APIC Timer for modern systems (calibrated via PIT channel 2)
Constantsยง
- NS_
PER_ TICK - Nanoseconds per timer tick (derived from TIMER_HZ).
- PIT_
CHANNE ๐L0_ PORT - Programmable Interval Timer (PIT) constants
- PIT_
COMMAND_ ๐PORT - PIT_
FREQUENCY ๐ - TIMER_
HZ - Kernel timer frequency in Hz.
Staticsยง
- APIC_
TICKS_ ๐PER_ 10MS - Cached APIC ticks per 10ms from calibration (used by APs)
- APIC_
TIMER_ ๐ACTIVE - Whether the APIC timer is currently active
Functionsยง
- apic_
ticks_ per_ 10ms - Return the cached calibration value (ticks per 10ms).
- calibrate_
apic_ timer - Calibrate the APIC timer using PIT channel 2 as a reference.
- init_
pit - Initialize the Programmable Interval Timer (PIT)
- is_
apic_ timer_ active - Check if the APIC timer is active
- start_
apic_ timer - Start the APIC timer in periodic mode.
- start_
apic_ timer_ cached - Start the APIC timer using the cached calibration value.
- stop_
pit - Stop PIT channel 0 to prevent phantom interrupts.