[][src]Macro r3_port_arm::use_sp804

macro_rules! use_sp804 {
    (unsafe impl PortTimer for $ty:ty) => { ... };
}

Attach the implementation of PortTimer that is based on Arm PrimeCell SP804 Dual Timer to a given system type. This macro also implements Timer on the system type. Requires Sp804Options.

You should do the following:

  • Implement Sp804Options on the system type $ty.
  • Call $ty::configure_sp804() in your configuration function. See the following example.
This example is not tested
r3_port_arm::use_sp804!(unsafe impl PortTimer for System);

impl r3_port_arm::Sp804Options for System {
    const SP804_BASE: usize = 0x1001_1000;
    const FREQUENCY: u64 = 1_000_000;
    const INTERRUPT_NUM: InterruptNum = 36;
}

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

Safety

  • Sp804Options must be configured correctly.