Commit cf4758a7 authored by Michael Cook's avatar Michael Cook

Merge remote-tracking branch 'origin/episys/x2_trigger_nsa' into episys/sync-nfapi-with-muep-more

parents 4fb933cb 9b96dd2a
......@@ -187,6 +187,27 @@ static void reset_queue(queue_t *q)
}
}
static bool sfn_slot_matcher(void *wanted, void *candidate)
{
nr_queue_candidate *ind = candidate;
int sfn_sf = *(int*)wanted;
if (NFAPI_SFNSLOT2SFN(sfn_sf) == ind->rach_ind.sfn && NFAPI_SFNSLOT2SLOT(sfn_sf) == ind->rach_ind.slot)
{
return true;
}
else if (NFAPI_SFNSLOT2SFN(sfn_sf) == ind->rx_ind.sfn && NFAPI_SFNSLOT2SLOT(sfn_sf) == ind->rx_ind.slot)
{
return true;
}
else if (NFAPI_SFNSLOT2SFN(sfn_sf) == ind->crc_ind.sfn && NFAPI_SFNSLOT2SLOT(sfn_sf) == ind->crc_ind.slot)
{
return true;
}
return false;
}
static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
{
LOG_I(MAC, "Clearing Queues\n");
......@@ -286,11 +307,12 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
}
}
if (slot == 19)
nfapi_nr_rach_indication_t *rach_ind = unqueue_matching(&nr_rach_ind_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &sfn_slot);
nfapi_nr_rx_data_indication_t *rx_ind = unqueue_matching(&nr_rx_ind_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &sfn_slot);
nfapi_nr_crc_indication_t *crc_ind = unqueue_matching(&nr_crc_ind_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &sfn_slot);
if (rach_ind && rach_ind->number_of_pdus > 0)
{
nfapi_nr_rach_indication_t *rach_ind = get_queue(&nr_rach_ind_queue);
if (rach_ind != NULL && rach_ind->number_of_pdus > 0 && (rach_ind->sfn == frame && rach_ind->slot == slot))
{
NR_UL_IND_t UL_INFO = {
.rach_ind = *rach_ind,
};
......@@ -301,30 +323,24 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
}
free(rach_ind->pdu_list);
nr_Msg1_transmitted(mod_id, CC_id, frame, gNB_id);
}
}
if (slot == 17)
if (rx_ind && rx_ind->number_of_pdus > 0)
{
nfapi_nr_rx_data_indication_t *rx_ind = get_queue(&nr_rx_ind_queue);
if (rx_ind != NULL && rx_ind->number_of_pdus > 0 && (rx_ind->sfn == frame && rx_ind->slot == slot))
{
NR_UL_IND_t UL_INFO = {
.rx_ind = *rx_ind,
};
send_nsa_standalone_msg(&UL_INFO, rx_ind->header.message_id);
free(rx_ind->pdu_list);
}
nfapi_nr_crc_indication_t *crc_ind = get_queue(&nr_crc_ind_queue);
if (crc_ind != NULL && crc_ind->number_crcs > 0 && (crc_ind->sfn == frame && crc_ind->slot == slot))
{
NR_UL_IND_t UL_INFO = {
.crc_ind = *crc_ind,
};
send_nsa_standalone_msg(&UL_INFO, crc_ind->header.message_id);
free(crc_ind->crc_list);
}
NR_UL_IND_t UL_INFO = {
.rx_ind = *rx_ind,
};
send_nsa_standalone_msg(&UL_INFO, rx_ind->header.message_id);
free(rx_ind->pdu_list);
}
if (crc_ind && crc_ind->number_crcs > 0)
{
NR_UL_IND_t UL_INFO = {
.crc_ind = *crc_ind,
};
send_nsa_standalone_msg(&UL_INFO, crc_ind->header.message_id);
free(crc_ind->crc_list);
}
}
return NULL;
}
......
......@@ -1761,4 +1761,10 @@ typedef struct
} nfapi_nr_rach_indication_t;
typedef union {
nfapi_nr_rach_indication_t rach_ind;
nfapi_nr_rx_data_indication_t rx_ind;
nfapi_nr_crc_indication_t crc_ind;
} nr_queue_candidate;
#endif
......@@ -376,7 +376,10 @@ static void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request,
nfapi_nr_tx_data_request_t *tx_data_request,
nfapi_nr_ul_dci_request_t *ul_dci_request)
{
frame_t frame = 0;
int slot = 0;
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
if (mac->scc == NULL)
{
return;
......@@ -384,19 +387,29 @@ static void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request,
if (dl_tti_request)
{
LOG_I(NR_PHY, "[%d, %d] dl_tti_request\n", dl_tti_request->SFN, dl_tti_request->Slot);
frame = dl_tti_request->SFN;
slot = dl_tti_request->Slot;
LOG_I(NR_PHY, "[%d, %d] dl_tti_request\n", frame, slot);
copy_dl_tti_req_to_dl_info(&mac->dl_info, dl_tti_request);
}
if (tx_data_request)
else if (tx_data_request)
{
LOG_I(NR_PHY, "[%d, %d] PDSCH in tx_request\n", tx_data_request->SFN, tx_data_request->Slot);
frame = tx_data_request->SFN;
slot = tx_data_request->Slot;
LOG_I(NR_PHY, "[%d, %d] PDSCH in tx_request\n", frame, slot);
copy_tx_data_req_to_dl_info(&mac->dl_info, tx_data_request);
}
if (ul_dci_request)
else if (ul_dci_request)
{
LOG_I(NR_PHY, "[%d, %d] ul_dci_request\n", ul_dci_request->SFN, ul_dci_request->Slot);
frame = ul_dci_request->SFN;
slot = ul_dci_request->Slot;
LOG_I(NR_PHY, "[%d, %d] ul_dci_request\n", frame, slot);
copy_ul_dci_data_req_to_dl_info(&mac->dl_info, ul_dci_request);
}
else
{
return;
}
NR_UL_TIME_ALIGNMENT_t ul_time_alignment;
......@@ -404,6 +417,20 @@ static void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request,
fill_dci_from_dl_config(&mac->dl_info, &mac->dl_config_request);
nr_ue_dl_indication(&mac->dl_info, &ul_time_alignment);
// If we filled dl_info AFTER we got the slot indication, we want to check if we should fill tx_req:
nr_uplink_indication_t ul_info;
memset(&ul_info, 0, sizeof(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.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 (mac->scc && is_nr_UL_slot(mac->scc, ul_info.slot_tx))
{
nr_ue_ul_indication(&ul_info);
}
#if 0 //Melissa may want to free this
free(dl_info.dci_ind);
......
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