Hardware blocks such as reset, clock, and power controllers often pack control bits for unrelated peripherals into the same register or MMIO page. The registers driver and client libraries in this directory coordinate shared register access across drivers so each client can only read and modify its granted bits without racing on read-modify-write sequences.
See the registers driver guide for board configuration and client usage examples.
drivers/registers/: Driver serving fuchsia.hardware.registers/Service. It maps the underlying MMIO blocks, validates non-overlapping bit grants from board metadata, and serializes reads and masked writes per register.lib/registers-io/: Client library wrapping a fuchsia.hardware.registers/Device channel (//src/devices/registers/lib/registers-io):registers::Registers queries GetMasks() on creation, caches the client's granted bitmasks, and provides stateless ReadRegister and WriteRegister calls that reject writes outside the grant. Because each access performs a synchronous FIDL call, Registers is intended for slow-path initialization, reset, and power control rather than interrupt or data paths.registers::RegistersIo adapts a registers::Registers instance as a stack-scoped hwreg I/O backend (ReadFrom and WriteTo), latching the first error to be checked with status() before destruction.testing/fake-registers/: Stateful fake fuchsia.hardware.registers/Device server (fake_registers::FakeRegisters) for unit tests. It implements GetMasks(), masked read-modify-write, read-only bitmasks, and error injection, and works with registers::Registers and RegistersIo.testing/mock-registers/: Expectation-queue mock (mock_registers::MockRegisters) for unit tests that set per-register ExpectRead and ExpectWrite expectations.bin/register-util/: Command-line tool for reading and writing registers exposed by a registers device.