use lazy_static::lazy_static; use spin::Mutex; use uart_16550::SerialPort; const SERIAL_IO_PORT: u16 = 0x3F8; lazy_static! { pub static ref SERIAL1: Mutex = { let mut serial_port = unsafe { SerialPort::new(SERIAL_IO_PORT) }; serial_port.init(); Mutex::new(serial_port) }; } #[derive(Default)] pub struct SerialStream {} impl SerialStream { pub fn new() -> Self { SerialStream {} } } impl core::fmt::Write for SerialStream { fn write_str(&mut self, s: &str) -> core::fmt::Result { SERIAL1.lock().write_str(s) } }