[][src]Struct kernel::common::registers::LocalRegisterCopy

pub struct LocalRegisterCopy<T, R = ()> where
    R: RegisterLongName,
    T: IntLike
{ /* fields omitted */ }

A read-write copy of register contents.

This behaves very similarly to a read-write register, but instead of doing a volatile read to MMIO to get the value for each function call, a copy of the register contents are stored locally in memory. This allows a peripheral to do a single read on a register, and then check which bits are set without having to do a full MMIO read each time. It also allows the value of the register to be "cached" in case the peripheral driver needs to clear the register in hardware yet still be able to check the bits. You can write to a local register, which will modify the stored value, but will not modify any hardware because it operates only on local copy.

Implementations

impl<T, R> LocalRegisterCopy<T, R> where
    R: RegisterLongName,
    T: IntLike
[src]

pub fn new(value: T) -> LocalRegisterCopy<T, R>[src]

pub fn get(&self) -> T[src]

Get the raw register value

pub fn set(&mut self, value: T)[src]

Set the raw register value

pub fn read(&self, field: Field<T, R>) -> T[src]

Read the value of the given field

pub fn read_as_enum<E>(&self, field: Field<T, R>) -> Option<E> where
    E: TryFromValue<T, EnumType = E>, 
[src]

Read value of the given field as an enum member

pub fn write(&mut self, field: FieldValue<T, R>)[src]

Write the value of one or more fields, overwriting the other fields with zero

pub fn modify(&mut self, field: FieldValue<T, R>)[src]

Write the value of one or more fields, leaving the other fields unchanged

pub fn is_set(&self, field: Field<T, R>) -> bool[src]

Check if one or more bits in a field are set

pub fn matches_any(&self, field: FieldValue<T, R>) -> bool[src]

Check if any specified parts of a field match

pub fn matches_all(&self, field: FieldValue<T, R>) -> bool[src]

Check if all specified parts of a field match

pub fn bitand(&self, rhs: T) -> LocalRegisterCopy<T, R>[src]

Do a bitwise AND operation of the stored value and the passed in value and return a new LocalRegisterCopy.

Trait Implementations

impl<T, R> Clone for LocalRegisterCopy<T, R> where
    R: RegisterLongName + Clone,
    T: IntLike + Clone
[src]

impl<T, R> Copy for LocalRegisterCopy<T, R> where
    R: RegisterLongName + Copy,
    T: IntLike + Copy
[src]

impl<T, R> Debug for LocalRegisterCopy<T, R> where
    R: RegisterLongName,
    T: IntLike + Debug
[src]

Auto Trait Implementations

impl<T, R> Send for LocalRegisterCopy<T, R> where
    R: Send,
    T: Send

impl<T, R> Sync for LocalRegisterCopy<T, R> where
    R: Sync,
    T: Sync

impl<T, R> Unpin for LocalRegisterCopy<T, R> where
    R: Unpin,
    T: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.