diff --git a/driver/src/hal/board_info.c b/driver/src/hal/board_info.c index a24641c..1244ca9 100644 --- a/driver/src/hal/board_info.c +++ b/driver/src/hal/board_info.c @@ -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(); +} + + diff --git a/inc/driver/iot_board.h b/inc/driver/iot_board.h index 5a14d91..5ad2c12 100644 --- a/inc/driver/iot_board.h +++ b/inc/driver/iot_board.h @@ -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 }