/* * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 *//* ... */#ifndefNVS_CONSTANTS_H#defineNVS_CONSTANTS_H#include"spi_flash_mmap.h"// for SPI_FLASH_SEC_SIZE// constants for the NVS to be used in the regular as well as bootloader implementations#defineNVS_CONST_PSB_INIT0x1#defineNVS_CONST_PSB_FULL0x2#defineNVS_CONST_PSB_FREEING0x4#defineNVS_CONST_PSB_CORRUPT0x8#defineNVS_CONST_ESB_WRITTEN0x1#defineNVS_CONST_ESB_ERASED0x2#defineNVS_CONST_PAGE_SIZESPI_FLASH_SEC_SIZE#defineNVS_CONST_ENTRY_SIZE32#defineNVS_CONST_ENTRY_COUNT126#defineNVS_CONST_INVALID_ENTRY0xffffffff#defineNVS_CONST_CHUNK_MAX_SIZE(NVS_CONST_ENTRY_SIZE*(NVS_CONST_ENTRY_COUNT-1))#defineNVS_CONST_STR_LEN_MAX_SIZE(NVS_CONST_ENTRY_SIZE*(NVS_CONST_ENTRY_COUNT-1))#defineNVS_CONST_NS_INDEX0#defineNVS_CONST_NS_ANY255#defineNVS_CONST_NVS_VERSION0xfe// Decrement to upgrade// Page States// All bits set, default state after flash erase. Page has not been initialized yet.#defineNVS_CONST_PAGE_STATE_UNINITIALIZED0xffffffff// Page is initialized, and will accept writes.#defineNVS_CONST_PAGE_STATE_ACTIVE(NVS_CONST_PAGE_STATE_UNINITIALIZED&~NVS_CONST_PSB_INIT)// Page is marked as full and will not accept new writes.#defineNVS_CONST_PAGE_STATE_FULL(NVS_CONST_PAGE_STATE_ACTIVE&~NVS_CONST_PSB_FULL)// Data is being moved from this page to a new one.#defineNVS_CONST_PAGE_STATE_FREEING(NVS_CONST_PAGE_STATE_FULL&~NVS_CONST_PSB_FREEING)// Page was found to be in a corrupt and unrecoverable state.// Instead of being erased immediately, it will be kept for diagnostics and data recovery.// It will be erased once we run out out free pages.#defineNVS_CONST_PAGE_STATE_CORRUPT(NVS_CONST_PAGE_STATE_FREEING&~PSB_CORRUPT)// Page object wasn't loaded from flash memory#defineNVS_CONST_PAGE_STATE_INVALID0// Entry States#defineNVS_CONST_ENTRY_STATE_EMPTY0x3// 0b11, default state after flash erase#defineNVS_CONST_ENTRY_STATE_WRITTEN(NVS_CONST_ENTRY_STATE_EMPTY&~NVS_CONST_ESB_WRITTEN)// entry was written#defineNVS_CONST_ENTRY_STATE_ERASED(NVS_CONST_ENTRY_STATE_WRITTEN&~NVS_CONST_ESB_ERASED)// entry was written and then erased#defineNVS_CONST_ENTRY_STATE_ILLEGAL0x1// only possible if flash is inconsistent#defineNVS_CONST_ENTRY_STATE_INVALID0x4// entry is in inconsistent state (write started but ESB_WRITTEN has not been set yet)// Offsets within a NVS page#defineNVS_CONST_PAGE_HEADER_OFFSET0#defineNVS_CONST_PAGE_ENTRY_TABLE_OFFSET(NVS_CONST_PAGE_HEADER_OFFSET+32)#defineNVS_CONST_PAGE_ENTRY_DATA_OFFSET(NVS_CONST_PAGE_ENTRY_TABLE_OFFSET+32)29 defines/* ... */#endif
Details
Show: from
Types: Columns:
All items filtered out
All items filtered out
This file uses the notable symbols shown below. Click anywhere in the file to view more details.