     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20

    mod ns16550a;

    pub use ns16550a::NS16550a;

    use crate::board::CharDeviceImpl;
    use alloc::sync::Arc;
    use lazy_static::*;

    pub trait CharDevice {
        fn read(&self) -> u8;
        fn write(&self, ch: u8);
        fn handle_irq(&self);
    }

    lazy_static! {
        pub static ref UART: Arc<CharDeviceImpl> = {
            kprintln!("[KERN] drivers::chardev::lazy_static!UART begin");
            Arc::new(CharDeviceImpl::new())
        };
    }