From d46ad652cc7c109527fa0f15374d0e6596c829da Mon Sep 17 00:00:00 2001 From: David Saada Date: Thu, 12 Apr 2018 21:35:00 +0300 Subject: [PATCH] Implement the get_erase_value function --- SPIFBlockDevice.cpp | 5 +++++ SPIFBlockDevice.h | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/SPIFBlockDevice.cpp b/SPIFBlockDevice.cpp index 12308d09e9..64bf16e83c 100644 --- a/SPIFBlockDevice.cpp +++ b/SPIFBlockDevice.cpp @@ -333,3 +333,8 @@ bd_size_t SPIFBlockDevice::size() const { return _size; } + +int SPIFBlockDevice::get_erase_value() const +{ + return 0xFF; +} diff --git a/SPIFBlockDevice.h b/SPIFBlockDevice.h index c4ee447e2f..811a9f81bb 100644 --- a/SPIFBlockDevice.h +++ b/SPIFBlockDevice.h @@ -130,6 +130,17 @@ public: */ virtual bd_size_t get_erase_size() const; + /** Get the value of storage when 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