summaryrefslogtreecommitdiff
path: root/i2c.h
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2017-06-23 21:48:38 -0700
committerMichael Pavone <pavone@retrodev.com>2017-06-23 21:48:38 -0700
commited13c1993c34a296dcf9cc312e64875e5ef8c889 (patch)
tree78d4f261b5e128fa1838e7f63153290bd498e5fc /i2c.h
parente7e41dd4b314ce34c2c4f1152d243b606ded8565 (diff)
Move I2C EEPROM and NOR Flash functions out of romdb.c into new files
Diffstat (limited to 'i2c.h')
-rw-r--r--i2c.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/i2c.h b/i2c.h
new file mode 100644
index 0000000..bc8accc
--- /dev/null
+++ b/i2c.h
@@ -0,0 +1,22 @@
+#ifndef I2C_H_
+#define I2C_H_
+
+typedef struct {
+ char *buffer;
+ uint32_t size;
+ uint16_t address;
+ uint8_t host_sda;
+ uint8_t slave_sda;
+ uint8_t scl;
+ uint8_t state;
+ uint8_t counter;
+ uint8_t latch;
+} eeprom_state;
+
+void eeprom_init(eeprom_state *state, uint8_t *buffer, uint32_t size);
+void * write_eeprom_i2c_w(uint32_t address, void * context, uint16_t value);
+void * write_eeprom_i2c_b(uint32_t address, void * context, uint8_t value);
+uint16_t read_eeprom_i2c_w(uint32_t address, void * context);
+uint8_t read_eeprom_i2c_b(uint32_t address, void * context);
+
+#endif //I2C_H_