mirror of
https://gitlab.eurecom.fr/oai/openairinterface5g.git
synced 2026-07-16 14:10:28 +00:00
Compare commits
1 Commits
develop
...
phy_config
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75235f7ebe |
@@ -867,7 +867,6 @@ void *UE_thread(void *arg)
|
||||
initNotifiedFIFO_nothreadSafe(&freeBlocks);
|
||||
|
||||
int timing_advance = UE->timing_advance;
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(UE->Mod_id);
|
||||
|
||||
bool syncRunning = false;
|
||||
const int nb_slot_frame = fp->slots_per_frame;
|
||||
@@ -917,7 +916,7 @@ void *UE_thread(void *arg)
|
||||
process_msg_rcc_to_mac(msg);
|
||||
else
|
||||
LOG_E(PHY, "It seems we arbort while trying to sync\n");
|
||||
decoded_frame_rx = mac->mib_frame;
|
||||
decoded_frame_rx = UE->mib_frame;
|
||||
}
|
||||
LOG_A(PHY,
|
||||
"UE synchronized! decoded_frame_rx=%d UE->init_sync_frame=%d trashed_frames=%d\n",
|
||||
|
||||
@@ -701,15 +701,16 @@ typedef struct {
|
||||
} fapi_nr_synch_request_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t config_mask;
|
||||
int mib_frame;
|
||||
} fapi_nr_master_info_config_t;
|
||||
|
||||
typedef struct {
|
||||
fapi_nr_ue_carrier_config_t carrier_config;
|
||||
fapi_nr_cell_config_t cell_config;
|
||||
fapi_nr_ssb_config_t ssb_config;
|
||||
fapi_nr_ssb_table_t ssb_table;
|
||||
fapi_nr_tdd_table_t tdd_table;
|
||||
fapi_nr_prach_config_t prach_config;
|
||||
|
||||
} fapi_nr_config_request_t;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -476,6 +476,8 @@ typedef struct PHY_VARS_NR_UE_s {
|
||||
int ta_slot;
|
||||
int ta_command;
|
||||
|
||||
int mib_frame;
|
||||
|
||||
/// Flag to tell if UE is secondary user (cognitive mode)
|
||||
unsigned char is_secondary_ue;
|
||||
/// Flag to tell if secondary gNB has channel estimates to create NULL-beams from.
|
||||
|
||||
@@ -599,10 +599,13 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response)
|
||||
void nr_ue_phy_config_request(nr_phy_config_t *phy_config)
|
||||
{
|
||||
PHY_VARS_NR_UE *phy = PHY_vars_UE_g[phy_config->Mod_id][phy_config->CC_id];
|
||||
fapi_nr_config_request_t *nrUE_config = &phy->nrUE_config;
|
||||
if(phy_config != NULL) {
|
||||
if(phy_config != NULL && phy_config->type == NR_PHY_CONFIG_REQUEST) {
|
||||
fapi_nr_config_request_t *nrUE_config = &phy->nrUE_config;
|
||||
phy->received_config_request = true;
|
||||
memcpy(nrUE_config, &phy_config->config_req, sizeof(fapi_nr_config_request_t));
|
||||
memcpy(nrUE_config, &phy_config->choice.config_req, sizeof(fapi_nr_config_request_t));
|
||||
}
|
||||
if(phy_config != NULL && phy_config->type == NR_PHY_CONFIG_MIB) {
|
||||
phy->mib_frame = phy_config->choice.mib_config.mib_frame;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -902,7 +902,12 @@ printf("%d\n", slot);
|
||||
fapi_nr_dl_config_request_t dl_config = {.sfn = frame, .slot = slot};
|
||||
nr_scheduled_response_t scheduled_response = {.dl_config = &dl_config, .phy_data = &phy_data, .mac = UE_mac};
|
||||
|
||||
nr_ue_phy_config_request(&UE_mac->phy_config);
|
||||
nr_phy_config_t config;
|
||||
config.Mod_id = 0;
|
||||
config.CC_id = 0;
|
||||
config.type = NR_PHY_CONFIG_REQUEST;
|
||||
config.choice.config_req = UE_mac->config_request;
|
||||
nr_ue_phy_config_request(&config);
|
||||
//NR_COMMON_channels_t *cc = RC.nrmac[0]->common_channels;
|
||||
int n_errs = 0;
|
||||
|
||||
|
||||
@@ -753,7 +753,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
initFloatingCoresTpool(threadCnt, &nrUE_params.Tpool, false, "UE-tpool");
|
||||
|
||||
nr_ue_phy_config_request(&UE_mac->phy_config);
|
||||
nr_phy_config_t config;
|
||||
config.Mod_id = 0;
|
||||
config.CC_id = 0;
|
||||
config.type = NR_PHY_CONFIG_REQUEST;
|
||||
config.choice.config_req = UE_mac->config_request;
|
||||
nr_ue_phy_config_request(&config);
|
||||
|
||||
unsigned char harq_pid = 0;
|
||||
|
||||
|
||||
@@ -81,11 +81,13 @@ static void set_tdd_config_nr_ue(fapi_nr_tdd_table_t *tdd_table, const frame_str
|
||||
}
|
||||
}
|
||||
|
||||
static void config_common_ue_sa(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommonSIB_t *scc, int cc_idP)
|
||||
static nr_phy_config_t config_common_ue_sa(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommonSIB_t *scc, int cc_idP)
|
||||
{
|
||||
fapi_nr_config_request_t *cfg = &mac->phy_config.config_req;
|
||||
mac->phy_config.Mod_id = mac->ue_id;
|
||||
mac->phy_config.CC_id = cc_idP;
|
||||
nr_phy_config_t config;
|
||||
config.Mod_id = mac->ue_id;
|
||||
config.CC_id = cc_idP;
|
||||
config.type = NR_PHY_CONFIG_REQUEST;
|
||||
fapi_nr_config_request_t *cfg = &config.choice.config_req;
|
||||
|
||||
LOG_D(MAC, "Entering SA UE Config Common\n");
|
||||
|
||||
@@ -219,7 +221,8 @@ static void config_common_ue_sa(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommo
|
||||
//prach_fd_occasion->num_unused_root_sequences = ???
|
||||
}
|
||||
cfg->prach_config.ssb_per_rach = rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present-1;
|
||||
|
||||
mac->config_request = *cfg;
|
||||
return config;
|
||||
}
|
||||
|
||||
// computes round-trip-time between ue and sat based on SIB19 ephemeris data
|
||||
@@ -271,12 +274,13 @@ void configure_ntn_ta(module_id_t module_id, ntn_timing_advance_componets_t *ntn
|
||||
ntn_ta->ntn_params_changed = true;
|
||||
}
|
||||
|
||||
static void config_common_ue(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommon_t *scc, int cc_idP)
|
||||
static nr_phy_config_t config_common_ue(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommon_t *scc, int cc_idP)
|
||||
{
|
||||
fapi_nr_config_request_t *cfg = &mac->phy_config.config_req;
|
||||
|
||||
mac->phy_config.Mod_id = mac->ue_id;
|
||||
mac->phy_config.CC_id = cc_idP;
|
||||
nr_phy_config_t config;
|
||||
config.Mod_id = mac->ue_id;
|
||||
config.CC_id = cc_idP;
|
||||
config.type = NR_PHY_CONFIG_REQUEST;
|
||||
fapi_nr_config_request_t *cfg = &config.choice.config_req;
|
||||
frame_type_t frame_type = mac->frame_structure.frame_type;
|
||||
|
||||
// carrier config
|
||||
@@ -450,6 +454,8 @@ static void config_common_ue(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommon_t
|
||||
} else {
|
||||
asn1cFreeStruc(asn_DEF_NR_NTN_Config_r17, mac->sc_info.ntn_Config_r17);
|
||||
}
|
||||
mac->config_request = *cfg;
|
||||
return config;
|
||||
}
|
||||
|
||||
void release_common_ss_cset(NR_BWP_PDCCH_t *pdcch)
|
||||
@@ -905,14 +911,20 @@ void nr_rrc_mac_config_req_mib(module_id_t module_id,
|
||||
if (!mac->mib)
|
||||
mac->mib = calloc(1, sizeof(*mac->mib));
|
||||
update_mib_conf(mac->mib, mib);
|
||||
mac->phy_config.Mod_id = module_id;
|
||||
mac->phy_config.CC_id = cc_idP;
|
||||
if (sched_sib == 1)
|
||||
mac->get_sib1 = true;
|
||||
else if (sched_sib == 2)
|
||||
mac->get_otherSI = true;
|
||||
nr_ue_decode_mib(mac, cc_idP);
|
||||
ret = pthread_mutex_unlock(&mac->if_mutex);
|
||||
if (!get_softmodem_params()->emulate_l1) {
|
||||
nr_phy_config_t phy_config;
|
||||
phy_config.CC_id = cc_idP;
|
||||
phy_config.Mod_id = module_id;
|
||||
phy_config.type = NR_PHY_CONFIG_MIB;
|
||||
phy_config.choice.mib_config.mib_frame = mac->mib_frame;
|
||||
mac->if_module->phy_config_request(&phy_config);
|
||||
}
|
||||
AssertFatal(!ret, "mutex failed %d\n", ret);
|
||||
}
|
||||
|
||||
@@ -1746,7 +1758,7 @@ void nr_rrc_mac_config_req_sib1(module_id_t module_id, int cc_idP, NR_SIB1_t *si
|
||||
configure_si_schedulingInfo(mac, si_SchedulingInfo, si_SchedulingInfo_v1700);
|
||||
mac->n_ta_offset = get_ta_offset(scc->n_TimingAdvanceOffset);
|
||||
|
||||
config_common_ue_sa(mac, scc, cc_idP);
|
||||
nr_phy_config_t phy_config = config_common_ue_sa(mac, scc, cc_idP);
|
||||
configure_common_BWP_dl(mac,
|
||||
0, // bwp-id
|
||||
&scc->downlinkConfigCommon.initialDownlinkBWP);
|
||||
@@ -1772,7 +1784,7 @@ void nr_rrc_mac_config_req_sib1(module_id_t module_id, int cc_idP, NR_SIB1_t *si
|
||||
build_ssb_to_ro_map(mac);
|
||||
|
||||
if (!get_softmodem_params()->emulate_l1)
|
||||
mac->if_module->phy_config_request(&mac->phy_config);
|
||||
mac->if_module->phy_config_request(&phy_config);
|
||||
ret = pthread_mutex_unlock(&mac->if_mutex);
|
||||
AssertFatal(!ret, "mutex failed %d\n", ret);
|
||||
}
|
||||
@@ -1796,9 +1808,7 @@ void nr_rrc_mac_config_other_sib(module_id_t module_id, NR_SIB19_r17_t *sib19, b
|
||||
AssertFatal(!ret, "mutex failed %d\n", ret);
|
||||
}
|
||||
|
||||
static void handle_reconfiguration_with_sync(NR_UE_MAC_INST_t *mac,
|
||||
int cc_idP,
|
||||
const NR_ReconfigurationWithSync_t *reconfWithSync)
|
||||
static void handle_reconfiguration_with_sync(NR_UE_MAC_INST_t *mac, int cc_idP, const NR_ReconfigurationWithSync_t *reconfWithSync)
|
||||
{
|
||||
reset_mac_inst(mac);
|
||||
mac->crnti = reconfWithSync->newUE_Identity;
|
||||
@@ -1818,12 +1828,15 @@ static void handle_reconfiguration_with_sync(NR_UE_MAC_INST_t *mac,
|
||||
mac->physCellId = *scc->physCellId;
|
||||
mac->dmrs_TypeA_Position = scc->dmrs_TypeA_Position;
|
||||
UPDATE_IE(mac->tdd_UL_DL_ConfigurationCommon, scc->tdd_UL_DL_ConfigurationCommon, NR_TDD_UL_DL_ConfigCommon_t);
|
||||
config_common_ue(mac, scc, cc_idP);
|
||||
nr_phy_config_t phy_config = config_common_ue(mac, scc, cc_idP);
|
||||
const int bwp_id = 0;
|
||||
if (scc->downlinkConfigCommon)
|
||||
configure_common_BWP_dl(mac, bwp_id, scc->downlinkConfigCommon->initialDownlinkBWP);
|
||||
if (scc->uplinkConfigCommon)
|
||||
configure_common_BWP_ul(mac, bwp_id, scc->uplinkConfigCommon->initialUplinkBWP);
|
||||
if (!get_softmodem_params()->emulate_l1) {
|
||||
mac->if_module->phy_config_request(&phy_config);
|
||||
}
|
||||
}
|
||||
|
||||
mac->state = UE_NOT_SYNC;
|
||||
@@ -1835,7 +1848,6 @@ static void handle_reconfiguration_with_sync(NR_UE_MAC_INST_t *mac,
|
||||
mac->synch_request.CC_id = cc_idP;
|
||||
mac->synch_request.synch_req.target_Nid_cell = mac->physCellId;
|
||||
mac->if_module->synch_request(&mac->synch_request);
|
||||
mac->if_module->phy_config_request(&mac->phy_config);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2559,7 +2571,7 @@ static void handle_mac_uecap_info(NR_UE_MAC_INST_t *mac, NR_UE_NR_Capability_t *
|
||||
NR_FeatureSetDownlinkPerCC_t *fs_dl_cc = fs_dlcc_list->list.array[i];
|
||||
if (mac->current_DL_BWP->scs != fs_dl_cc->supportedSubcarrierSpacingDL)
|
||||
continue;
|
||||
int dl_bw_mhz = mac->phy_config.config_req.carrier_config.dl_bandwidth;
|
||||
int dl_bw_mhz = mac->config_request.carrier_config.dl_bandwidth;
|
||||
if (!supported_bw_comparison(dl_bw_mhz, &fs_dl_cc->supportedBandwidthDL, fs_dl_cc->channelBW_90mhz))
|
||||
continue;
|
||||
if (fs_dl_cc->maxNumberMIMO_LayersPDSCH)
|
||||
@@ -2572,7 +2584,7 @@ static void handle_mac_uecap_info(NR_UE_MAC_INST_t *mac, NR_UE_NR_Capability_t *
|
||||
NR_FeatureSetUplinkPerCC_t *fs_ul_cc = fs_ulcc_list->list.array[i];
|
||||
if (mac->current_UL_BWP->scs != fs_ul_cc->supportedSubcarrierSpacingUL)
|
||||
continue;
|
||||
int ul_bw_mhz = mac->phy_config.config_req.carrier_config.uplink_bandwidth;
|
||||
int ul_bw_mhz = mac->config_request.carrier_config.uplink_bandwidth;
|
||||
if (!supported_bw_comparison(ul_bw_mhz, &fs_ul_cc->supportedBandwidthUL, fs_ul_cc->channelBW_90mhz))
|
||||
continue;
|
||||
if (fs_ul_cc->maxNumberMIMO_LayersNonCB_PUSCH)
|
||||
|
||||
@@ -621,9 +621,9 @@ typedef struct NR_UE_MAC_INST_s {
|
||||
fapi_nr_dl_config_request_t *dl_config_request;
|
||||
|
||||
/// Interface module instances
|
||||
nr_ue_if_module_t *if_module;
|
||||
nr_phy_config_t phy_config;
|
||||
nr_synch_request_t synch_request;
|
||||
nr_ue_if_module_t *if_module;
|
||||
nr_synch_request_t synch_request;
|
||||
fapi_nr_config_request_t config_request;
|
||||
|
||||
// order lc info
|
||||
A_SEQUENCE_OF(nr_lcordered_info_t) lc_ordered_list;
|
||||
|
||||
@@ -58,7 +58,7 @@ void nr_ue_init_mac(NR_UE_MAC_INST_t *mac)
|
||||
nr_ue_reset_sync_state(mac);
|
||||
mac->get_sib1 = false;
|
||||
mac->get_otherSI = false;
|
||||
memset(&mac->phy_config, 0, sizeof(mac->phy_config));
|
||||
memset(&mac->config_request, 0, sizeof(mac->config_request));
|
||||
mac->si_SchedInfo.si_window_start = -1;
|
||||
mac->servCellIndex = 0;
|
||||
mac->harq_ACK_SpatialBundlingPUCCH = false;
|
||||
|
||||
@@ -73,7 +73,7 @@ void init_RA(NR_UE_MAC_INST_t *mac,
|
||||
ra->RA_backoff_cnt = 0;
|
||||
ra->RA_window_cnt = -1;
|
||||
|
||||
fapi_nr_config_request_t *cfg = &mac->phy_config.config_req;
|
||||
fapi_nr_config_request_t *cfg = &mac->config_request;
|
||||
|
||||
prach_resources->RA_PREAMBLE_BACKOFF = 0;
|
||||
NR_SubcarrierSpacing_t prach_scs;
|
||||
@@ -83,7 +83,7 @@ void init_RA(NR_UE_MAC_INST_t *mac,
|
||||
scs_for_pcmax = prach_scs;
|
||||
} else {
|
||||
const unsigned int index = rach_ConfigGeneric->prach_ConfigurationIndex;
|
||||
const unsigned int unpaired = mac->phy_config.config_req.cell_config.frame_duplex_type;
|
||||
const unsigned int unpaired = mac->frame_structure.frame_type;
|
||||
const unsigned int format = get_format0(index, unpaired, mac->frequency_range);
|
||||
prach_scs = get_delta_f_RA_long(format);
|
||||
scs_for_pcmax = mac->current_UL_BWP->scs;
|
||||
|
||||
@@ -429,7 +429,7 @@ static int get_deltatf(uint16_t nb_of_prbs,
|
||||
// - referenceSignalPower: dBm/RE (average EPRE of the resources elements that carry secondary synchronization signals in dBm)
|
||||
int16_t compute_nr_SSB_PL(NR_UE_MAC_INST_t *mac, short ssb_rsrp_dBm)
|
||||
{
|
||||
fapi_nr_config_request_t *cfg = &mac->phy_config.config_req;
|
||||
fapi_nr_config_request_t *cfg = &mac->config_request;
|
||||
int referenceSignalPower = cfg->ssb_config.ss_pbch_power;
|
||||
//TODO improve PL measurements. Probably not correct as it is.
|
||||
|
||||
|
||||
@@ -1846,7 +1846,7 @@ static void build_ro_list(NR_UE_MAC_INST_t *mac)
|
||||
// Create the PRACH occasions map
|
||||
// WIP: For now assume no rejected PRACH occasions because of conflict with SSB or TDD_UL_DL_ConfigurationCommon schedule
|
||||
|
||||
int unpaired = mac->phy_config.config_req.cell_config.frame_duplex_type;
|
||||
int unpaired = mac->frame_structure.frame_type;
|
||||
|
||||
const int64_t *prach_config_info_p = get_prach_config_info(mac->frequency_range, config_index, unpaired);
|
||||
const int ul_mu = mac->current_UL_BWP->scs;
|
||||
@@ -1986,7 +1986,7 @@ static void build_ssb_list(NR_UE_MAC_INST_t *mac)
|
||||
// Create the list of transmitted SSBs
|
||||
const int bwp_id = mac->current_UL_BWP->bwp_id;
|
||||
ssb_list_info_t *ssb_list = &mac->ssb_list[bwp_id];
|
||||
fapi_nr_config_request_t *cfg = &mac->phy_config.config_req;
|
||||
fapi_nr_config_request_t *cfg = &mac->config_request;
|
||||
ssb_list->nb_tx_ssb = 0;
|
||||
|
||||
for (int ssb_index = 0; ssb_index < MAX_NB_SSB; ssb_index++) {
|
||||
@@ -2827,8 +2827,6 @@ void nr_schedule_csirs_reception(NR_UE_MAC_INST_t *mac, int frame, int slot)
|
||||
|
||||
// This function schedules the PRACH according to prach_ConfigurationIndex and TS 38.211, tables 6.3.3.2.x
|
||||
// PRACH formats 9, 10, 11 are corresponding to dual PRACH format configurations A1/B1, A2/B2, A3/B3.
|
||||
// - todo:
|
||||
// - Partial configuration is actually already stored in (fapi_nr_prach_config_t) &mac->phy_config.config_req->prach_config
|
||||
static void nr_ue_prach_scheduler(NR_UE_MAC_INST_t *mac, frame_t frameP, sub_frame_t slotP)
|
||||
{
|
||||
RA_config_t *ra = &mac->ra;
|
||||
@@ -2836,7 +2834,7 @@ static void nr_ue_prach_scheduler(NR_UE_MAC_INST_t *mac, frame_t frameP, sub_fra
|
||||
if (ra->ra_state != nrRA_GENERATE_PREAMBLE)
|
||||
return;
|
||||
|
||||
fapi_nr_config_request_t *cfg = &mac->phy_config.config_req;
|
||||
fapi_nr_config_request_t *cfg = &mac->config_request;
|
||||
fapi_nr_prach_config_t *prach_config = &cfg->prach_config;
|
||||
|
||||
NR_RACH_ConfigCommon_t *setup = mac->current_UL_BWP->rach_ConfigCommon;
|
||||
|
||||
@@ -169,16 +169,24 @@ typedef struct {
|
||||
struct NR_UE_MAC_INST_s *mac;
|
||||
} nr_scheduled_response_t;
|
||||
|
||||
typedef struct {
|
||||
/// module id
|
||||
uint8_t Mod_id;
|
||||
/// component carrier id
|
||||
uint8_t CC_id;
|
||||
|
||||
/// NR UE FAPI-like P5 message
|
||||
/// physical layer configuration request structure
|
||||
fapi_nr_config_request_t config_req;
|
||||
typedef enum {
|
||||
NR_PHY_CONFIG_REQUEST,
|
||||
NR_PHY_CONFIG_MIB
|
||||
} nr_phy_config_type;
|
||||
|
||||
typedef struct {
|
||||
/// module id
|
||||
uint8_t Mod_id;
|
||||
/// component carrier id
|
||||
uint8_t CC_id;
|
||||
|
||||
/// NR UE FAPI-like P5 message
|
||||
/// physical layer configuration request structure
|
||||
nr_phy_config_type type;
|
||||
union {
|
||||
fapi_nr_config_request_t config_req;
|
||||
fapi_nr_master_info_config_t mib_config;
|
||||
} choice;
|
||||
} nr_phy_config_t;
|
||||
|
||||
typedef struct {
|
||||
|
||||
Reference in New Issue
Block a user