添加 write_hw_version 函数写硬件识别码

This commit is contained in:
2024-10-29 15:47:01 +08:00
parent 99537d5bd9
commit cf9aa0f12d
2 changed files with 37 additions and 0 deletions

View File

@@ -1506,3 +1506,39 @@ bool_t iot_board_is_overseas_rf_band(void)
}
}
// 写入硬件识别码:
// extern uint32_t iot_version_hex(void);
// extern void iot_board_hw_version_reload();
// extern uint32_t board_load_oem_cfg();
void write_hw_version(uint32_t hw_ver)
{
iot_cal_data_cfg_t *calcfg;
int ret = 0xff;
ret = iot_cal_data_get_cfg(&calcfg);
iot_printf("write_hw_version:%d,%d,%d\n",ret,
calcfg->halphy_cfg.hw_ver_major,calcfg->halphy_cfg.hw_ver_minor);
calcfg->halphy_cfg.hw_ver_major = hw_ver>>16; //31.200
calcfg->halphy_cfg.hw_ver_minor = hw_ver&0xffff; //02.00
calcfg->halphy_cfg.magic = IOT_OEM_PHY_MAGIC_NUM;
calcfg->halphy_cfg.mask = 0;
/* update pt fw ver */
calcfg->halphy_cfg.pt_fw_ver = iot_version_hex();
/* update mask */
iot_cal_data_set_mask(calcfg, IOT_PHY_CFG_MASK_PT_VER);
iot_cal_data_set_cfg(calcfg);
ret = iot_cal_data_set_cfg(calcfg);
iot_printf("write_hw_version:%d\n",ret);
ret = iot_cal_data_get_cfg(&calcfg);
iot_printf("write_hw_version:%d,%d,%d\n",ret,
calcfg->halphy_cfg.hw_ver_major,calcfg->halphy_cfg.hw_ver_minor);
iot_board_hw_version_reload();
// board_load_oem_cfg();
}

View File

@@ -605,6 +605,7 @@ bool_t iot_board_is_5v_power_in(void);
*/
bool_t iot_board_is_overseas_rf_band(void);
void write_hw_version(uint32_t hw_ver);
#ifdef __cplusplus
}