add session id generator
This commit is contained in:
@@ -36,12 +36,33 @@ static int parse_system_section(struct config *cfg, toml_table_t *conf_file_hand
|
||||
}
|
||||
strncpy(cfg->sys_cfg.dev_symbol, ptr, sizeof(cfg->sys_cfg.dev_symbol) - 1);
|
||||
|
||||
ptr = toml_raw_in(system_table, "device_base");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing system.device_base");
|
||||
return -1;
|
||||
}
|
||||
cfg->sys_cfg.device_base = atoi(ptr);
|
||||
|
||||
ptr = toml_raw_in(system_table, "device_offset");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing system.device_offset");
|
||||
return -1;
|
||||
}
|
||||
cfg->sys_cfg.device_offset = atoi(ptr);
|
||||
|
||||
ptr = toml_raw_in(system_table, "nr_threads");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing system.nr_threads");
|
||||
return -1;
|
||||
}
|
||||
if (atoi(ptr) <= 0 || atoi(ptr) > MAX_THREAD_NUM)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file invalid system.nr_threads %d, range [1, %d]", atoi(ptr), MAX_THREAD_NUM);
|
||||
return -1;
|
||||
}
|
||||
cfg->sys_cfg.nr_threads = atoi(ptr);
|
||||
|
||||
mask_array = toml_array_in(system_table, "cpu_mask");
|
||||
@@ -50,7 +71,7 @@ static int parse_system_section(struct config *cfg, toml_table_t *conf_file_hand
|
||||
CONFIG_LOG_ERROR("config file missing system.cpu_mask");
|
||||
return -1;
|
||||
}
|
||||
for (uint16_t i = 0; i < cfg->sys_cfg.nr_threads; i++)
|
||||
for (uint8_t i = 0; i < cfg->sys_cfg.nr_threads; i++)
|
||||
{
|
||||
ptr = toml_raw_at(mask_array, i);
|
||||
if (ptr == NULL)
|
||||
@@ -301,8 +322,10 @@ void config_dump(struct config *cfg)
|
||||
|
||||
CONFIG_LOG_DEBUG("system.app_symbol : %s", cfg->sys_cfg.app_symbol);
|
||||
CONFIG_LOG_DEBUG("system.dev_symbol : %s", cfg->sys_cfg.dev_symbol);
|
||||
CONFIG_LOG_DEBUG("system.device_base : %d", cfg->sys_cfg.device_base);
|
||||
CONFIG_LOG_DEBUG("system.device_offset : %d", cfg->sys_cfg.device_offset);
|
||||
CONFIG_LOG_DEBUG("system.nr_threads : %d", cfg->sys_cfg.nr_threads);
|
||||
for (uint16_t i = 0; i < cfg->sys_cfg.nr_threads; i++)
|
||||
for (uint8_t i = 0; i < cfg->sys_cfg.nr_threads; i++)
|
||||
{
|
||||
CONFIG_LOG_DEBUG("system.cpu_mask[%d] : %d", i, cfg->sys_cfg.cpu_mask[i]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user