Commit f768b90f authored by Melissa Elkadi's avatar Melissa Elkadi

Fixing how we set slot_tx in the NR UE.

Also fixed unpacking ul_tti_inds.
parent 2949d300
......@@ -206,39 +206,34 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
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;
int slots_per_frame = 20; //30 kHZ subcarrier spacing
int slot_ahead = 6; // Melissa lets make this dynamic
ul_info.frame_rx = frame;
ul_info.slot_rx = slot;
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__);
ul_info.slot_tx = (slot + slot_ahead) % slots_per_frame;
ul_info.frame_tx = (ul_info.slot_rx + slot_ahead >= slots_per_frame) ? ul_info.frame_rx + 1 : ul_info.frame_rx;
if (is_nr_UL_slot(mac->scc, ul_info.slot_tx)) {
LOG_I(NR_MAC, "Slot %d. calling nr_ue_ul_ind() from %s\n", ul_info.slot_tx, __FUNCTION__);
nr_ue_ul_indication(&ul_info);
}
int CC_id = 0;
uint8_t gNB_id = 0;
uint8_t nr_prach = nr_ue_get_rach(&prach_resources, &prach_pdu, mod_id, CC_id, frame, gNB_id, slot);
uint8_t nr_prach = nr_ue_get_rach(&prach_resources, &prach_pdu, mod_id, CC_id, ul_info.frame_tx, gNB_id, ul_info.slot_tx);
if (nr_prach == 1)
{
nfapi_nr_rach_indication_t *ind = CALLOC(1, sizeof(*ind));
L1_nsa_prach_procedures(ind, frame, slot);
L1_nsa_prach_procedures(ind, ul_info.frame_tx, ul_info.slot_tx);
free(ind);
/* Fill rach indication here and send to proxy. Basically take pieces from
L1_nr_prach_procedures() and send it to the proxy. prach from ue->gNb->gnb sends rach->ue receives rach
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 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
LOG_I(NR_PHY, "Calling nr_Msg1_transmitted for slot %d\n", ul_info.slot_tx);
nr_Msg1_transmitted(mod_id, CC_id, ul_info.frame_tx, gNB_id); //This is called when phy layer has sent the prach
}
else if (nr_prach == 2)
{
......
......@@ -217,6 +217,7 @@ void *nrue_standalone_pnf_task(void *context)
{
nfapi_p7_message_header_t header;
nfapi_nr_dl_tti_request_t dl_tti_request;
nfapi_nr_ul_tti_request_t ul_tti_request;
if (nfapi_p7_message_header_unpack((void *)buffer, len, &header, sizeof(header), NULL) < 0)
{
LOG_E(NR_PHY, "Header unpack failed for nrue_standalone pnf\n");
......@@ -227,7 +228,7 @@ void *nrue_standalone_pnf_task(void *context)
switch (header.message_id)
{
case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST:
LOG_D(NR_PHY, "Received an NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST message. \n");
LOG_I(NR_PHY, "Received an NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST message. \n");
if (nfapi_nr_p7_message_unpack((void *)buffer, len, &dl_tti_request,
sizeof(nfapi_nr_dl_tti_request_t), NULL) < 0)
{
......@@ -244,8 +245,8 @@ void *nrue_standalone_pnf_task(void *context)
break;
case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST:
LOG_I(NR_PHY, "Received an NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST message. \n");
if (nfapi_nr_p7_message_unpack((void *)buffer, len, &dl_tti_request,
sizeof(dl_tti_request), NULL) < 0)
if (nfapi_nr_p7_message_unpack((void *)buffer, len, &ul_tti_request,
sizeof(ul_tti_request), NULL) < 0)
{
LOG_E(NR_PHY, "Message dl_tti_request failed to unpack\n");
break;
......
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