MmioTimer

Struct MmioTimer 

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

An MMIO wrapper for Timer

Implementations§

Source§

impl MmioTimer<'_>

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 Timer

Retrieve the base pointer for this MMIO handle.

Source

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.

Source

pub fn read_control(&self) -> Control

Read the Timer::control register.

Source

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

Write the Timer::control register.

Source

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

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

Source

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.

Source

pub fn read_reset_value(&self) -> u32

Read the Timer::reset_value register.

Source

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

Write the Timer::reset_value register.

Source

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

Read-Modify-Write the Timer::reset_value register.

Source

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.

Source

pub fn read_count_value(&self) -> u32

Read the Timer::count_value register.

Source

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

Write the Timer::count_value register.

Source

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

Read-Modify-Write the Timer::count_value register.

Source

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.

Source

pub fn read_enable_control(&self) -> EnableControl

Read the Timer::enable_control register.

Source

pub fn write_enable_control(&mut self, value: EnableControl)

Write the Timer::enable_control register.

Source

pub fn modify_enable_control<F>(&mut self, f: F)

Read-Modify-Write the Timer::enable_control register.

Source

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.

Source

pub fn read_cascade_control(&self) -> CascadeControl

Read the Timer::cascade_control register.

Source

pub fn write_cascade_control(&mut self, value: CascadeControl)

Write the Timer::cascade_control register.

Source

pub fn modify_cascade_control<F>(&mut self, f: F)

Read-Modify-Write the Timer::cascade_control register.

Source

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.

Source

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.

Source

pub fn read_cascade( &self, index: usize, ) -> Result<CascadeSourceReg, OutOfBoundsError>

Read the Timer::cascade register.

This function also performs bound checking.

Source

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.

Source

pub fn write_cascade( &mut self, index: usize, value: CascadeSourceReg, ) -> Result<(), OutOfBoundsError>

Write the Timer::cascade register.

This function also performs bound checking.

Source

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.

Source

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.

Source

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.

Source

pub fn read_pwma_value(&self) -> u32

Read the Timer::pwma_value register.

Source

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

Write the Timer::pwma_value register.

Source

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

Read-Modify-Write the Timer::pwma_value register.

Source

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.

Source

pub fn read_pwmb_value(&self) -> u32

Read the Timer::pwmb_value register.

Source

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

Write the Timer::pwmb_value register.

Source

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

Read-Modify-Write the Timer::pwmb_value register.

Source

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.

Source

pub fn read_perid(&self) -> u32

Read the Timer::perid register.

Source

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

Write the Timer::perid register.

Source

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

Read-Modify-Write the Timer::perid register.

Trait Implementations§

Source§

impl Send for MmioTimer<'_>
where Timer: 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.

Auto Trait Implementations§

§

impl<'a> Freeze for MmioTimer<'a>

§

impl<'a> RefUnwindSafe for MmioTimer<'a>

§

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

§

impl<'a> Unpin for MmioTimer<'a>

§

impl<'a> UnwindSafe for MmioTimer<'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.