nvl32: Add nvl32 target
Also adds an i2c device class to allow us to send raw i2c
Tested:
ran on the nvl32-obmc model and i2c devices were enumerated correctly.
as well as mctp devices
Change-Id: I073156de2bbe06b06017379de35e076166df3875
Signed-off-by: Marc Olberding <molberding@nvidia.com>
diff --git a/i2c.hpp b/i2c.hpp
index 6685162..4c62799 100644
--- a/i2c.hpp
+++ b/i2c.hpp
@@ -3,6 +3,7 @@
#pragma once
+#include <cstdint>
#include <string>
namespace i2c
@@ -11,4 +12,19 @@
void rebind_controller(const std::string_view number);
void new_device(unsigned int bus, unsigned int address,
std::string_view device_type);
+
+// a simple RAII wrapper for raw i2c comms
+struct RawDevice
+{
+ RawDevice(size_t bus, uint8_t address);
+ ~RawDevice();
+ RawDevice(const RawDevice&) = delete;
+ RawDevice& operator=(const RawDevice&) = delete;
+ RawDevice& operator=(RawDevice&&) = default;
+ RawDevice(RawDevice&&) = default;
+
+ int read_byte(uint8_t reg, uint8_t& val);
+
+ int fd;
+};
} // namespace i2c