gila/src/kernel/arch/x86_64/serial.rs
2025-05-16 10:57:30 -04:00

24 lines
453 B
Rust

// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later
use crate::{asm::*, log::LogSubscriber};
#[derive(Clone, Copy)]
pub struct Serialport {
port: u16,
}
impl LogSubscriber for Serialport {
fn write(&self, msg: &str) {
for c in msg.chars() {
unsafe { port_write_u8(self.port, c as u8) };
}
}
}
impl Serialport {
pub fn new(port: u16) -> Self {
Serialport { port }
}
}