summaryrefslogtreecommitdiffstats
path: root/include/ipmid/utils.hpp
diff options
context:
space:
mode:
authorYong Li <yong.b.li@linux.intel.com>2019-08-23 17:44:32 +0800
committerVernon Mauery <vernon.mauery@linux.intel.com>2019-08-30 15:55:14 +0000
commit7dc4ac0246bfae3da04c11e7a2053d28acfde35c (patch)
tree90bb088e2fbf675a26f45ffff000ebfee38b09c4 /include/ipmid/utils.hpp
parentbd0503a75067ea80072f6716b379694da134026d (diff)
downloadphosphor-host-ipmid-7dc4ac0246bfae3da04c11e7a2053d28acfde35c.tar.gz
phosphor-host-ipmid-7dc4ac0246bfae3da04c11e7a2053d28acfde35c.zip
Move i2c WR api into libipmid
Move the low-level i2c write-read api into libipmid, to allow provider libraries access to i2c without duplicating this code. Tested: I2c master write read command still works: ipmitool i2c bus=2 0x9c 8 0 Signed-off-by: Yong Li <yong.b.li@linux.intel.com> Change-Id: I0d5f82cf46ecf871eebb47aae25537b5da1f2e6a
Diffstat (limited to 'include/ipmid/utils.hpp')
-rw-r--r--include/ipmid/utils.hpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/ipmid/utils.hpp b/include/ipmid/utils.hpp
index 9ef1488..45c9c1a 100644
--- a/include/ipmid/utils.hpp
+++ b/include/ipmid/utils.hpp
@@ -1,6 +1,7 @@
#pragma once
#include <chrono>
+#include <ipmid/api-types.hpp>
#include <ipmid/types.hpp>
#include <optional>
#include <sdbusplus/server.hpp>
@@ -305,4 +306,14 @@ void createVLAN(sdbusplus::bus::bus& bus, const std::string& service,
uint32_t getVLAN(const std::string& path);
} // namespace network
+
+/** @brief Perform the low-level i2c bus write-read.
+ * @param[in] i2cBus - i2c bus device node name, such as /dev/i2c-2.
+ * @param[in] slaveAddr - i2c device slave address.
+ * @param[in] writeData - The data written to i2c device.
+ * @param[out] readBuf - Data read from the i2c device.
+ */
+ipmi::Cc i2cWriteRead(std::string i2cBus, const uint8_t slaveAddr,
+ std::vector<uint8_t> writeData,
+ std::vector<uint8_t>& readBuf);
} // namespace ipmi
OpenPOWER on IntegriCloud