forked from AbleOS/ableos
Documenting a bit in interrupts
This commit is contained in:
parent
f0ca90ae25
commit
2bd5ffb4eb
|
@ -177,11 +177,17 @@ pub fn init_idt() {
|
||||||
IDT.load();
|
IDT.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// https://wiki.osdev.org/Pit
|
||||||
|
///
|
||||||
const PIT_MAX_FREQ: u32 = 1193180;
|
const PIT_MAX_FREQ: u32 = 1193180;
|
||||||
|
|
||||||
pub fn set_pit_frequency(pit: u16, freq: u32) {
|
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();
|
let ret = (PIT_MAX_FREQ / freq).try_into();
|
||||||
|
|
||||||
|
// Type-bounded counter maximum.
|
||||||
let divisor: u16 = match ret {
|
let divisor: u16 = match ret {
|
||||||
Ok(div) => div,
|
Ok(div) => div,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
|
Loading…
Reference in a new issue