BA
/
BaBoRo1
Erste version der Software für der Prototyp
Diff: mbed-os/features/filesystem/bd/ChainingBlockDevice.cpp
- Revision:
- 4:75df35ef4fb6
- Parent:
- 0:380207fcb5c1
diff -r 27100cbaaa6e -r 75df35ef4fb6 mbed-os/features/filesystem/bd/ChainingBlockDevice.cpp --- a/mbed-os/features/filesystem/bd/ChainingBlockDevice.cpp Thu Mar 29 14:42:59 2018 +0000 +++ b/mbed-os/features/filesystem/bd/ChainingBlockDevice.cpp Fri Mar 30 14:07:05 2018 +0000 @@ -211,6 +211,22 @@ return _erase_size; } +bd_size_t ChainingBlockDevice::get_erase_size(bd_addr_t addr) const +{ + bd_addr_t bd_start_addr = 0; + for (size_t i = 0; i < _bd_count; i++) { + bd_size_t bdsize = _bds[i]->size(); + if (addr < (bd_start_addr + bdsize)) { + return _bds[i]->get_erase_size(addr - bd_start_addr); + } + bd_start_addr += bdsize; + } + + // Getting here implies an illegal address + MBED_ASSERT(0); + return 0; // satisfy compiler +} + int ChainingBlockDevice::get_erase_value() const { return _erase_value;