mbed
Fork of mbed-dev by
Diff: drivers/FlashIAP.cpp
- Revision:
- 169:e3b6fe271b81
- Parent:
- 160:d5399cc887bb
--- a/drivers/FlashIAP.cpp Thu Jul 06 15:42:05 2017 +0100 +++ b/drivers/FlashIAP.cpp Wed Jul 19 17:31:21 2017 +0100 @@ -55,7 +55,7 @@ int ret = 0; _mutex->lock(); if (flash_init(&_flash)) { - ret = -1; + ret = -1; } _mutex->unlock(); return ret; @@ -66,7 +66,7 @@ int ret = 0; _mutex->lock(); if (flash_free(&_flash)) { - ret = -1; + ret = -1; } _mutex->unlock(); return ret; @@ -75,10 +75,11 @@ int FlashIAP::read(void *buffer, uint32_t addr, uint32_t size) { + int32_t ret = -1; _mutex->lock(); - memcpy(buffer, (const void *)addr, size); + ret = flash_read(&_flash, addr, (uint8_t *) buffer, size); _mutex->unlock(); - return 0; + return ret; } int FlashIAP::program(const void *buffer, uint32_t addr, uint32_t size)