Commit 287e6078 authored by francescomani's avatar francescomani

ssb slot computation from starting symbol in sib1 function

parent 8756a561
...@@ -35,6 +35,13 @@ ...@@ -35,6 +35,13 @@
#define reserved 0xffff #define reserved 0xffff
// start symbols for SSB types A,B,C,D,E
uint16_t symbol_ssb_AC[8]={2,8,16,22,30,36,44,50};
uint16_t symbol_ssb_BD[64]={4,8,16,20,32,36,44,48,60,64,72,76,88,92,100,104,144,148,156,160,172,176,184,188,200,204,212,216,228,232,240,244,284,288,
296,300,312,316,324,328,340,344,352,356,368,372,380,384,424,428,436,440,452,456,464,468,480,484,492,496,508,512,520,524};
uint16_t symbol_ssb_E[64]={8,12,16,20,32,36,40,44,64,68,72,76,88,92,96,100,120,124,128,132,144,148,152,156,176,180,184,188,200,204,208,212,288,292,
296,300,312,316,320,324,344,348,352,356,368,372,376,380,400,404,408,412,424,428,432,436,456,460,464,468,480,484,488,492};
const uint8_t nr_slots_per_frame[5] = {10, 20, 40, 80, 160}; const uint8_t nr_slots_per_frame[5] = {10, 20, 40, 80, 160};
// Table 6.3.3.1-5 (38.211) NCS for preamble formats with delta_f_RA = 1.25 KHz // Table 6.3.3.1-5 (38.211) NCS for preamble formats with delta_f_RA = 1.25 KHz
...@@ -3109,12 +3116,23 @@ void get_band(uint64_t downlink_frequency, ...@@ -3109,12 +3116,23 @@ void get_band(uint64_t downlink_frequency,
"Can't find EUTRA band for frequency %lu\n", downlink_frequency); "Can't find EUTRA band for frequency %lu\n", downlink_frequency);
} }
uint16_t get_ssb_start_symbol(const long band, NR_SubcarrierSpacing_t scs, int i_ssb) {
uint32_t get_ssb_slot(uint32_t ssb_index){ switch (scs) {
// this function now only support f <= 3GHz case NR_SubcarrierSpacing_kHz15:
return ssb_index & 0x3 ; return symbol_ssb_AC[i_ssb]; //type A
case NR_SubcarrierSpacing_kHz30:
// return first_symbol(case, freq, ssb_index) / 14 if (band == 5 || band == 66)
return symbol_ssb_BD[i_ssb]; //type B
else
return symbol_ssb_AC[i_ssb]; //type C
case NR_SubcarrierSpacing_kHz120:
return symbol_ssb_BD[i_ssb]; //type D
case NR_SubcarrierSpacing_kHz240:
return symbol_ssb_E[i_ssb];
default:
AssertFatal(1 == 0, "SCS %ld not allowed for SSB \n",scs);
}
} }
void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config,
...@@ -3122,6 +3140,7 @@ void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PD ...@@ -3122,6 +3140,7 @@ void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PD
NR_MIB_t *mib, NR_MIB_t *mib,
uint8_t num_slot_per_frame, uint8_t num_slot_per_frame,
uint8_t ssb_subcarrier_offset, uint8_t ssb_subcarrier_offset,
uint16_t ssb_start_symbol,
NR_SubcarrierSpacing_t scs_ssb, NR_SubcarrierSpacing_t scs_ssb,
frequency_range_t frequency_range, frequency_range_t frequency_range,
uint32_t ssb_index, uint32_t ssb_index,
...@@ -3148,6 +3167,8 @@ void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PD ...@@ -3148,6 +3167,8 @@ void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PD
type0_PDCCH_CSS_config->ssb_index = ssb_index; type0_PDCCH_CSS_config->ssb_index = ssb_index;
type0_PDCCH_CSS_config->frame = frameP; type0_PDCCH_CSS_config->frame = frameP;
uint8_t ssb_slot = ssb_start_symbol/14;
uint32_t is_condition_A = (ssb_subcarrier_offset == 0); // 38.213 ch.13 uint32_t is_condition_A = (ssb_subcarrier_offset == 0); // 38.213 ch.13
uint32_t index_4msb = (mib->pdcch_ConfigSIB1.controlResourceSetZero); uint32_t index_4msb = (mib->pdcch_ConfigSIB1.controlResourceSetZero);
uint32_t index_4lsb = (mib->pdcch_ConfigSIB1.searchSpaceZero); uint32_t index_4lsb = (mib->pdcch_ConfigSIB1.searchSpaceZero);
...@@ -3361,7 +3382,7 @@ void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PD ...@@ -3361,7 +3382,7 @@ void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PD
AssertFatal(index_4lsb == 0, "38.213 Table 13-13 4 LSB out of range\n"); AssertFatal(index_4lsb == 0, "38.213 Table 13-13 4 LSB out of range\n");
// PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot
// sfn_c = SFN_C_EQ_SFN_SSB; // sfn_c = SFN_C_EQ_SFN_SSB;
type0_PDCCH_CSS_config->n_c = get_ssb_slot(type0_PDCCH_CSS_config->ssb_index); type0_PDCCH_CSS_config->n_c = ssb_slot;
switch(type0_PDCCH_CSS_config->ssb_index & 0x3){ // ssb_index(i) mod 4 switch(type0_PDCCH_CSS_config->ssb_index & 0x3){ // ssb_index(i) mod 4
case 0: case 0:
type0_PDCCH_CSS_config->first_symbol_index = 0; type0_PDCCH_CSS_config->first_symbol_index = 0;
...@@ -3383,7 +3404,7 @@ void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PD ...@@ -3383,7 +3404,7 @@ void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PD
AssertFatal(index_4lsb == 0, "38.213 Table 13-14 4 LSB out of range\n"); AssertFatal(index_4lsb == 0, "38.213 Table 13-14 4 LSB out of range\n");
// PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot
// sfn_c = SFN_C_EQ_SFN_SSB; // sfn_c = SFN_C_EQ_SFN_SSB;
type0_PDCCH_CSS_config->n_c = get_ssb_slot(type0_PDCCH_CSS_config->ssb_index); type0_PDCCH_CSS_config->n_c = ssb_slot;
switch(type0_PDCCH_CSS_config->ssb_index & 0x7){ // ssb_index(i) mod 8 switch(type0_PDCCH_CSS_config->ssb_index & 0x7){ // ssb_index(i) mod 8
case 0: case 0:
type0_PDCCH_CSS_config->first_symbol_index = 0; type0_PDCCH_CSS_config->first_symbol_index = 0;
...@@ -3399,11 +3420,11 @@ void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PD ...@@ -3399,11 +3420,11 @@ void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PD
break; break;
case 4: case 4:
type0_PDCCH_CSS_config->first_symbol_index = 12; type0_PDCCH_CSS_config->first_symbol_index = 12;
type0_PDCCH_CSS_config->n_c = get_ssb_slot(type0_PDCCH_CSS_config->ssb_index) - 1; type0_PDCCH_CSS_config->n_c = ssb_slot - 1;
break; break;
case 5: case 5:
type0_PDCCH_CSS_config->first_symbol_index = 13; type0_PDCCH_CSS_config->first_symbol_index = 13;
type0_PDCCH_CSS_config->n_c = get_ssb_slot(type0_PDCCH_CSS_config->ssb_index) - 1; type0_PDCCH_CSS_config->n_c = ssb_slot - 1;
break; break;
case 6: case 6:
type0_PDCCH_CSS_config->first_symbol_index = 0; type0_PDCCH_CSS_config->first_symbol_index = 0;
...@@ -3425,7 +3446,7 @@ void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PD ...@@ -3425,7 +3446,7 @@ void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PD
AssertFatal(index_4lsb == 0, "38.213 Table 13-15 4 LSB out of range\n"); AssertFatal(index_4lsb == 0, "38.213 Table 13-15 4 LSB out of range\n");
// PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot
// sfn_c = SFN_C_EQ_SFN_SSB; // sfn_c = SFN_C_EQ_SFN_SSB;
type0_PDCCH_CSS_config->n_c = get_ssb_slot(type0_PDCCH_CSS_config->ssb_index); type0_PDCCH_CSS_config->n_c = ssb_slot;
switch(type0_PDCCH_CSS_config->ssb_index & 0x3){ // ssb_index(i) mod 4 switch(type0_PDCCH_CSS_config->ssb_index & 0x3){ // ssb_index(i) mod 4
case 0: case 0:
type0_PDCCH_CSS_config->first_symbol_index = 4; type0_PDCCH_CSS_config->first_symbol_index = 4;
......
...@@ -131,11 +131,14 @@ void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PD ...@@ -131,11 +131,14 @@ void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PD
NR_MIB_t *mib, NR_MIB_t *mib,
uint8_t num_slot_per_frame, uint8_t num_slot_per_frame,
uint8_t ssb_subcarrier_offset, uint8_t ssb_subcarrier_offset,
uint16_t ssb_start_symbol,
NR_SubcarrierSpacing_t scs_ssb, NR_SubcarrierSpacing_t scs_ssb,
frequency_range_t frequency_range, frequency_range_t frequency_range,
uint32_t ssb_index, uint32_t ssb_index,
uint32_t ssb_offset_point_a); uint32_t ssb_offset_point_a);
uint16_t get_ssb_start_symbol(const long band, NR_SubcarrierSpacing_t scs, int i_ssb);
int16_t get_N_RA_RB (int delta_f_RA_PRACH,int delta_f_PUSCH); int16_t get_N_RA_RB (int delta_f_RA_PRACH,int delta_f_PUSCH);
bool set_dl_ptrs_values(NR_PTRS_DownlinkConfig_t *ptrs_config, bool set_dl_ptrs_values(NR_PTRS_DownlinkConfig_t *ptrs_config,
......
...@@ -318,7 +318,7 @@ typedef struct { ...@@ -318,7 +318,7 @@ typedef struct {
NR_TAG_Config_t *tag_Config; NR_TAG_Config_t *tag_Config;
NR_PHR_Config_t *phr_Config; NR_PHR_Config_t *phr_Config;
NR_RNTI_Value_t *cs_RNTI; NR_RNTI_Value_t *cs_RNTI;
NR_MIB_t *mib; NR_MIB_t *mib;
NR_BWP_Downlink_t *DLbwp[MAX_NUM_BWP]; NR_BWP_Downlink_t *DLbwp[MAX_NUM_BWP];
NR_BWP_Uplink_t *ULbwp[MAX_NUM_BWP]; NR_BWP_Uplink_t *ULbwp[MAX_NUM_BWP];
......
...@@ -104,6 +104,7 @@ int8_t nr_ue_decode_mib(module_id_t module_id, ...@@ -104,6 +104,7 @@ int8_t nr_ue_decode_mib(module_id_t module_id,
LOG_I(MAC,"[L2][MAC] decode mib\n"); LOG_I(MAC,"[L2][MAC] decode mib\n");
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
NR_ServingCellConfigCommon_t *scc = mac->scc;
frequency_range_t frequency_range; frequency_range_t frequency_range;
nr_mac_rrc_data_ind_ue( module_id, cc_id, gNB_index, NR_BCCH_BCH, (uint8_t *) pduP, 3 ); // fixed 3 bytes MIB PDU nr_mac_rrc_data_ind_ue( module_id, cc_id, gNB_index, NR_BCCH_BCH, (uint8_t *) pduP, 3 ); // fixed 3 bytes MIB PDU
...@@ -143,22 +144,37 @@ int8_t nr_ue_decode_mib(module_id_t module_id, ...@@ -143,22 +144,37 @@ int8_t nr_ue_decode_mib(module_id_t module_id,
//storing ssb index in the mac structure //storing ssb index in the mac structure
mac->mib_ssb = ssb_index; mac->mib_ssb = ssb_index;
// TODO fix this (it shouldn't be taken from config) if (get_softmodem_params()->sa == 1) {
uint8_t scs_ssb = mac->phy_config.config_req.ssb_config.scs_common;
// TODO these values shouldn't be taken from SCC in SA
get_type0_PDCCH_CSS_config_parameters(&mac->type0_PDCCH_CSS_config, uint8_t scs_ssb = *scc->ssbSubcarrierSpacing;
frame, uint32_t band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
mac->mib, int scs_scaling = 1<<scs_ssb;
nr_slots_per_frame[scs_ssb], if (scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA < 600000)
ssb_subcarrier_offset, scs_scaling = scs_scaling*3;
scs_ssb, if (scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA > 2016666)
frequency_range, scs_scaling = scs_scaling>>2;
ssb_index, uint32_t absolute_diff = (*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA);
mac->phy_config.config_req.ssb_table.ssb_offset_point_a);
uint16_t ssb_start_symbol = get_ssb_start_symbol(band,scs_ssb,ssb_index);
mac->type0_pdcch_ss_mux_pattern = mac->type0_PDCCH_CSS_config.type0_pdcch_ss_mux_pattern;
mac->type0_pdcch_ss_sfn_c = mac->type0_PDCCH_CSS_config.sfn_c; get_type0_PDCCH_CSS_config_parameters(&mac->type0_PDCCH_CSS_config,
mac->type0_pdcch_ss_n_c = mac->type0_PDCCH_CSS_config.n_c; frame,
mac->mib,
nr_slots_per_frame[scs_ssb],
ssb_subcarrier_offset,
ssb_start_symbol,
scs_ssb,
frequency_range,
ssb_index,
absolute_diff/(12*scs_scaling)-10);
mac->type0_pdcch_ss_mux_pattern = mac->type0_PDCCH_CSS_config.type0_pdcch_ss_mux_pattern;
mac->type0_pdcch_ss_sfn_c = mac->type0_PDCCH_CSS_config.sfn_c;
mac->type0_pdcch_ss_n_c = mac->type0_PDCCH_CSS_config.n_c;
}
mac->dl_config_request.sfn = mac->type0_PDCCH_CSS_config.frame; mac->dl_config_request.sfn = mac->type0_PDCCH_CSS_config.frame;
mac->dl_config_request.slot = (ssb_index>>1) + ((ssb_index>>4)<<1); // not valid for 240kHz SCS mac->dl_config_request.slot = (ssb_index>>1) + ((ssb_index>>4)<<1); // not valid for 240kHz SCS
......
...@@ -53,33 +53,7 @@ ...@@ -53,33 +53,7 @@
#include "executables/softmodem-common.h" #include "executables/softmodem-common.h"
extern RAN_CONTEXT_t RC; extern RAN_CONTEXT_t RC;
extern uint8_t SSB_Table[38];
// start symbols for SSB types A,B,C,D,E
uint16_t symbol_ssb_AC[8]={2,8,16,22,30,36,44,50};
uint16_t symbol_ssb_BD[64]={4,8,16,20,32,36,44,48,60,64,72,76,88,92,100,104,144,148,156,160,172,176,184,188,200,204,212,216,228,232,240,244,284,288,
296,300,312,316,324,328,340,344,352,356,368,372,380,384,424,428,436,440,452,456,464,468,480,484,492,496,508,512,520,524};
uint16_t symbol_ssb_E[64]={8,12,16,20,32,36,40,44,64,68,72,76,88,92,96,100,120,124,128,132,144,148,152,156,176,180,184,188,200,204,208,212,288,292,
296,300,312,316,320,324,344,348,352,356,368,372,376,380,400,404,408,412,424,428,432,436,456,460,464,468,480,484,488,492};
uint16_t get_ssb_start_symbol(const long band, NR_SubcarrierSpacing_t scs, int i_ssb) {
switch (scs) {
case NR_SubcarrierSpacing_kHz15:
return symbol_ssb_AC[i_ssb]; //type A
case NR_SubcarrierSpacing_kHz30:
if (band == 5 || band == 66)
return symbol_ssb_BD[i_ssb]; //type B
else
return symbol_ssb_AC[i_ssb]; //type C
case NR_SubcarrierSpacing_kHz120:
return symbol_ssb_BD[i_ssb]; //type D
case NR_SubcarrierSpacing_kHz240:
return symbol_ssb_E[i_ssb];
default:
AssertFatal(1 == 0, "SCS %ld not allowed for SSB \n",scs);
}
}
uint16_t get_ssboffset_pointa(NR_ServingCellConfigCommon_t *scc,const long band) { uint16_t get_ssboffset_pointa(NR_ServingCellConfigCommon_t *scc,const long band) {
...@@ -229,6 +203,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, ...@@ -229,6 +203,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP,
mib, mib,
slots_per_frame, slots_per_frame,
ssbSubcarrierOffset, ssbSubcarrierOffset,
ssb_start_symbol,
scs, scs,
FR1, FR1,
i_ssb, i_ssb,
...@@ -254,6 +229,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, ...@@ -254,6 +229,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP,
mib, mib,
slots_per_frame, slots_per_frame,
ssbSubcarrierOffset, ssbSubcarrierOffset,
ssb_start_symbol,
scs, scs,
FR1, FR1,
i_ssb, i_ssb,
...@@ -279,6 +255,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, ...@@ -279,6 +255,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP,
mib, mib,
slots_per_frame, slots_per_frame,
ssbSubcarrierOffset, ssbSubcarrierOffset,
ssb_start_symbol,
scs, scs,
FR2, FR2,
i_ssb, i_ssb,
......
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