47 lines
1.5 KiB
C
47 lines
1.5 KiB
C
/*
|
||
* 模块名称:Network Configuration Store (存储后端接口)
|
||
* 模块功能:net_cfg 加载/保存的磁盘读写抽象——每平台一份实现(互斥编译):
|
||
* MCU = NAND 上 FatFS 文件 /cfg/netcfg.bin(net_cfg_store_mcu.c);
|
||
* 模拟器 = 工作目录本地文件 sim_netcfg.bin(net_cfg_store_sim.c)
|
||
* 适用平台:STM32F407ZGTx / PC 模拟器(接口共用;两端各编一份实现)
|
||
* 作者:王建锋
|
||
* 创建日期:2026-09-10
|
||
* 修改记录:
|
||
* v1.0 2026-09-10 王建锋 创建初始版本
|
||
*/
|
||
|
||
#ifndef NET_CFG_STORE_H
|
||
#define NET_CFG_STORE_H
|
||
|
||
#include <stdint.h>
|
||
|
||
#include <stddef.h>
|
||
|
||
#ifdef __cplusplus
|
||
extern "C" {
|
||
#endif
|
||
|
||
/*
|
||
* 函数功能:读取配置文件
|
||
* 入口参数:p_buf - 接收缓冲(不可为 NULL) uint8_t *
|
||
* len - 文件长度(须与磁盘格式一致,net_cfg.c 的 net_cfg_blob_t) size_t
|
||
* 返回值:0 - 成功;-1 - 文件缺失/读失败 int
|
||
* 限定条件:后端存储可用(MCU:FatFS 已挂载;未挂载时实现直接返回 -1 即可)
|
||
*/
|
||
int net_cfg_store_read(uint8_t *p_buf, size_t len);
|
||
|
||
/*
|
||
* 函数功能:写配置文件(不存在则创建,存在则覆盖)
|
||
* 入口参数:p_buf - 待写数据(不可为 NULL) const uint8_t *
|
||
* len - 数据长度(须与磁盘格式一致) size_t
|
||
* 返回值:0 - 成功;-1 - 写失败 int
|
||
* 限定条件:后端存储可用
|
||
*/
|
||
int net_cfg_store_write(const uint8_t *p_buf, size_t len);
|
||
|
||
#ifdef __cplusplus
|
||
}
|
||
#endif
|
||
|
||
#endif /* NET_CFG_STORE_H */
|