Documenting a bit in interrupts

This commit is contained in:
Elfein Landers 2022-08-06 20:43:23 -07:00
parent f0ca90ae25
commit 2bd5ffb4eb

View file

@ -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) => {