Macro r3_port_arm::use_sp804
source · macro_rules! use_sp804 { (unsafe impl PortTimer for $Traits:ty) => { ... }; }
Expand description
Attach the implementation of PortTimer
that is based on
Arm PrimeCell SP804 Dual Timer to a given kernel trait type. This macro
also implements Timer
on the kernel trait type.
Requires Sp804Options
.
You should do the following:
- Implement
Sp804Options
on the kernel trait type$Traits
. - Call
$Traits::configure_sp804()
in your configuration function. See the following example.
ⓘ
r3_port_arm::use_sp804!(unsafe impl PortTimer for SystemTraits);
impl r3_port_arm::Sp804Options for SystemTraits {
const SP804_BASE: usize = 0x1001_1000;
const FREQUENCY: u64 = 1_000_000;
const INTERRUPT_NUM: InterruptNum = 36;
}
const fn configure_app<C>(b: &mut Cfg<SystemTraits>) -> Objects
where
C: ~const traits::CfgBase<System = System<SystemTraits>>,
{
SystemTraits::configure_sp804(b);
/* ... */
}
Safety
Sp804Options
must be configured correctly.