Replace RegisterAccessLevel_t with RegisterAttributeFlags_t
The Chip Data File format allows for an 8-bit attribute flag field, two
of which determine the register access level. Using a query function to
get the access level information from the attribute field instead of
having separate member variables per flag.
Change-Id: Ica4e408910e23ab8419964c35830ced5aa435d97
Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
diff --git a/src/register/hei_hardware_register.hpp b/src/register/hei_hardware_register.hpp
index 81fb79b..fe71c75 100644
--- a/src/register/hei_hardware_register.hpp
+++ b/src/register/hei_hardware_register.hpp
@@ -43,17 +43,16 @@
protected:
/**
* @brief Constructor from components.
- * @param i_chipType Type of chip associated with this register.
- * @param i_id Unique ID for this register.
- * @param i_instance Instance of this register
- * @param i_accessLevel Hardware access level for this register.
+ * @param i_chipType Type of chip associated with this register.
+ * @param i_id Unique ID for this register.
+ * @param i_instance Instance of this register
+ * @param i_flags Attribute flags for this register.
*/
HardwareRegister(ChipType_t i_chipType, RegisterId_t i_id,
- Instance_t i_instance,
- RegisterAccessLevel_t i_accessLevel) :
+ Instance_t i_instance, RegisterAttributeFlags_t i_flags) :
Register(),
iv_chipType(i_chipType), iv_id(i_id), iv_instance(i_instance),
- iv_accessLevel(i_accessLevel)
+ iv_flags(i_flags)
{}
private: // Instance variables
@@ -70,7 +69,7 @@
/** The hardware access level of this register (read/write, read-only,
* write-only, etc.). */
- const RegisterAccessLevel_t iv_accessLevel;
+ const RegisterAttributeFlags_t iv_flags;
public: // Accessor functions
/** @return The type of chip associated with this register. */
@@ -91,10 +90,10 @@
return iv_instance;
}
- /** @return The hardware access level of this register. */
- RegisterAccessLevel_t getAccessLevel() const
+ /** @return True if given flag is enabled, false if disabled. */
+ bool queryAttrFlag(RegisterAttributeFlags_t i_flag) const
{
- return iv_accessLevel;
+ return (0 != (iv_flags & i_flag));
}
// NOTE: The following are determined by child classes.