The crate provides the definitions to conviniently work with register field values that are typically presented by a set of bit fields.
To use this crate simply add the dependency to your Cargo.toml file:
toml
[dependencies]
ruspiro-register = "0.5.5"
A single register field is specified with its bit mask and the bit shift. The RegisterField structure can be instantiated for the types u8, u16, u32 and u64.
```rust use ruspiro_register::*;
fn main() {
let field = RegisterField::
To represent a specific value of a register field the RegisterFieldValue structure is used. It is available for the same scalar types as the RegisterField: u8, u16, u32 and u64.
```rust use ruspiro_register::*;
fn main() {
let field = RegisterField::
The register field value printed will look like this then:
text
RegisterFieldValue { field: RegisterField {
Bits: [3:2]
Mask: 0b1100
}, value: 2, raw_value: 8 }
It is quite unlikely those definitions will be directly used as the represantation of a full register with all its fields. Typically macros will be used to reduce the complexity of the register definitions. Examples can be found in the ruspiro-mmio-register and the ruspiro-arch-aarch64 crates.
Licensed under Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0) or MIT (LICENSE-MIT or http://opensource.org/licenses/MIT)) at your choice.