+
+/**
+ * Values for Eeprom types.
+ */
+typedef enum EepromType
+{
+ EEPROM_24XX08,
+ EEPROM_24XX16,
+ EEPROM_24XX256,
+ EEPROM_24XX512,
+ EEPROM_24XX1024,
+ EEPROM_CNT,
+} EepromType;
+
+/**
+ * On the same I2C bus can live more than one EEPROM
+ * device. Each device can be addressed by one or more
+ * pins.
+ */
+typedef uint8_t e2dev_addr_t;
+
+/**
+ * Describe an EEPROM context, used by the driver to
+ * access the single device.
+ */
+typedef struct Eeprom
+{
+ KBlock blk;
+ I2c *i2c;
+ EepromType type; ///< EEPROM type
+ e2dev_addr_t addr; ///< Device address.
+ bool verify;
+#if !CONFIG_EEPROM_DISABLE_OLD_API
+ union {
+ KFile fd;
+ KFileBlock fdblk;
+ } DEPRECATED;
+#endif /* !CONFIG_EEPROM_DISABLE_OLD_API */
+} Eeprom;
+
+#if !CONFIG_EEPROM_DISABLE_OLD_API
+ STATIC_ASSERT(offsetof(Eeprom, fd) == offsetof(Eeprom, fdblk.fd));
+#endif /* !CONFIG_EEPROM_DISABLE_OLD_API */
+
+/**
+ * ID for eeproms.
+ */
+#define KBT_EEPROM MAKE_ID('E', 'E', 'P', 'R')
+
+/**
+ * Convert + ASSERT from generic KFile to Eeprom.
+ */
+INLINE Eeprom * EEPROM_CAST_KBLOCK(KBlock *blk)
+{
+ ASSERT(blk->priv.type == KBT_EEPROM);
+ return (Eeprom *)blk;
+}
+