MmioUartRegisters

Struct MmioUartRegisters 

Source
pub struct MmioUartRegisters<'a> { /* private fields */ }
Expand description

An MMIO wrapper for UartRegisters

Implementations§

Source§

impl MmioUartRegisters<'_>

Source

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.

Source

pub const unsafe fn ptr(&self) -> *mut UartRegisters

Retrieve the base pointer for this MMIO handle.

Source

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.

Source

pub fn read_fifo(&mut self) -> u32

Read the UartRegisters::fifo register.

Source

pub fn write_fifo(&mut self, value: u32)

Write the UartRegisters::fifo register.

Source

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.

Source

pub fn read_control(&mut self) -> Control

Read the UartRegisters::control register.

Source

pub fn write_control(&mut self, value: Control)

Write the UartRegisters::control register.

Source

pub fn modify_control<F>(&mut self, f: F)
where F: FnOnce(Control) -> Control,

Read-Modify-Write the UartRegisters::control register.

Source

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.

Source

pub fn read_status(&self) -> Status

Read the UartRegisters::status register.

Trait Implementations§

Source§

impl Send for MmioUartRegisters<'_>

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.

Auto Trait Implementations§

§

impl<'a> Freeze for MmioUartRegisters<'a>

§

impl<'a> RefUnwindSafe for MmioUartRegisters<'a>

§

impl<'a> !Sync for MmioUartRegisters<'a>

§

impl<'a> Unpin for MmioUartRegisters<'a>

§

impl<'a> UnwindSafe for MmioUartRegisters<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.