pub trait Bus {
// Required methods
fn read8(&mut self, addr: u32) -> u8;
fn write8(&mut self, addr: u32, value: u8);
// Provided methods
fn read16(&mut self, addr: u32) -> u16 { ... }
fn read32(&mut self, addr: u32) -> u32 { ... }
fn write16(&mut self, addr: u32, value: u16) { ... }
fn write32(&mut self, addr: u32, value: u32) { ... }
}Expand description
The address space a CPU core sees.
Peripherals are not methods on the bus: a bus owns an ordered table of address ranges and forwards to whichever peripheral claims the range. That keeps the chip definition declarative and lets a peripheral be moved from one chip to another without touching the CPU.
Required Methods§
Provided Methods§
fn read16(&mut self, addr: u32) -> u16
fn read32(&mut self, addr: u32) -> u32
fn write16(&mut self, addr: u32, value: u16)
fn write32(&mut self, addr: u32, value: u32)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".