use alioth_macros::trace_error;
use snafu::Snafu;
use crate::errors::DebugTrace;
use crate::mem::emulated::Mmio;
pub mod clock;
pub mod cmos;
pub mod console;
#[cfg(target_arch = "x86_64")]
#[path = "fw_cfg/fw_cfg.rs"]
pub mod fw_cfg;
pub mod fw_dbg;
#[cfg(target_arch = "x86_64")]
pub mod ioapic;
pub mod net;
#[cfg(target_arch = "aarch64")]
pub mod pl011;
#[cfg(target_arch = "aarch64")]
pub mod pl031;
#[cfg(target_arch = "x86_64")]
pub mod serial;
#[trace_error]
#[derive(Snafu, DebugTrace)]
#[snafu(module, visibility(pub(crate)), context(suffix(false)))]
pub enum Error {
#[snafu(display("Error from OS"), context(false))]
System { error: std::io::Error },
#[snafu(display("Device is not pausable"))]
NotPausable,
}
pub type Result<T, E = Error> = std::result::Result<T, E>;
pub trait Pause {
fn pause(&self) -> Result<()> {
error::NotPausable.fail()
}
fn resume(&self) -> Result<()> {
error::NotPausable.fail()
}
}
pub trait MmioDev: Mmio + Pause {}