hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/kernel/input.rv
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-09-25 18:08:17 +0200
committerhachem <im@hachem.wtf>2026-09-25 18:08:17 +0200
commitfd3f51eecaecc12806a573c38263df1de43ee8c2 (patch)
tree4bd43519ce87af6b791c7f86d8a273829a56786d /kernel/input.rv
parent6593ddc56fc96df0a566cc3b1a3e9396e4f3b2c6 (diff)
feat: pit timer
Diffstat (limited to 'kernel/input.rv')
-rw-r--r--kernel/input.rv9
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 }