pub trait MemoryMappedRegister<T>:
Clone
+ From<T>
+ Into<T>
+ Sized
+ Debug {
const ADDRESS_OFFSET: u64;
const NAME: &'static str;
// Provided methods
fn get_mmio_address_from_base(
base_address: u64,
) -> Result<u64, RegisterAddressOutOfBounds> { ... }
fn get_mmio_address() -> u64 { ... }
}
Expand description
A memory mapped register, for instance ARM debug registers (DHCSR, etc).
Required Associated Constants§
Sourceconst ADDRESS_OFFSET: u64
const ADDRESS_OFFSET: u64
The register’s address in the target memory. For some architectures (e.g. ARM Cortex-A) this address is offset from a base address. For others (e.g. ARM Cortex-M, RISC-V) this address is absolute.
Provided Methods§
Sourcefn get_mmio_address_from_base(
base_address: u64,
) -> Result<u64, RegisterAddressOutOfBounds>
fn get_mmio_address_from_base( base_address: u64, ) -> Result<u64, RegisterAddressOutOfBounds>
Get the register’s address in the memory map.
For architectures like ARM Cortex-A, this address is offset from a base address, which must be supplied when calling this method.
For others (e.g. ARM Cortex-M, RISC-V) where this address is a constant, please use MemoryMappedRegister::get_mmio_address
.
Sourcefn get_mmio_address() -> u64
fn get_mmio_address() -> u64
Get the register’s address in the memory map.
For architectures ARM Cortex-M and RISC-V, this address is constant value stored as part of MemoryMappedRegister::ADDRESS_OFFSET
.
For other architectures (e.g. ARM Cortex-A) where this address is offset from a base address, please use MemoryMappedRegister::get_mmio_address_from_base
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.