Add serial uart mux interface class
1. This change adds the multi-host serial uart mux interface class.
In a multi-host system when the host position is changed,
then the serial uart mux is configured to enable the
respective host's serial console which is accessed via
OCP debug card.
2. Introduced two new methods in gpio.cpp
setGpioState - set state for gpio fd based on polarity
getGpiostate - get state for gpio fd based on polarity
3. Updated the readme file about details on the new gpio
configs
design : https://github.com/openbmc/docs/blob/master/designs/multihost-phosphor-buttons.md
Testing : This change is verified in yosemiteV2 platform.
Signed-off-by: Naveen Moses <naveen.mosess@hcl.com>
Change-Id: I861d70570650d7dfcab842a35bdcf63a9fdd3bd0
diff --git a/inc/gpio.hpp b/inc/gpio.hpp
index 6a63056..9cfd57d 100644
--- a/inc/gpio.hpp
+++ b/inc/gpio.hpp
@@ -21,10 +21,24 @@
#include <string>
#include <vector>
+// enum to represent gpio states
enum class GpioState
{
- low,
- high
+ assert,
+ deassert,
+ invalid
+};
+// enum to represent gpio polarity
+enum class GpioPolarity
+{
+ activeLow,
+ activeHigh
+};
+
+struct GPIOBufferValue
+{
+ char assert;
+ char deassert;
};
// this struct has the gpio config for single gpio
@@ -32,7 +46,9 @@
{
int fd; // io fd mapped with the gpio
uint32_t number;
+ std::string name;
std::string direction;
+ GpioPolarity polarity;
};
// this struct represents button interface
@@ -60,6 +76,11 @@
int configGpio(gpioInfo& gpioConfig);
uint32_t getGpioNum(const std::string& gpioPin);
+// Set gpio state based on polarity
+void setGpioState(int fd, GpioPolarity polarity, GpioState state);
+// Get gpio state based on polarity
+GpioState getGpioState(int fd, GpioPolarity polarity);
+
void closeGpio(int fd);
// global json object which holds gpio_defs.json configs
extern nlohmann::json gpioDefs;