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

Enable an interrupt by directly binding it to an available CPU interrupt

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

  • Provided handler will be used as an actual trap-handler
  • It is user’s responsibility to:
    • Save and restore all registers they use.
    • Clear the interrupt source if necessary.
    • Return using the mret instruction.
  • The handler should be declared as naked function. The compiler will not insert a function prologue/epilogue for the user, normal Rust fn will result in an error.

Unless you are sure that you need such low-level control to achieve the lowest possible latency, you most likely want to use enable instead.

§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.