From 2bd5ffb4ebed973e24ccaf6f6df17ba1ce01dcdc Mon Sep 17 00:00:00 2001 From: Elfein Landers Date: Sat, 6 Aug 2022 20:43:23 -0700 Subject: [PATCH] Documenting a bit in interrupts --- ableos/src/arch/x86_64/interrupts.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ableos/src/arch/x86_64/interrupts.rs b/ableos/src/arch/x86_64/interrupts.rs index 8388be2..f18cd7a 100644 --- a/ableos/src/arch/x86_64/interrupts.rs +++ b/ableos/src/arch/x86_64/interrupts.rs @@ -177,11 +177,17 @@ pub fn init_idt() { IDT.load(); } +/// https://wiki.osdev.org/Pit +/// const PIT_MAX_FREQ: u32 = 1193180; pub fn set_pit_frequency(pit: u16, freq: u32) { + // Dividing the maximum frequency by the desired frequency + // gives roughly what the maximum value for the timer + // counter should be to run at the desired frequency. let ret = (PIT_MAX_FREQ / freq).try_into(); + // Type-bounded counter maximum. let divisor: u16 = match ret { Ok(div) => div, Err(err) => {