regulators: Create regulators PMBusReadSensorAction class
Create the PMBusReadSensorAction class that implements the
"pmbus_read_sensor" action in the JSON config file.
Only create the .hpp file for PMBusReadSensorAction class first.
Signed-off-by: Bob King <Bob_King@wistron.com>
Change-Id: I689ad9dbefe601d8962c694e7e1b8b7275ba6880
diff --git a/phosphor-regulators/src/pmbus_utils.hpp b/phosphor-regulators/src/pmbus_utils.hpp
index 599c236..5e2e270 100644
--- a/phosphor-regulators/src/pmbus_utils.hpp
+++ b/phosphor-regulators/src/pmbus_utils.hpp
@@ -17,6 +17,7 @@
#include <cmath>
#include <cstdint>
+#include <string>
/**
* @namespace pmbus_utils
@@ -38,6 +39,78 @@
const uint8_t VOUT_COMMAND{0x21u};
/**
+ * Sensor data format.
+ */
+enum class SensorDataFormat
+{
+ /**
+ * Linear data format used for values not related to voltage output, such
+ * as output current, input voltage, and temperature. Two byte value with
+ * an 11-bit, two's complement mantissa and a 5-bit, two's complement
+ * exponent.
+ */
+ linear_11,
+
+ /**
+ * Linear data format used for values related to voltage output. Two
+ * byte (16-bit), unsigned integer that is raised to the power of an
+ * exponent. The exponent is not stored within the two bytes.
+ */
+ linear_16
+};
+
+/**
+ * Sensor Value Type.
+ */
+enum class SensorValueType
+{
+ /**
+ * Output current.
+ */
+ iout,
+
+ /**
+ * Highest output current.
+ */
+ iout_peak,
+
+ /**
+ * Lowest output current.
+ */
+ iout_valley,
+
+ /**
+ * Output power.
+ */
+ pout,
+
+ /**
+ * Temperature.
+ */
+ temperature,
+
+ /**
+ * Highest temperature.
+ */
+ temperature_peak,
+
+ /**
+ * Output voltage.
+ */
+ vout,
+
+ /**
+ * Highest output voltage.
+ */
+ vout_peak,
+
+ /**
+ * Lowest output voltage.
+ */
+ vout_valley
+};
+
+/**
* Data formats for output voltage.
*
* These formats are used for commanding and reading output voltage and related
@@ -88,6 +161,30 @@
int8_t& parameter);
/**
+ * Converts the specified SensorDataFormat value to a string.
+ *
+ * @param format SensorDataFormat value
+ * @return string corresponding to the enum value
+ */
+std::string toString(SensorDataFormat format);
+
+/**
+ * Converts the specified SensorValueType value to string.
+ *
+ * @param type SensorValueType type
+ * @return string corresponding to the enum value
+ */
+std::string toString(SensorValueType type);
+
+/**
+ * Converts the specified VoutDataFormat value to string.
+ *
+ * @param format VoutDataFormat format
+ * @return string corresponding to the enum value
+ */
+std::string toString(VoutDataFormat format);
+
+/**
* Converts a volts value to the linear data format for output voltage.
*
* This data format consists of the following: