diff options
| author | Ada Christine <adachristine18@gmail.com> | 2022-02-14 16:13:23 +0000 |
|---|---|---|
| committer | Ada Christine <adachristine18@gmail.com> | 2022-02-14 16:22:54 +0000 |
| commit | e024c54be1b94093171eb4182c5fc21db5b2d7e2 (patch) | |
| tree | 9125564493b48f0562da484c628e02730e581cc6 /kc/core/pit8253.c | |
| parent | f020142891decdf63e5908b4756bcaad9b0f5f7e (diff) | |
more task scheduling work, scheduler appears to work without crashing
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; |
