2 Star 2 Fork 4

Liuis/nvs

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
nvs_priv.h 1.14 KB
一键复制 编辑 原始数据 按行查看 历史
Liuis 提交于 2023-09-28 14:11 . The first version.
/* NVS: non volatile storage in flash
*
* Copyright (c) 2018 Laczen
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2023-09-03 Liuis Ported from zephyr RTOS.
*/
#ifndef __NVS_PRIV_H_
#define __NVS_PRIV_H_
#ifdef __cplusplus
extern "C"
{
#endif
/*
* MASKS AND SHIFT FOR ADDRESSES
* an address in nvs is an uint32_t where:
* high 2 bytes represent the sector number
* low 2 bytes represent the offset in a sector
*/
#define ADDR_SECT_MASK 0xFFFF0000
#define ADDR_SECT_SHIFT 16
#define ADDR_OFFS_MASK 0x0000FFFF
/*
* Status return values
*/
#define NVS_STATUS_NOSPACE 1
#define NVS_BUFFER_SIZE 32
#define NVS_ID_UNUSED 0xFFFF
#define NVS_ID_DELETED 0x0000
#define NVS_LOOKUP_CACHE_NO_ADDR 0xFFFFFFFF
/* Allocation Table Entry */
struct nvs_ate
{
uint16_t id; /* data id */
uint16_t offset; /* data offset within sector */
uint16_t len; /* data len within sector */
uint8_t part; /* part of a multipart data - future extension */
uint8_t crc8; /* crc8 check of the entry */
} __packed;
#ifdef __cplusplus
}
#endif
#endif /* __NVS_PRIV_H_ */
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/Liuis_Lou/nvs.git
[email protected]:Liuis_Lou/nvs.git
Liuis_Lou
nvs
nvs
master

搜索帮助