fix for pointa and ssboffset
This commit is contained in:
committed by
Robert Schmidt
parent
5091682551
commit
79586c03f4
@@ -35,6 +35,7 @@
|
||||
#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
|
||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||
#include "PHY/sse_intrin.h"
|
||||
#include "executables/softmodem-common.h"
|
||||
|
||||
//#define DEBUG_PBCH
|
||||
//#define DEBUG_PBCH_ENCODING
|
||||
@@ -248,6 +249,9 @@ int nr_generate_pbch(nfapi_nr_dl_tti_ssb_pdu *ssb_pdu,
|
||||
for (int i=0; i<NR_PBCH_PDU_BITS; i++)
|
||||
pbch->pbch_a |= ((pbch_pdu[i>>3]>>(7-(i&7)))&1)<<i;
|
||||
|
||||
// NSA to signal no coreset0
|
||||
const int ssb_sc_offset = get_softmodem_params()->sa ? config->ssb_table.ssb_subcarrier_offset.value : 31;
|
||||
|
||||
#ifdef DEBUG_PBCH_ENCODING
|
||||
for (int i=0; i<3; i++)
|
||||
printf("pbch_pdu[%d]: 0x%02x\n", i, pbch_pdu[i]);
|
||||
@@ -265,7 +269,7 @@ int nr_generate_pbch(nfapi_nr_dl_tti_ssb_pdu *ssb_pdu,
|
||||
for (int i=0; i<3; i++)
|
||||
pbch->pbch_a |= ((ssb_index>>(5-i))&1)<<(29+i); // resp. 6th, 5th and 4th bits of ssb_index
|
||||
else
|
||||
pbch->pbch_a |= ((config->ssb_table.ssb_subcarrier_offset.value>>4)&1)<<29; //MSB of k_SSB (bit index 4)
|
||||
pbch->pbch_a |= ((ssb_sc_offset>>4)&1)<<29; //MSB of k_SSB (bit index 4)
|
||||
|
||||
LOG_D(PHY,"After extra byte: pbch_a = 0x%08x\n",pbch->pbch_a);
|
||||
|
||||
|
||||
@@ -72,8 +72,11 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame,int slot,nfapi_nr_
|
||||
ssb_start_symbol = ssb_start_symbol_abs % fp->symbols_per_slot; // start symbol wrt slot
|
||||
|
||||
// setting the first subcarrier
|
||||
fp->ssb_start_subcarrier = (12 * cfg->ssb_table.ssb_offset_point_a.value + ssb_pdu.ssb_pdu_rel15.SsbSubcarrierOffset);
|
||||
LOG_D(PHY, "SSB first subcarrier %d (%d,%d)\n", fp->ssb_start_subcarrier,cfg->ssb_table.ssb_offset_point_a.value,ssb_pdu.ssb_pdu_rel15.SsbSubcarrierOffset);
|
||||
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 : 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->ssb_start_subcarrier = (12 * prb_offset + sc_offset);
|
||||
LOG_D(PHY, "SSB first subcarrier %d (%d,%d)\n", fp->ssb_start_subcarrier, prb_offset, sc_offset);
|
||||
|
||||
LOG_D(PHY,"SS TX: frame %d, slot %d, start_symbol %d\n",frame,slot, ssb_start_symbol);
|
||||
nr_generate_pss(&txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp);
|
||||
|
||||
@@ -67,7 +67,10 @@ openair0_config_t openair0_cfg[MAX_CARDS];
|
||||
uint8_t const nr_rv_round_map[4] = {0, 2, 3, 1};
|
||||
|
||||
uint64_t get_softmodem_optmask(void) {return 0;}
|
||||
softmodem_params_t *get_softmodem_params(void) {return 0;}
|
||||
static softmodem_params_t softmodem_params;
|
||||
softmodem_params_t *get_softmodem_params(void) {
|
||||
return &softmodem_params;
|
||||
}
|
||||
|
||||
void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {}
|
||||
|
||||
@@ -174,6 +177,7 @@ int main(int argc, char **argv)
|
||||
int ssb_subcarrier_offset = 0;
|
||||
|
||||
channel_desc_t *gNB2UE;
|
||||
get_softmodem_params()->sa = 0;
|
||||
|
||||
//uint8_t extended_prefix_flag=0;
|
||||
//int8_t interf1=-21,interf2=-21;
|
||||
|
||||
@@ -335,22 +335,13 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, int pusch_AntennaPorts,
|
||||
cfg->num_tlv++;
|
||||
|
||||
// SSB Table Configuration
|
||||
int scs_scaling = 1<<(cfg->ssb_config.scs_common.value);
|
||||
if (scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA < 600000)
|
||||
scs_scaling = scs_scaling*3;
|
||||
if (scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA > 2016666)
|
||||
scs_scaling = scs_scaling>>2;
|
||||
uint32_t absolute_diff = (*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA);
|
||||
|
||||
RC.nrmac[Mod_idP]->ssb_SubcarrierOffset = absolute_diff%(12*scs_scaling);
|
||||
int sco = 31; // no SIB1
|
||||
if(get_softmodem_params()->sa) {
|
||||
sco = RC.nrmac[Mod_idP]->ssb_SubcarrierOffset;
|
||||
if(frequency_range == FR1)
|
||||
sco <<= cfg->ssb_config.scs_common.value; // 38.211 section 7.4.3.1 in FR1 it is expresses in terms of 15kHz SCS
|
||||
}
|
||||
|
||||
cfg->ssb_table.ssb_offset_point_a.value = absolute_diff/(12*scs_scaling) - 10; //absoluteFrequencySSB is the central frequency of SSB which is made by 20RBs in total
|
||||
const int scaling_5khz = scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA < 600000 ? 3 : 1;
|
||||
int sco = (absolute_diff*scaling_5khz) % 24;
|
||||
if(frequency_range == FR2)
|
||||
sco >>= 1; // this assumes 120kHz SCS for SSB and subCarrierSpacingCommon (only option supported by OAI for
|
||||
const int scs_scaling = frequency_range == FR2 ? 1 << (*scc->ssbSubcarrierSpacing - 2) : 1 << *scc->ssbSubcarrierSpacing;
|
||||
cfg->ssb_table.ssb_offset_point_a.value = absolute_diff/(12*scaling_5khz) - 10*scs_scaling; //absoluteFrequencySSB is the central frequency of SSB which is made by 20RBs in total
|
||||
cfg->ssb_table.ssb_offset_point_a.tl.tag = NFAPI_NR_CONFIG_SSB_OFFSET_POINT_A_TAG;
|
||||
cfg->num_tlv++;
|
||||
cfg->ssb_table.ssb_period.value = *scc->ssb_periodicityServingCell;
|
||||
@@ -360,6 +351,9 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, int pusch_AntennaPorts,
|
||||
cfg->ssb_table.ssb_subcarrier_offset.tl.tag = NFAPI_NR_CONFIG_SSB_SUBCARRIER_OFFSET_TAG;
|
||||
cfg->num_tlv++;
|
||||
|
||||
RC.nrmac[Mod_idP]->ssb_SubcarrierOffset = cfg->ssb_table.ssb_subcarrier_offset.value;
|
||||
RC.nrmac[Mod_idP]->ssb_OffsetPointA = cfg->ssb_table.ssb_offset_point_a.value;
|
||||
|
||||
switch (scc->ssb_PositionsInBurst->present) {
|
||||
case 1 :
|
||||
cfg->ssb_table.ssb_mask_list[0].ssb_mask.value = scc->ssb_PositionsInBurst->choice.shortBitmap.buf[0]<<24;
|
||||
|
||||
@@ -54,52 +54,6 @@
|
||||
|
||||
extern RAN_CONTEXT_t RC;
|
||||
|
||||
|
||||
uint16_t get_ssboffset_pointa(NR_ServingCellConfigCommon_t *scc,const long band) {
|
||||
|
||||
int ratio;
|
||||
switch (*scc->ssbSubcarrierSpacing) {
|
||||
case NR_SubcarrierSpacing_kHz15:
|
||||
AssertFatal(band <= 95,
|
||||
"Band %ld is not possible for SSB with 15 kHz SCS\n",
|
||||
band);
|
||||
// no band available above 3GHz using 15kHz
|
||||
ratio = 3; // NRARFCN step is 5 kHz
|
||||
break;
|
||||
case NR_SubcarrierSpacing_kHz30:
|
||||
AssertFatal(band <= 96,
|
||||
"Band %ld is not possible for SSB with 30 kHz SCS\n",
|
||||
band);
|
||||
if (band == 46 || band == 48 || band == 77 ||
|
||||
band == 78 || band == 79 || band == 96) // above 3GHz
|
||||
ratio = 2; // NRARFCN step is 15 kHz
|
||||
else
|
||||
ratio = 6; // NRARFCN step is 5 kHz
|
||||
break;
|
||||
case NR_SubcarrierSpacing_kHz120:
|
||||
AssertFatal(band >= 257,
|
||||
"Band %ld is not possible for SSB with 120 kHz SCS\n",
|
||||
band);
|
||||
ratio = 2; // NRARFCN step is 15 kHz
|
||||
break;
|
||||
case NR_SubcarrierSpacing_kHz240:
|
||||
AssertFatal(band >= 257,
|
||||
"Band %ld is not possible for SSB with 240 kHz SCS\n",
|
||||
band);
|
||||
ratio = 4; // NRARFCN step is 15 kHz
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1 == 0, "SCS %ld not allowed for SSB \n",
|
||||
*scc->ssbSubcarrierSpacing);
|
||||
}
|
||||
|
||||
const uint32_t ssb_offset0 = *scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA;
|
||||
|
||||
return (ssb_offset0/(ratio*12) - 10); // absoluteFrequencySSB is the center of SSB
|
||||
|
||||
}
|
||||
|
||||
|
||||
void schedule_ssb(frame_t frame, sub_frame_t slot,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
nfapi_nr_dl_tti_request_body_t *dl_req,
|
||||
@@ -190,7 +144,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
|
||||
|
||||
NR_SubcarrierSpacing_t scs = *scc->ssbSubcarrierSpacing;
|
||||
const long band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
|
||||
uint16_t offset_pointa = get_ssboffset_pointa(scc,band);
|
||||
const uint16_t offset_pointa = gNB->ssb_OffsetPointA;
|
||||
uint8_t ssbSubcarrierOffset = gNB->ssb_SubcarrierOffset;
|
||||
|
||||
const BIT_STRING_t *shortBitmap = &scc->ssb_PositionsInBurst->choice.shortBitmap;
|
||||
@@ -207,8 +161,9 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
|
||||
ssb_start_symbol = get_ssb_start_symbol(band,scs,i_ssb);
|
||||
// if start symbol is in current slot, schedule current SSB, fill VRB map and call get_type0_PDCCH_CSS_config_parameters
|
||||
if ((ssb_start_symbol/14) == rel_slot){
|
||||
const int prb_offset = offset_pointa >> scs;
|
||||
schedule_ssb(frameP, slotP, scc, dl_req, i_ssb, ssbSubcarrierOffset, offset_pointa, (*(uint32_t*)cc->MIB_pdu.payload) & ((1<<24)-1));
|
||||
fill_ssb_vrb_map(cc, offset_pointa, ssb_start_symbol, CC_id);
|
||||
fill_ssb_vrb_map(cc, prb_offset, ssbSubcarrierOffset, ssb_start_symbol, CC_id);
|
||||
if (get_softmodem_params()->sa == 1) {
|
||||
get_type0_PDCCH_CSS_config_parameters(&gNB->type0_PDCCH_CSS_config[i_ssb],
|
||||
frameP,
|
||||
@@ -221,7 +176,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
|
||||
band,
|
||||
i_ssb,
|
||||
ssb_frame_periodicity,
|
||||
offset_pointa);
|
||||
prb_offset);
|
||||
gNB->type0_PDCCH_CSS_config[i_ssb].active = true;
|
||||
}
|
||||
}
|
||||
@@ -235,8 +190,9 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
|
||||
ssb_start_symbol = get_ssb_start_symbol(band,scs,i_ssb);
|
||||
// if start symbol is in current slot, schedule current SSB, fill VRB map and call get_type0_PDCCH_CSS_config_parameters
|
||||
if ((ssb_start_symbol/14) == rel_slot){
|
||||
const int prb_offset = offset_pointa >> scs;
|
||||
schedule_ssb(frameP, slotP, scc, dl_req, i_ssb, ssbSubcarrierOffset, offset_pointa, (*(uint32_t*)cc->MIB_pdu.payload) & ((1<<24)-1));
|
||||
fill_ssb_vrb_map(cc, offset_pointa, ssb_start_symbol, CC_id);
|
||||
fill_ssb_vrb_map(cc, prb_offset, ssbSubcarrierOffset, ssb_start_symbol, CC_id);
|
||||
if (get_softmodem_params()->sa == 1) {
|
||||
get_type0_PDCCH_CSS_config_parameters(&gNB->type0_PDCCH_CSS_config[i_ssb],
|
||||
frameP,
|
||||
@@ -249,7 +205,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
|
||||
band,
|
||||
i_ssb,
|
||||
ssb_frame_periodicity,
|
||||
offset_pointa);
|
||||
prb_offset);
|
||||
gNB->type0_PDCCH_CSS_config[i_ssb].active = true;
|
||||
}
|
||||
}
|
||||
@@ -264,8 +220,9 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
|
||||
ssb_start_symbol = get_ssb_start_symbol(band,scs,i_ssb);
|
||||
// if start symbol is in current slot, schedule current SSB, fill VRB map and call get_type0_PDCCH_CSS_config_parameters
|
||||
if ((ssb_start_symbol/14) == rel_slot){
|
||||
const int prb_offset = offset_pointa >> (scs-2); // reference 60kHz
|
||||
schedule_ssb(frameP, slotP, scc, dl_req, i_ssb, ssbSubcarrierOffset, offset_pointa, (*(uint32_t*)cc->MIB_pdu.payload) & ((1<<24)-1));
|
||||
fill_ssb_vrb_map(cc, offset_pointa, ssb_start_symbol, CC_id);
|
||||
fill_ssb_vrb_map(cc, prb_offset, ssbSubcarrierOffset, ssb_start_symbol, CC_id);
|
||||
const NR_TDD_UL_DL_Pattern_t *tdd = &scc->tdd_UL_DL_ConfigurationCommon->pattern1;
|
||||
const int n_slots_frame = nr_slots_per_frame[*scc->ssbSubcarrierSpacing];
|
||||
// FR2 is only TDD, to be fixed for flexible TDD
|
||||
@@ -286,7 +243,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
|
||||
band,
|
||||
i_ssb,
|
||||
ssb_frame_periodicity,
|
||||
offset_pointa);
|
||||
prb_offset);
|
||||
gNB->type0_PDCCH_CSS_config[i_ssb].active = true;
|
||||
}
|
||||
}
|
||||
@@ -306,7 +263,7 @@ void schedule_nr_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframe
|
||||
//----------------------------------------
|
||||
}
|
||||
|
||||
void fill_ssb_vrb_map (NR_COMMON_channels_t *cc, int rbStart, uint16_t symStart, int CC_id) {
|
||||
void fill_ssb_vrb_map (NR_COMMON_channels_t *cc, int rbStart, int ssb_subcarrier_offset, uint16_t symStart, int CC_id) {
|
||||
|
||||
AssertFatal(*cc->ServingCellConfigCommon->ssbSubcarrierSpacing !=
|
||||
NR_SubcarrierSpacing_kHz240,
|
||||
@@ -314,7 +271,8 @@ void fill_ssb_vrb_map (NR_COMMON_channels_t *cc, int rbStart, uint16_t symStart
|
||||
|
||||
uint16_t *vrb_map = cc[CC_id].vrb_map;
|
||||
|
||||
for (int rb = 0; rb < 20; rb++)
|
||||
const int extra_prb = ssb_subcarrier_offset > 0;
|
||||
for (int rb = 0; rb < 20+extra_prb; rb++)
|
||||
vrb_map[rbStart + rb] = SL_to_bitmap(symStart, 4);
|
||||
|
||||
}
|
||||
|
||||
@@ -434,7 +434,7 @@ int binomial(int n, int k);
|
||||
|
||||
bool is_xlsch_in_slot(uint64_t bitmap, sub_frame_t slot);
|
||||
|
||||
void fill_ssb_vrb_map (NR_COMMON_channels_t *cc, int rbStart, uint16_t symStart, int CC_id);
|
||||
void fill_ssb_vrb_map (NR_COMMON_channels_t *cc, int rbStart, int ssb_subcarrier_offset, uint16_t symStart, int CC_id);
|
||||
|
||||
|
||||
/* \brief Function to indicate a received SDU on ULSCH.
|
||||
|
||||
@@ -765,6 +765,7 @@ typedef struct gNB_MAC_INST_s {
|
||||
int pusch_failure_thres;
|
||||
/// Subcarrier Offset
|
||||
int ssb_SubcarrierOffset;
|
||||
int ssb_OffsetPointA;
|
||||
/// SIB1 Time domain allocation
|
||||
int sib1_tda;
|
||||
int minRXTXTIMEpdsch;
|
||||
|
||||
@@ -226,17 +226,13 @@ uint8_t do_MIB_NR(gNB_RRC_INST *rrc,uint32_t frame) {
|
||||
AssertFatal(scc->ssbSubcarrierSpacing != NULL, "scc->ssbSubcarrierSpacing is null\n");
|
||||
int band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
|
||||
frequency_range_t frequency_range = band<100?FR1:FR2;
|
||||
int scs_scaling = 1<<*scc->ssbSubcarrierSpacing;
|
||||
if (scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA < 600000)
|
||||
scs_scaling = scs_scaling*3;
|
||||
if (scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA > 2016666)
|
||||
scs_scaling = scs_scaling>>2;
|
||||
uint32_t absolute_diff = (*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA);
|
||||
int ssb_subcarrier_offset = 31; // default value for NSA
|
||||
if (get_softmodem_params()->sa) {
|
||||
ssb_subcarrier_offset = absolute_diff%(12*scs_scaling);
|
||||
if(frequency_range == FR1)
|
||||
ssb_subcarrier_offset <<= *scc->ssbSubcarrierSpacing;
|
||||
uint32_t absolute_diff = (*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA);
|
||||
int scs_scaling = scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA < 600000 ? 3 : 1;
|
||||
ssb_subcarrier_offset = (absolute_diff*scs_scaling)%24;
|
||||
if(frequency_range == FR2)
|
||||
ssb_subcarrier_offset >>= 1; // this assumes 120kHz SCS for SSB and subCarrierSpacingCommon (only option supported by OAI for now)
|
||||
}
|
||||
mib->message.choice.mib->ssb_SubcarrierOffset = ssb_subcarrier_offset&15;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user