e
E
This commit is contained in:
@@ -24,6 +24,19 @@ pub fn _print(args: core::fmt::Arguments) {
|
||||
})
|
||||
|
||||
}
|
||||
pub fn serial_reply(chr: char) -> char {
|
||||
use core::fmt::Write;
|
||||
use x86_64::instructions::interrupts;
|
||||
|
||||
let mut chr_return: char = 'X';
|
||||
|
||||
interrupts::without_interrupts(|| {
|
||||
SERIAL1.lock().send(chr as u8);
|
||||
chr_return = SERIAL1.lock().receive() as char ;
|
||||
});
|
||||
|
||||
chr_return
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! serial_print {
|
||||
|
||||
@@ -8,6 +8,7 @@ use alloc::vec::Vec;
|
||||
|
||||
pub use crate::{print, println, serial_print, serial_println};
|
||||
pub use crate::kernel::render::Color;
|
||||
use crate::kernel::serial::serial_reply;
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
use spin::Mutex;
|
||||
@@ -30,6 +31,14 @@ impl Stdin {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Serial {}
|
||||
|
||||
impl Serial {
|
||||
pub fn reply_char(c: char) -> char {
|
||||
serial_reply(c)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Screen {}
|
||||
impl Screen {
|
||||
pub fn terminal_mode() {
|
||||
|
||||
Reference in New Issue
Block a user