添加oem解析相关 注释

This commit is contained in:
2024-10-25 19:37:32 +08:00
parent 0e2871e95d
commit 1a60d3f171
7 changed files with 148 additions and 16 deletions

View File

@@ -107,6 +107,42 @@ uint32_t iot_oem_read_mtd(uint8_t *buf, uint32_t size, uint32_t offset)
return ret;
}
// 抓取额外的差分oem数据
uint32_t iot_oem_read_mtd_ext(uint8_t *buff,size_t buff_size)
{
int fd;
int ret;
int offset;
int status;
int fw_prtition=PART_NUM_FW1;
do {
fd = dev_open(fw_prtition, 0);
if (fd < 0) {
fd = 0;
break;
}
status = dev_seek(fd, offset, DEV_SEEK_SET);
if (status < 0) {
break;
}
status = dev_read(fd, buff, buff_size);
if (status < 0) {
break;
}
ret = ERR_OK;
} while(0);
if (fd) {
dev_close(fd);
}
return ret;
}
static uint32_t iot_oem_write_mtd(uint8_t *buf, uint32_t size, uint32_t offset)
{
uint32_t ret = ERR_FAIL;
@@ -230,6 +266,7 @@ uint32_t iot_oem_get_cfg_ext(iot_oem_obj_t** oem_obj)
#endif
if (gbl_oemcfg.ready != 1) {
// 这里只是读取基础oem配置 没有读取差分配置
ret = iot_oem_read_mtd((uint8_t*)&gbl_oemcfg.oemcfg, sizeof(iot_oem_cfg_t),
IOT_OEM_SECTION_START_ADDR);