1pub mod frame_console;
4pub mod uart_console;
5
6use alloc::{string::String, sync::Arc, vec::Vec};
7use spin::RwLock;
8
9lazy_static::lazy_static! {
10 pub static ref CONSOLES: RwLock<Vec<Arc<dyn Console>>> = RwLock::new(Vec::new());
12 pub static ref MAIN_CONSOLE: RwLock<Option<Arc<dyn Console>>> = RwLock::new(None);
14}
15
16pub trait Console: Send + Sync {
17 fn write_str(&self, s: &str);
19
20 fn read_char(&self) -> char;
22
23 fn read_line(&self, buf: &mut String);
25
26 fn flush(&self);
28}
29
30pub fn init() {
32 MAIN_CONSOLE.write().replace(CONSOLES.read()[0].clone());
33 }