Documenting a bit in interrupts

master
Elfein Landers 2022-08-06 20:43:23 -07:00
parent e86bbfcfe5
commit ffa70b68ce
1 changed files with 6 additions and 0 deletions

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