|
|
@ -151,7 +151,7 @@ void phy_common::set_mch_period_stop(uint32_t stop)
|
|
|
|
pthread_mutex_unlock(&mtch_mutex);
|
|
|
|
pthread_mutex_unlock(&mtch_mutex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void phy_common::configure_mbsfn(phy_interface_stack_lte::phy_cfg_mbsfn_t* cfg)
|
|
|
|
void phy_common::configure_mbsfn(srslte::phy_cfg_mbsfn_t* cfg)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mbsfn = *cfg;
|
|
|
|
mbsfn = *cfg;
|
|
|
|
|
|
|
|
|
|
|
@ -168,11 +168,11 @@ void phy_common::build_mch_table()
|
|
|
|
|
|
|
|
|
|
|
|
// 40 element table represents 4 frames (40 subframes)
|
|
|
|
// 40 element table represents 4 frames (40 subframes)
|
|
|
|
uint32_t nof_sfs = 0;
|
|
|
|
uint32_t nof_sfs = 0;
|
|
|
|
if (mbsfn.mbsfn_subfr_cnfg.sf_alloc.type().value == mbsfn_sf_cfg_s::sf_alloc_c_::types::one_frame) {
|
|
|
|
if (mbsfn.mbsfn_subfr_cnfg.nof_alloc_subfrs == srslte::mbsfn_sf_cfg_t::sf_alloc_type_t::one_frame) {
|
|
|
|
generate_mch_table(&mch_table[0], (uint32_t)mbsfn.mbsfn_subfr_cnfg.sf_alloc.one_frame().to_number(), 1);
|
|
|
|
generate_mch_table(&mch_table[0], (uint32_t)mbsfn.mbsfn_subfr_cnfg.sf_alloc, 1);
|
|
|
|
nof_sfs = 10;
|
|
|
|
nof_sfs = 10;
|
|
|
|
} else if (mbsfn.mbsfn_subfr_cnfg.sf_alloc.type().value == mbsfn_sf_cfg_s::sf_alloc_c_::types::four_frames) {
|
|
|
|
} else if (mbsfn.mbsfn_subfr_cnfg.nof_alloc_subfrs == srslte::mbsfn_sf_cfg_t::sf_alloc_type_t::four_frames) {
|
|
|
|
generate_mch_table(&mch_table[0], (uint32_t)mbsfn.mbsfn_subfr_cnfg.sf_alloc.four_frames().to_number(), 4);
|
|
|
|
generate_mch_table(&mch_table[0], (uint32_t)mbsfn.mbsfn_subfr_cnfg.sf_alloc, 4);
|
|
|
|
nof_sfs = 40;
|
|
|
|
nof_sfs = 40;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
fprintf(stderr, "No valid SF alloc\n");
|
|
|
|
fprintf(stderr, "No valid SF alloc\n");
|
|
|
@ -191,8 +191,7 @@ void phy_common::build_mcch_table()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ZERO_OBJECT(mcch_table);
|
|
|
|
ZERO_OBJECT(mcch_table);
|
|
|
|
|
|
|
|
|
|
|
|
generate_mcch_table(mcch_table,
|
|
|
|
generate_mcch_table(mcch_table, static_cast<uint32_t>(mbsfn.mbsfn_area_info.mcch_cfg.sf_alloc_info));
|
|
|
|
static_cast<uint32_t>(mbsfn.mbsfn_area_info.mcch_cfg_r9.sf_alloc_info_r9.to_number()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::stringstream ss;
|
|
|
|
std::stringstream ss;
|
|
|
|
ss << "|";
|
|
|
|
ss << "|";
|
|
|
@ -212,15 +211,15 @@ bool phy_common::is_mcch_subframe(srslte_mbsfn_cfg_t* cfg, uint32_t phy_tti)
|
|
|
|
sf = phy_tti % 10;
|
|
|
|
sf = phy_tti % 10;
|
|
|
|
|
|
|
|
|
|
|
|
if (sib13_configured) {
|
|
|
|
if (sib13_configured) {
|
|
|
|
mbsfn_area_info_r9_s* area_info = &mbsfn.mbsfn_area_info;
|
|
|
|
// mbsfn_area_info_r9_s* area_info = &mbsfn.mbsfn_area_info;
|
|
|
|
|
|
|
|
srslte::mbsfn_area_info_t* area_info = &mbsfn.mbsfn_area_info;
|
|
|
|
offset = area_info->mcch_cfg_r9.mcch_offset_r9;
|
|
|
|
offset = area_info->mcch_cfg.mcch_offset;
|
|
|
|
period = area_info->mcch_cfg_r9.mcch_repeat_period_r9.to_number();
|
|
|
|
period = enum_to_number(area_info->mcch_cfg.mcch_repeat_period);
|
|
|
|
|
|
|
|
|
|
|
|
if ((sfn % period == offset) && mcch_table[sf] > 0) {
|
|
|
|
if ((sfn % period == offset) && mcch_table[sf] > 0) {
|
|
|
|
cfg->mbsfn_area_id = area_info->mbsfn_area_id_r9;
|
|
|
|
cfg->mbsfn_area_id = area_info->mbsfn_area_id;
|
|
|
|
cfg->non_mbsfn_region_length = area_info->non_mbsfn_region_len.to_number();
|
|
|
|
cfg->non_mbsfn_region_length = enum_to_number(area_info->non_mbsfn_region_len);
|
|
|
|
cfg->mbsfn_mcs = area_info->mcch_cfg_r9.sig_mcs_r9.to_number();
|
|
|
|
cfg->mbsfn_mcs = enum_to_number(area_info->mcch_cfg.sig_mcs);
|
|
|
|
cfg->enable = true;
|
|
|
|
cfg->enable = true;
|
|
|
|
cfg->is_mcch = true;
|
|
|
|
cfg->is_mcch = true;
|
|
|
|
have_mtch_stop = false;
|
|
|
|
have_mtch_stop = false;
|
|
|
@ -255,32 +254,29 @@ bool phy_common::is_mch_subframe(srslte_mbsfn_cfg_t* cfg, uint32_t phy_tti)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Not MCCH, check for MCH
|
|
|
|
// Not MCCH, check for MCH
|
|
|
|
mbsfn_sf_cfg_s* subfr_cnfg = &mbsfn.mbsfn_subfr_cnfg;
|
|
|
|
srslte::mbsfn_sf_cfg_t* subfr_cnfg = &mbsfn.mbsfn_subfr_cnfg;
|
|
|
|
mbsfn_area_info_r9_s* area_info = &mbsfn.mbsfn_area_info;
|
|
|
|
srslte::mbsfn_area_info_t* area_info = &mbsfn.mbsfn_area_info;
|
|
|
|
|
|
|
|
|
|
|
|
offset = subfr_cnfg->radioframe_alloc_offset;
|
|
|
|
offset = subfr_cnfg->radioframe_alloc_offset;
|
|
|
|
period = subfr_cnfg->radioframe_alloc_period.to_number();
|
|
|
|
period = enum_to_number(subfr_cnfg->radioframe_alloc_period);
|
|
|
|
|
|
|
|
|
|
|
|
if (subfr_cnfg->sf_alloc.type() == mbsfn_sf_cfg_s::sf_alloc_c_::types::one_frame) {
|
|
|
|
if (subfr_cnfg->nof_alloc_subfrs == srslte::mbsfn_sf_cfg_t::sf_alloc_type_t::one_frame) {
|
|
|
|
if ((sfn % period == offset) && (mch_table[sf] > 0)) {
|
|
|
|
if ((sfn % period == offset) && (mch_table[sf] > 0)) {
|
|
|
|
if (sib13_configured) {
|
|
|
|
if (sib13_configured) {
|
|
|
|
cfg->mbsfn_area_id = area_info->mbsfn_area_id_r9;
|
|
|
|
cfg->mbsfn_area_id = area_info->mbsfn_area_id;
|
|
|
|
cfg->non_mbsfn_region_length = area_info->non_mbsfn_region_len.to_number();
|
|
|
|
cfg->non_mbsfn_region_length = enum_to_number(area_info->non_mbsfn_region_len);
|
|
|
|
if (mcch_configured) {
|
|
|
|
if (mcch_configured) {
|
|
|
|
// Iterate through PMCH configs to see which one applies in the current frame
|
|
|
|
// Iterate through PMCH configs to see which one applies in the current frame
|
|
|
|
mbsfn_area_cfg_r9_s* area_r9 = &mbsfn.mcch.msg.c1().mbsfn_area_cfg_r9();
|
|
|
|
uint32_t frame_alloc_idx = sfn % enum_to_number(mbsfn.mcch.common_sf_alloc_period);
|
|
|
|
|
|
|
|
uint32_t mbsfn_per_frame = mbsfn.mcch.pmch_info_list[0].sf_alloc_end /
|
|
|
|
uint32_t frame_alloc_idx = sfn % area_r9->common_sf_alloc_period_r9.to_number();
|
|
|
|
+enum_to_number(mbsfn.mcch.pmch_info_list[0].mch_sched_period);
|
|
|
|
uint32_t mbsfn_per_frame = area_r9->pmch_info_list_r9[0].pmch_cfg_r9.sf_alloc_end_r9 /
|
|
|
|
|
|
|
|
+area_r9->pmch_info_list_r9[0].pmch_cfg_r9.mch_sched_period_r9.to_number();
|
|
|
|
|
|
|
|
uint32_t sf_alloc_idx = frame_alloc_idx * mbsfn_per_frame + ((sf < 4) ? sf - 1 : sf - 3);
|
|
|
|
uint32_t sf_alloc_idx = frame_alloc_idx * mbsfn_per_frame + ((sf < 4) ? sf - 1 : sf - 3);
|
|
|
|
while (!have_mtch_stop) {
|
|
|
|
while (!have_mtch_stop) {
|
|
|
|
pthread_cond_wait(&mtch_cvar, &mtch_mutex);
|
|
|
|
pthread_cond_wait(&mtch_cvar, &mtch_mutex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (uint32_t i = 0; i < mbsfn.mcch.nof_pmch_info; i++) {
|
|
|
|
for (uint32_t i = 0; i < area_r9->pmch_info_list_r9.size(); i++) {
|
|
|
|
|
|
|
|
if (sf_alloc_idx <= mch_period_stop) {
|
|
|
|
if (sf_alloc_idx <= mch_period_stop) {
|
|
|
|
cfg->mbsfn_mcs = mbsfn.mcch.msg.c1().mbsfn_area_cfg_r9().pmch_info_list_r9[i].pmch_cfg_r9.data_mcs_r9;
|
|
|
|
cfg->mbsfn_mcs = mbsfn.mcch.pmch_info_list[i].data_mcs;
|
|
|
|
cfg->enable = true;
|
|
|
|
cfg->enable = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -288,13 +284,13 @@ bool phy_common::is_mch_subframe(srslte_mbsfn_cfg_t* cfg, uint32_t phy_tti)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (subfr_cnfg->sf_alloc.type() == mbsfn_sf_cfg_s::sf_alloc_c_::types::four_frames) {
|
|
|
|
} else if (subfr_cnfg->nof_alloc_subfrs == srslte::mbsfn_sf_cfg_t::sf_alloc_type_t::four_frames) {
|
|
|
|
uint8_t idx = sfn % period;
|
|
|
|
uint8_t idx = sfn % period;
|
|
|
|
if ((idx >= offset) && (idx < offset + 4)) {
|
|
|
|
if ((idx >= offset) && (idx < offset + 4)) {
|
|
|
|
if (mch_table[(idx * 10) + sf] > 0) {
|
|
|
|
if (mch_table[(idx * 10) + sf] > 0) {
|
|
|
|
if (sib13_configured) {
|
|
|
|
if (sib13_configured) {
|
|
|
|
cfg->mbsfn_area_id = area_info->mbsfn_area_id_r9;
|
|
|
|
cfg->mbsfn_area_id = area_info->mbsfn_area_id;
|
|
|
|
cfg->non_mbsfn_region_length = area_info->non_mbsfn_region_len.to_number();
|
|
|
|
cfg->non_mbsfn_region_length = enum_to_number(area_info->non_mbsfn_region_len);
|
|
|
|
// TODO: check for MCCH configuration, set MCS and decode
|
|
|
|
// TODO: check for MCCH configuration, set MCS and decode
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|