diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 0792c6c312..84f63d4a9b 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -327,7 +327,7 @@ static void check_nr_prach(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_inf { L1_nsa_prach_procedures(ul_info->frame_tx, ul_info->slot_tx, prach_pdu); ul_config->number_pdus = 0; - ul_info->ue_sched_mode = SCHED_ALL; + ul_info->ue_sched_mode = SCHED_PUSCH; } else if (nr_prach == 2) { @@ -427,7 +427,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) 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; - ul_info.ue_sched_mode = SCHED_ALL; + ul_info.ue_sched_mode = SCHED_PUSCH; if (pthread_mutex_lock(&mac->mutex_dl_info)) abort(); @@ -459,7 +459,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) LOG_D(NR_MAC, "Slot %d. calling nr_ue_ul_ind() and nr_ue_pucch_scheduler() from %s\n", ul_info.slot_tx, __FUNCTION__); nr_ue_scheduler(NULL, &ul_info); nr_ue_prach_scheduler(mod_id, ul_info.frame_tx, ul_info.slot_tx, ul_info.thread_id); - nr_ue_pucch_scheduler(mod_id, ul_info.frame_tx, ul_info.slot_tx, ul_info.thread_id); + nr_ue_pucch_scheduler(mod_id, ul_info.frame_tx, ul_info.slot_tx, ul_info.thread_id, NULL); check_nr_prach(mac, &ul_info, &prach_resources); } if (!IS_SOFTMODEM_NOS1 && get_softmodem_params()->sa) { @@ -611,12 +611,9 @@ void processSlotTX(void *arg) { nr_rxtx_thread_data_t *rxtxD = (nr_rxtx_thread_data_t *) arg; UE_nr_rxtx_proc_t *proc = &rxtxD->proc; PHY_VARS_NR_UE *UE = rxtxD->UE; - fapi_nr_config_request_t *cfg = &UE->nrUE_config; - int tx_slot_type = nr_ue_slot_select(cfg, proc->frame_tx, proc->nr_slot_tx); - uint8_t gNB_id = 0; - LOG_D(PHY,"processSlotTX %d.%d => slot type %d\n",proc->frame_tx,proc->nr_slot_tx,tx_slot_type); - if (tx_slot_type == NR_UPLINK_SLOT || tx_slot_type == NR_MIXED_SLOT){ + LOG_D(PHY,"%d.%d => slot type %d\n", proc->frame_tx, proc->nr_slot_tx, proc->tx_slot_type); + if (proc->tx_slot_type == NR_UPLINK_SLOT || proc->tx_slot_type == NR_MIXED_SLOT){ // trigger L2 to run ue_scheduler thru IF module // [TODO] mapping right after NR initial sync @@ -626,7 +623,7 @@ void processSlotTX(void *arg) { memset((void*)&ul_indication, 0, sizeof(ul_indication)); ul_indication.module_id = UE->Mod_id; - ul_indication.gNB_index = gNB_id; + ul_indication.gNB_index = proc->gNB_id; ul_indication.cc_id = UE->CC_id; ul_indication.frame_rx = proc->frame_rx; ul_indication.slot_rx = proc->nr_slot_rx; @@ -639,20 +636,15 @@ void processSlotTX(void *arg) { stop_meas(&UE->ue_ul_indication_stats); } - if (rxtxD->ue_sched_mode != NOT_PUSCH) { - phy_procedures_nrUE_TX(UE,proc,0); - } + phy_procedures_nrUE_TX(UE,proc,proc->gNB_id); } } -void processSlotRX(void *arg) { +void UE_processing(void *arg) { nr_rxtx_thread_data_t *rxtxD = (nr_rxtx_thread_data_t *) arg; UE_nr_rxtx_proc_t *proc = &rxtxD->proc; PHY_VARS_NR_UE *UE = rxtxD->UE; - fapi_nr_config_request_t *cfg = &UE->nrUE_config; - int rx_slot_type = nr_ue_slot_select(cfg, proc->frame_rx, proc->nr_slot_rx); - int tx_slot_type = nr_ue_slot_select(cfg, proc->frame_tx, proc->nr_slot_tx); uint8_t gNB_id = 0; NR_UE_PDCCH_CONFIG phy_pdcch_config={0}; @@ -666,7 +658,7 @@ void processSlotRX(void *arg) { } } - if (rx_slot_type == NR_DOWNLINK_SLOT || rx_slot_type == NR_MIXED_SLOT){ + if (proc->rx_slot_type == NR_DOWNLINK_SLOT || proc->rx_slot_type == NR_MIXED_SLOT){ if(UE->if_inst != NULL && UE->if_inst->dl_indication != NULL) { nr_downlink_indication_t dl_indication; @@ -696,35 +688,39 @@ void processSlotRX(void *arg) { if (res == NULL) return; // Tpool has been stopped delNotifiedFIFO_elt(res); - - // calling UL_indication to schedule things other than PUSCH (eg, PUCCH) - rxtxD->ue_sched_mode = NOT_PUSCH; - processSlotTX(rxtxD); - - } else { - rxtxD->ue_sched_mode = SCHED_ALL; - processSlotTX(rxtxD); } - if (tx_slot_type == NR_UPLINK_SLOT || tx_slot_type == NR_MIXED_SLOT){ + if (proc->tx_slot_type == NR_UPLINK_SLOT || proc->tx_slot_type == NR_MIXED_SLOT) { + nr_phy_data_t phy_data = {0}; + if (UE->if_inst != NULL && UE->if_inst->ul_indication != NULL) { + nr_uplink_indication_t ul_indication; + memset((void*)&ul_indication, 0, sizeof(ul_indication)); + ul_indication.module_id = UE->Mod_id; + ul_indication.gNB_index = gNB_id; + ul_indication.cc_id = UE->CC_id; + ul_indication.frame_rx = proc->frame_rx; + ul_indication.slot_rx = proc->nr_slot_rx; + ul_indication.frame_tx = proc->frame_tx; + ul_indication.slot_tx = proc->nr_slot_tx; + ul_indication.ue_sched_mode = SCHED_PUCCH; + ul_indication.phy_data = &phy_data; + UE->if_inst->ul_indication(&ul_indication); + } if (UE->UE_mode[gNB_id] <= PUSCH) { - if (get_softmodem_params()->usim_test==0) { - pucch_procedures_ue_nr(UE, - gNB_id, - proc); - } - - LOG_D(PHY, "Sending Uplink data \n"); - nr_ue_pusch_common_procedures(UE, - proc->nr_slot_tx, - &UE->frame_parms, - UE->frame_parms.nb_antennas_tx); + pucch_procedures_ue_nr(UE, + gNB_id, + proc, + &phy_data); } - if (UE->UE_mode[gNB_id] > NOT_SYNCHED && UE->UE_mode[gNB_id] < PUSCH) { - nr_ue_prach_procedures(UE, proc, gNB_id); - } - LOG_D(PHY,"****** end TX-Chain for AbsSubframe %d.%d ******\n", proc->frame_tx, proc->nr_slot_tx); + LOG_D(PHY, "Sending Uplink data \n"); + nr_ue_pusch_common_procedures(UE, + proc->nr_slot_tx, + &UE->frame_parms, + UE->frame_parms.nb_antennas_tx); + + if (UE->UE_mode[gNB_id] > NOT_SYNCHED && UE->UE_mode[gNB_id] < PUSCH) + nr_ue_prach_procedures(UE, proc, proc->gNB_id); } ue_ta_procedures(UE, proc->nr_slot_tx, proc->frame_tx); @@ -833,6 +829,7 @@ void *UE_thread(void *arg) { openair0_timestamp timestamp, writeTimestamp; void *rxp[NB_ANTENNAS_RX], *txp[NB_ANTENNAS_TX]; int start_rx_stream = 0; + fapi_nr_config_request_t *cfg = &UE->nrUE_config; AssertFatal(0== openair0_device_load(&(UE->rfdevice), &openair0_cfg[0]), ""); UE->rfdevice.host_type = RAU_HOST; UE->lost_sync = 0; @@ -855,7 +852,7 @@ void *UE_thread(void *arg) { int absolute_slot=0, decoded_frame_rx=INT_MAX, trashed_frames=0; for (int i=0; itxFifo); pushNotifiedFIFO_nothreadSafe(&freeBlocks, newElt); @@ -867,7 +864,7 @@ void *UE_thread(void *arg) { nb += abortNotifiedFIFOJob(&nf, RX_JOB_ID); LOG_I(PHY,"Number of aborted slots %d\n",nb); for (int i=0; iis_synchronized = 0; UE->lost_sync = 0; @@ -947,6 +944,8 @@ void *UE_thread(void *arg) { curMsg->proc.nr_slot_tx = (absolute_slot + DURATION_RX_TO_TX) % nb_slot_frame; curMsg->proc.frame_rx = (absolute_slot/nb_slot_frame) % MAX_FRAME_NUMBER; curMsg->proc.frame_tx = ((absolute_slot+DURATION_RX_TO_TX)/nb_slot_frame) % MAX_FRAME_NUMBER; + curMsg->proc.rx_slot_type = nr_ue_slot_select(cfg, curMsg->proc.frame_rx, curMsg->proc.nr_slot_rx); + curMsg->proc.tx_slot_type = nr_ue_slot_select(cfg, curMsg->proc.frame_tx, curMsg->proc.nr_slot_tx); curMsg->proc.decoded_frame_rx=-1; //LOG_I(PHY,"Process slot %d thread Idx %d total gain %d\n", slot_nr, thread_idx, UE->rx_total_gain_dB); diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index 2f1c665e0b..59c18cb17b 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -339,16 +339,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) // init NR modulation lookup tables nr_generate_modulation_table(); - /////////////////////////PUCCH init///////////////////////// - /////////// - for (th_id = 0; th_id < RX_NB_TH_MAX; th_id++) { - for (gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) { - ue->pucch_vars[th_id][gNB_id] = (NR_UE_PUCCH *)malloc16(sizeof(NR_UE_PUCCH)); - for (i=0; i<2; i++) - ue->pucch_vars[th_id][gNB_id]->active[i] = false; - } - } - /////////// //////////////////////////////////////////////////////////////////////////////////////////// @@ -488,10 +478,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) } for (gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) { - for (th_id=0; th_idpdcch_vars[th_id][gNB_id] = (NR_UE_PDCCH *)malloc16_clear(sizeof(NR_UE_PDCCH)); - } - prach_vars[gNB_id] = (NR_UE_PRACH *)malloc16_clear(sizeof(NR_UE_PRACH)); pbch_vars[gNB_id] = (NR_UE_PBCH *)malloc16_clear(sizeof(NR_UE_PBCH)); csiim_vars[gNB_id] = (NR_UE_CSI_IM *)malloc16_clear(sizeof(NR_UE_CSI_IM)); @@ -522,10 +508,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) ue->nr_srs_info = (nr_srs_info_t *)malloc16_clear(sizeof(nr_srs_info_t)); - // RACH - prach_vars[gNB_id]->prachF = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) ); - prach_vars[gNB_id]->prach = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) ); - } ue->sinr_CQI_dB = (double *) malloc16_clear( fp->N_RB_DL*12*sizeof(double) ); @@ -553,12 +535,6 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) const NR_DL_FRAME_PARMS* fp = &ue->frame_parms; phy_term_nr_top(); - for (int th_id = 0; th_id < RX_NB_TH_MAX; th_id++) { - for (int gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) { - free_and_zero(ue->pucch_vars[th_id][gNB_id]); - } - } - for (int slot = 0; slot < fp->slots_per_frame; slot++) { for (int symb = 0; symb < fp->symbols_per_slot; symb++) { for (int q=0; qn_connected_gNB; gNB_id++) { - for (int th_id = 0; th_id < RX_NB_TH_MAX; th_id++) { - free_and_zero(ue->pdcch_vars[th_id][gNB_id]); - } - for (int i=0; inr_csi_info->csi_rs_generated_signal[i]); } @@ -643,9 +615,6 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) free_and_zero(ue->srs_vars[gNB_id]); free_and_zero(ue->pbch_vars[gNB_id]); - - free_and_zero(ue->prach_vars[gNB_id]->prachF); - free_and_zero(ue->prach_vars[gNB_id]->prach); free_and_zero(ue->prach_vars[gNB_id]); } diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c index 8437b8f8f3..f56f01f764 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c @@ -67,7 +67,8 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, int frame, uint8_t uint8_t Mod_id, fd_occasion, preamble_index, restricted_set, not_found; uint16_t rootSequenceIndex, prach_fmt_id, NCS, *prach_root_sequence_map, preamble_offset = 0; uint16_t preamble_shift = 0, preamble_index0, n_shift_ra, n_shift_ra_bar, d_start=INT16_MAX, numshift, N_ZC, u, offset, offset2, first_nonzero_root_idx; - int16_t prach_tmp[(4688+4*24576)*4*2] __attribute__((aligned(32))); + int16_t prach_tmp[(4688+4*24576)*4*2] __attribute__((aligned(32))) = {0}; + int16_t prachF_tmp[(4688+4*24576)*4*2] __attribute__((aligned(32))) = {0}; int16_t Ncp = 0, amp, *prach, *prach2, *prachF, *Xu; int32_t Xu_re, Xu_im; @@ -79,8 +80,8 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, int frame, uint8_t dftlen = 0; first_nonzero_root_idx = 0; prach = prach_tmp; - prachF = ue->prach_vars[gNB_id]->prachF; amp = ue->prach_vars[gNB_id]->amp; + prachF = prachF_tmp; Mod_id = ue->Mod_id; prach_sequence_length = nrUE_config->prach_config.prach_sequence_length; N_ZC = (prach_sequence_length == 0) ? 839:139; diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index b5d1814077..541f2d4718 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -599,8 +599,6 @@ typedef struct { typedef struct { int16_t amp; - int16_t *prachF; - int16_t *prach; fapi_nr_ul_config_prach_pdu prach_pdu; } NR_UE_PRACH; @@ -723,12 +721,10 @@ typedef struct { NR_UE_PDSCH *pdsch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX+1]; // two RxTx Threads NR_UE_PBCH *pbch_vars[NUMBER_OF_CONNECTED_gNB_MAX]; - NR_UE_PDCCH *pdcch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_PRACH *prach_vars[NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_CSI_IM *csiim_vars[NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_CSI_RS *csirs_vars[NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_SRS *srs_vars[NUMBER_OF_CONNECTED_gNB_MAX]; - NR_UE_PUCCH *pucch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_DLSCH_t *dlsch[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX][NR_MAX_NB_LAYERS>4 ? 2:1]; // two RxTx Threads NR_UE_ULSCH_t *ulsch[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_DLSCH_t *dlsch_SI[NUMBER_OF_CONNECTED_gNB_MAX]; @@ -996,6 +992,9 @@ typedef struct { void* scopeData; } PHY_VARS_NR_UE; +typedef struct nr_phy_data_s { + NR_UE_PUCCH pucch_vars; +} nr_phy_data_t; /* this structure is used to pass both UE phy vars and * proc to the function UE_thread_rxn_txnp4 */ diff --git a/openair1/PHY/thread_NR_UE.h b/openair1/PHY/thread_NR_UE.h index 8fbcc75083..77986f3c75 100644 --- a/openair1/PHY/thread_NR_UE.h +++ b/openair1/PHY/thread_NR_UE.h @@ -11,10 +11,13 @@ typedef struct { /// timestamp transmitted to HW openair0_timestamp timestamp_tx; //#ifdef UE_NR_PHY_DEMO + int gNB_id; /// NR slot index within frame_tx [0 .. slots_per_frame - 1] to act upon for transmission int nr_slot_tx; + int rx_slot_type; /// NR slot index within frame_rx [0 .. slots_per_frame - 1] to act upon for transmission int nr_slot_rx; + int tx_slot_type; //#endif /// frame to act upon for transmission int frame_tx; diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index f4c863bb40..0acd33edd3 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -359,7 +359,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ thread_id = scheduled_response->thread_id; NR_UE_DLSCH_t *dlsch0 = NULL; NR_UE_ULSCH_t *ulsch = PHY_vars_UE_g[module_id][cc_id]->ulsch[thread_id][0]; - NR_UE_PUCCH *pucch_vars = PHY_vars_UE_g[module_id][cc_id]->pucch_vars[thread_id][0]; + NR_UE_PUCCH *pucch_vars = &((nr_phy_data_t *)scheduled_response->phy_data)->pucch_vars; NR_UE_CSI_IM *csiim_vars = PHY_vars_UE_g[module_id][cc_id]->csiim_vars[0]; NR_UE_CSI_RS *csirs_vars = PHY_vars_UE_g[module_id][cc_id]->csirs_vars[0]; NR_UE_PDCCH_CONFIG *phy_pdcch_config = NULL; diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 366ab0ee77..6db9f38714 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -307,11 +307,10 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, if (ue->UE_mode[gNB_id] == PUSCH) { ue_srs_procedures_nr(ue, proc, gNB_id); } + LOG_D(PHY,"****** end TX-Chain for AbsSubframe %d.%d ******\n", proc->frame_tx, proc->nr_slot_tx); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX, VCD_FUNCTION_OUT); stop_meas(&ue->phy_proc_tx); - - } void nr_ue_measurement_procedures(uint16_t l, @@ -545,7 +544,6 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id, dci_ind->dci_list[i].rnti, dci_ind->dci_list[i].dci_format); } - ue->pdcch_vars[proc->thread_id][gNB_id]->dci_received += dci_cnt; dci_ind->number_of_dcis = dci_cnt; @@ -760,16 +758,6 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, if (frame_rx < *dlsch_errors) *dlsch_errors=0; - if (pdsch == RA_PDSCH) { - if (ue->prach_resources[gNB_id]!=NULL) - dlsch0->rnti = ue->prach_resources[gNB_id]->ra_RNTI; - else { - LOG_E(PHY,"[UE %d] Frame %d, nr_slot_rx %d: FATAL, prach_resources is NULL\n", ue->Mod_id, frame_rx, nr_slot_rx); - //mac_xface->macphy_exit("prach_resources is NULL"); - return false; - } - } - // exit dlsch procedures as there are no active dlsch if (is_cw0_active != ACTIVE && is_cw1_active != ACTIVE) return false; @@ -1533,7 +1521,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, nr_rxtx_thread_data_t *curMsg=(nr_rxtx_thread_data_t *)NotifiedFifoData(newElt); curMsg->proc = *proc; curMsg->UE = ue; - curMsg->ue_sched_mode = ONLY_PUSCH; + curMsg->ue_sched_mode = SCHED_PUSCH; pushTpool(&(get_nrUE_params()->Tpool), newElt); start_meas(&ue->generic_stat); // do procedures for C-RNTI diff --git a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c index 77ac105e14..4e1f8a338a 100644 --- a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c +++ b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c @@ -203,11 +203,12 @@ void nr_generate_pucch3_4(int32_t **txdataF, void pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, - UE_nr_rxtx_proc_t *proc) { + UE_nr_rxtx_proc_t *proc, + nr_phy_data_t *phy_data) { int nr_slot_tx = proc->nr_slot_tx; fapi_nr_ul_config_pucch_pdu *pucch_pdu; - NR_UE_PUCCH *pucch_vars = ue->pucch_vars[proc->thread_id][gNB_id]; + NR_UE_PUCCH *pucch_vars = &phy_data->pucch_vars; for (int i=0; i<2; i++) { if(pucch_vars->active[i]) { diff --git a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.h b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.h index 37e24f43bc..1ff1b7cc5c 100644 --- a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.h +++ b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.h @@ -61,7 +61,8 @@ void pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, - UE_nr_rxtx_proc_t *proc); + UE_nr_rxtx_proc_t *proc, + nr_phy_data_t *phy_data); void set_csi_nr(int csi_status, uint32_t csi_payload); diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index 161799fb66..ffa8c6f5c1 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -357,7 +357,7 @@ and fills the PRACH PDU per each FD occasion. @returns void */ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, int thread_id); -void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, int thread_id); +void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, int thread_id, void *phy_data); void nr_schedule_csirs_reception(NR_UE_MAC_INST_t *mac, int frame, int slot); void nr_schedule_csi_for_im(NR_UE_MAC_INST_t *mac, int frame, int slot); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index aee3e369cc..cab9f92a8d 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -2318,7 +2318,7 @@ void build_ssb_to_ro_map(NR_UE_MAC_INST_t *mac) { } -void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, int thread_id) { +void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, int thread_id, void *phy_data) { NR_UE_MAC_INST_t *mac = get_mac_inst(module_idP); int O_SR = 0; @@ -2410,7 +2410,7 @@ void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, in O_SR, O_ACK, O_CSI); LOG_D(NR_MAC, "Configuring pucch, is_common = %d\n", pucch.is_common); nr_scheduled_response_t scheduled_response; - fill_scheduled_response(&scheduled_response, NULL, ul_config, NULL, module_idP, 0 /*TBR fix*/, frameP, slotP, thread_id, NULL); + fill_scheduled_response(&scheduled_response, NULL, ul_config, NULL, module_idP, 0 /*TBR fix*/, frameP, slotP, thread_id, phy_data); if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL) mac->if_module->scheduled_response(&scheduled_response); } diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index f74f213cf0..3ef02dd4c3 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -762,7 +762,7 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request, 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; - ul_info.ue_sched_mode = SCHED_ALL; + ul_info.ue_sched_mode = SCHED_PUSCH; if (mac->scc || mac->scc_SIB) { if (is_nr_UL_slot(mac->scc ? @@ -1129,24 +1129,24 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){ module_id_t module_id = ul_info->module_id; NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); - if (ul_info->ue_sched_mode == ONLY_PUSCH) { - ret = nr_ue_scheduler(NULL, ul_info); - return 0; - } - if (ul_info->ue_sched_mode == SCHED_ALL) { - ret = nr_ue_scheduler(NULL, ul_info); - } - else - LOG_T(NR_MAC, "In %s():%d not calling scheduler. sched mode = %d and mac->ra.ra_state = %d\n", - __FUNCTION__, __LINE__, ul_info->ue_sched_mode, mac->ra.ra_state); - NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon = mac->scc != NULL ? mac->scc->tdd_UL_DL_ConfigurationCommon : mac->scc_SIB->tdd_UL_DL_ConfigurationCommon; - if (is_nr_UL_slot(tdd_UL_DL_ConfigurationCommon, ul_info->slot_tx, mac->frame_type) && !get_softmodem_params()->phy_test) - nr_ue_prach_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx, ul_info->thread_id); + switch (ul_info->ue_sched_mode) { + case SCHED_PUSCH: + ret = nr_ue_scheduler(NULL, ul_info); + if (is_nr_UL_slot(tdd_UL_DL_ConfigurationCommon, ul_info->slot_tx, mac->frame_type) && !get_softmodem_params()->phy_test) + nr_ue_prach_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx, ul_info->thread_id); + LOG_T(NR_MAC, "In %s():%d not calling scheduler. sched mode = %d and mac->ra.ra_state = %d\n", + __FUNCTION__, __LINE__, ul_info->ue_sched_mode, mac->ra.ra_state); + break; - if (is_nr_UL_slot(tdd_UL_DL_ConfigurationCommon, ul_info->slot_tx, mac->frame_type)) - nr_ue_pucch_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx, ul_info->thread_id); + case SCHED_PUCCH: + if (is_nr_UL_slot(tdd_UL_DL_ConfigurationCommon, ul_info->slot_tx, mac->frame_type)) + nr_ue_pucch_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx, ul_info->thread_id, ul_info->phy_data); + LOG_T(NR_MAC, "In %s():%d not calling scheduler. sched mode = %d and mac->ra.ra_state = %d\n", + __FUNCTION__, __LINE__, ul_info->ue_sched_mode, mac->ra.ra_state); + break; + } switch(ret){ case UE_CONNECTION_OK: diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h index 65bbf9a5a0..e870a48388 100755 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h @@ -47,9 +47,8 @@ extern slot_rnti_mcs_s slot_rnti_mcs[NUM_NFAPI_SLOT]; typedef struct NR_UL_TIME_ALIGNMENT NR_UL_TIME_ALIGNMENT_t; typedef enum { - ONLY_PUSCH, - NOT_PUSCH, - SCHED_ALL, + SCHED_PUSCH, + SCHED_PUCCH, } NR_UE_SCHED_MODE_t; typedef struct { @@ -118,6 +117,7 @@ typedef struct { fapi_nr_dci_indication_t *dci_ind; NR_UE_SCHED_MODE_t ue_sched_mode; + void *phy_data; } nr_uplink_indication_t;