Mercurial > flash_v2
changeset 1730:3f6b1c304c7a
* src/flash.c: Offset into the block is not calculated correctly
when the flash start is not aligned on a flash block.
* src/legacy_dev.c (legacy_flash_read): Fixed typo.
| author | asl |
|---|---|
| date | Thu, 30 Sep 2004 18:09:20 +0000 |
| parents | e290a0372578 |
| children | a24c2d6d8afa |
| files | packages/io/flash/current/ChangeLog packages/io/flash/current/src/flash.c packages/io/flash/current/src/legacy_dev.c |
| diffstat | 3 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/io/flash/current/ChangeLog +++ b/packages/io/flash/current/ChangeLog @@ -1,3 +1,9 @@ +2004-09-30 Savin Zlobec <savin@elatec.si> + + * src/flash.c: Offset into the block is not calculated correctly + when the flash start is not aligned on a flash block. + * src/legacy_dev.c (legacy_flash_read): Fixed typo. + 2004-09-14 Andrew Lunn <andrew.lunn@ascom.ch> * src/flash.c (cyg_flash_init): Add assert checking that the
--- a/packages/io/flash/current/src/flash.c +++ b/packages/io/flash/current/src/flash.c @@ -514,7 +514,7 @@ cyg_flash_program(const cyg_flashaddr_t if (size > block_size) size = block_size; // Writing from the middle of a block? - offset = (size_t)addr % block_size; + offset = (size_t)(addr - dev->start) % block_size; if (offset) size = MIN(block_size - offset, size); stat = dev->funs->flash_program(dev, addr, ram, size); @@ -602,7 +602,7 @@ cyg_flash_read(cyg_flashaddr_t flash_bas if (size > block_size) size = block_size; // Reading from the middle of a block? - offset = (size_t)addr % block_size; + offset = (size_t)(addr - dev->start) % block_size; if (offset) size = MIN(block_size - offset, size); if (dev->funs->flash_read) {
--- a/packages/io/flash/current/src/legacy_dev.c +++ b/packages/io/flash/current/src/legacy_dev.c @@ -181,14 +181,14 @@ legacy_flash_read (struct cyg_flash_dev void* data, const size_t len) { #ifdef CYGSEM_IO_FLASH_READ_INDIRECT - typedef int code_fun(void *, void *, int, unsigned long, int); + typedef int code_fun(const cyg_flashaddr_t, void *, int, unsigned long, int); code_fun *_flash_read_buf; size_t block_size = dev->block_info[0].block_size; size_t block_mask = ~(block_mask -1); _flash_read_buf = (code_fun*) __anonymizer(&flash_read_buf); - return = (*_flash_read_buf)(base, data, len, block_mask, buffer_size); + return (*_flash_read_buf)(base, data, len, block_mask, block_size); #else memcpy(data,(void *)base, len); return CYG_FLASH_ERR_OK;
