ax-api 0.5.12

Public APIs and types for ArceOS modules
mod mem;
mod task;

cfg_fs! {
    mod fs;
    pub use fs::*;
}

cfg_net! {
    mod net;
    pub use net::*;
}

cfg_display! {
    mod display;
    pub use display::*;
}

mod stdio {
    use core::fmt;

    pub fn ax_console_read_bytes(buf: &mut [u8]) -> crate::AxResult<usize> {
        let len = ax_hal::console::read_bytes(buf);
        for c in &mut buf[..len] {
            if *c == b'\r' {
                *c = b'\n';
            }
        }
        Ok(len)
    }

    pub fn ax_console_write_bytes(buf: &[u8]) -> crate::AxResult<usize> {
        ax_hal::console::write_bytes(buf);
        Ok(buf.len())
    }

    pub fn ax_console_write_fmt(args: fmt::Arguments) -> fmt::Result {
        ax_log::print_fmt(args)
    }
}

mod sys {
    pub use ax_hal::{cpu_num as ax_get_cpu_num, power::system_off as ax_terminate};
}

mod time {
    pub use ax_hal::time::{
        TimeValue as AxTimeValue, monotonic_time as ax_monotonic_time, wall_time as ax_wall_time,
    };
}

pub use ax_hal::power::system_off as ax_terminate;
pub use ax_io::PollState as AxPollState;

pub use self::{mem::*, stdio::*, sys::*, task::*, time::*};