template <uint32_t index_offset, uint32_t data_offset, typename IndexType = uint8_t, typename RegisterIo = RegisterMmio>
class IndirectIo
Defined at line 44 of file ../../zircon/system/ulib/hwreg/include/hwreg/indirect.h
IndirectIo is a replacement for RegisterMmio that sequences access to a
common PCI device construct where two registers, "index" and "data", are
used to read and write a much larger store, logically private_store[index] =
data.
Example usage from VGA:
typedef IndirectIo
<
0x03D4, 0x03D5> CrtcIo;
class CrtcReg : public hwreg::RegisterBase
<CrtcReg
, uint8_t> {
public:
static auto Get(size_t offset) : { return hwreg::RegisterAddr
<CrtcReg
>(offset); }
};
...
void SetMode3(volatile void* mmio) {
auto io = CrtcIo(mmio);
CrtcReg::Get(0x00).ReadFrom(
&io
).set_reg_value(0x5F).WriteTo(
&io
);
CrtcReg::Get(0x01).ReadFrom(
&io
).set_reg_value(0x4F).WriteTo(
&io
);
CrtcReg::Get(0x02).ReadFrom(
&io
).set_reg_value(0x50).WriteTo(
&io
);
CrtcReg::Get(0x03).ReadFrom(
&io
).set_reg_value(0x82).WriteTo(
&io
);
CrtcReg::Get(0x04).ReadFrom(
&io
).set_reg_value(0x55).WriteTo(
&io
);
CrtcReg::Get(0x05).ReadFrom(
&io
).set_reg_value(0x81).WriteTo(
&io
);
}
Public Methods
void IndirectIo<index_offset, data_offset, IndexType, RegisterIo> (RegisterIo io)
Defined at line 46 of file ../../zircon/system/ulib/hwreg/include/hwreg/indirect.h
void ~IndirectIo<index_offset, data_offset, IndexType, RegisterIo> ()
Defined at line 48 of file ../../zircon/system/ulib/hwreg/include/hwreg/indirect.h
template <class IntType>
void Write (IntType value, uint32_t offset)
Defined at line 51 of file ../../zircon/system/ulib/hwreg/include/hwreg/indirect.h
template <class IntType>
IntType Read (uint32_t offset)
Defined at line 58 of file ../../zircon/system/ulib/hwreg/include/hwreg/indirect.h