From e024c54be1b94093171eb4182c5fc21db5b2d7e2 Mon Sep 17 00:00:00 2001 From: Ada Christine Date: Mon, 14 Feb 2022 16:13:23 +0000 Subject: more task scheduling work, scheduler appears to work without crashing --- kc/core/pit8253.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'kc/core/pit8253.c') 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; -- cgit v1.3.1-1-g115d