From e3bf4940fd821cabc5c0789b9b5a9798335f06ac Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Fri, 18 Jun 2021 15:06:59 -0700 Subject: [PATCH] WIP: Not working or building. Starting to complete the final fill of dl_indication and an rx_indication --- openair1/SCHED_NR_UE/fapi_nr_ue_l1.c | 118 +++++++++++++++++++++------ 1 file changed, 92 insertions(+), 26 deletions(-) diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index dfca193293..8529704c61 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -45,6 +45,72 @@ 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"}; +static void nr_fill_dl_indication_stub(nr_downlink_indication_t *dl_ind, + fapi_nr_dci_indication_t *dci_ind, + fapi_nr_rx_indication_t *rx_ind, + nr_scheduled_response_t *sched_resp) +{ + memset((void*)dl_ind, 0, sizeof(nr_downlink_indication_t)); + + dl_ind->gNB_index = 0; + dl_ind->module_id = sched_resp->module_id; + dl_ind->cc_id = sched_resp->CC_id; + dl_ind->frame = sched_resp->frame + dl_ind->slot = sched_resp->slot; + + if (dci_ind) + { + dl_ind->rx_ind = NULL; + dl_ind->dci_ind = dci_ind; + } + else if (rx_ind) + { + dl_ind->rx_ind = rx_ind; + dl_ind->dci_ind = NULL; + } +} + +static void nr_fill_rx_indication_stub(fapi_nr_rx_indication_t *rx_ind, + uint8_t pdu_type, + nr_scheduled_response_t sched_resp) +{ + #if 0 + int harq_pid; + uint8_t pdu_type, + uint8_t gNB_id, + PHY_VARS_NR_UE *ue, + NR_UE_DLSCH_t *dlsch0, + uint16_t n_pdus + NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; + + if (n_pdus > 1){ + LOG_E(PHY, "In %s: multiple number of DL PDUs not supported yet...\n", __FUNCTION__); + } + + switch (pdu_type){ + case FAPI_NR_RX_PDU_TYPE_DLSCH: + case FAPI_NR_RX_PDU_TYPE_RAR: + harq_pid = dlsch0->current_harq_pid; + rx_ind->rx_indication_body[n_pdus - 1].pdsch_pdu.pdu = dlsch0->harq_processes[harq_pid]->b; + rx_ind->rx_indication_body[n_pdus - 1].pdsch_pdu.pdu_length = dlsch0->harq_processes[harq_pid]->TBS / 8; + break; + case FAPI_NR_RX_PDU_TYPE_MIB: + rx_ind->rx_indication_body[n_pdus - 1].mib_pdu.pdu = ue->pbch_vars[gNB_id]->decoded_output; + rx_ind->rx_indication_body[n_pdus - 1].mib_pdu.additional_bits = ue->pbch_vars[gNB_id]->xtra_byte; + rx_ind->rx_indication_body[n_pdus - 1].mib_pdu.ssb_index = frame_parms->ssb_index; + rx_ind->rx_indication_body[n_pdus - 1].mib_pdu.ssb_length = frame_parms->Lmax; + rx_ind->rx_indication_body[n_pdus - 1].mib_pdu.cell_id = frame_parms->Nid_cell; + break; + default: + break; + } + + rx_ind->rx_indication_body[n_pdus -1].pdu_type = pdu_type; + rx_ind->number_pdus = n_pdus; + #endif + +} + int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response) { if(scheduled_response != NULL) @@ -126,33 +192,33 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response } if (scheduled_response->dl_config != NULL) { - //scheduled_response->dl_config->number_pdus = 0; - /* After calling nr_ue_dl_indiction then the dl_config is here. - We will have dl_config and a tx_req. Then we need to - if(retmax_ldpc_iterations+1){ - - switch (pdsch) { - case RA_PDSCH: - nr_fill_dl_indication(&dl_indication, NULL, &rx_ind, proc, ue, eNB_id); - nr_fill_rx_indication(&rx_ind, FAPI_NR_RX_PDU_TYPE_RAR, eNB_id, ue, dlsch0, number_pdus); - - ue->UE_mode[eNB_id] = RA_RESPONSE; - break; - case PDSCH: - nr_fill_dl_indication(&dl_indication, NULL, &rx_ind, proc, ue, eNB_id); - nr_fill_rx_indication(&rx_ind, FAPI_NR_RX_PDU_TYPE_DLSCH, eNB_id, ue, dlsch0, number_pdus); - break; - case SI_PDSCH: - rx_ind.rx_indication_body[0].pdu_type = FAPI_NR_RX_PDU_TYPE_SIB; - break; - default: - break; + if (scheduled_response->tx_request != NULL) + { + int num_pdus = scheduled_response->dl_config->number_pdus; + for (int i = 0; i < num_pdus; i++) + { + int pdu_type = scheduled_response->dl_config->dl_config_list[i].pdu_type; + nr_downlink_indication_t dl_indication; + fapi_nr_rx_indication_t rx_ind; + switch (pdu_type) + { + case FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH: + nr_fill_dl_indication_stub(&dl_indication, NULL, &rx_ind, &scheduled_response); + nr_fill_rx_indication_stub(&rx_ind, FAPI_NR_RX_PDU_TYPE_RAR, &scheduled_response); + break; + case FAPI_NR_DL_CONFIG_TYPE_DLSCH: + nr_fill_dl_indication_stub(&dl_indication, NULL, &rx_ind, &scheduled_response); + nr_fill_rx_indication_stub(&rx_ind, FAPI_NR_RX_PDU_TYPE_DLSCH, &scheduled_response); + break; + case FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH: + rx_ind.rx_indication_body[0].pdu_type = FAPI_NR_RX_PDU_TYPE_SIB; + break; + default: + break; + } + } } - // send to mac - if (ue->if_inst && ue->if_inst->dl_indication) { - ue->if_inst->dl_indication(&dl_indication, ul_time_alignment); - } - */ + nr_ue_dl_indication(&dl_indication, NULL); } } return 0;