pub struct MmioUartRegisters<'a> { /* private fields */ }Expand description
An MMIO wrapper for UartRegisters
Implementations§
Source§impl MmioUartRegisters<'_>
impl MmioUartRegisters<'_>
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 const unsafe fn ptr(&self) -> *mut UartRegisters
pub const unsafe fn ptr(&self) -> *mut UartRegisters
Retrieve the base pointer for this MMIO handle.
Sourcepub fn pointer_to_fifo(&self) -> *mut u32
pub fn pointer_to_fifo(&self) -> *mut u32
Obtain a pointer to the UartRegisters::fifo 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_fifo(&mut self) -> u32
pub fn read_fifo(&mut self) -> u32
Read the UartRegisters::fifo register.
Sourcepub fn write_fifo(&mut self, value: u32)
pub fn write_fifo(&mut self, value: u32)
Write the UartRegisters::fifo register.
Sourcepub fn pointer_to_control(&self) -> *mut Control
pub fn pointer_to_control(&self) -> *mut Control
Obtain a pointer to the UartRegisters::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(&mut self) -> Control
pub fn read_control(&mut self) -> Control
Read the UartRegisters::control register.
Sourcepub fn write_control(&mut self, value: Control)
pub fn write_control(&mut self, value: Control)
Write the UartRegisters::control register.
Sourcepub fn modify_control<F>(&mut self, f: F)
pub fn modify_control<F>(&mut self, f: F)
Read-Modify-Write the UartRegisters::control register.
Sourcepub fn pointer_to_status(&self) -> *mut Status
pub fn pointer_to_status(&self) -> *mut Status
Obtain a pointer to the UartRegisters::status 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_status(&self) -> Status
pub fn read_status(&self) -> Status
Read the UartRegisters::status register.
Trait Implementations§
impl Send for MmioUartRegisters<'_>where
UartRegisters: Send,
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.