You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
#pragma once
#include "project_configs.h"
#include "sdk/os/zos.hpp"
namespace iflytop { using namespace std;
class ZNVS { typedef struct { const char* name; uint8_t* ___; size_t len; } cfg_index_t; #pragma pack(1)
typedef struct { uint32_t config_start;
uint32_t data_size; uint8_t data[]; } config_t; #pragma pack()
cfg_index_t m_index[20]; int m_index_num = 0;
bool inited = false;
config_t* m_cfgcache = nullptr; size_t m_cfgcachesize = 0;
public: static ZNVS& ins();
void initialize(int32_t flash_sector);
bool alloc_config(const char* key, uint8_t* ___, size_t datalen); bool alloc_config(const char* key, size_t datalen); bool init_config();
bool get_config(const char* key, uint8_t* data, size_t len); bool set_config(const char* key, uint8_t* data, size_t len);
void flush();
private: void flush_all_to_configcache(); };
} // namespace iflytop
|