refactor: ByteOffset newtype for window/register/ring offsets; named virtio-gpu cmd fields
This commit is contained in:
@@ -3,11 +3,12 @@
|
||||
|
||||
use libkos::Window;
|
||||
use port_input_device::{InputDevice, InputEvent, Key};
|
||||
use types::address::VirtualAddress;
|
||||
use types::address::{ByteOffset, VirtualAddress};
|
||||
|
||||
const UART_VA: VirtualAddress = VirtualAddress::from_raw(0x20000);
|
||||
const UART_IER_OFFSET: usize = 1;
|
||||
const UART_LSR_OFFSET: usize = 5;
|
||||
const UART_RBR: ByteOffset = ByteOffset::new(0);
|
||||
const UART_IER_OFFSET: ByteOffset = ByteOffset::new(1);
|
||||
const UART_LSR_OFFSET: ByteOffset = ByteOffset::new(5);
|
||||
/// IER bit: interrupt when a received byte is waiting (cleared by reading
|
||||
/// it, so `acknowledge` has nothing to do).
|
||||
const IER_RX_READY: u8 = 1;
|
||||
@@ -27,7 +28,7 @@ impl UartInputDevice {
|
||||
}
|
||||
|
||||
fn read_byte(&self) -> Option<u8> {
|
||||
self.has_event().then(|| self.regs.read(0))
|
||||
self.has_event().then(|| self.regs.read(UART_RBR))
|
||||
}
|
||||
|
||||
fn byte_to_key(byte: u8) -> Key {
|
||||
|
||||
Reference in New Issue
Block a user