//! irq 标记状态

cfg_if::cfg_if! {
    if #[cfg(aarch64_moana)] {
        mod aarch64;
        use aarch64::{arch_local_irq_enable, arch_local_irq_disable, arch_local_irq_save, arch_local_irq_restore, arch_local_daif_mask, arch_local_save_flags, arch_irqs_disabled, arch_irqs_disabled_flags};
    } else {
        mod dummy;
        use dummy::{arch_local_irq_enable, arch_local_irq_disable, arch_local_irq_save, arch_local_irq_restore, arch_local_daif_mask, arch_local_save_flags, arch_irqs_disabled, arch_irqs_disabled_flags};
    }
}

/// 启用本地中断
#[inline(always)]
pub fn local_irq_enable() {
    arch_local_irq_enable();
}

/// 禁用本地中断
#[inline(always)]
pub fn local_irq_disable() {
    arch_local_irq_disable();
}

/// 返回当前中断状态并禁用中断
#[inline(always)]
pub fn local_irq_save() -> usize {
    arch_local_irq_save()
}

/// 从保存的中断状态恢复中断状态
#[inline(always)]
pub fn local_irq_restore(flags: usize) {
    arch_local_irq_restore(flags);
}

/// 禁用所有异常中断
#[inline(always)]
pub fn local_daif_mask() {
    arch_local_daif_mask();
}

/// 返回当前中断状态
#[inline(always)]
pub fn local_save_flags() -> usize {
    arch_local_save_flags()
}

/// 当前中断是否禁用
#[inline(always)]
pub fn irqs_disabled() -> bool {
    arch_irqs_disabled()
}

/// 当前保存的中断状态是否是禁用中断
#[inline(always)]
pub fn irqs_disabled_flags(flags: usize) {
    arch_irqs_disabled_flags(flags);
}
