Make eeprom reads and writes across block boundary work
authorKeith Packard <keithp@keithp.com>
Thu, 3 Sep 2009 04:57:54 +0000 (21:57 -0700)
committerKeith Packard <keithp@keithp.com>
Thu, 3 Sep 2009 04:57:54 +0000 (21:57 -0700)
Reading and writing across the block boundary was not stepping the
eeprom position after the partial i/o operation at the end of the
first block. This meant that the operation would re-use the end of the
previous block, either re-reading or re-writing it.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/ao_ee.c

index f299b925c0274b70c46270de3c76da05aee23087..9b6db2340d69e2a1f9f6e41582a1742773f84519 100644 (file)
@@ -271,6 +271,7 @@ ao_ee_write(uint32_t pos, uint8_t *buf, uint16_t len) __reentrant
                /* See how much is left */
                buf += this_len;
                len -= this_len;
                /* See how much is left */
                buf += this_len;
                len -= this_len;
+               pos += this_len;
        }
        return 1;
 }
        }
        return 1;
 }
@@ -306,6 +307,7 @@ ao_ee_read(uint32_t pos, uint8_t *buf, uint16_t len) __reentrant
                /* See how much is left */
                buf += this_len;
                len -= this_len;
                /* See how much is left */
                buf += this_len;
                len -= this_len;
+               pos += this_len;
        }
        return 1;
 }
        }
        return 1;
 }