Files
99_7018_lmx/apps/earphone/xtell_remote_control/nvs/nvs.h

57 lines
1.7 KiB
C
Raw Normal View History

2025-12-01 10:01:10 +08:00
#ifndef __NVS_H__
#define __NVS_H__
#include "typedef.h"
2025-12-02 16:25:20 +08:00
#define MAIN_BOARD_MAC_ADDR_LENGTH 6
/**
* @brief
*/
2025-12-01 10:01:10 +08:00
typedef struct {
2025-12-02 16:25:20 +08:00
u8 main_board_mac[MAIN_BOARD_MAC_ADDR_LENGTH]; // 配对的主板MAC地址
// u8 reserved[2]; // 可选的保留字节,用于对齐或未来扩展
} rc_nvs_data_t;
2025-12-01 10:01:10 +08:00
/**
2025-12-02 16:25:20 +08:00
* @brief MAC地址写入Flash
2025-12-01 10:01:10 +08:00
*
2025-12-02 16:25:20 +08:00
* @param mac_addr MAC地址数组的指针
2025-12-01 10:01:10 +08:00
* @return , <0:
*/
2025-12-02 16:25:20 +08:00
int nvs_write_main_board_mac(const u8 *mac_addr);
2025-12-01 10:01:10 +08:00
/**
2025-12-02 16:25:20 +08:00
* @brief Flash读取主板MAC地址
2025-12-01 10:01:10 +08:00
*
2025-12-02 16:25:20 +08:00
* @param mac_addr MAC地址数组的指针
2025-12-01 10:01:10 +08:00
* @return , <0: ()
*/
2025-12-02 16:25:20 +08:00
int nvs_read_main_board_mac(u8 *mac_addr);
// =================================================================================
// 以下为旧的通用出厂信息API已废弃不建议在新代码中使用
// =================================================================================
typedef struct {
char product_id[16];
char serial_number[32];
u16 hw_version;
u16 cal_data;
u32 manufacture_date;
} factory_info_t;
__attribute__((deprecated("Use nvs_write_main_board_mac instead")))
int nvs_write_factory_info(const factory_info_t *info);
__attribute__((deprecated("Use nvs_read_main_board_mac instead")))
2025-12-01 10:01:10 +08:00
int nvs_read_factory_info(factory_info_t *info);
2025-12-02 16:25:20 +08:00
__attribute__((deprecated("This function is no longer needed")))
2025-12-01 10:01:10 +08:00
int nvs_clear_factory_info(void);
2025-12-02 16:25:20 +08:00
__attribute__((deprecated("This function is no longer needed")))
2025-12-01 10:01:10 +08:00
void nvs_test_factory_info(void);
#endif // __NVS_H__