diff options
Diffstat (limited to 'kc/core/pit8253.c')
| -rw-r--r-- | kc/core/pit8253.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/kc/core/pit8253.c b/kc/core/pit8253.c index 8be2872..0cf5232 100644 --- a/kc/core/pit8253.c +++ b/kc/core/pit8253.c @@ -13,6 +13,8 @@ #define CONFIG_CHANNEL_0 (SEL_CHANNEL0|ACC_LOHI|MODE_RATE|BIN_COUNT) +#define PIT_HZ 1193182U + static uint64_t count = 0; int pit8253_callback(uint8_t irq) @@ -22,7 +24,7 @@ int pit8253_callback(uint8_t irq) if (!(count % (185))) { - kprintf("it's been about %lu seconds\n", count / 18); + kprintf("it's been about %lu seconds since starting\n", count / 18); } return 0; @@ -30,6 +32,9 @@ int pit8253_callback(uint8_t irq) void pit8253_init(void) { + kprintf( + "initializing timer to an approximate frequency of %uHz\n", + PIT_HZ / 0xffff); outb(PIT8253_CMD, CONFIG_CHANNEL_0); outb(PIT8253_DATA0, 0xff); outb(PIT8253_DATA0, 0xff); @@ -46,6 +51,11 @@ void pit8253_stop(void) { } +uint64_t pit8253_count(void) +{ + return count; +} + void pit8253_set_hz(uint16_t hz) { (void)hz; |
