implements the PIT

This commit is contained in:
2025-06-08 13:22:09 -04:00
parent c6cc318c69
commit ac3dc4d48a
4 changed files with 26 additions and 4 deletions

View File

@ -61,4 +61,15 @@ void set_pit_count(uint8_t channel, uint16_t count) // Only in lobyte/hibyte mod
// TODO: make sure to set interrupts
}
void init_pit(uint8_t init_command, uint8_t channel, uint32_t divisor)
{
uint32_t normalized_div = normalize_divisor(divisor);
pit.divisor = normalized_div;
pit.interrupts = 0;
outb(PIT_CMD_REG, init_command); // access mode must be lobyte/hibyte
outb(channel, normalized_div & 0xFF);
outb(channel, (normalized_div & 0xFF00) >> 8);
}