Struct tock_registers::LocalRegisterCopy[][src]

pub struct LocalRegisterCopy<T: UIntLike, R: RegisterLongName = ()> { /* fields omitted */ }
Expand description

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.

This type does not implement the Readable and Writeable traits because it requires a mutable reference to modify the contained value. It still mirrors the interface which would be exposed by a type implementing Readable, Writeable and ReadWriteable.

Implementations

Get the raw register value

Set the raw register value

Read the value of the given field

Read value of the given field as an enum member

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

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

Check if one or more bits in a field are set

Check if any specified parts of a field match

Check if all specified parts of a field match

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

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.