pub struct MmioTimer<'a> { /* private fields */ }Expand description
An MMIO wrapper for Timer
Implementations§
Source§impl MmioTimer<'_>
impl MmioTimer<'_>
Sourcepub const unsafe fn clone(&self) -> Self
pub const unsafe fn clone(&self) -> Self
Unsafely clone the MMIO handle.
§Safety
This allows to create multiple instances of the same MMIO handle. The user must ensure that these handles are not used concurrently in a way that leads to data races.
Sourcepub fn pointer_to_control(&self) -> *mut Control
pub fn pointer_to_control(&self) -> *mut Control
Obtain a pointer to the Timer::control register.
This function allows modification through the pointer but does not require mutable access to the MMIO handle. The caller should specify the correct mutability depending on how the pointer is used.
Never create a reference from this pointer - only use read/write/read_volatile/write_volatile methods on it.
Sourcepub fn read_control(&self) -> Control
pub fn read_control(&self) -> Control
Read the Timer::control register.
Sourcepub fn write_control(&mut self, value: Control)
pub fn write_control(&mut self, value: Control)
Write the Timer::control register.
Sourcepub fn modify_control<F>(&mut self, f: F)
pub fn modify_control<F>(&mut self, f: F)
Read-Modify-Write the Timer::control register.
Sourcepub fn pointer_to_reset_value(&self) -> *mut u32
pub fn pointer_to_reset_value(&self) -> *mut u32
Obtain a pointer to the Timer::reset_value register.
This function allows modification through the pointer but does not require mutable access to the MMIO handle. The caller should specify the correct mutability depending on how the pointer is used.
Never create a reference from this pointer - only use read/write/read_volatile/write_volatile methods on it.
Sourcepub fn read_reset_value(&self) -> u32
pub fn read_reset_value(&self) -> u32
Read the Timer::reset_value register.
Sourcepub fn write_reset_value(&mut self, value: u32)
pub fn write_reset_value(&mut self, value: u32)
Write the Timer::reset_value register.
Sourcepub fn modify_reset_value<F>(&mut self, f: F)
pub fn modify_reset_value<F>(&mut self, f: F)
Read-Modify-Write the Timer::reset_value register.
Sourcepub fn pointer_to_count_value(&self) -> *mut u32
pub fn pointer_to_count_value(&self) -> *mut u32
Obtain a pointer to the Timer::count_value register.
This function allows modification through the pointer but does not require mutable access to the MMIO handle. The caller should specify the correct mutability depending on how the pointer is used.
Never create a reference from this pointer - only use read/write/read_volatile/write_volatile methods on it.
Sourcepub fn read_count_value(&self) -> u32
pub fn read_count_value(&self) -> u32
Read the Timer::count_value register.
Sourcepub fn write_count_value(&mut self, value: u32)
pub fn write_count_value(&mut self, value: u32)
Write the Timer::count_value register.
Sourcepub fn modify_count_value<F>(&mut self, f: F)
pub fn modify_count_value<F>(&mut self, f: F)
Read-Modify-Write the Timer::count_value register.
Sourcepub fn pointer_to_enable_control(&self) -> *mut EnableControl
pub fn pointer_to_enable_control(&self) -> *mut EnableControl
Obtain a pointer to the Timer::enable_control register.
This function allows modification through the pointer but does not require mutable access to the MMIO handle. The caller should specify the correct mutability depending on how the pointer is used.
Never create a reference from this pointer - only use read/write/read_volatile/write_volatile methods on it.
Sourcepub fn read_enable_control(&self) -> EnableControl
pub fn read_enable_control(&self) -> EnableControl
Read the Timer::enable_control register.
Sourcepub fn write_enable_control(&mut self, value: EnableControl)
pub fn write_enable_control(&mut self, value: EnableControl)
Write the Timer::enable_control register.
Sourcepub fn modify_enable_control<F>(&mut self, f: F)
pub fn modify_enable_control<F>(&mut self, f: F)
Read-Modify-Write the Timer::enable_control register.
Sourcepub fn pointer_to_cascade_control(&self) -> *mut CascadeControl
pub fn pointer_to_cascade_control(&self) -> *mut CascadeControl
Obtain a pointer to the Timer::cascade_control register.
This function allows modification through the pointer but does not require mutable access to the MMIO handle. The caller should specify the correct mutability depending on how the pointer is used.
Never create a reference from this pointer - only use read/write/read_volatile/write_volatile methods on it.
Sourcepub fn read_cascade_control(&self) -> CascadeControl
pub fn read_cascade_control(&self) -> CascadeControl
Read the Timer::cascade_control register.
Sourcepub fn write_cascade_control(&mut self, value: CascadeControl)
pub fn write_cascade_control(&mut self, value: CascadeControl)
Write the Timer::cascade_control register.
Sourcepub fn modify_cascade_control<F>(&mut self, f: F)
pub fn modify_cascade_control<F>(&mut self, f: F)
Read-Modify-Write the Timer::cascade_control register.
Sourcepub fn pointer_to_cascade_start(&self) -> *mut CascadeSourceReg
pub fn pointer_to_cascade_start(&self) -> *mut CascadeSourceReg
Obtain a pointer to the Timer::cascade first entry register array.
This function allows modification through the pointer but does not require mutable access to the MMIO handle. The caller should specify the correct mutability depending on how the pointer is used.
Never create a reference from this pointer - only use read/write/read_volatile/write_volatile methods on it.
The add method method of the pointer can be used to access entries of the array at higher indices.
Sourcepub unsafe fn read_cascade_unchecked(&self, index: usize) -> CascadeSourceReg
pub unsafe fn read_cascade_unchecked(&self, index: usize) -> CascadeSourceReg
Read the Timer::cascade register.
§Safety
This function does not perform bounds checking and performs a volatile read on a raw pointer with the given offset which might lead to undefined behaviour. Users MUST ensure that the offset is valid.
Sourcepub fn read_cascade(
&self,
index: usize,
) -> Result<CascadeSourceReg, OutOfBoundsError>
pub fn read_cascade( &self, index: usize, ) -> Result<CascadeSourceReg, OutOfBoundsError>
Read the Timer::cascade register.
This function also performs bound checking.
Sourcepub unsafe fn write_cascade_unchecked(
&mut self,
index: usize,
value: CascadeSourceReg,
)
pub unsafe fn write_cascade_unchecked( &mut self, index: usize, value: CascadeSourceReg, )
Write the Timer::cascade register.
§Safety
This function does not perform bounds checking and performs a volatile write on a raw pointer with the given offset which might lead to undefined behaviour. Users MUST ensure that the offset is valid.
Sourcepub fn write_cascade(
&mut self,
index: usize,
value: CascadeSourceReg,
) -> Result<(), OutOfBoundsError>
pub fn write_cascade( &mut self, index: usize, value: CascadeSourceReg, ) -> Result<(), OutOfBoundsError>
Write the Timer::cascade register.
This function also performs bound checking.
Sourcepub unsafe fn modify_cascade_unchecked<F>(&mut self, index: usize, f: F)
pub unsafe fn modify_cascade_unchecked<F>(&mut self, index: usize, f: F)
Read-Modify-Write the Timer::cascade register.
This function does not perform bounds checking and performs a volatile read and a volatile write on a raw pointer with the given offset which might lead to undefined behaviour. Users MUST ensure that the offset is valid.
Sourcepub fn modify_cascade(
&mut self,
index: usize,
f: impl FnOnce(CascadeSourceReg) -> CascadeSourceReg,
) -> Result<(), OutOfBoundsError>
pub fn modify_cascade( &mut self, index: usize, f: impl FnOnce(CascadeSourceReg) -> CascadeSourceReg, ) -> Result<(), OutOfBoundsError>
Read-Modify-Write the Timer::cascade register.
This function also performs bound checking.
Sourcepub fn pointer_to_pwma_value(&self) -> *mut u32
pub fn pointer_to_pwma_value(&self) -> *mut u32
Obtain a pointer to the Timer::pwma_value register.
This function allows modification through the pointer but does not require mutable access to the MMIO handle. The caller should specify the correct mutability depending on how the pointer is used.
Never create a reference from this pointer - only use read/write/read_volatile/write_volatile methods on it.
Sourcepub fn read_pwma_value(&self) -> u32
pub fn read_pwma_value(&self) -> u32
Read the Timer::pwma_value register.
Sourcepub fn write_pwma_value(&mut self, value: u32)
pub fn write_pwma_value(&mut self, value: u32)
Write the Timer::pwma_value register.
Sourcepub fn modify_pwma_value<F>(&mut self, f: F)
pub fn modify_pwma_value<F>(&mut self, f: F)
Read-Modify-Write the Timer::pwma_value register.
Sourcepub fn pointer_to_pwmb_value(&self) -> *mut u32
pub fn pointer_to_pwmb_value(&self) -> *mut u32
Obtain a pointer to the Timer::pwmb_value register.
This function allows modification through the pointer but does not require mutable access to the MMIO handle. The caller should specify the correct mutability depending on how the pointer is used.
Never create a reference from this pointer - only use read/write/read_volatile/write_volatile methods on it.
Sourcepub fn read_pwmb_value(&self) -> u32
pub fn read_pwmb_value(&self) -> u32
Read the Timer::pwmb_value register.
Sourcepub fn write_pwmb_value(&mut self, value: u32)
pub fn write_pwmb_value(&mut self, value: u32)
Write the Timer::pwmb_value register.
Sourcepub fn modify_pwmb_value<F>(&mut self, f: F)
pub fn modify_pwmb_value<F>(&mut self, f: F)
Read-Modify-Write the Timer::pwmb_value register.
Sourcepub fn pointer_to_perid(&self) -> *mut u32
pub fn pointer_to_perid(&self) -> *mut u32
Obtain a pointer to the Timer::perid register.
This function allows modification through the pointer but does not require mutable access to the MMIO handle. The caller should specify the correct mutability depending on how the pointer is used.
Never create a reference from this pointer - only use read/write/read_volatile/write_volatile methods on it.
Sourcepub fn read_perid(&self) -> u32
pub fn read_perid(&self) -> u32
Read the Timer::perid register.
Sourcepub fn write_perid(&mut self, value: u32)
pub fn write_perid(&mut self, value: u32)
Write the Timer::perid register.
Sourcepub fn modify_perid<F>(&mut self, f: F)
pub fn modify_perid<F>(&mut self, f: F)
Read-Modify-Write the Timer::perid register.
Trait Implementations§
impl Send for MmioTimer<'_>
The core::marker::Send trait is unsafely implemented because sending a register block pointer to another thread should not be an issue for most use-cases.
However, there are cases where this core::marker::Send implementation might be invalid, for example if an MMIO handle was created for a core-local private address.
In that case, it it is recommended to un-implement Send. on the register block structure.