From eab28e704f032328b957de0d4f880180ade83aa1 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Wed, 24 Feb 2016 19:24:13 -0800 Subject: Accept address on 128-byte EEPROMs on both read and write --- romdb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'romdb.c') diff --git a/romdb.c b/romdb.c index 6dbf428..940b3f7 100644 --- a/romdb.c +++ b/romdb.c @@ -108,6 +108,9 @@ void set_scl(eeprom_state *state, uint8_t val) if (state->latch & 1) { state->state = I2C_READ; state->counter = 8; + if (state->size < 256) { + state->address = state->latch >> 1; + } state->latch = state->buffer[state->address]; } else { if (state->size < 256) { @@ -365,7 +368,7 @@ uint16_t read_eeprom_i2c_w(uint32_t address, void * context) if (map->sda_read_bit < 16) { ret = get_sda(&gen->eeprom) << map->sda_read_bit; } - return ret; + return ret; } uint8_t read_eeprom_i2c_b(uint32_t address, void * context) -- cgit v1.2.3