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
@ -811,10 +811,37 @@ void Page::invalidateCache()
|
|||||||
{
|
{
|
||||||
mFindInfo = CachedFindInfo();
|
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
|
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;
|
size_t skip = 0;
|
||||||
for (size_t i = 0; i < ENTRY_COUNT; ++i) {
|
for (size_t i = 0; i < ENTRY_COUNT; ++i) {
|
||||||
printf("%3d: ", static_cast<int>(i));
|
printf("%3d: ", static_cast<int>(i));
|
||||||
|
@ -220,6 +220,8 @@ protected:
|
|||||||
assert(entry < ENTRY_COUNT);
|
assert(entry < ENTRY_COUNT);
|
||||||
return mBaseAddress + ENTRY_DATA_OFFSET + static_cast<uint32_t>(entry) * ENTRY_SIZE;
|
return mBaseAddress + ENTRY_DATA_OFFSET + static_cast<uint32_t>(entry) * ENTRY_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char* pageStateToName(PageState ps);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user