pub trait IrqOps {
type LocalIrqState: Copy;
// Required methods
fn current_cpu(&self) -> CpuId;
fn cpu_online(&self, cpu: CpuId) -> bool;
fn in_irq_context(&self) -> bool;
fn local_irq_save(&self) -> Self::LocalIrqState;
fn local_irq_restore(&self, state: Self::LocalIrqState);
fn run_on_cpu_sync(
&self,
cpu: CpuId,
f: unsafe fn(*mut ()),
arg: *mut (),
) -> Result<(), IrqError>;
fn set_enabled(
&self,
irq: IrqNumber,
cpu: Option<CpuId>,
enabled: bool,
) -> Result<(), IrqError>;
fn is_enabled(
&self,
irq: IrqNumber,
cpu: Option<CpuId>,
) -> Result<bool, IrqError>;
fn is_pending(
&self,
irq: IrqNumber,
cpu: Option<CpuId>,
) -> Result<bool, IrqError>;
fn is_in_service(
&self,
irq: IrqNumber,
cpu: Option<CpuId>,
) -> Result<bool, IrqError>;
fn relax(&self);
}Expand description
External capabilities supplied by the OS/platform adapter.
Required Associated Types§
Sourcetype LocalIrqState: Copy
type LocalIrqState: Copy
Saved local IRQ state.
Required Methods§
Sourcefn current_cpu(&self) -> CpuId
fn current_cpu(&self) -> CpuId
Returns the current CPU.
Sourcefn cpu_online(&self, cpu: CpuId) -> bool
fn cpu_online(&self, cpu: CpuId) -> bool
Returns whether the CPU is online.
Sourcefn in_irq_context(&self) -> bool
fn in_irq_context(&self) -> bool
Returns whether the current execution context is an IRQ context.
Sourcefn local_irq_save(&self) -> Self::LocalIrqState
fn local_irq_save(&self) -> Self::LocalIrqState
Saves and disables local IRQs for metadata lock acquisition.
Sourcefn local_irq_restore(&self, state: Self::LocalIrqState)
fn local_irq_restore(&self, state: Self::LocalIrqState)
Restores local IRQ state saved by IrqOps::local_irq_save.
Sourcefn run_on_cpu_sync(
&self,
cpu: CpuId,
f: unsafe fn(*mut ()),
arg: *mut (),
) -> Result<(), IrqError>
fn run_on_cpu_sync( &self, cpu: CpuId, f: unsafe fn(*mut ()), arg: *mut (), ) -> Result<(), IrqError>
Runs a thunk synchronously on the target CPU.
Sourcefn set_enabled(
&self,
irq: IrqNumber,
cpu: Option<CpuId>,
enabled: bool,
) -> Result<(), IrqError>
fn set_enabled( &self, irq: IrqNumber, cpu: Option<CpuId>, enabled: bool, ) -> Result<(), IrqError>
Enables or disables an IRQ line.
Sourcefn is_enabled(
&self,
irq: IrqNumber,
cpu: Option<CpuId>,
) -> Result<bool, IrqError>
fn is_enabled( &self, irq: IrqNumber, cpu: Option<CpuId>, ) -> Result<bool, IrqError>
Returns whether the IRQ line is enabled.
Sourcefn is_pending(
&self,
irq: IrqNumber,
cpu: Option<CpuId>,
) -> Result<bool, IrqError>
fn is_pending( &self, irq: IrqNumber, cpu: Option<CpuId>, ) -> Result<bool, IrqError>
Returns whether the IRQ line is pending.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".