Commit 7d2281c0 authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/ue-remove-global-vars' into integration_2022_wk40

parents ee2b9a32 c6fd2419
...@@ -327,7 +327,7 @@ static void check_nr_prach(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_inf ...@@ -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); L1_nsa_prach_procedures(ul_info->frame_tx, ul_info->slot_tx, prach_pdu);
ul_config->number_pdus = 0; ul_config->number_pdus = 0;
ul_info->ue_sched_mode = SCHED_ALL; ul_info->ue_sched_mode = SCHED_PUSCH;
} }
else if (nr_prach == 2) else if (nr_prach == 2)
{ {
...@@ -427,7 +427,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) ...@@ -427,7 +427,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
ul_info.slot_rx = slot; ul_info.slot_rx = slot;
ul_info.slot_tx = (slot + slot_ahead) % slots_per_frame; 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.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(); if (pthread_mutex_lock(&mac->mutex_dl_info)) abort();
...@@ -459,7 +459,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) ...@@ -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__); 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_scheduler(NULL, &ul_info);
nr_ue_prach_scheduler(mod_id, ul_info.frame_tx, ul_info.slot_tx, ul_info.thread_id); 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); check_nr_prach(mac, &ul_info, &prach_resources);
} }
if (!IS_SOFTMODEM_NOS1 && get_softmodem_params()->sa) { if (!IS_SOFTMODEM_NOS1 && get_softmodem_params()->sa) {
...@@ -611,12 +611,9 @@ void processSlotTX(void *arg) { ...@@ -611,12 +611,9 @@ void processSlotTX(void *arg) {
nr_rxtx_thread_data_t *rxtxD = (nr_rxtx_thread_data_t *) arg; nr_rxtx_thread_data_t *rxtxD = (nr_rxtx_thread_data_t *) arg;
UE_nr_rxtx_proc_t *proc = &rxtxD->proc; UE_nr_rxtx_proc_t *proc = &rxtxD->proc;
PHY_VARS_NR_UE *UE = rxtxD->UE; 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); LOG_D(PHY,"%d.%d => slot type %d\n", proc->frame_tx, proc->nr_slot_tx, proc->tx_slot_type);
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){
// trigger L2 to run ue_scheduler thru IF module // trigger L2 to run ue_scheduler thru IF module
// [TODO] mapping right after NR initial sync // [TODO] mapping right after NR initial sync
...@@ -626,7 +623,7 @@ void processSlotTX(void *arg) { ...@@ -626,7 +623,7 @@ void processSlotTX(void *arg) {
memset((void*)&ul_indication, 0, sizeof(ul_indication)); memset((void*)&ul_indication, 0, sizeof(ul_indication));
ul_indication.module_id = UE->Mod_id; 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.cc_id = UE->CC_id;
ul_indication.frame_rx = proc->frame_rx; ul_indication.frame_rx = proc->frame_rx;
ul_indication.slot_rx = proc->nr_slot_rx; ul_indication.slot_rx = proc->nr_slot_rx;
...@@ -639,20 +636,15 @@ void processSlotTX(void *arg) { ...@@ -639,20 +636,15 @@ void processSlotTX(void *arg) {
stop_meas(&UE->ue_ul_indication_stats); stop_meas(&UE->ue_ul_indication_stats);
} }
if (rxtxD->ue_sched_mode != NOT_PUSCH) { phy_procedures_nrUE_TX(UE,proc,proc->gNB_id);
phy_procedures_nrUE_TX(UE,proc,0);
}
} }
} }
void processSlotRX(void *arg) { void UE_processing(void *arg) {
nr_rxtx_thread_data_t *rxtxD = (nr_rxtx_thread_data_t *) arg; nr_rxtx_thread_data_t *rxtxD = (nr_rxtx_thread_data_t *) arg;
UE_nr_rxtx_proc_t *proc = &rxtxD->proc; UE_nr_rxtx_proc_t *proc = &rxtxD->proc;
PHY_VARS_NR_UE *UE = rxtxD->UE; 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; uint8_t gNB_id = 0;
NR_UE_PDCCH_CONFIG phy_pdcch_config={0}; NR_UE_PDCCH_CONFIG phy_pdcch_config={0};
...@@ -666,7 +658,7 @@ void processSlotRX(void *arg) { ...@@ -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) { if(UE->if_inst != NULL && UE->if_inst->dl_indication != NULL) {
nr_downlink_indication_t dl_indication; nr_downlink_indication_t dl_indication;
...@@ -696,35 +688,39 @@ void processSlotRX(void *arg) { ...@@ -696,35 +688,39 @@ void processSlotRX(void *arg) {
if (res == NULL) if (res == NULL)
return; // Tpool has been stopped return; // Tpool has been stopped
delNotifiedFIFO_elt(res); 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 (UE->UE_mode[gNB_id] <= PUSCH) {
if (get_softmodem_params()->usim_test==0) { pucch_procedures_ue_nr(UE,
pucch_procedures_ue_nr(UE, gNB_id,
gNB_id, proc,
proc); &phy_data);
}
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) { LOG_D(PHY, "Sending Uplink data \n");
nr_ue_prach_procedures(UE, proc, gNB_id); nr_ue_pusch_common_procedures(UE,
} proc->nr_slot_tx,
LOG_D(PHY,"****** end TX-Chain for AbsSubframe %d.%d ******\n", proc->frame_tx, 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); ue_ta_procedures(UE, proc->nr_slot_tx, proc->frame_tx);
...@@ -833,6 +829,7 @@ void *UE_thread(void *arg) { ...@@ -833,6 +829,7 @@ void *UE_thread(void *arg) {
openair0_timestamp timestamp, writeTimestamp; openair0_timestamp timestamp, writeTimestamp;
void *rxp[NB_ANTENNAS_RX], *txp[NB_ANTENNAS_TX]; void *rxp[NB_ANTENNAS_RX], *txp[NB_ANTENNAS_TX];
int start_rx_stream = 0; int start_rx_stream = 0;
fapi_nr_config_request_t *cfg = &UE->nrUE_config;
AssertFatal(0== openair0_device_load(&(UE->rfdevice), &openair0_cfg[0]), ""); AssertFatal(0== openair0_device_load(&(UE->rfdevice), &openair0_cfg[0]), "");
UE->rfdevice.host_type = RAU_HOST; UE->rfdevice.host_type = RAU_HOST;
UE->lost_sync = 0; UE->lost_sync = 0;
...@@ -855,7 +852,7 @@ void *UE_thread(void *arg) { ...@@ -855,7 +852,7 @@ void *UE_thread(void *arg) {
int absolute_slot=0, decoded_frame_rx=INT_MAX, trashed_frames=0; int absolute_slot=0, decoded_frame_rx=INT_MAX, trashed_frames=0;
for (int i=0; i<NR_RX_NB_TH+1; i++) {// NR_RX_NB_TH working + 1 we are making to be pushed for (int i=0; i<NR_RX_NB_TH+1; i++) {// NR_RX_NB_TH working + 1 we are making to be pushed
notifiedFIFO_elt_t *newElt = newNotifiedFIFO_elt(sizeof(nr_rxtx_thread_data_t), RX_JOB_ID,&nf,processSlotRX); notifiedFIFO_elt_t *newElt = newNotifiedFIFO_elt(sizeof(nr_rxtx_thread_data_t), RX_JOB_ID,&nf,UE_processing);
nr_rxtx_thread_data_t *curMsg=(nr_rxtx_thread_data_t *)NotifiedFifoData(newElt); nr_rxtx_thread_data_t *curMsg=(nr_rxtx_thread_data_t *)NotifiedFifoData(newElt);
initNotifiedFIFO(&curMsg->txFifo); initNotifiedFIFO(&curMsg->txFifo);
pushNotifiedFIFO_nothreadSafe(&freeBlocks, newElt); pushNotifiedFIFO_nothreadSafe(&freeBlocks, newElt);
...@@ -867,7 +864,7 @@ void *UE_thread(void *arg) { ...@@ -867,7 +864,7 @@ void *UE_thread(void *arg) {
nb += abortNotifiedFIFOJob(&nf, RX_JOB_ID); nb += abortNotifiedFIFOJob(&nf, RX_JOB_ID);
LOG_I(PHY,"Number of aborted slots %d\n",nb); LOG_I(PHY,"Number of aborted slots %d\n",nb);
for (int i=0; i<nb; i++) for (int i=0; i<nb; i++)
pushNotifiedFIFO_nothreadSafe(&freeBlocks, newNotifiedFIFO_elt(sizeof(nr_rxtx_thread_data_t), RX_JOB_ID,&nf,processSlotRX)); pushNotifiedFIFO_nothreadSafe(&freeBlocks, newNotifiedFIFO_elt(sizeof(nr_rxtx_thread_data_t), RX_JOB_ID,&nf,UE_processing));
nbSlotProcessing = 0; nbSlotProcessing = 0;
UE->is_synchronized = 0; UE->is_synchronized = 0;
UE->lost_sync = 0; UE->lost_sync = 0;
...@@ -947,6 +944,8 @@ void *UE_thread(void *arg) { ...@@ -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.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_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.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; 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); //LOG_I(PHY,"Process slot %d thread Idx %d total gain %d\n", slot_nr, thread_idx, UE->rx_total_gain_dB);
......
...@@ -339,16 +339,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) ...@@ -339,16 +339,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
// init NR modulation lookup tables // init NR modulation lookup tables
nr_generate_modulation_table(); 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) ...@@ -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 (gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) {
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
ue->pdcch_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)); 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)); 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)); 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) ...@@ -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)); 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) ); 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) ...@@ -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; const NR_DL_FRAME_PARMS* fp = &ue->frame_parms;
phy_term_nr_top(); 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 slot = 0; slot < fp->slots_per_frame; slot++) {
for (int symb = 0; symb < fp->symbols_per_slot; symb++) { for (int symb = 0; symb < fp->symbols_per_slot; symb++) {
for (int q=0; q<NR_NB_NSCID; q++) for (int q=0; q<NR_NB_NSCID; q++)
...@@ -619,10 +595,6 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) ...@@ -619,10 +595,6 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
for (int gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) { for (int gNB_id = 0; gNB_id < ue->n_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; i<NR_MAX_NB_PORTS; i++) { for (int i=0; i<NR_MAX_NB_PORTS; i++) {
free_and_zero(ue->nr_csi_info->csi_rs_generated_signal[i]); free_and_zero(ue->nr_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) ...@@ -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->srs_vars[gNB_id]);
free_and_zero(ue->pbch_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]); free_and_zero(ue->prach_vars[gNB_id]);
} }
......
...@@ -67,7 +67,8 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, int frame, uint8_t ...@@ -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; 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 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; 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; int16_t Ncp = 0, amp, *prach, *prach2, *prachF, *Xu;
int32_t Xu_re, Xu_im; 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 ...@@ -79,8 +80,8 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, int frame, uint8_t
dftlen = 0; dftlen = 0;
first_nonzero_root_idx = 0; first_nonzero_root_idx = 0;
prach = prach_tmp; prach = prach_tmp;
prachF = ue->prach_vars[gNB_id]->prachF;
amp = ue->prach_vars[gNB_id]->amp; amp = ue->prach_vars[gNB_id]->amp;
prachF = prachF_tmp;
Mod_id = ue->Mod_id; Mod_id = ue->Mod_id;
prach_sequence_length = nrUE_config->prach_config.prach_sequence_length; prach_sequence_length = nrUE_config->prach_config.prach_sequence_length;
N_ZC = (prach_sequence_length == 0) ? 839:139; N_ZC = (prach_sequence_length == 0) ? 839:139;
......
...@@ -599,8 +599,6 @@ typedef struct { ...@@ -599,8 +599,6 @@ typedef struct {
typedef struct { typedef struct {
int16_t amp; int16_t amp;
int16_t *prachF;
int16_t *prach;
fapi_nr_ul_config_prach_pdu prach_pdu; fapi_nr_ul_config_prach_pdu prach_pdu;
} NR_UE_PRACH; } NR_UE_PRACH;
...@@ -723,12 +721,10 @@ typedef struct { ...@@ -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_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_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_PRACH *prach_vars[NUMBER_OF_CONNECTED_gNB_MAX];
NR_UE_CSI_IM *csiim_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_CSI_RS *csirs_vars[NUMBER_OF_CONNECTED_gNB_MAX];
NR_UE_SRS *srs_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_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_ULSCH_t *ulsch[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX];
NR_UE_DLSCH_t *dlsch_SI[NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_DLSCH_t *dlsch_SI[NUMBER_OF_CONNECTED_gNB_MAX];
...@@ -996,6 +992,9 @@ typedef struct { ...@@ -996,6 +992,9 @@ typedef struct {
void* scopeData; void* scopeData;
} PHY_VARS_NR_UE; } 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 /* this structure is used to pass both UE phy vars and
* proc to the function UE_thread_rxn_txnp4 * proc to the function UE_thread_rxn_txnp4
*/ */
......
...@@ -11,10 +11,13 @@ typedef struct { ...@@ -11,10 +11,13 @@ typedef struct {
/// timestamp transmitted to HW /// timestamp transmitted to HW
openair0_timestamp timestamp_tx; openair0_timestamp timestamp_tx;
//#ifdef UE_NR_PHY_DEMO //#ifdef UE_NR_PHY_DEMO
int gNB_id;
/// NR slot index within frame_tx [0 .. slots_per_frame - 1] to act upon for transmission /// NR slot index within frame_tx [0 .. slots_per_frame - 1] to act upon for transmission
int nr_slot_tx; int nr_slot_tx;
int rx_slot_type;
/// NR slot index within frame_rx [0 .. slots_per_frame - 1] to act upon for transmission /// NR slot index within frame_rx [0 .. slots_per_frame - 1] to act upon for transmission
int nr_slot_rx; int nr_slot_rx;
int tx_slot_type;
//#endif //#endif
/// frame to act upon for transmission /// frame to act upon for transmission
int frame_tx; int frame_tx;
......
...@@ -359,7 +359,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ ...@@ -359,7 +359,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
thread_id = scheduled_response->thread_id; thread_id = scheduled_response->thread_id;
NR_UE_DLSCH_t *dlsch0 = NULL; 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_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_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_CSI_RS *csirs_vars = PHY_vars_UE_g[module_id][cc_id]->csirs_vars[0];
NR_UE_PDCCH_CONFIG *phy_pdcch_config = NULL; NR_UE_PDCCH_CONFIG *phy_pdcch_config = NULL;
......
...@@ -307,11 +307,10 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, ...@@ -307,11 +307,10 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
if (ue->UE_mode[gNB_id] == PUSCH) { if (ue->UE_mode[gNB_id] == PUSCH) {
ue_srs_procedures_nr(ue, proc, gNB_id); 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); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX, VCD_FUNCTION_OUT);
stop_meas(&ue->phy_proc_tx); stop_meas(&ue->phy_proc_tx);
} }
void nr_ue_measurement_procedures(uint16_t l, void nr_ue_measurement_procedures(uint16_t l,
...@@ -545,7 +544,6 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id, ...@@ -545,7 +544,6 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id,
dci_ind->dci_list[i].rnti, dci_ind->dci_list[i].rnti,
dci_ind->dci_list[i].dci_format); 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; dci_ind->number_of_dcis = dci_cnt;
...@@ -760,16 +758,6 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, ...@@ -760,16 +758,6 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
if (frame_rx < *dlsch_errors) if (frame_rx < *dlsch_errors)
*dlsch_errors=0; *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 // exit dlsch procedures as there are no active dlsch
if (is_cw0_active != ACTIVE && is_cw1_active != ACTIVE) if (is_cw0_active != ACTIVE && is_cw1_active != ACTIVE)
return false; return false;
...@@ -1533,7 +1521,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ...@@ -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); nr_rxtx_thread_data_t *curMsg=(nr_rxtx_thread_data_t *)NotifiedFifoData(newElt);
curMsg->proc = *proc; curMsg->proc = *proc;
curMsg->UE = ue; curMsg->UE = ue;
curMsg->ue_sched_mode = ONLY_PUSCH; curMsg->ue_sched_mode = SCHED_PUSCH;
pushTpool(&(get_nrUE_params()->Tpool), newElt); pushTpool(&(get_nrUE_params()->Tpool), newElt);
start_meas(&ue->generic_stat); start_meas(&ue->generic_stat);
// do procedures for C-RNTI // do procedures for C-RNTI
......
...@@ -203,11 +203,12 @@ void nr_generate_pucch3_4(int32_t **txdataF, ...@@ -203,11 +203,12 @@ void nr_generate_pucch3_4(int32_t **txdataF,
void pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, void pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue,
uint8_t gNB_id, 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; int nr_slot_tx = proc->nr_slot_tx;
fapi_nr_ul_config_pucch_pdu *pucch_pdu; 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++) { for (int i=0; i<2; i++) {
if(pucch_vars->active[i]) { if(pucch_vars->active[i]) {
......
...@@ -61,7 +61,8 @@ ...@@ -61,7 +61,8 @@
void pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, void pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue,
uint8_t gNB_id, 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); void set_csi_nr(int csi_status, uint32_t csi_payload);
......
...@@ -357,7 +357,7 @@ and fills the PRACH PDU per each FD occasion. ...@@ -357,7 +357,7 @@ and fills the PRACH PDU per each FD occasion.
@returns void @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_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_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); void nr_schedule_csi_for_im(NR_UE_MAC_INST_t *mac, int frame, int slot);
......
...@@ -2318,7 +2318,7 @@ void build_ssb_to_ro_map(NR_UE_MAC_INST_t *mac) { ...@@ -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); NR_UE_MAC_INST_t *mac = get_mac_inst(module_idP);
int O_SR = 0; int O_SR = 0;
...@@ -2410,7 +2410,7 @@ void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, in ...@@ -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); O_SR, O_ACK, O_CSI);
LOG_D(NR_MAC, "Configuring pucch, is_common = %d\n", pucch.is_common); LOG_D(NR_MAC, "Configuring pucch, is_common = %d\n", pucch.is_common);
nr_scheduled_response_t scheduled_response; 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) if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL)
mac->if_module->scheduled_response(&scheduled_response); mac->if_module->scheduled_response(&scheduled_response);
} }
......
...@@ -762,7 +762,7 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request, ...@@ -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_rx = slot;
ul_info.slot_tx = (slot + slot_ahead) % slots_per_frame; 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.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 (mac->scc || mac->scc_SIB)
{ {
if (is_nr_UL_slot(mac->scc ? if (is_nr_UL_slot(mac->scc ?
...@@ -1129,24 +1129,24 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){ ...@@ -1129,24 +1129,24 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){
module_id_t module_id = ul_info->module_id; module_id_t module_id = ul_info->module_id;
NR_UE_MAC_INST_t *mac = get_mac_inst(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; 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) switch (ul_info->ue_sched_mode) {
nr_ue_prach_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx, ul_info->thread_id); 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)) if (is_nr_UL_slot(tdd_UL_DL_ConfigurationCommon, ul_info->slot_tx, mac->frame_type) && !get_softmodem_params()->phy_test)
nr_ue_pucch_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx, ul_info->thread_id); 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;
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){ switch(ret){
case UE_CONNECTION_OK: case UE_CONNECTION_OK:
......
...@@ -47,9 +47,8 @@ extern slot_rnti_mcs_s slot_rnti_mcs[NUM_NFAPI_SLOT]; ...@@ -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 struct NR_UL_TIME_ALIGNMENT NR_UL_TIME_ALIGNMENT_t;
typedef enum { typedef enum {
ONLY_PUSCH, SCHED_PUSCH,
NOT_PUSCH, SCHED_PUCCH,
SCHED_ALL,
} NR_UE_SCHED_MODE_t; } NR_UE_SCHED_MODE_t;
typedef struct { typedef struct {
...@@ -118,6 +117,7 @@ typedef struct { ...@@ -118,6 +117,7 @@ typedef struct {
fapi_nr_dci_indication_t *dci_ind; fapi_nr_dci_indication_t *dci_ind;
NR_UE_SCHED_MODE_t ue_sched_mode; NR_UE_SCHED_MODE_t ue_sched_mode;
void *phy_data;
} nr_uplink_indication_t; } nr_uplink_indication_t;
......
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