Commit e640af84 authored by Francesco Mani's avatar Francesco Mani

UE PHY parameters configured from fapi config req (UE is running, to be verified with gNB)

parent 2c108cf8
...@@ -1808,19 +1808,19 @@ int check_capabilities(RU_t *ru,RRU_capabilities_t *cap) ...@@ -1808,19 +1808,19 @@ int check_capabilities(RU_t *ru,RRU_capabilities_t *cap)
FH_fmt_options_t fmt = cap->FH_fmt; FH_fmt_options_t fmt = cap->FH_fmt;
int i; int i;
int found_band=0; int found_band=0;
LOG_I(PHY,"RRU %d, num_bands %d, looking for band %d\n",ru->idx,cap->num_bands,ru->nr_frame_parms->eutra_band); LOG_I(PHY,"RRU %d, num_bands %d, looking for band %d\n",ru->idx,cap->num_bands,ru->nr_frame_parms->nr_band);
for (i=0; i<cap->num_bands; i++) { for (i=0; i<cap->num_bands; i++) {
LOG_I(PHY,"band %d on RRU %d\n",cap->band_list[i],ru->idx); LOG_I(PHY,"band %d on RRU %d\n",cap->band_list[i],ru->idx);
if (ru->nr_frame_parms->eutra_band == cap->band_list[i]) { if (ru->nr_frame_parms->nr_band == cap->band_list[i]) {
found_band=1; found_band=1;
break; break;
} }
} }
if (found_band == 0) { if (found_band == 0) {
LOG_I(PHY,"Couldn't find target EUTRA band %d on RRU %d\n",ru->nr_frame_parms->eutra_band,ru->idx); LOG_I(PHY,"Couldn't find target NR band %d on RRU %d\n",ru->nr_frame_parms->nr_band,ru->idx);
return(-1); return(-1);
} }
...@@ -1877,11 +1877,11 @@ void configure_ru(int idx, ...@@ -1877,11 +1877,11 @@ void configure_ru(int idx,
ru->nb_tx = capabilities->nb_tx[0]; ru->nb_tx = capabilities->nb_tx[0];
ru->nb_rx = capabilities->nb_rx[0]; ru->nb_rx = capabilities->nb_rx[0];
// Pass configuration to RRU // Pass configuration to RRU
LOG_I(PHY, "Using %s fronthaul (%d), band %d \n",ru_if_formats[ru->if_south],ru->if_south,ru->nr_frame_parms->eutra_band); LOG_I(PHY, "Using %s fronthaul (%d), band %d \n",ru_if_formats[ru->if_south],ru->if_south,ru->nr_frame_parms->nr_band);
// wait for configuration // wait for configuration
config->FH_fmt = ru->if_south; config->FH_fmt = ru->if_south;
config->num_bands = 1; config->num_bands = 1;
config->band_list[0] = ru->nr_frame_parms->eutra_band; config->band_list[0] = ru->nr_frame_parms->nr_band;
config->tx_freq[0] = ru->nr_frame_parms->dl_CarrierFreq; config->tx_freq[0] = ru->nr_frame_parms->dl_CarrierFreq;
config->rx_freq[0] = ru->nr_frame_parms->ul_CarrierFreq; config->rx_freq[0] = ru->nr_frame_parms->ul_CarrierFreq;
//config->tdd_config[0] = ru->nr_frame_parms->tdd_config; //config->tdd_config[0] = ru->nr_frame_parms->tdd_config;
...@@ -1905,7 +1905,7 @@ void configure_rru(int idx, ...@@ -1905,7 +1905,7 @@ void configure_rru(int idx,
RRU_config_t *config = (RRU_config_t *)arg; RRU_config_t *config = (RRU_config_t *)arg;
RU_t *ru = RC.ru[idx]; RU_t *ru = RC.ru[idx];
nfapi_nr_config_request_scf_t *gNB_config = &ru->gNB_list[0]->gNB_config; nfapi_nr_config_request_scf_t *gNB_config = &ru->gNB_list[0]->gNB_config;
ru->nr_frame_parms->eutra_band = config->band_list[0]; ru->nr_frame_parms->nr_band = config->band_list[0];
ru->nr_frame_parms->dl_CarrierFreq = config->tx_freq[0]; ru->nr_frame_parms->dl_CarrierFreq = config->tx_freq[0];
ru->nr_frame_parms->ul_CarrierFreq = config->rx_freq[0]; ru->nr_frame_parms->ul_CarrierFreq = config->rx_freq[0];
......
...@@ -547,7 +547,7 @@ void set_default_frame_parms(nfapi_nr_config_request_scf_t *config[MAX_NUM_CCs], ...@@ -547,7 +547,7 @@ void set_default_frame_parms(nfapi_nr_config_request_scf_t *config[MAX_NUM_CCs],
frame_parms[CC_id]->Ncp_UL = NORMAL; frame_parms[CC_id]->Ncp_UL = NORMAL;
frame_parms[CC_id]->Nid_cell = 0; frame_parms[CC_id]->Nid_cell = 0;
frame_parms[CC_id]->num_MBSFN_config = 0; frame_parms[CC_id]->num_MBSFN_config = 0;
frame_parms[CC_id]->nb_antenna_ports_eNB = 1; frame_parms[CC_id]->nb_antenna_ports_gNB = 1;
frame_parms[CC_id]->nb_antennas_tx = 1; frame_parms[CC_id]->nb_antennas_tx = 1;
frame_parms[CC_id]->nb_antennas_rx = 1; frame_parms[CC_id]->nb_antennas_rx = 1;
......
...@@ -133,14 +133,12 @@ typedef enum { ...@@ -133,14 +133,12 @@ typedef enum {
} sync_mode_t; } sync_mode_t;
PHY_VARS_NR_UE *init_nr_ue_vars(NR_DL_FRAME_PARMS *frame_parms, void init_nr_ue_vars(PHY_VARS_NR_UE *ue,
NR_DL_FRAME_PARMS *frame_parms,
uint8_t UE_id, uint8_t UE_id,
uint8_t abstraction_flag) uint8_t abstraction_flag)
{ {
PHY_VARS_NR_UE *ue;
ue = (PHY_VARS_NR_UE *)malloc(sizeof(PHY_VARS_NR_UE));
memset(ue,0,sizeof(PHY_VARS_NR_UE));
memcpy(&(ue->frame_parms), frame_parms, sizeof(NR_DL_FRAME_PARMS)); memcpy(&(ue->frame_parms), frame_parms, sizeof(NR_DL_FRAME_PARMS));
ue->Mod_id = UE_id; ue->Mod_id = UE_id;
...@@ -150,7 +148,6 @@ PHY_VARS_NR_UE *init_nr_ue_vars(NR_DL_FRAME_PARMS *frame_parms, ...@@ -150,7 +148,6 @@ PHY_VARS_NR_UE *init_nr_ue_vars(NR_DL_FRAME_PARMS *frame_parms,
init_nr_ue_signal(ue,1,abstraction_flag); init_nr_ue_signal(ue,1,abstraction_flag);
// intialize transport // intialize transport
init_nr_ue_transport(ue,abstraction_flag); init_nr_ue_transport(ue,abstraction_flag);
return(ue);
} }
/*! /*!
...@@ -172,22 +169,20 @@ static void UE_synch(void *arg) { ...@@ -172,22 +169,20 @@ static void UE_synch(void *arg) {
int freq_offset=0; int freq_offset=0;
UE->is_synchronized = 0; UE->is_synchronized = 0;
if (UE->UE_scan == 0) { if (UE->UE_scan == 0) {
get_band(downlink_frequency[CC_id][0], &UE->frame_parms.eutra_band, &uplink_frequency_offset[CC_id][0], &UE->frame_parms.frame_type);
LOG_I( PHY, "[SCHED][UE] Check absolute frequency DL %"PRIu32", UL %"PRIu32" (oai_exit %d, rx_num_channels %d)\n", LOG_I( PHY, "[SCHED][UE] Check absolute frequency DL %"PRIu64", UL %"PRIu64" (oai_exit %d, rx_num_channels %d)\n",
downlink_frequency[0][0], downlink_frequency[0][0]+uplink_frequency_offset[0][0], UE->frame_parms.dl_CarrierFreq, UE->frame_parms.ul_CarrierFreq,
oai_exit, openair0_cfg[0].rx_num_channels); oai_exit, openair0_cfg[0].rx_num_channels);
for (i=0; i<openair0_cfg[UE->rf_map.card].rx_num_channels; i++) { for (i=0; i<openair0_cfg[UE->rf_map.card].rx_num_channels; i++) {
openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i] = downlink_frequency[CC_id][i]; openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i] = UE->frame_parms.dl_CarrierFreq;
openair0_cfg[UE->rf_map.card].tx_freq[UE->rf_map.chain+i] = openair0_cfg[UE->rf_map.card].tx_freq[UE->rf_map.chain+i] = UE->frame_parms.ul_CarrierFreq;
downlink_frequency[CC_id][i]+uplink_frequency_offset[CC_id][i];
openair0_cfg[UE->rf_map.card].autocal[UE->rf_map.chain+i] = 1; openair0_cfg[UE->rf_map.card].autocal[UE->rf_map.chain+i] = 1;
if (uplink_frequency_offset[CC_id][i] != 0) // if (UE->frame_parms.frame_type == FDD)
openair0_cfg[UE->rf_map.card].duplex_mode = duplex_mode_FDD; openair0_cfg[UE->rf_map.card].duplex_mode = duplex_mode_FDD;
else //FDD else
openair0_cfg[UE->rf_map.card].duplex_mode = duplex_mode_TDD; openair0_cfg[UE->rf_map.card].duplex_mode = duplex_mode_TDD;
} }
...@@ -246,12 +241,12 @@ static void UE_synch(void *arg) { ...@@ -246,12 +241,12 @@ static void UE_synch(void *arg) {
if (nr_initial_sync( &syncD->proc, UE, UE->mode,2) == 0) { if (nr_initial_sync( &syncD->proc, UE, UE->mode,2) == 0) {
freq_offset = UE->common_vars.freq_offset; // frequency offset computed with pss in initial sync freq_offset = UE->common_vars.freq_offset; // frequency offset computed with pss in initial sync
hw_slot_offset = (UE->rx_offset<<1) / UE->frame_parms.samples_per_slot; hw_slot_offset = (UE->rx_offset<<1) / UE->frame_parms.samples_per_slot;
LOG_I(PHY,"Got synch: hw_slot_offset %d, carrier off %d Hz, rxgain %d (DL %u, UL %u), UE_scan_carrier %d\n", LOG_I(PHY,"Got synch: hw_slot_offset %d, carrier off %d Hz, rxgain %d (DL %lu, UL %lu), UE_scan_carrier %d\n",
hw_slot_offset, hw_slot_offset,
freq_offset, freq_offset,
UE->rx_total_gain_dB, UE->rx_total_gain_dB,
downlink_frequency[0][0]+freq_offset, UE->frame_parms.dl_CarrierFreq+freq_offset,
downlink_frequency[0][0]+uplink_frequency_offset[0][0]+freq_offset, UE->frame_parms.ul_CarrierFreq+freq_offset,
UE->UE_scan_carrier ); UE->UE_scan_carrier );
// rerun with new cell parameters and frequency-offset // rerun with new cell parameters and frequency-offset
...@@ -264,8 +259,8 @@ static void UE_synch(void *arg) { ...@@ -264,8 +259,8 @@ static void UE_synch(void *arg) {
openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i] -= abs(freq_offset); openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i] -= abs(freq_offset);
openair0_cfg[UE->rf_map.card].tx_freq[UE->rf_map.chain+i] = openair0_cfg[UE->rf_map.card].tx_freq[UE->rf_map.chain+i] =
openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i]+uplink_frequency_offset[CC_id][i]; openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i]+(UE->frame_parms.ul_CarrierFreq-UE->frame_parms.dl_CarrierFreq);
downlink_frequency[CC_id][i] = openair0_cfg[CC_id].rx_freq[i]; UE->frame_parms.dl_CarrierFreq = openair0_cfg[CC_id].rx_freq[i];
} }
// reconfigure for potentially different bandwidth // reconfigure for potentially different bandwidth
...@@ -324,15 +319,15 @@ static void UE_synch(void *arg) { ...@@ -324,15 +319,15 @@ static void UE_synch(void *arg) {
freq_offset += 100; freq_offset += 100;
freq_offset *= -1; freq_offset *= -1;
LOG_I(PHY, "[initial_sync] trying carrier off %d Hz, rxgain %d (DL %u, UL %u)\n", LOG_I(PHY, "[initial_sync] trying carrier off %d Hz, rxgain %d (DL %lu, UL %lu)\n",
freq_offset, freq_offset,
UE->rx_total_gain_dB, UE->rx_total_gain_dB,
downlink_frequency[0][0]+freq_offset, UE->frame_parms.dl_CarrierFreq+freq_offset,
downlink_frequency[0][0]+uplink_frequency_offset[0][0]+freq_offset ); UE->frame_parms.ul_CarrierFreq+freq_offset );
for (i=0; i<openair0_cfg[UE->rf_map.card].rx_num_channels; i++) { for (i=0; i<openair0_cfg[UE->rf_map.card].rx_num_channels; i++) {
openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i] = downlink_frequency[CC_id][i]+freq_offset; openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i] = UE->frame_parms.dl_CarrierFreq+freq_offset;
openair0_cfg[UE->rf_map.card].tx_freq[UE->rf_map.chain+i] = downlink_frequency[CC_id][i]+uplink_frequency_offset[CC_id][i]+freq_offset; openair0_cfg[UE->rf_map.card].tx_freq[UE->rf_map.chain+i] = UE->frame_parms.ul_CarrierFreq+freq_offset;
openair0_cfg[UE->rf_map.card].rx_gain[UE->rf_map.chain+i] = UE->rx_total_gain_dB;//-USRP_GAIN_OFFSET; openair0_cfg[UE->rf_map.card].rx_gain[UE->rf_map.chain+i] = UE->rx_total_gain_dB;//-USRP_GAIN_OFFSET;
if (UE->UE_scan_carrier==1) if (UE->UE_scan_carrier==1)
......
...@@ -489,7 +489,7 @@ void set_default_frame_parms(NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) { ...@@ -489,7 +489,7 @@ void set_default_frame_parms(NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) {
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
/* Set some default values that may be overwritten while reading options */ /* Set some default values that may be overwritten while reading options */
frame_parms[CC_id] = (NR_DL_FRAME_PARMS *) calloc(sizeof(NR_DL_FRAME_PARMS),1); frame_parms[CC_id] = (NR_DL_FRAME_PARMS *) calloc(sizeof(NR_DL_FRAME_PARMS),1);
frame_parms[CC_id]->eutra_band = 78; frame_parms[CC_id]->nr_band = 78;
frame_parms[CC_id]->frame_type = FDD; frame_parms[CC_id]->frame_type = FDD;
frame_parms[CC_id]->tdd_config = 3; frame_parms[CC_id]->tdd_config = 3;
//frame_parms[CC_id]->tdd_config_S = 0; //frame_parms[CC_id]->tdd_config_S = 0;
...@@ -499,7 +499,7 @@ void set_default_frame_parms(NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) { ...@@ -499,7 +499,7 @@ void set_default_frame_parms(NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) {
//frame_parms[CC_id]->Ncp_UL = NORMAL; //frame_parms[CC_id]->Ncp_UL = NORMAL;
frame_parms[CC_id]->Nid_cell = 0; frame_parms[CC_id]->Nid_cell = 0;
//frame_parms[CC_id]->num_MBSFN_config = 0; //frame_parms[CC_id]->num_MBSFN_config = 0;
frame_parms[CC_id]->nb_antenna_ports_eNB = 1; frame_parms[CC_id]->nb_antenna_ports_gNB = 1;
frame_parms[CC_id]->nb_antennas_tx = 1; frame_parms[CC_id]->nb_antennas_tx = 1;
frame_parms[CC_id]->nb_antennas_rx = 1; frame_parms[CC_id]->nb_antennas_rx = 1;
//frame_parms[CC_id]->nushift = 0; //frame_parms[CC_id]->nushift = 0;
...@@ -601,12 +601,12 @@ void init_openair0(void) { ...@@ -601,12 +601,12 @@ void init_openair0(void) {
for (i=0; i<4; i++) { for (i=0; i<4; i++) {
if (i<openair0_cfg[card].tx_num_channels) if (i<openair0_cfg[card].tx_num_channels)
openair0_cfg[card].tx_freq[i] = downlink_frequency[0][i]+uplink_frequency_offset[0][i]; openair0_cfg[card].tx_freq[i] = frame_parms[0]->ul_CarrierFreq;
else else
openair0_cfg[card].tx_freq[i]=0.0; openair0_cfg[card].tx_freq[i]=0.0;
if (i<openair0_cfg[card].rx_num_channels) if (i<openair0_cfg[card].rx_num_channels)
openair0_cfg[card].rx_freq[i] = downlink_frequency[0][i]; openair0_cfg[card].rx_freq[i] = frame_parms[0]->dl_CarrierFreq;
else else
openair0_cfg[card].rx_freq[i]=0.0; openair0_cfg[card].rx_freq[i]=0.0;
...@@ -702,16 +702,6 @@ int main( int argc, char **argv ) { ...@@ -702,16 +702,6 @@ int main( int argc, char **argv ) {
#endif #endif
*/ */
// init the parameters
for (int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
frame_parms[CC_id]->nb_antennas_tx = nb_antenna_tx;
frame_parms[CC_id]->nb_antennas_rx = nb_antenna_rx;
frame_parms[CC_id]->nb_antenna_ports_eNB = 1; //initial value overwritten by initial sync later
frame_parms[CC_id]->threequarter_fs = threequarter_fs;
LOG_I(PHY,"Set nb_rx_antenna %d , nb_tx_antenna %d \n",frame_parms[CC_id]->nb_antennas_rx, frame_parms[CC_id]->nb_antennas_tx);
get_band(downlink_frequency[CC_id][0], &frame_parms[CC_id]->eutra_band, &uplink_frequency_offset[CC_id][0], &frame_parms[CC_id]->frame_type);
}
NB_UE_INST=1; NB_UE_INST=1;
NB_INST=1; NB_INST=1;
PHY_vars_UE_g = malloc(sizeof(PHY_VARS_NR_UE **)); PHY_vars_UE_g = malloc(sizeof(PHY_VARS_NR_UE **));
...@@ -719,9 +709,24 @@ int main( int argc, char **argv ) { ...@@ -719,9 +709,24 @@ int main( int argc, char **argv ) {
for (int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { for (int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
printf("frame_parms %d\n",frame_parms[CC_id]->ofdm_symbol_size); printf("frame_parms %d\n",frame_parms[CC_id]->ofdm_symbol_size);
nr_init_frame_parms_ue(frame_parms[CC_id],numerology,NORMAL,frame_parms[CC_id]->N_RB_DL,(frame_parms[CC_id]->N_RB_DL-20)>>1,0); frame_parms[CC_id]->nb_antennas_tx = nb_antenna_tx;
PHY_vars_UE_g[0][CC_id] = init_nr_ue_vars(frame_parms[CC_id], 0,abstraction_flag); frame_parms[CC_id]->nb_antennas_rx = nb_antenna_rx;
frame_parms[CC_id]->nb_antenna_ports_gNB = 1; //initial value overwritten by initial sync later
frame_parms[CC_id]->threequarter_fs = threequarter_fs;
LOG_I(PHY,"Set nb_rx_antenna %d , nb_tx_antenna %d \n",frame_parms[CC_id]->nb_antennas_rx, frame_parms[CC_id]->nb_antennas_tx);
PHY_vars_UE_g[0][CC_id] = (PHY_VARS_NR_UE *)malloc(sizeof(PHY_VARS_NR_UE));
UE[CC_id] = PHY_vars_UE_g[0][CC_id]; UE[CC_id] = PHY_vars_UE_g[0][CC_id];
memset(UE[CC_id],0,sizeof(PHY_VARS_NR_UE));
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
if(mac->if_module != NULL && mac->if_module->phy_config_request != NULL)
mac->if_module->phy_config_request(&mac->phy_config);
fapi_nr_config_request_t *nrUE_config = &UE[CC_id]->nrUE_config;
nr_init_frame_parms_ue(frame_parms[CC_id],nrUE_config,NORMAL);
init_nr_ue_vars(UE[CC_id],frame_parms[CC_id],0,abstraction_flag);
UE[CC_id]->mac_enabled = 1; UE[CC_id]->mac_enabled = 1;
UE[CC_id]->if_inst = nr_ue_if_module_init(0); UE[CC_id]->if_inst = nr_ue_if_module_init(0);
......
...@@ -103,6 +103,6 @@ extern void init_NR_UE_threads(int); ...@@ -103,6 +103,6 @@ extern void init_NR_UE_threads(int);
extern void reset_opp_meas(void); extern void reset_opp_meas(void);
extern void print_opp_meas(void); extern void print_opp_meas(void);
void *UE_thread(void *arg); void *UE_thread(void *arg);
PHY_VARS_NR_UE *init_nr_ue_vars(NR_DL_FRAME_PARMS *frame_parms, uint8_t UE_id, uint8_t abstraction_flag); void init_nr_ue_vars(PHY_VARS_NR_UE *ue, NR_DL_FRAME_PARMS *frame_parms, uint8_t UE_id, uint8_t abstraction_flag);
extern tpool_t *Tpool; extern tpool_t *Tpool;
#endif #endif
...@@ -360,7 +360,7 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB, ...@@ -360,7 +360,7 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,
gNB->mac_enabled = 1; gNB->mac_enabled = 1;
fp->dl_CarrierFreq = 3500000000;//from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value); fp->dl_CarrierFreq = 3500000000;//from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value);
fp->ul_CarrierFreq = 3500000000;//fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000); fp->ul_CarrierFreq = 3500000000;//fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000);
fp->eutra_band = 78; fp->nr_band = 78;
fp->threequarter_fs= 0; fp->threequarter_fs= 0;
nr_init_frame_parms(gNB_config, fp); nr_init_frame_parms(gNB_config, fp);
gNB->configured = 1; gNB->configured = 1;
...@@ -409,7 +409,7 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) { ...@@ -409,7 +409,7 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) {
int32_t dlul_offset = 0; int32_t dlul_offset = 0;
lte_frame_type_t frame_type = 0; lte_frame_type_t frame_type = 0;
get_band(fp->dl_CarrierFreq,&fp->eutra_band,&dlul_offset,&frame_type); get_band(fp->dl_CarrierFreq,&fp->nr_band,&dlul_offset,&frame_type);
fp->ul_CarrierFreq = (gNB_config->carrier_config.uplink_frequency.value)*1e3 + (gNB_config->carrier_config.uplink_bandwidth.value)*5e5; fp->ul_CarrierFreq = (gNB_config->carrier_config.uplink_frequency.value)*1e3 + (gNB_config->carrier_config.uplink_bandwidth.value)*5e5;
......
...@@ -649,17 +649,13 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, ...@@ -649,17 +649,13 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
int i,j,k,l,slot,symb,q; int i,j,k,l,slot,symb,q;
int eNB_id; int eNB_id;
int th_id; int th_id;
int n_ssb_crb=(fp->N_RB_DL-20)>>1;
int k_ssb=0; int k_ssb=0;
uint32_t ****pusch_dmrs; uint32_t ****pusch_dmrs;
uint16_t N_n_scid[2] = {0,1}; // [HOTFIX] This is a temporary implementation of scramblingID0 and scramblingID1 which are given by DMRS-UplinkConfig uint16_t N_n_scid[2] = {0,1}; // [HOTFIX] This is a temporary implementation of scramblingID0 and scramblingID1 which are given by DMRS-UplinkConfig
int n_scid; int n_scid;
abstraction_flag = 0; abstraction_flag = 0;
fp->nb_antennas_tx = 1;
fp->nb_antennas_rx=1;
printf("Initializing UE vars (abstraction %"PRIu8") for eNB TXant %"PRIu8", UE RXant %"PRIu8"\n",abstraction_flag,fp->nb_antennas_tx,fp->nb_antennas_rx); printf("Initializing UE vars (abstraction %"PRIu8") for eNB TXant %"PRIu8", UE RXant %"PRIu8"\n",abstraction_flag,fp->nb_antennas_tx,fp->nb_antennas_rx);
//LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_eNB_INST); //LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_eNB_INST);
nr_init_frame_parms_ue(fp,NR_MU_1,NORMAL,fp->N_RB_DL,n_ssb_crb,k_ssb);
phy_init_nr_top(ue); phy_init_nr_top(ue);
// many memory allocation sizes are hard coded // many memory allocation sizes are hard coded
AssertFatal( fp->nb_antennas_rx <= 2, "hard coded allocation for ue_common_vars->dl_ch_estimates[eNB_id]" ); AssertFatal( fp->nb_antennas_rx <= 2, "hard coded allocation for ue_common_vars->dl_ch_estimates[eNB_id]" );
...@@ -921,7 +917,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, ...@@ -921,7 +917,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
ue->init_averaging = 1; ue->init_averaging = 1;
// default value until overwritten by RRCConnectionReconfiguration // default value until overwritten by RRCConnectionReconfiguration
if (fp->nb_antenna_ports_eNB==2) if (fp->nb_antenna_ports_gNB==2)
ue->pdsch_config_dedicated->p_a = dBm3; ue->pdsch_config_dedicated->p_a = dBm3;
else else
ue->pdsch_config_dedicated->p_a = dB0; ue->pdsch_config_dedicated->p_a = dB0;
...@@ -950,7 +946,7 @@ void init_nr_ue_transport(PHY_VARS_NR_UE *ue, ...@@ -950,7 +946,7 @@ void init_nr_ue_transport(PHY_VARS_NR_UE *ue,
ue->dlsch_SI[i] = new_nr_ue_dlsch(1,1,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag); ue->dlsch_SI[i] = new_nr_ue_dlsch(1,1,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag);
ue->dlsch_ra[i] = new_nr_ue_dlsch(1,1,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag); ue->dlsch_ra[i] = new_nr_ue_dlsch(1,1,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag);
ue->transmission_mode[i] = ue->frame_parms.nb_antenna_ports_eNB==1 ? 1 : 2; ue->transmission_mode[i] = ue->frame_parms.nb_antenna_ports_gNB==1 ? 1 : 2;
} }
//ue->frame_parms.pucch_config_common.deltaPUCCH_Shift = 1; //ue->frame_parms.pucch_config_common.deltaPUCCH_Shift = 1;
...@@ -995,7 +991,7 @@ void set_default_frame_parms_single(nfapi_nr_config_request_t *config, ...@@ -995,7 +991,7 @@ void set_default_frame_parms_single(nfapi_nr_config_request_t *config,
//frame_parms[CC_id]->Ncp_UL = NORMAL; //frame_parms[CC_id]->Ncp_UL = NORMAL;
frame_parms->Nid_cell = 0; frame_parms->Nid_cell = 0;
//frame_parms[CC_id]->num_MBSFN_config = 0; //frame_parms[CC_id]->num_MBSFN_config = 0;
frame_parms->nb_antenna_ports_eNB = 1; frame_parms->nb_antenna_ports_gNB = 1;
frame_parms->nb_antennas_tx = 1; frame_parms->nb_antennas_tx = 1;
frame_parms->nb_antennas_rx = 1; frame_parms->nb_antennas_rx = 1;
......
...@@ -21,12 +21,12 @@ ...@@ -21,12 +21,12 @@
#include "phy_init.h" #include "phy_init.h"
#include "common/utils/LOG/log.h" #include "common/utils/LOG/log.h"
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
/// Subcarrier spacings in Hz indexed by numerology index /// Subcarrier spacings in Hz indexed by numerology index
uint32_t nr_subcarrier_spacing[MAX_NUM_SUBCARRIER_SPACING] = {15e3, 30e3, 60e3, 120e3, 240e3}; uint32_t nr_subcarrier_spacing[MAX_NUM_SUBCARRIER_SPACING] = {15e3, 30e3, 60e3, 120e3, 240e3};
uint16_t nr_slots_per_subframe[MAX_NUM_SUBCARRIER_SPACING] = {1, 2, 4, 16, 32}; uint16_t nr_slots_per_subframe[MAX_NUM_SUBCARRIER_SPACING] = {1, 2, 4, 16, 32};
int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp) int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp)
{ {
...@@ -81,32 +81,8 @@ int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp) ...@@ -81,32 +81,8 @@ int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp)
return symbol; return symbol;
} }
int nr_init_frame_parms0(NR_DL_FRAME_PARMS *fp, void set_scs_parameters (NR_DL_FRAME_PARMS *fp, int mu)
nfapi_nr_config_request_scf_t* cfg,
int mu0,
int Ncp,
int N_RB_DL,
int N_RB_UL)
{ {
int mu = cfg!= NULL ? cfg->ssb_config.scs_common.value : mu0;
#if DISABLE_LOG_X
printf("Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",mu, N_RB_DL, Ncp);
#else
LOG_I(PHY,"Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",mu, N_RB_DL, Ncp);
#endif
if (Ncp == NFAPI_CP_EXTENDED)
AssertFatal(mu == NR_MU_2,"Invalid cyclic prefix %d for numerology index %d\n", Ncp, mu);
fp->half_frame_bit = 0; // half frame bit initialized to 0 here
fp->numerology_index = mu;
fp->Ncp = Ncp;
fp->N_RB_DL = N_RB_DL;
fp->N_RB_UL = N_RB_UL;
switch(mu) { switch(mu) {
case NR_MU_0: //15kHz scs case NR_MU_0: //15kHz scs
...@@ -120,16 +96,16 @@ int nr_init_frame_parms0(NR_DL_FRAME_PARMS *fp, ...@@ -120,16 +96,16 @@ int nr_init_frame_parms0(NR_DL_FRAME_PARMS *fp,
fp->slots_per_subframe = nr_slots_per_subframe[NR_MU_1]; fp->slots_per_subframe = nr_slots_per_subframe[NR_MU_1];
// selection of SS block pattern according to TS 38101-1 Table 5.4.3.3-1 for SCS 30kHz // selection of SS block pattern according to TS 38101-1 Table 5.4.3.3-1 for SCS 30kHz
if (fp->eutra_band == 5 || fp->eutra_band == 66) if (fp->nr_band == 5 || fp->nr_band == 66)
fp->ssb_type = nr_ssb_type_B; fp->ssb_type = nr_ssb_type_B;
else{ else{
if (fp->eutra_band == 41 || ( fp->eutra_band > 76 && fp->eutra_band < 80) ) if (fp->nr_band == 41 || ( fp->nr_band > 76 && fp->nr_band < 80) )
fp->ssb_type = nr_ssb_type_C; fp->ssb_type = nr_ssb_type_C;
else else
AssertFatal(1==0,"NR Operating Band n%d not available for SS block SCS with mu=%d\n", fp->eutra_band, mu); AssertFatal(1==0,"NR Operating Band n%d not available for SS block SCS with mu=%d\n", fp->nr_band, mu);
} }
switch(N_RB_DL){ switch(fp->N_RB_DL){
case 11: case 11:
case 24: case 24:
case 38: case 38:
...@@ -172,21 +148,21 @@ int nr_init_frame_parms0(NR_DL_FRAME_PARMS *fp, ...@@ -172,21 +148,21 @@ int nr_init_frame_parms0(NR_DL_FRAME_PARMS *fp,
break; break;
case 245: case 245:
AssertFatal(fp->threequarter_fs==0,"3/4 sampling impossible for N_RB %d and MU %d\n",N_RB_DL,mu); AssertFatal(fp->threequarter_fs==0,"3/4 sampling impossible for N_RB %d and MU %d\n",fp->N_RB_DL,mu);
fp->ofdm_symbol_size = 4096; fp->ofdm_symbol_size = 4096;
fp->first_carrier_offset = 2626; //4096 - ( (245*12) / 2 ) fp->first_carrier_offset = 2626; //4096 - ( (245*12) / 2 )
fp->nb_prefix_samples0 = 352; fp->nb_prefix_samples0 = 352;
fp->nb_prefix_samples = 288; fp->nb_prefix_samples = 288;
break; break;
case 273: case 273:
AssertFatal(fp->threequarter_fs==0,"3/4 sampling impossible for N_RB %d and MU %d\n",N_RB_DL,mu); AssertFatal(fp->threequarter_fs==0,"3/4 sampling impossible for N_RB %d and MU %d\n",fp->N_RB_DL,mu);
fp->ofdm_symbol_size = 4096; fp->ofdm_symbol_size = 4096;
fp->first_carrier_offset = 2458; //4096 - ( (273*12) / 2 ) fp->first_carrier_offset = 2458; //4096 - ( (273*12) / 2 )
fp->nb_prefix_samples0 = 352; fp->nb_prefix_samples0 = 352;
fp->nb_prefix_samples = 288; fp->nb_prefix_samples = 288;
break; break;
default: default:
AssertFatal(1==0,"Number of resource blocks %d undefined for mu %d, frame parms = %p\n", N_RB_DL, mu, fp); AssertFatal(1==0,"Number of resource blocks %d undefined for mu %d, frame parms = %p\n", fp->N_RB_DL, mu, fp);
} }
break; break;
...@@ -194,7 +170,7 @@ int nr_init_frame_parms0(NR_DL_FRAME_PARMS *fp, ...@@ -194,7 +170,7 @@ int nr_init_frame_parms0(NR_DL_FRAME_PARMS *fp,
fp->subcarrier_spacing = nr_subcarrier_spacing[NR_MU_2]; fp->subcarrier_spacing = nr_subcarrier_spacing[NR_MU_2];
fp->slots_per_subframe = nr_slots_per_subframe[NR_MU_2]; fp->slots_per_subframe = nr_slots_per_subframe[NR_MU_2];
switch(N_RB_DL){ //FR1 bands only switch(fp->N_RB_DL){ //FR1 bands only
case 11: case 11:
case 18: case 18:
case 38: case 38:
...@@ -208,7 +184,7 @@ int nr_init_frame_parms0(NR_DL_FRAME_PARMS *fp, ...@@ -208,7 +184,7 @@ int nr_init_frame_parms0(NR_DL_FRAME_PARMS *fp,
case 121: case 121:
case 135: case 135:
default: default:
AssertFatal(1==0,"Number of resource blocks %d undefined for mu %d, frame parms = %p\n", N_RB_DL, mu, fp); AssertFatal(1==0,"Number of resource blocks %d undefined for mu %d, frame parms = %p\n", fp->N_RB_DL, mu, fp);
} }
break; break;
...@@ -227,10 +203,40 @@ int nr_init_frame_parms0(NR_DL_FRAME_PARMS *fp, ...@@ -227,10 +203,40 @@ int nr_init_frame_parms0(NR_DL_FRAME_PARMS *fp,
default: default:
AssertFatal(1==0,"Invalid numerology index %d", mu); AssertFatal(1==0,"Invalid numerology index %d", mu);
} }
}
int nr_init_frame_parms0(NR_DL_FRAME_PARMS *fp,
nfapi_nr_config_request_scf_t* cfg,
int mu0,
int Ncp,
int N_RB_DL,
int N_RB_UL)
{
int mu = cfg!= NULL ? cfg->ssb_config.scs_common.value : mu0;
#if DISABLE_LOG_X
printf("Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",mu, N_RB_DL, Ncp);
#else
LOG_I(PHY,"Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",mu, N_RB_DL, Ncp);
#endif
if (Ncp == NFAPI_CP_EXTENDED)
AssertFatal(mu == NR_MU_2,"Invalid cyclic prefix %d for numerology index %d\n", Ncp, mu);
fp->half_frame_bit = 0; // half frame bit initialized to 0 here
fp->numerology_index = mu;
fp->Ncp = Ncp;
fp->N_RB_DL = N_RB_DL;
fp->N_RB_UL = N_RB_UL;
set_scs_parameters(fp, mu);
fp->slots_per_frame = 10* fp->slots_per_subframe; fp->slots_per_frame = 10* fp->slots_per_subframe;
fp->nb_antenna_ports_eNB = 1; // default value until overwritten by RRCConnectionReconfiguration fp->nb_antenna_ports_gNB = 1; // default value until overwritten by RRCConnectionReconfiguration
fp->nb_antennas_rx = 1; // default value until overwritten by RRCConnectionReconfiguration fp->nb_antennas_rx = 1; // default value until overwritten by RRCConnectionReconfiguration
fp->nb_antennas_tx = 1; // default value until overwritten by RRCConnectionReconfiguration fp->nb_antennas_tx = 1; // default value until overwritten by RRCConnectionReconfiguration
...@@ -280,15 +286,69 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* config, ...@@ -280,15 +286,69 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* config,
} }
int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp, int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp,
int mu, fapi_nr_config_request_t* config,
int Ncp, int Ncp)
int N_RB_DL,
int n_ssb_crb,
int ssb_subcarrier_offset)
{ {
int N_RB_UL = N_RB_DL;
nr_init_frame_parms0(fp,NULL,mu,Ncp,N_RB_DL,N_RB_UL); fp->dl_CarrierFreq = (config->carrier_config.dl_frequency)*1e3 + (config->carrier_config.dl_bandwidth)*5e5;
fp->ssb_start_subcarrier = (12 * n_ssb_crb + ssb_subcarrier_offset); fp->ul_CarrierFreq = (config->carrier_config.uplink_frequency)*1e3 + (config->carrier_config.uplink_bandwidth)*5e5;
fp->numerology_index = config->ssb_config.scs_common;
fp->N_RB_UL = config->carrier_config.ul_grid_size[fp->numerology_index];
fp->N_RB_DL = config->carrier_config.dl_grid_size[fp->numerology_index];
int32_t uplink_frequency_offset = 0;
get_band(fp->dl_CarrierFreq, &fp->nr_band, &uplink_frequency_offset, &fp->frame_type);
AssertFatal(fp->frame_type==config->cell_config.frame_duplex_type, "Invalid duplex type in config request file for band %d\n", fp->nr_band);
AssertFatal(fp->ul_CarrierFreq==(fp->dl_CarrierFreq+uplink_frequency_offset), "Disagreement in uplink frequency for band %d\n", fp->nr_band);
#if DISABLE_LOG_X
printf("Initializing UE frame parms for mu %d, N_RB %d, Ncp %d\n",fp->numerology_index, fp->N_RB_DL, Ncp);
#else
LOG_I(PHY,"Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",fp->numerology_index, fp->N_RB_DL, Ncp);
#endif
if (Ncp == NFAPI_CP_EXTENDED)
AssertFatal(fp->numerology_index == NR_MU_2,"Invalid cyclic prefix %d for numerology index %d\n", Ncp, fp->numerology_index);
fp->Ncp = Ncp;
set_scs_parameters(fp,fp->numerology_index);
fp->nb_antenna_ports_gNB = 1; // default value until overwritten by RRCConnectionReconfiguration
fp->nb_antennas_rx = 1; // default value until overwritten by RRCConnectionReconfiguration
fp->nb_antennas_tx = 1; // default value until overwritten by RRCConnectionReconfiguration
fp->symbols_per_slot = ((Ncp == NORMAL)? 14 : 12); // to redefine for different slot formats
fp->samples_per_subframe_wCP = fp->ofdm_symbol_size * fp->symbols_per_slot * fp->slots_per_subframe;
fp->samples_per_frame_wCP = 10 * fp->samples_per_subframe_wCP;
fp->samples_per_slot_wCP = fp->symbols_per_slot*fp->ofdm_symbol_size;
fp->samples_per_slot = fp->nb_prefix_samples0 + ((fp->symbols_per_slot-1)*fp->nb_prefix_samples) + (fp->symbols_per_slot*fp->ofdm_symbol_size);
fp->samples_per_subframe = (fp->samples_per_subframe_wCP + (fp->nb_prefix_samples0 * fp->slots_per_subframe) +
(fp->nb_prefix_samples * fp->slots_per_subframe * (fp->symbols_per_slot - 1)));
fp->samples_per_frame = 10 * fp->samples_per_subframe;
fp->freq_range = (fp->dl_CarrierFreq < 6e9)? nr_FR1 : nr_FR2;
fp->ssb_start_subcarrier = (12 * config->ssb_table.ssb_offset_point_a + config->ssb_table.ssb_subcarrier_offset);
// definition of Lmax according to ts 38.213 section 4.1
if (fp->dl_CarrierFreq < 6e9) {
if(fp->frame_type && (fp->ssb_type==2))
fp->Lmax = (fp->dl_CarrierFreq < 2.4e9)? 4 : 8;
else
fp->Lmax = (fp->dl_CarrierFreq < 3e9)? 4 : 8;
} else {
fp->Lmax = 64;
}
fp->L_ssb = (((uint64_t) config->ssb_table.ssb_mask_list[1].ssb_mask)<<32) | config->ssb_table.ssb_mask_list[0].ssb_mask;
fp->N_ssb = 0;
for (int p=0; p<fp->Lmax; p++)
fp->N_ssb += ((fp->L_ssb >> p) & 0x01);
return 0; return 0;
} }
......
...@@ -379,7 +379,7 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf); ...@@ -379,7 +379,7 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf);
void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms); void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms);
int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp); int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp);
int nr_init_frame_parms(nfapi_nr_config_request_scf_t *config, NR_DL_FRAME_PARMS *frame_parms); int nr_init_frame_parms(nfapi_nr_config_request_scf_t *config, NR_DL_FRAME_PARMS *frame_parms);
int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *frame_parms,int mu,int Ncp,int N_RB_DL,int n_ssb_crb,int ssb_subcarrier_offset); int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *frame_parms,fapi_nr_config_request_t *config,int Ncp);
int init_nr_ue_signal(PHY_VARS_NR_UE *ue,int nb_connected_eNB,uint8_t abstraction_flag); int init_nr_ue_signal(PHY_VARS_NR_UE *ue,int nb_connected_eNB,uint8_t abstraction_flag);
void init_nr_ue_transport(PHY_VARS_NR_UE *ue,int abstraction_flag); void init_nr_ue_transport(PHY_VARS_NR_UE *ue,int abstraction_flag);
void nr_dump_frame_parms(NR_DL_FRAME_PARMS *frame_parms); void nr_dump_frame_parms(NR_DL_FRAME_PARMS *frame_parms);
......
...@@ -307,7 +307,7 @@ void nr_ulsch_scale_channel(int **ul_ch_estimates_ext, ...@@ -307,7 +307,7 @@ void nr_ulsch_scale_channel(int **ul_ch_estimates_ext,
ch_amp128 = _mm_set1_epi16(ch_amp); // Q3.13 ch_amp128 = _mm_set1_epi16(ch_amp); // Q3.13
for (aatx=0; aatx < frame_parms->nb_antenna_ports_eNB; aatx++) { for (aatx=0; aatx < frame_parms->nb_antenna_ports_gNB; aatx++) {
for (aarx=0; aarx < frame_parms->nb_antennas_rx; aarx++) { for (aarx=0; aarx < frame_parms->nb_antennas_rx; aarx++) {
ul_ch128 = (__m128i *)&ul_ch_estimates_ext[aarx][symbol*nb_rb*NR_NB_SC_PER_RB]; ul_ch128 = (__m128i *)&ul_ch_estimates_ext[aarx][symbol*nb_rb*NR_NB_SC_PER_RB];
...@@ -390,7 +390,7 @@ void nr_ulsch_channel_level(int **ul_ch_estimates_ext, ...@@ -390,7 +390,7 @@ void nr_ulsch_channel_level(int **ul_ch_estimates_ext,
symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol;
for (aatx=0; aatx<frame_parms->nb_antenna_ports_eNB; aatx++) for (aatx=0; aatx<frame_parms->nb_antenna_ports_gNB; aatx++)
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
//clear average level //clear average level
avg128U = vdupq_n_s32(0); avg128U = vdupq_n_s32(0);
...@@ -406,7 +406,7 @@ void nr_ulsch_channel_level(int **ul_ch_estimates_ext, ...@@ -406,7 +406,7 @@ void nr_ulsch_channel_level(int **ul_ch_estimates_ext,
avg128U = vqaddq_s32(avg128U, vmull_s16(ul_ch128[2], ul_ch128[2])); avg128U = vqaddq_s32(avg128U, vmull_s16(ul_ch128[2], ul_ch128[2]));
avg128U = vqaddq_s32(avg128U, vmull_s16(ul_ch128[3], ul_ch128[3])); avg128U = vqaddq_s32(avg128U, vmull_s16(ul_ch128[3], ul_ch128[3]));
if (((symbol_mod == 0) || (symbol_mod == (frame_parms->Ncp-1)))&&(frame_parms->nb_antenna_ports_eNB!=1)) { if (((symbol_mod == 0) || (symbol_mod == (frame_parms->Ncp-1)))&&(frame_parms->nb_antenna_ports_gNB!=1)) {
ul_ch128+=4; ul_ch128+=4;
} else { } else {
avg128U = vqaddq_s32(avg128U, vmull_s16(ul_ch128[4], ul_ch128[4])); avg128U = vqaddq_s32(avg128U, vmull_s16(ul_ch128[4], ul_ch128[4]));
...@@ -752,7 +752,7 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext, ...@@ -752,7 +752,7 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext,
symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol;
if ((symbol_mod == 0) || (symbol_mod == (4-frame_parms->Ncp))) { if ((symbol_mod == 0) || (symbol_mod == (4-frame_parms->Ncp))) {
if (frame_parms->nb_antenna_ports_eNB==1) { // 10 out of 12 so don't reduce size if (frame_parms->nb_antenna_ports_gNB==1) { // 10 out of 12 so don't reduce size
nb_rb=1+(5*nb_rb/6); nb_rb=1+(5*nb_rb/6);
} }
else { else {
...@@ -760,7 +760,7 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext, ...@@ -760,7 +760,7 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext,
} }
} }
for (aatx=0; aatx<frame_parms->nb_antenna_ports_eNB; aatx++) { for (aatx=0; aatx<frame_parms->nb_antenna_ports_gNB; aatx++) {
if (mod_order == 4) { if (mod_order == 4) {
QAM_amp128 = vmovq_n_s16(QAM16_n1); // 2/sqrt(10) QAM_amp128 = vmovq_n_s16(QAM16_n1); // 2/sqrt(10)
QAM_amp128b = vmovq_n_s16(0); QAM_amp128b = vmovq_n_s16(0);
......
...@@ -449,7 +449,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -449,7 +449,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
{ {
// do ifft of channel estimate // do ifft of channel estimate
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++)
for (p=0; p<ue->frame_parms.nb_antenna_ports_eNB; p++) { for (p=0; p<ue->frame_parms.nb_antenna_ports_gNB; p++) {
if (ue->pbch_vars[eNB_offset]->dl_ch_estimates[(p<<1)+aarx]) if (ue->pbch_vars[eNB_offset]->dl_ch_estimates[(p<<1)+aarx])
{ {
LOG_D(PHY,"Channel Impulse Computation Slot %d ThreadId %d Symbol %d ch_offset %d\n", Ns, ue->current_thread_id[Ns], symbol, ch_offset); LOG_D(PHY,"Channel Impulse Computation Slot %d ThreadId %d Symbol %d ch_offset %d\n", Ns, ue->current_thread_id[Ns], symbol, ch_offset);
......
...@@ -288,7 +288,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, ...@@ -288,7 +288,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
pilots = ((1<<symbol)&dlsch0_harq->dlDmrsSymbPos)>0 ? 1 : 0; pilots = ((1<<symbol)&dlsch0_harq->dlDmrsSymbPos)>0 ? 1 : 0;
if (frame_parms->nb_antenna_ports_eNB>1 && beamforming_mode==0) { if (frame_parms->nb_antenna_ports_gNB>1 && beamforming_mode==0) {
#ifdef DEBUG_DLSCH_MOD #ifdef DEBUG_DLSCH_MOD
LOG_I(PHY,"dlsch: using pmi %x (%p)\n",pmi2hex_2Ar1(dlsch0_harq->pmi_alloc),dlsch[0]); LOG_I(PHY,"dlsch: using pmi %x (%p)\n",pmi2hex_2Ar1(dlsch0_harq->pmi_alloc),dlsch[0]);
#endif #endif
...@@ -349,7 +349,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, ...@@ -349,7 +349,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
frame_parms, frame_parms,
dlsch0_harq->mimo_mode); dlsch0_harq->mimo_mode);
} }
} else if (beamforming_mode==0) { //else if nb_antennas_ports_eNB==1 && beamforming_mode == 0 } else if (beamforming_mode==0) { //else if nb_antennas_ports_gNB==1 && beamforming_mode == 0
//printf("start nr dlsch extract nr_tti_rx %d thread id %d \n", nr_tti_rx, ue->current_thread_id[nr_tti_rx]); //printf("start nr dlsch extract nr_tti_rx %d thread id %d \n", nr_tti_rx, ue->current_thread_id[nr_tti_rx]);
nb_rb = nr_dlsch_extract_rbs_single(common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[nr_tti_rx]].rxdataF, nb_rb = nr_dlsch_extract_rbs_single(common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[nr_tti_rx]].rxdataF,
pdsch_vars[eNB_id]->dl_ch_estimates, pdsch_vars[eNB_id]->dl_ch_estimates,
...@@ -391,7 +391,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, ...@@ -391,7 +391,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
start_meas(&ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot]); start_meas(&ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot]);
#endif #endif
n_tx = frame_parms->nb_antenna_ports_eNB; n_tx = frame_parms->nb_antenna_ports_gNB;
n_rx = frame_parms->nb_antennas_rx; n_rx = frame_parms->nb_antennas_rx;
nr_dlsch_scale_channel(pdsch_vars[eNB_id]->dl_ch_estimates_ext, nr_dlsch_scale_channel(pdsch_vars[eNB_id]->dl_ch_estimates_ext,
...@@ -423,7 +423,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, ...@@ -423,7 +423,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
len, len,
nb_rb); nb_rb);
avgs = 0; avgs = 0;
for (aatx=0;aatx<frame_parms->nb_antenna_ports_eNB;aatx++) for (aatx=0;aatx<frame_parms->nb_antenna_ports_gNB;aatx++)
for (aarx=0;aarx<frame_parms->nb_antennas_rx;aarx++) for (aarx=0;aarx<frame_parms->nb_antennas_rx;aarx++)
avgs = cmax(avgs,avg[(aatx<<1)+aarx]); avgs = cmax(avgs,avg[(aatx<<1)+aarx]);
...@@ -1149,7 +1149,7 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext, ...@@ -1149,7 +1149,7 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext,
__m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128,QAM_amp128b; __m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128,QAM_amp128b;
QAM_amp128b = _mm_setzero_si128(); QAM_amp128b = _mm_setzero_si128();
for (aatx=0; aatx<frame_parms->nb_antenna_ports_eNB; aatx++) { for (aatx=0; aatx<frame_parms->nb_antenna_ports_gNB; aatx++) {
if (mod_order == 4) { if (mod_order == 4) {
QAM_amp128 = _mm_set1_epi16(QAM16_n1); // 2/sqrt(10) QAM_amp128 = _mm_set1_epi16(QAM16_n1); // 2/sqrt(10)
QAM_amp128b = _mm_setzero_si128(); QAM_amp128b = _mm_setzero_si128();
...@@ -1401,7 +1401,7 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext, ...@@ -1401,7 +1401,7 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext,
symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol;
if ((symbol_mod == 0) || (symbol_mod == (4-frame_parms->Ncp))) { if ((symbol_mod == 0) || (symbol_mod == (4-frame_parms->Ncp))) {
if (frame_parms->nb_antenna_ports_eNB==1) { // 10 out of 12 so don't reduce size if (frame_parms->nb_antenna_ports_gNB==1) { // 10 out of 12 so don't reduce size
nb_rb=1+(5*nb_rb/6); nb_rb=1+(5*nb_rb/6);
} }
else { else {
...@@ -1409,7 +1409,7 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext, ...@@ -1409,7 +1409,7 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext,
} }
} }
for (aatx=0; aatx<frame_parms->nb_antenna_ports_eNB; aatx++) { for (aatx=0; aatx<frame_parms->nb_antenna_ports_gNB; aatx++) {
if (mod_order == 4) { if (mod_order == 4) {
QAM_amp128 = vmovq_n_s16(QAM16_n1); // 2/sqrt(10) QAM_amp128 = vmovq_n_s16(QAM16_n1); // 2/sqrt(10)
QAM_amp128b = vmovq_n_s16(0); QAM_amp128b = vmovq_n_s16(0);
...@@ -1817,7 +1817,7 @@ void nr_dlsch_scale_channel(int **dl_ch_estimates_ext, ...@@ -1817,7 +1817,7 @@ void nr_dlsch_scale_channel(int **dl_ch_estimates_ext,
ch_amp128 = _mm_set1_epi16(ch_amp); // Q3.13 ch_amp128 = _mm_set1_epi16(ch_amp); // Q3.13
for (aatx=0; aatx<frame_parms->nb_antenna_ports_eNB; aatx++) { for (aatx=0; aatx<frame_parms->nb_antenna_ports_gNB; aatx++) {
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
dl_ch128=(__m128i *)&dl_ch_estimates_ext[(aatx<<1)+aarx][symbol*nb_rb*12]; dl_ch128=(__m128i *)&dl_ch_estimates_ext[(aatx<<1)+aarx][symbol*nb_rb*12];
...@@ -1868,7 +1868,7 @@ void nr_dlsch_channel_level(int **dl_ch_estimates_ext, ...@@ -1868,7 +1868,7 @@ void nr_dlsch_channel_level(int **dl_ch_estimates_ext,
int16_t y = (len)>>x; int16_t y = (len)>>x;
//printf("nb_rb*nre = %d = %d * 2^(%d)\n",nb_rb*nre,y,x); //printf("nb_rb*nre = %d = %d * 2^(%d)\n",nb_rb*nre,y,x);
for (aatx=0; aatx<frame_parms->nb_antenna_ports_eNB; aatx++) for (aatx=0; aatx<frame_parms->nb_antenna_ports_gNB; aatx++)
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
//clear average level //clear average level
avg128D = _mm_setzero_si128(); avg128D = _mm_setzero_si128();
...@@ -1885,7 +1885,7 @@ void nr_dlsch_channel_level(int **dl_ch_estimates_ext, ...@@ -1885,7 +1885,7 @@ void nr_dlsch_channel_level(int **dl_ch_estimates_ext,
//avg128D = _mm_add_epi32(avg128D,_mm_madd_epi16(dl_ch128[0],_mm_srai_epi16(_mm_mulhi_epi16(dl_ch128[0], coeff128),15))); //avg128D = _mm_add_epi32(avg128D,_mm_madd_epi16(dl_ch128[0],_mm_srai_epi16(_mm_mulhi_epi16(dl_ch128[0], coeff128),15)));
//avg128D = _mm_add_epi32(avg128D,_mm_madd_epi16(dl_ch128[1],_mm_srai_epi16(_mm_mulhi_epi16(dl_ch128[1], coeff128),15))); //avg128D = _mm_add_epi32(avg128D,_mm_madd_epi16(dl_ch128[1],_mm_srai_epi16(_mm_mulhi_epi16(dl_ch128[1], coeff128),15)));
/*if (((symbol_mod == 0) || (symbol_mod == (frame_parms->Ncp-1)))&&(frame_parms->nb_antenna_ports_eNB!=1)) { /*if (((symbol_mod == 0) || (symbol_mod == (frame_parms->Ncp-1)))&&(frame_parms->nb_antenna_ports_gNB!=1)) {
dl_ch128+=2; dl_ch128+=2;
} }
else {*/ else {*/
...@@ -1921,7 +1921,7 @@ void nr_dlsch_channel_level(int **dl_ch_estimates_ext, ...@@ -1921,7 +1921,7 @@ void nr_dlsch_channel_level(int **dl_ch_estimates_ext,
symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol;
for (aatx=0; aatx<frame_parms->nb_antenna_ports_eNB; aatx++) for (aatx=0; aatx<frame_parms->nb_antenna_ports_gNB; aatx++)
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
//clear average level //clear average level
avg128D = vdupq_n_s32(0); avg128D = vdupq_n_s32(0);
...@@ -1937,7 +1937,7 @@ void nr_dlsch_channel_level(int **dl_ch_estimates_ext, ...@@ -1937,7 +1937,7 @@ void nr_dlsch_channel_level(int **dl_ch_estimates_ext,
avg128D = vqaddq_s32(avg128D,vmull_s16(dl_ch128[2],dl_ch128[2])); avg128D = vqaddq_s32(avg128D,vmull_s16(dl_ch128[2],dl_ch128[2]));
avg128D = vqaddq_s32(avg128D,vmull_s16(dl_ch128[3],dl_ch128[3])); avg128D = vqaddq_s32(avg128D,vmull_s16(dl_ch128[3],dl_ch128[3]));
if (((symbol_mod == 0) || (symbol_mod == (frame_parms->Ncp-1)))&&(frame_parms->nb_antenna_ports_eNB!=1)) { if (((symbol_mod == 0) || (symbol_mod == (frame_parms->Ncp-1)))&&(frame_parms->nb_antenna_ports_gNB!=1)) {
dl_ch128+=4; dl_ch128+=4;
} else { } else {
avg128D = vqaddq_s32(avg128D,vmull_s16(dl_ch128[4],dl_ch128[4])); avg128D = vqaddq_s32(avg128D,vmull_s16(dl_ch128[4],dl_ch128[4]));
...@@ -2031,7 +2031,7 @@ void nr_dlsch_channel_level_median(int **dl_ch_estimates_ext, ...@@ -2031,7 +2031,7 @@ void nr_dlsch_channel_level_median(int **dl_ch_estimates_ext,
int32x4_t norm128D; int32x4_t norm128D;
int16x4_t *dl_ch128; int16x4_t *dl_ch128;
for (aatx=0; aatx<frame_parms->nb_antenna_ports_eNB; aatx++){ for (aatx=0; aatx<frame_parms->nb_antenna_ports_gNB; aatx++){
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
max = 0; max = 0;
min = 0; min = 0;
...@@ -2603,7 +2603,7 @@ void dump_dlsch2(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t nr_tti_rx,unsigned int * ...@@ -2603,7 +2603,7 @@ void dump_dlsch2(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t nr_tti_rx,unsigned int *
write_output(fname,vname,ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->dl_ch_estimates_ext[1],12*N_RB_DL*nsymb,1,1); write_output(fname,vname,ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->dl_ch_estimates_ext[1],12*N_RB_DL*nsymb,1,1);
} }
if (ue->frame_parms.nb_antenna_ports_eNB == 2) { if (ue->frame_parms.nb_antenna_ports_gNB == 2) {
sprintf(fname,"dlsch%d_ch_r%d_ext10.m",eNB_id,round); sprintf(fname,"dlsch%d_ch_r%d_ext10.m",eNB_id,round);
sprintf(vname,"dl%d_ch_r%d_ext10",eNB_id,round); sprintf(vname,"dl%d_ch_r%d_ext10",eNB_id,round);
write_output(fname,vname,ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->dl_ch_estimates_ext[2],12*N_RB_DL*nsymb,1,1); write_output(fname,vname,ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->dl_ch_estimates_ext[2],12*N_RB_DL*nsymb,1,1);
...@@ -2637,7 +2637,7 @@ void dump_dlsch2(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t nr_tti_rx,unsigned int * ...@@ -2637,7 +2637,7 @@ void dump_dlsch2(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t nr_tti_rx,unsigned int *
sprintf(fname,"dlsch%d_rxF_r%d_comp0.m",eNB_id,round); sprintf(fname,"dlsch%d_rxF_r%d_comp0.m",eNB_id,round);
sprintf(vname,"dl%d_rxF_r%d_comp0",eNB_id,round); sprintf(vname,"dl%d_rxF_r%d_comp0",eNB_id,round);
write_output(fname,vname,ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->rxdataF_comp0[0],12*N_RB_DL*nsymb,1,1); write_output(fname,vname,ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->rxdataF_comp0[0],12*N_RB_DL*nsymb,1,1);
if (ue->frame_parms.nb_antenna_ports_eNB == 2) { if (ue->frame_parms.nb_antenna_ports_gNB == 2) {
sprintf(fname,"dlsch%d_rxF_r%d_comp1.m",eNB_id,round); sprintf(fname,"dlsch%d_rxF_r%d_comp1.m",eNB_id,round);
sprintf(vname,"dl%d_rxF_r%d_comp1",eNB_id,round); sprintf(vname,"dl%d_rxF_r%d_comp1",eNB_id,round);
write_output(fname,vname,ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->rxdataF_comp1[harq_pid][round][0],12*N_RB_DL*nsymb,1,1); write_output(fname,vname,ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->rxdataF_comp1[harq_pid][round][0],12*N_RB_DL*nsymb,1,1);
......
...@@ -980,7 +980,7 @@ void nr_dlsch_64qam_llr_SIC(NR_DL_FRAME_PARMS *frame_parms, ...@@ -980,7 +980,7 @@ void nr_dlsch_64qam_llr_SIC(NR_DL_FRAME_PARMS *frame_parms,
if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) { if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) {
amp_tmp = 0x1fff;//dlsch0->sqrt_rho_b; already taken into account amp_tmp = 0x1fff;//dlsch0->sqrt_rho_b; already taken into account
if (frame_parms->nb_antenna_ports_eNB!=1) if (frame_parms->nb_antenna_ports_gNB!=1)
len = nb_rb*8 - (2*pbch_pss_sss_adjust/3); len = nb_rb*8 - (2*pbch_pss_sss_adjust/3);
else else
len = nb_rb*10 - (5*pbch_pss_sss_adjust/6); len = nb_rb*10 - (5*pbch_pss_sss_adjust/6);
...@@ -1379,7 +1379,7 @@ int nr_dlsch_qpsk_16qam_llr(NR_DL_FRAME_PARMS *frame_parms, ...@@ -1379,7 +1379,7 @@ int nr_dlsch_qpsk_16qam_llr(NR_DL_FRAME_PARMS *frame_parms,
if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) { if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) {
// if symbol has pilots // if symbol has pilots
if (frame_parms->nb_antenna_ports_eNB!=1) if (frame_parms->nb_antenna_ports_gNB!=1)
// in 2 antenna ports we have 8 REs per symbol per RB // in 2 antenna ports we have 8 REs per symbol per RB
len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3);
else else
...@@ -1661,7 +1661,7 @@ int nr_dlsch_qpsk_64qam_llr(NR_DL_FRAME_PARMS *frame_parms, ...@@ -1661,7 +1661,7 @@ int nr_dlsch_qpsk_64qam_llr(NR_DL_FRAME_PARMS *frame_parms,
if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) { if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) {
// if symbol has pilots // if symbol has pilots
if (frame_parms->nb_antenna_ports_eNB!=1) if (frame_parms->nb_antenna_ports_gNB!=1)
// in 2 antenna ports we have 8 REs per symbol per RB // in 2 antenna ports we have 8 REs per symbol per RB
len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3);
else else
...@@ -2427,7 +2427,7 @@ int nr_dlsch_16qam_qpsk_llr(NR_DL_FRAME_PARMS *frame_parms, ...@@ -2427,7 +2427,7 @@ int nr_dlsch_16qam_qpsk_llr(NR_DL_FRAME_PARMS *frame_parms,
if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) { if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) {
// if symbol has pilots // if symbol has pilots
if (frame_parms->nb_antenna_ports_eNB!=1) if (frame_parms->nb_antenna_ports_gNB!=1)
// in 2 antenna ports we have 8 REs per symbol per RB // in 2 antenna ports we have 8 REs per symbol per RB
len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3);
else else
...@@ -3602,7 +3602,7 @@ int nr_dlsch_16qam_64qam_llr(NR_DL_FRAME_PARMS *frame_parms, ...@@ -3602,7 +3602,7 @@ int nr_dlsch_16qam_64qam_llr(NR_DL_FRAME_PARMS *frame_parms,
if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) { if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) {
// if symbol has pilots // if symbol has pilots
if (frame_parms->nb_antenna_ports_eNB!=1) if (frame_parms->nb_antenna_ports_gNB!=1)
// in 2 antenna ports we have 8 REs per symbol per RB // in 2 antenna ports we have 8 REs per symbol per RB
len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3);
else else
...@@ -5164,7 +5164,7 @@ int nr_dlsch_64qam_qpsk_llr(NR_DL_FRAME_PARMS *frame_parms, ...@@ -5164,7 +5164,7 @@ int nr_dlsch_64qam_qpsk_llr(NR_DL_FRAME_PARMS *frame_parms,
if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) { if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) {
// if symbol has pilots // if symbol has pilots
if (frame_parms->nb_antenna_ports_eNB!=1) if (frame_parms->nb_antenna_ports_gNB!=1)
// in 2 antenna ports we have 8 REs per symbol per RB // in 2 antenna ports we have 8 REs per symbol per RB
len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3);
else else
...@@ -6707,7 +6707,7 @@ int nr_dlsch_64qam_16qam_llr(NR_DL_FRAME_PARMS *frame_parms, ...@@ -6707,7 +6707,7 @@ int nr_dlsch_64qam_16qam_llr(NR_DL_FRAME_PARMS *frame_parms,
if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) { if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) {
// if symbol has pilots // if symbol has pilots
if (frame_parms->nb_antenna_ports_eNB!=1) if (frame_parms->nb_antenna_ports_gNB!=1)
// in 2 antenna ports we have 8 REs per symbol per RB // in 2 antenna ports we have 8 REs per symbol per RB
len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3);
else else
......
...@@ -176,7 +176,7 @@ int nr_pbch_detection(UE_nr_rxtx_proc_t * proc, PHY_VARS_NR_UE *ue, int pbch_ini ...@@ -176,7 +176,7 @@ int nr_pbch_detection(UE_nr_rxtx_proc_t * proc, PHY_VARS_NR_UE *ue, int pbch_ini
if (ret==0) { if (ret==0) {
frame_parms->nb_antenna_ports_eNB = 1; //pbch_tx_ant; frame_parms->nb_antenna_ports_gNB = 1; //pbch_tx_ant;
// set initial transmission mode to 1 or 2 depending on number of detected TX antennas // set initial transmission mode to 1 or 2 depending on number of detected TX antennas
//frame_parms->mode1_flag = (pbch_tx_ant==1); //frame_parms->mode1_flag = (pbch_tx_ant==1);
...@@ -213,19 +213,9 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, runmode_t mode, ...@@ -213,19 +213,9 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, runmode_t mode,
NR_DL_FRAME_PARMS *fp = &ue->frame_parms; NR_DL_FRAME_PARMS *fp = &ue->frame_parms;
int ret=-1; int ret=-1;
int rx_power=0; //aarx, int rx_power=0; //aarx,
//nfapi_nr_config_request_t* config;
int n_ssb_crb=(fp->N_RB_DL-20)>>1;
// First try TDD normal prefix, mu 1
fp->Ncp=NORMAL;
fp->frame_type=TDD;
// FK: added N_RB_DL paramter here as this function shares code with the gNB where it is needed. We should rewrite this function for the UE.
nr_init_frame_parms_ue(fp,NR_MU_1,NORMAL,fp->N_RB_DL,n_ssb_crb,0);
LOG_D(PHY,"nr_initial sync ue RB_DL %d\n", fp->N_RB_DL); LOG_D(PHY,"nr_initial sync ue RB_DL %d\n", fp->N_RB_DL);
/* Initial synchronisation /* Initial synchronisation
* *
* 1 radio frame = 10 ms * 1 radio frame = 10 ms
...@@ -407,7 +397,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, runmode_t mode, ...@@ -407,7 +397,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, runmode_t mode,
fp->N_RB_DL, fp->N_RB_DL,
fp->phich_config_common.phich_duration, fp->phich_config_common.phich_duration,
phich_string[fp->phich_config_common.phich_resource], phich_string[fp->phich_config_common.phich_resource],
fp->nb_antenna_ports_eNB);*/ fp->nb_antenna_ports_gNB);*/
#if defined(OAI_USRP) || defined(EXMIMO) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) || defined(OAI_ADRV9371_ZC706) #if defined(OAI_USRP) || defined(EXMIMO) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) || defined(OAI_ADRV9371_ZC706)
LOG_I(PHY, "[UE %d] Measured Carrier Frequency %.0f Hz (offset %d Hz)\n", LOG_I(PHY, "[UE %d] Measured Carrier Frequency %.0f Hz (offset %d Hz)\n",
......
...@@ -492,7 +492,7 @@ void phy_scope_nrUE(FD_phy_scope_nrue *form, ...@@ -492,7 +492,7 @@ void phy_scope_nrUE(FD_phy_scope_nrue *form,
//int nsymb_ce = frame_parms->ofdm_symbol_size;//*frame_parms->symbols_per_tti; //int nsymb_ce = frame_parms->ofdm_symbol_size;//*frame_parms->symbols_per_tti;
int samples_per_frame = frame_parms->samples_per_frame; int samples_per_frame = frame_parms->samples_per_frame;
uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx; uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx;
uint8_t nb_antennas_tx = frame_parms->nb_antenna_ports_eNB; uint8_t nb_antennas_tx = frame_parms->nb_antenna_ports_gNB;
int16_t **rxsig_t; int16_t **rxsig_t;
float **rxsig_t_dB; float **rxsig_t_dB;
float *time; float *time;
......
...@@ -238,8 +238,8 @@ typedef struct NR_DL_FRAME_PARMS { ...@@ -238,8 +238,8 @@ typedef struct NR_DL_FRAME_PARMS {
uint8_t N_RBG; uint8_t N_RBG;
/// Total Number of Resource Block Groups SubSets: this is P /// Total Number of Resource Block Groups SubSets: this is P
uint8_t N_RBGS; uint8_t N_RBGS;
/// EUTRA Band /// NR Band
uint16_t eutra_band; uint16_t nr_band;
/// DL carrier frequency /// DL carrier frequency
uint64_t dl_CarrierFreq; uint64_t dl_CarrierFreq;
/// UL carrier frequency /// UL carrier frequency
...@@ -300,7 +300,7 @@ typedef struct NR_DL_FRAME_PARMS { ...@@ -300,7 +300,7 @@ typedef struct NR_DL_FRAME_PARMS {
/// Number of Receive antennas in node /// Number of Receive antennas in node
uint8_t nb_antennas_rx; uint8_t nb_antennas_rx;
/// Number of common transmit antenna ports in eNodeB (1 or 2) /// Number of common transmit antenna ports in eNodeB (1 or 2)
uint8_t nb_antenna_ports_eNB; uint8_t nb_antenna_ports_gNB;
/// PRACH_CONFIG /// PRACH_CONFIG
NR_PRACH_CONFIG_COMMON prach_config_common; NR_PRACH_CONFIG_COMMON prach_config_common;
/// Cyclic Prefix for DL (0=Normal CP, 1=Extended CP) /// Cyclic Prefix for DL (0=Normal CP, 1=Extended CP)
......
...@@ -196,7 +196,7 @@ int8_t nr_ue_phy_config_request(nr_phy_config_t *phy_config){ ...@@ -196,7 +196,7 @@ int8_t nr_ue_phy_config_request(nr_phy_config_t *phy_config){
fapi_nr_config_request_t *nrUE_config = &PHY_vars_UE_g[phy_config->Mod_id][phy_config->CC_id]->nrUE_config; fapi_nr_config_request_t *nrUE_config = &PHY_vars_UE_g[phy_config->Mod_id][phy_config->CC_id]->nrUE_config;
if(phy_config != NULL) if(phy_config != NULL)
memcpy(&nrUE_config,&phy_config->config_req,sizeof(fapi_nr_config_request_t *)); memcpy(nrUE_config,&phy_config->config_req,sizeof(fapi_nr_config_request_t));
return 0; return 0;
} }
......
...@@ -237,7 +237,7 @@ int init_test(unsigned char N_tx, unsigned char N_rx, unsigned char transmission ...@@ -237,7 +237,7 @@ int init_test(unsigned char N_tx, unsigned char N_rx, unsigned char transmission
frame_parms->nb_antennas_tx = N_tx; frame_parms->nb_antennas_tx = N_tx;
frame_parms->nb_antennas_rx = N_rx; frame_parms->nb_antennas_rx = N_rx;
frame_parms->frame_type = frame_type; frame_parms->frame_type = frame_type;
frame_parms->nb_antenna_ports_eNB = 1; frame_parms->nb_antenna_ports_gNB = 1;
frame_parms->threequarter_fs = 0; frame_parms->threequarter_fs = 0;
frame_parms->numerology_index = NUMEROLOGY_INDEX_MAX_NR; frame_parms->numerology_index = NUMEROLOGY_INDEX_MAX_NR;
int mu = 1; int mu = 1;
......
...@@ -151,6 +151,8 @@ void config_common_ue(NR_UE_MAC_INST_t *mac) { ...@@ -151,6 +151,8 @@ void config_common_ue(NR_UE_MAC_INST_t *mac) {
// carrier config // carrier config
LOG_I(MAC,"UE Config Common\n");
cfg->carrier_config.dl_bandwidth = config_bandwidth(scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, cfg->carrier_config.dl_bandwidth = config_bandwidth(scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth, scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth,
*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]); *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]);
...@@ -214,7 +216,7 @@ void config_common_ue(NR_UE_MAC_INST_t *mac) { ...@@ -214,7 +216,7 @@ void config_common_ue(NR_UE_MAC_INST_t *mac) {
uint32_t absolute_diff = (*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA); uint32_t absolute_diff = (*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA);
cfg->ssb_table.ssb_offset_point_a = absolute_diff/(12*scs_scaling); cfg->ssb_table.ssb_offset_point_a = absolute_diff/(12*scs_scaling);
cfg->ssb_table.ssb_period = *scc->ssb_periodicityServingCell; cfg->ssb_table.ssb_period = *scc->ssb_periodicityServingCell;
cfg->ssb_table.ssb_subcarrier_offset = 0; // TODO currently not in RRC?
switch (scc->ssb_PositionsInBurst->present) { switch (scc->ssb_PositionsInBurst->present) {
case 1 : case 1 :
cfg->ssb_table.ssb_mask_list[0].ssb_mask = scc->ssb_PositionsInBurst->choice.shortBitmap.buf[0]; cfg->ssb_table.ssb_mask_list[0].ssb_mask = scc->ssb_PositionsInBurst->choice.shortBitmap.buf[0];
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "nr_mac_gNB.h" #include "nr_mac_gNB.h"
#include "SCHED_NR/sched_nr.h" #include "SCHED_NR/sched_nr.h"
#include "mac_proto.h" #include "mac_proto.h"
#include "nr_mac_common.h"
#include "PHY/NR_TRANSPORT/nr_dlsch.h" #include "PHY/NR_TRANSPORT/nr_dlsch.h"
#include "PHY/NR_TRANSPORT/nr_dci.h" #include "PHY/NR_TRANSPORT/nr_dci.h"
#include "executables/nr-softmodem.h" #include "executables/nr-softmodem.h"
......
...@@ -145,8 +145,6 @@ int add_new_nr_ue(module_id_t mod_idP, ...@@ -145,8 +145,6 @@ int add_new_nr_ue(module_id_t mod_idP,
int get_num_dmrs(uint16_t dmrs_mask ); int get_num_dmrs(uint16_t dmrs_mask );
int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols);
uint16_t nr_dci_size(nr_dci_format_t format, uint16_t nr_dci_size(nr_dci_format_t format,
nr_rnti_type_t rnti_type, nr_rnti_type_t rnti_type,
uint16_t N_RB); uint16_t N_RB);
......
...@@ -38,6 +38,8 @@ uint64_t from_nrarfcn(int nr_bandP, uint32_t dl_nrarfcn); ...@@ -38,6 +38,8 @@ uint64_t from_nrarfcn(int nr_bandP, uint32_t dl_nrarfcn);
uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint32_t bw); uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint32_t bw);
int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols);
typedef enum { typedef enum {
NR_DL_DCI_FORMAT_1_0 = 0, NR_DL_DCI_FORMAT_1_0 = 0,
NR_DL_DCI_FORMAT_1_1, NR_DL_DCI_FORMAT_1_1,
......
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