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

@ -16,7 +16,7 @@
*/
enum PIT_CHANNEL {
CHANNEL_0 = 0x0,
CHANNEL_1,
CHANNEL_1, // this channel isn't always here...
CHANNEL_2,
/**
* Isn't supported on 8253 chips, but should be supported on AT and later (except for PS/2).
@ -245,9 +245,12 @@ enum PIT_DIGIT_MODE {
struct pit_state {
uint32_t divisor;
// this allows us to track a.. very long time before an overflow... 52ms * INT64MAX = 4.8e20ms = 5.6e12 days = 1.5e7 centuries
// TODO: ... handle overflow? :p
uint64_t interrupts;
} __attribute__((packed));
void init_pit(uint32_t divisor);
void init_pit(uint8_t init_command, uint8_t channel, uint32_t divisor);
double get_time_from_divisor(uint32_t divisor);