enable_direct

Function enable_direct 

Source
pub fn enable_direct(
    interrupt: Interrupt,
    level: Priority,
    cpu_interrupt: CpuInterrupt,
    handler: unsafe extern "C" fn(),
) -> Result<(), Error>
Expand description

Enable an interrupt by directly binding it to a 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.

Trying using a reserved interrupt from RESERVED_INTERRUPTS will return an error.