Skip to main content

enable_direct

Function enable_direct 

Source
pub fn enable_direct(
    interrupt: Interrupt,
    level: Priority,
    cpu_interrupt: DirectBindableCpuInterrupt,
    handler: unsafe extern "C" fn(),
)
Available on crate feature unstable only.
Expand description

Enables an interrupt by directly binding it to an available CPU interrupt.

⚠️ This installs a raw trap handler: the provided handler is written directly into the CPU interrupt vector table. That means:

  • The provided handler is used as an actual trap handler.
  • The caller must:
    • Save and restore all used registers.
    • Clear the interrupt source if necessary.
    • Return using the mret instruction.
  • The handler must be declared as a naked function. The compiler does not insert a function prologue or epilogue; a normal Rust fn results in an error

Unless low-level control is required for the lowest possible latency, enable is usually preferable

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.