mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
nvs: print page state as text in nvs_dump
This commit is contained in:
parent
4813ab2d28
commit
447ffb23d5
@ -812,9 +812,36 @@ void Page::invalidateCache()
|
||||
mFindInfo = CachedFindInfo();
|
||||
}
|
||||
|
||||
const char* Page::pageStateToName(PageState ps)
|
||||
{
|
||||
switch (ps) {
|
||||
case PageState::CORRUPT:
|
||||
return "CORRUPT";
|
||||
|
||||
case PageState::ACTIVE:
|
||||
return "ACTIVE";
|
||||
|
||||
case PageState::FREEING:
|
||||
return "FREEING";
|
||||
|
||||
case PageState::FULL:
|
||||
return "FULL";
|
||||
|
||||
case PageState::INVALID:
|
||||
return "INVALID";
|
||||
|
||||
case PageState::UNINITIALIZED:
|
||||
return "UNINITIALIZED";
|
||||
|
||||
default:
|
||||
assert(0 && "invalid state value");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
void Page::debugDump() const
|
||||
{
|
||||
printf("state=%x addr=%x seq=%d\nfirstUsed=%d nextFree=%d used=%d erased=%d\n", (int) mState, mBaseAddress, mSeqNumber, static_cast<int>(mFirstUsedEntry), static_cast<int>(mNextFreeEntry), mUsedEntryCount, mErasedEntryCount);
|
||||
printf("state=%x (%s) addr=%x seq=%d\nfirstUsed=%d nextFree=%d used=%d erased=%d\n", (uint32_t) mState, pageStateToName(mState), mBaseAddress, mSeqNumber, static_cast<int>(mFirstUsedEntry), static_cast<int>(mNextFreeEntry), mUsedEntryCount, mErasedEntryCount);
|
||||
size_t skip = 0;
|
||||
for (size_t i = 0; i < ENTRY_COUNT; ++i) {
|
||||
printf("%3d: ", static_cast<int>(i));
|
||||
|
@ -221,6 +221,8 @@ protected:
|
||||
return mBaseAddress + ENTRY_DATA_OFFSET + static_cast<uint32_t>(entry) * ENTRY_SIZE;
|
||||
}
|
||||
|
||||
static const char* pageStateToName(PageState ps);
|
||||
|
||||
|
||||
protected:
|
||||
uint32_t mBaseAddress = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user