aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/tools/tlv_eeprom/tlv_eeprom_io.h
diff options
context:
space:
mode:
Diffstat (limited to 'mpm/tools/tlv_eeprom/tlv_eeprom_io.h')
-rw-r--r--mpm/tools/tlv_eeprom/tlv_eeprom_io.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/mpm/tools/tlv_eeprom/tlv_eeprom_io.h b/mpm/tools/tlv_eeprom/tlv_eeprom_io.h
new file mode 100644
index 000000000..348bc6207
--- /dev/null
+++ b/mpm/tools/tlv_eeprom/tlv_eeprom_io.h
@@ -0,0 +1,31 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2019 Ettus Research, a National Instruments Brand
+ */
+
+#pragma once
+
+#include "tlv_eeprom.h"
+
+/**
+ * tlv_eeprom_write_to_file - write an eeprom to a file
+ * @e: eeprom to write
+ * @path: destination to write to
+ *
+ * Writes the eeprom to the specified path
+ *
+ * Return: zero on success, else negative error code
+ */
+int tlv_eeprom_write_to_file(const struct tlv_eeprom *e, const char *path);
+
+/**
+ * tlv_eeprom_read_from_file - read an eeprom from file
+ * @path: path to read from
+ *
+ * Reads from the path into an allocated eeprom object. No validation of the
+ * data is performed, and caller is responsible for free'ing this.
+ *
+ * Return: eeprom, or NULL if error
+ */
+struct tlv_eeprom *tlv_eeprom_read_from_file(const char *path);
+