pub struct Timer;
Expand description
Historically, PCs had a Timer component of type 8253 or 8254, modern systems come with a compatible chip. Each of these chips provides three 16-bit wide counters (“channel”), each running at a frequency of 1.19318 MHz. The timer’s counting speed is thereby independent from the CPU frequency.
Traditionally, the first counter (channel 0) was used for triggering interrupts, the second one (channel 1) controlled the memory refresh, and the third counter (channel 2) was assigned to the PC speaker.
As the PIT’s frequency is fixed to a constant value of 1.19318 MHz, the PIT can be used for calibration. For this purpose, we use channel 2 only.