Commit 7a7b668e authored by Melissa Elkadi's avatar Melissa Elkadi

The pRACH is now only generated for slot 19.

Several other changes in this commit include:
- Setting the number of PDUS in the ul_config
  to be zero when we will it (inside of the
  get_ul_config() function.)
- We reset the nprach flag to 0 for each slot.
- We return out of the prach scheduler if
  mac->ul_config == NULL
- Added error checking for array indexing
- Created a dummy scheduler response function.
- Allocated ul_config_req initially
parent 7db52420
......@@ -164,7 +164,7 @@ static void L1_nsa_prach_procedures(nfapi_nr_rach_indication_t *rach_ind, frame_
rach_ind->pdu_list[pdu_index].num_preamble = 1;
const int num_p = rach_ind->pdu_list[pdu_index].num_preamble;
rach_ind->pdu_list[pdu_index].preamble_list = calloc(num_p, sizeof(nfapi_nr_prach_indication_preamble_t));
rach_ind->pdu_list[pdu_index].preamble_list[0].preamble_index = 0;
rach_ind->pdu_list[pdu_index].preamble_list[0].preamble_index = 63; //Melissa, need to get this out of rrc_reconfig_msg
rach_ind->pdu_list[pdu_index].preamble_list[0].timing_advance = 0;
rach_ind->pdu_list[pdu_index].preamble_list[0].preamble_pwr = 0xffffffff;
......@@ -203,16 +203,21 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
continue;
}
mac->ra.generate_nr_prach = 0;
frame_t frame = NFAPI_SFNSLOT2SFN(sfn_slot);
int slot = NFAPI_SFNSLOT2SLOT(sfn_slot);
#if 0
int slots_per_frame = 2048;
int slots_per_subframe = 2;
int slot_ahead = 6;
ul_info.frame_tx = frame; //Melissa, hack. (slot > slots_per_frame - 1 - (slots_per_subframe*slot_ahead)) ? frame & 1023 : frame;
ul_info.slot_tx = slot; // Melissa hack. slot + slots_per_subframe*slot_ahead % slots_per_frame;
#endif
nr_uplink_indication_t ul_info;
ul_info.frame_rx = frame;
ul_info.slot_rx = slot;
ul_info.frame_tx = (slot > slots_per_frame - 1 - (slots_per_subframe*slot_ahead)) ? frame & 1023 : frame;
ul_info.slot_tx = slot + slots_per_subframe*slot_ahead % slots_per_frame;
ul_info.frame_tx = frame;
ul_info.slot_tx = slot;
if (is_nr_UL_slot(mac->scc, slot)) {
LOG_I(NR_MAC, "Slot %d. calling nr_ue_ul_ind() from %s\n", slot, __FUNCTION__);
nr_ue_ul_indication(&ul_info);
......@@ -232,7 +237,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
The UE is basically filling the rach and proxy will receive and think that it came from the gNB. The
received rach in the proxy will trigger gNB to send back the RAR. RAR will go to proxy then goes to UE
and the UE will get the DCI for RAR and the payload. have to handle receving the RAR once we get it. */
LOG_I(NR_PHY, "Calling nr_Msg1_transmitted!!!\n");
LOG_I(NR_PHY, "Calling nr_Msg1_transmitted for slot %d\n", slot);
nr_Msg1_transmitted(mod_id, CC_id, frame, gNB_id); //This is called when phy layer has sent the prach
}
else if (nr_prach == 2)
......
......@@ -45,6 +45,15 @@ extern PHY_VARS_NR_UE ***PHY_vars_UE_g;
const char *dl_pdu_type[]={"DCI", "DLSCH", "RA_DLSCH"};
const char *ul_pdu_type[]={"PRACH", "PUCCH", "PUSCH", "SRS"};
int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response) {
/* Melissa, this is a hack. We are not calling nr_ue_scheduled_response
because it requires PHY_vars_UE_g. We are basically not using layer
one here so we are calling a stub version of this scheduled response.
The original scheduled_response sends downlink information for the DCIs.
The physical layer provides this information. We dont need this yet.*/
return 0;
}
int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
if(scheduled_response != NULL){
......
......@@ -39,6 +39,8 @@
\param scheduled_response including transmission config(dl_config, ul_config) and data transmission (tx_req)*/
int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response);
int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response);
/**\brief NR UE FAPI-like P5 message, physical configuration from L2 to configure L1
\param scheduled_response including transmission config(dl_config, ul_config) and data transmission (tx_req)*/
int8_t nr_ue_phy_config_request(nr_phy_config_t *phy_config);
......
......@@ -531,6 +531,11 @@ int nr_rrc_mac_config_req_ue(
if (cell_group_config->spCellConfig->reconfigurationWithSync) {
ra->rach_ConfigDedicated = cell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink;
mac->scc = cell_group_config->spCellConfig->reconfigurationWithSync->spCellConfigCommon;
int num_slots = mac->scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots;
if (mac->scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols > 0) {
num_slots++;
}
mac->ul_config_request = calloc(num_slots, sizeof(*mac->ul_config_request));
config_common_ue(mac,module_id,cc_idP);
mac->crnti = cell_group_config->spCellConfig->reconfigurationWithSync->newUE_Identity;
LOG_I(MAC,"Configuring CRNTI %x\n",mac->crnti);
......
......@@ -138,9 +138,10 @@ fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int sl
num_slots_per_tdd,
num_slots_ul,
index);
if(!mac->ul_config_request)
return NULL;
mac->ul_config_request[index].number_pdus = 0;
return &mac->ul_config_request[index];
}
......@@ -1651,9 +1652,12 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
NR_UE_MAC_INST_t *mac = get_mac_inst(module_idP);
RA_config_t *ra = &mac->ra;
fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, slotP);
if (!ul_config) {
LOG_E(NR_MAC, "mac->ul_config is null! \n");
return;
}
//fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, slotP);
fapi_nr_ul_config_request_t *ul_config = &mac->ul_config_request[0];
fapi_nr_ul_config_prach_pdu *prach_config_pdu;
fapi_nr_config_request_t *cfg = &mac->phy_config.config_req;
fapi_nr_prach_config_t *prach_config = &cfg->prach_config;
......@@ -1686,10 +1690,9 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
format = prach_occasion_info_p->format;
format0 = format & 0xff; // single PRACH format
format1 = (format >> 8) & 0xff; // dual PRACH format
if (ul_config == NULL)
return;
AssertFatal(ul_config->number_pdus < FAPI_NR_UL_CONFIG_LIST_NUM, "Too many PDUs %d\n", ul_config->number_pdus);
prach_config_pdu = &ul_config->ul_config_list[ul_config->number_pdus].prach_config_pdu;
memset(prach_config_pdu, 0, sizeof(fapi_nr_ul_config_prach_pdu));
memset(prach_config_pdu, 0, sizeof(*prach_config_pdu));
ul_config->number_pdus += 1;
LOG_D(PHY, "In %s: (%p) %d UL PDUs:\n", __FUNCTION__, ul_config, ul_config->number_pdus);
......
......@@ -426,7 +426,10 @@ nr_ue_if_module_t *nr_ue_if_module_init(uint32_t module_id){
nr_ue_if_module_inst[module_id]->current_frame = 0;
nr_ue_if_module_inst[module_id]->current_slot = 0;
nr_ue_if_module_inst[module_id]->phy_config_request = nr_ue_phy_config_request;
nr_ue_if_module_inst[module_id]->scheduled_response = nr_ue_scheduled_response;
if (get_softmodem_params()->nsa) //Melissa, this is also a hack. Get a better flag.
nr_ue_if_module_inst[module_id]->scheduled_response = nr_ue_scheduled_response_stub;
else
nr_ue_if_module_inst[module_id]->scheduled_response = nr_ue_scheduled_response;
nr_ue_if_module_inst[module_id]->dl_indication = nr_ue_dl_indication;
nr_ue_if_module_inst[module_id]->ul_indication = nr_ue_ul_indication;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment