Skip to content

Commit ec21750

Browse files
authored
Merge pull request #10 from ARMmbed/david_get_erase_size_overload
Implement the get_erase_size API (based on address)
2 parents eb13165 + 6f3a342 commit ec21750

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

DataFlashBlockDevice.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,13 @@ bd_size_t DataFlashBlockDevice::get_erase_size() const
446446
return _block_size;
447447
}
448448

449+
bd_size_t DataFlashBlockDevice::get_erase_size(bd_addr_t addr) const
450+
{
451+
DEBUG_PRINTF("erase size: %" PRIX16 "\r\n", _block_size);
452+
453+
return _block_size;
454+
}
455+
449456
bd_size_t DataFlashBlockDevice::size() const
450457
{
451458
DEBUG_PRINTF("device size: %" PRIX32 "\r\n", _device_size);

DataFlashBlockDevice.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,14 @@ class DataFlashBlockDevice : public BlockDevice {
139139
*/
140140
virtual bd_size_t get_erase_size() const;
141141

142+
/** Get the size of an erasable block given address
143+
*
144+
* @param addr Address within the erasable block
145+
* @return Size of an erasable block in bytes
146+
* @note Must be a multiple of the program size
147+
*/
148+
virtual bd_size_t get_erase_size(bd_addr_t addr) const;
149+
142150
/** Get the total size of the underlying device
143151
*
144152
* @return Size of the underlying device in bytes

0 commit comments

Comments
 (0)