Commit efeb5384 authored by francescomani's avatar francescomani

harmonize usage of frequency range structures

parent 8a3c329e
......@@ -79,11 +79,6 @@ static inline const char *rnti_types(nr_rnti_type_t rr)
#define NR_MAX_NB_LAYERS 4 // 8
typedef enum {
nr_FR1 = 0,
nr_FR2
} nr_frequency_range_e;
typedef struct nr_bandentry_s {
int16_t band;
uint64_t ul_min;
......
......@@ -841,7 +841,7 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
flags_burst = proc->first_tx == 1 ? TX_BURST_START : TX_BURST_MIDDLE;
}
if (fp->freq_range == nr_FR2)
if (fp->freq_range == FR2)
flags_gpio = get_gpio_flags(ru, slot);
const int flags = flags_burst | (flags_gpio << 4);
......
......@@ -252,7 +252,7 @@ void nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg, NR_DL_FRAME_PARMS *
fp->get_samples_slot_timestamp = &get_samples_slot_timestamp;
fp->get_slot_from_timestamp = &get_slot_from_timestamp;
fp->samples_per_frame = 10 * fp->samples_per_subframe;
fp->freq_range = (fp->dl_CarrierFreq < 6e9)? nr_FR1 : nr_FR2;
fp->freq_range = (fp->dl_CarrierFreq < 6e9)? FR1 : FR2;
fp->Ncp = Ncp;
......@@ -341,12 +341,12 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp,
fp->get_samples_per_slot = &get_samples_per_slot;
fp->get_samples_slot_timestamp = &get_samples_slot_timestamp;
fp->samples_per_frame = 10 * fp->samples_per_subframe;
fp->freq_range = (fp->dl_CarrierFreq < 6e9)? nr_FR1 : nr_FR2;
fp->freq_range = (fp->dl_CarrierFreq < 6e9)? FR1 : FR2;
uint8_t sco = 0;
if (((fp->freq_range == nr_FR1) && (config->ssb_table.ssb_subcarrier_offset < 24)) ||
((fp->freq_range == nr_FR2) && (config->ssb_table.ssb_subcarrier_offset < 12))) {
if (fp->freq_range == nr_FR1)
if (((fp->freq_range == FR1) && (config->ssb_table.ssb_subcarrier_offset < 24)) ||
((fp->freq_range == FR2) && (config->ssb_table.ssb_subcarrier_offset < 12))) {
if (fp->freq_range == FR1)
sco = config->ssb_table.ssb_subcarrier_offset>>config->ssb_config.scs_common;
else
sco = config->ssb_table.ssb_subcarrier_offset;
......@@ -379,7 +379,7 @@ void nr_init_frame_parms_ue_sa(NR_DL_FRAME_PARMS *frame_parms, uint64_t downlink
frame_parms->numerology_index = mu;
frame_parms->dl_CarrierFreq = downlink_frequency;
frame_parms->ul_CarrierFreq = downlink_frequency + delta_duplex;
frame_parms->freq_range = (frame_parms->dl_CarrierFreq < 6e9)? nr_FR1 : nr_FR2;
frame_parms->freq_range = (frame_parms->dl_CarrierFreq < 6e9)? FR1 : FR2;
frame_parms->N_RB_UL = frame_parms->N_RB_DL;
frame_parms->nr_band = nr_band;
......
......@@ -71,7 +71,7 @@ int nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
int diff = ue->max_pos_avg >> 15;
if (frame_parms->freq_range==nr_FR2)
if (frame_parms->freq_range == FR2)
sync_offset = 2;
else
sync_offset = 0;
......
......@@ -139,7 +139,7 @@ typedef uint32_t (*get_samples_slot_timestamp_t)(int slot, const NR_DL_FRAME_PAR
struct NR_DL_FRAME_PARMS {
/// frequency range
nr_frequency_range_e freq_range;
frequency_range_t freq_range;
// /// Placeholder to replace overlapping fields below
// nfapi_nr_rf_config_t rf_config;
/// Placeholder to replace SSB overlapping fields below
......
......@@ -71,10 +71,10 @@ void nr_common_signal_procedures(PHY_VARS_gNB *gNB,int frame,int slot, nfapi_nr_
// for FR2 offsetToPointA is expressed in terms of 60 kHz SCS and k_SSB expressed in terms of the subcarrier spacing provided
// by the higher-layer parameter subCarrierSpacingCommon
const int scs = cfg->ssb_config.scs_common.value;
const int prb_offset = (fp->freq_range == nr_FR1) ? ssb_pdu.ssb_pdu_rel15.ssbOffsetPointA >> scs
const int prb_offset = (fp->freq_range == FR1) ? ssb_pdu.ssb_pdu_rel15.ssbOffsetPointA >> scs
: ssb_pdu.ssb_pdu_rel15.ssbOffsetPointA >> (scs - 2);
const int sc_offset =
(fp->freq_range == nr_FR1) ? ssb_pdu.ssb_pdu_rel15.SsbSubcarrierOffset >> scs : ssb_pdu.ssb_pdu_rel15.SsbSubcarrierOffset;
(fp->freq_range == FR1) ? ssb_pdu.ssb_pdu_rel15.SsbSubcarrierOffset >> scs : ssb_pdu.ssb_pdu_rel15.SsbSubcarrierOffset;
fp->ssb_start_subcarrier = (12 * prb_offset + sc_offset);
if (fp->print_ue_help_cmdline_log && get_softmodem_params()->sa) {
......@@ -134,7 +134,7 @@ void nr_common_signal_procedures(PHY_VARS_gNB *gNB,int frame,int slot, nfapi_nr_
#endif
// Beam_id is currently used only for FR2
if (fp->freq_range==nr_FR2){
if (fp->freq_range == FR2){
LOG_D(PHY,"slot %d, ssb_index %d, beam %d\n",slot,ssb_index,cfg->ssb_table.ssb_beam_id_list[ssb_index].beam_id.value);
for (int j=0;j<fp->symbols_per_slot;j++)
gNB->common_vars.beam_id[0][slot*fp->symbols_per_slot+j] = cfg->ssb_table.ssb_beam_id_list[ssb_index].beam_id.value;
......
......@@ -487,7 +487,7 @@ int main(int argc, char **argv)
frame_parms->N_RB_DL = N_RB_DL;
frame_parms->Nid_cell = Nid_cell;
frame_parms->ssb_type = nr_ssb_type_C;
frame_parms->freq_range = mu<2 ? nr_FR1 : nr_FR2;
frame_parms->freq_range = mu<2 ? FR1 : FR2;
nr_phy_config_request_sim_pbchsim(gNB,N_RB_DL,N_RB_DL,mu,Nid_cell,SSB_positions);
gNB->gNB_config.tdd_table.tdd_period.value = 6;
......@@ -620,8 +620,8 @@ int main(int argc, char **argv)
for (i=0; i<frame_parms->Lmax; i++) {
if((SSB_positions >> i) & 0x01) {
const int sc_offset = frame_parms->freq_range == nr_FR1 ? ssb_subcarrier_offset<<mu : ssb_subcarrier_offset;
const int prb_offset = frame_parms->freq_range == nr_FR1 ? gNB->gNB_config.ssb_table.ssb_offset_point_a.value<<mu : gNB->gNB_config.ssb_table.ssb_offset_point_a.value << (mu - 2);
const int sc_offset = frame_parms->freq_range == FR1 ? ssb_subcarrier_offset<<mu : ssb_subcarrier_offset;
const int prb_offset = frame_parms->freq_range == FR1 ? gNB->gNB_config.ssb_table.ssb_offset_point_a.value<<mu : gNB->gNB_config.ssb_table.ssb_offset_point_a.value << (mu - 2);
msgDataTx.ssb[i].ssb_pdu.ssb_pdu_rel15.bchPayload = 0x55dd33;
msgDataTx.ssb[i].ssb_pdu.ssb_pdu_rel15.SsbBlockIndex = i;
msgDataTx.ssb[i].ssb_pdu.ssb_pdu_rel15.SsbSubcarrierOffset = sc_offset;
......
......@@ -422,7 +422,7 @@ int main(int argc, char **argv){
frame_parms->N_RB_UL = N_RB_UL;
frame_parms->threequarter_fs = threequarter_fs;
frame_parms->frame_type = TDD;
frame_parms->freq_range = (mu != 3 ? nr_FR1 : nr_FR2);
frame_parms->freq_range = (mu != 3 ? FR1 : FR2);
frame_parms->numerology_index = mu;
nr_phy_config_request_sim(gNB, N_RB_UL, N_RB_UL, mu, Nid_cell, SSB_positions);
......@@ -447,7 +447,7 @@ int main(int argc, char **argv){
frame_parms->Ncp,
frame_parms->samples_per_subframe,
frame_parms->frame_type == FDD ? "FDD" : "TDD",
frame_parms->freq_range == nr_FR1 ? "FR1" : "FR2");
frame_parms->freq_range == FR1 ? "FR1" : "FR2");
ru->nr_frame_parms = frame_parms;
ru->if_south = LOCAL_RF;
......
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