[][src]Macro r3_port_riscv::use_plic

macro_rules! use_plic {
    (unsafe impl InterruptController for $sys:ty) => { ... };
}

Implement InterruptController and Plic on the given system type using the Platform-Level Interrupt Controller (PLIC) on the target. Requires PlicOptions.

This macro adds const fn configure_plic(b: &mut CfgBuilder<Self>) to the system type. It should be called by your application's configuration function. See the following example:

This example is not tested
r3_port_riscv::use_plic!(unsafe impl InterruptController for System);

impl r3_port_riscv::PlicOptions for System {
    // SiFive E
    const MAX_PRIORITY: InterruptPriority = 7;
    const MAX_NUM: InterruptNum = 127;
    const PLIC_BASE: usize = 0x0c00_0000;
}

const fn configure_app(b: &mut CfgBuilder<System>) -> Objects {
    System::configure_plic(b);
    /* ... */
}

Safety

  • The target must really include a PLIC.
  • PlicOptions should be configured correctly and the memory-mapped registers should be accessible.