Build HardwareRegister objects from Chip Data Files
Change-Id: I4fbcdd5ba012008000b8d1f324dd47d95ef2d932
Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
diff --git a/src/chip_data/hei_chip_data_stream.hpp b/src/chip_data/hei_chip_data_stream.hpp
index c9cbde7..122e425 100644
--- a/src/chip_data/hei_chip_data_stream.hpp
+++ b/src/chip_data/hei_chip_data_stream.hpp
@@ -126,4 +126,16 @@
return *this;
}
+/** @brief Template specialization for RegisterId_t. */
+template <>
+inline ChipDataStream& ChipDataStream::operator>>(RegisterId_t& o_right)
+{
+ // A register ID is only 3 bytes, but there isn't a 24-bit integer type. So
+ // extract 3 bytes to a uint32_t and drop the unused byte.
+ uint32_t tmp = 0;
+ read(&tmp, 3);
+ o_right = static_cast<RegisterId_t>(be32toh(tmp) >> 8);
+ return *this;
+}
+
} // namespace libhei