summaryrefslogtreecommitdiff
path: root/romdb.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2016-02-24 19:24:13 -0800
committerMichael Pavone <pavone@retrodev.com>2016-02-24 19:24:13 -0800
commiteab28e704f032328b957de0d4f880180ade83aa1 (patch)
tree3d2b8315deaafcf1a77d8f95301142e6fe03cea3 /romdb.c
parentf48a739560baaeaab289ac2e045bf3a8014cf7ba (diff)
Accept address on 128-byte EEPROMs on both read and write
Diffstat (limited to 'romdb.c')
-rw-r--r--romdb.c5
1 files changed, 4 insertions, 1 deletions
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)