From 2df7258710756e1ed13468b42fc92c8cc05f7182 Mon Sep 17 00:00:00 2001 From: Offir Kochalsky Date: Mon, 5 Nov 2018 12:47:18 +0200 Subject: [PATCH] Add get_erase_value() support --- .../blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.cpp | 5 +++++ .../blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.h | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/components/storage/blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.cpp b/components/storage/blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.cpp index 5e590d7c90..b440042496 100644 --- a/components/storage/blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.cpp +++ b/components/storage/blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.cpp @@ -514,6 +514,11 @@ bd_size_t QSPIFBlockDevice::size() const return _device_size_bytes; } +int QSPIFBlockDevice::get_erase_value() const +{ + return 0xFF; +} + /********************************/ /* Different Device Csel Mgmt */ /********************************/ diff --git a/components/storage/blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.h b/components/storage/blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.h index aad4e3fb37..c01bd5a859 100644 --- a/components/storage/blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.h +++ b/components/storage/blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.h @@ -191,6 +191,17 @@ public: */ virtual bd_size_t get_erase_size(bd_addr_t addr); + /** Get the value of storage byte after it was erased + * + * If get_erase_value returns a non-negative byte value, the underlying + * storage is set to that value when erased, and storage containing + * that value can be programmed without another erase. + * + * @return The value of storage when erased, or -1 if you can't + * rely on the value of erased storage + */ + virtual int get_erase_value() const; + /** Get the total size of the underlying device * * @return Size of the underlying device in bytes