Create stubs for regulator Device, Rail, and Rule
Create stub versions of the Device, Rail, and Rule classes for the
phosphor-regulators application. Having a stub version of these classes
is a pre-requisite for implementing the action framework.
Also updated the top level meson.build file to build the
phosphor-regulators directory. Created new meson.build files for
several phosphor-regulators sub-directories.
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: I50b018db744191acd1e473652019906a8506745f
diff --git a/phosphor-regulators/src/device.hpp b/phosphor-regulators/src/device.hpp
new file mode 100644
index 0000000..3b3a91b
--- /dev/null
+++ b/phosphor-regulators/src/device.hpp
@@ -0,0 +1,71 @@
+/**
+ * Copyright © 2019 IBM Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include <string>
+
+namespace phosphor
+{
+namespace power
+{
+namespace regulators
+{
+
+/**
+ * @class Device
+ *
+ * A hardware device, such as a voltage regulator or I/O expander.
+ */
+class Device
+{
+ public:
+ // Specify which compiler-generated methods we want
+ Device() = delete;
+ Device(const Device&) = delete;
+ Device(Device&&) = delete;
+ Device& operator=(const Device&) = delete;
+ Device& operator=(Device&&) = delete;
+ ~Device() = default;
+
+ /**
+ * Constructor.
+ *
+ * @param id unique device ID
+ */
+ Device(const std::string& id) : id{id}
+ {
+ }
+
+ /**
+ * Returns the unique ID of this device.
+ *
+ * @return device ID
+ */
+ const std::string& getId() const
+ {
+ return id;
+ }
+
+ private:
+ /**
+ * Unique ID of this device.
+ */
+ const std::string id{};
+};
+
+} // namespace regulators
+} // namespace power
+} // namespace phosphor
diff --git a/phosphor-regulators/src/meson.build b/phosphor-regulators/src/meson.build
new file mode 100644
index 0000000..19f1bb5
--- /dev/null
+++ b/phosphor-regulators/src/meson.build
@@ -0,0 +1 @@
+# subdir('actions')
diff --git a/phosphor-regulators/src/rail.hpp b/phosphor-regulators/src/rail.hpp
new file mode 100644
index 0000000..3fa516b
--- /dev/null
+++ b/phosphor-regulators/src/rail.hpp
@@ -0,0 +1,74 @@
+/**
+ * Copyright © 2019 IBM Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include <string>
+
+namespace phosphor
+{
+namespace power
+{
+namespace regulators
+{
+
+/**
+ * @class Rail
+ *
+ * A voltage rail produced by a voltage regulator.
+ *
+ * Voltage regulators produce one or more rails. Each rail typically provides a
+ * different output voltage level, such as 1.1V.
+ */
+class Rail
+{
+ public:
+ // Specify which compiler-generated methods we want
+ Rail() = delete;
+ Rail(const Rail&) = delete;
+ Rail(Rail&&) = delete;
+ Rail& operator=(const Rail&) = delete;
+ Rail& operator=(Rail&&) = delete;
+ ~Rail() = default;
+
+ /**
+ * Constructor.
+ *
+ * @param id unique rail ID
+ */
+ Rail(const std::string& id) : id{id}
+ {
+ }
+
+ /**
+ * Returns the unique ID of this rail.
+ *
+ * @return rail ID
+ */
+ const std::string& getId() const
+ {
+ return id;
+ }
+
+ private:
+ /**
+ * Unique ID of this rail.
+ */
+ const std::string id{};
+};
+
+} // namespace regulators
+} // namespace power
+} // namespace phosphor
diff --git a/phosphor-regulators/src/rule.hpp b/phosphor-regulators/src/rule.hpp
new file mode 100644
index 0000000..ccc47fa
--- /dev/null
+++ b/phosphor-regulators/src/rule.hpp
@@ -0,0 +1,78 @@
+/**
+ * Copyright © 2019 IBM Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include <string>
+
+namespace phosphor
+{
+namespace power
+{
+namespace regulators
+{
+
+/**
+ * @class Rule
+ *
+ * A rule is a sequence of actions that can be shared by multiple voltage
+ * regulators.
+ *
+ * Rules define a standard way to perform an operation. For example, the
+ * following action sequences might be sharable using a rule:
+ * - Actions that set the output voltage of a regulator rail
+ * - Actions that read all the sensors of a regulator rail
+ * - Actions that detect down-level hardware using version registers
+ */
+class Rule
+{
+ public:
+ // Specify which compiler-generated methods we want
+ Rule() = delete;
+ Rule(const Rule&) = delete;
+ Rule(Rule&&) = delete;
+ Rule& operator=(const Rule&) = delete;
+ Rule& operator=(Rule&&) = delete;
+ ~Rule() = default;
+
+ /**
+ * Constructor.
+ *
+ * @param id unique rule ID
+ */
+ Rule(const std::string& id) : id{id}
+ {
+ }
+
+ /**
+ * Returns the unique ID of this rule.
+ *
+ * @return rule ID
+ */
+ const std::string& getId() const
+ {
+ return id;
+ }
+
+ private:
+ /**
+ * Unique ID of this rule.
+ */
+ const std::string id{};
+};
+
+} // namespace regulators
+} // namespace power
+} // namespace phosphor