diff options
| author | hachem <im@hachem.wtf> | 2026-09-25 18:08:17 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-09-25 18:08:17 +0200 |
| commit | fd3f51eecaecc12806a573c38263df1de43ee8c2 (patch) | |
| tree | 4bd43519ce87af6b791c7f86d8a273829a56786d /kernel/input.rv | |
| parent | 6593ddc56fc96df0a566cc3b1a3e9396e4f3b2c6 (diff) | |
feat: pit timer
Diffstat (limited to 'kernel/input.rv')
| -rw-r--r-- | kernel/input.rv | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/input.rv b/kernel/input.rv index fde962d..d069521 100644 --- a/kernel/input.rv +++ b/kernel/input.rv @@ -14,6 +14,15 @@ fn pic_remap() do end fn pic_unmask(line) outb(0x21, inb(0x21) band (255 bxor (1 shl line))) +# 8253/8254 PIT channel 0, mode 3 (square wave) +# divisor 11931 -> ~100 Hz (1193182 / 11931) +# the ISR just counts ticks +fn pit_init() do + outb(0x43, 0x36) + outb(0x40, 11931 band 0xff) + outb(0x40, (11931 shr 8) band 0xff) +end + # she stroke my keys till i handle # no fr this is just a key stroke handler global sh = { line = "", shift = :false } |
