2022-04-25 13:39:39 -05:00
|
|
|
use cpuio::{inb, inl, inw, outb, outl, outw};
|
2022-03-11 13:51:47 -06:00
|
|
|
|
|
|
|
pub fn read32(reg: u16) -> u32 {
|
|
|
|
unsafe { inl(reg) }
|
|
|
|
}
|
2022-04-25 13:39:39 -05:00
|
|
|
pub fn read16(reg: u16) -> u16 {
|
|
|
|
unsafe { inw(reg) as u16 }
|
|
|
|
}
|
2022-04-11 17:23:11 -05:00
|
|
|
|
2022-03-11 13:51:47 -06:00
|
|
|
pub fn read8(reg: u16) -> u8 {
|
|
|
|
unsafe { inb(reg) }
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn write32(reg: u16, val: u32) {
|
|
|
|
unsafe { outl(val, reg) }
|
|
|
|
}
|
|
|
|
|
2022-04-25 13:39:39 -05:00
|
|
|
pub fn write16(reg: u16, val: u16) {
|
|
|
|
unsafe { outw(val, reg) }
|
|
|
|
}
|
|
|
|
|
2022-03-11 13:51:47 -06:00
|
|
|
pub fn write8(reg: u16, val: u8) {
|
|
|
|
unsafe { outb(val, reg) }
|
|
|
|
}
|