Commit 3e7a0820 authored by francescomani's avatar francescomani

check if SSB is on the sync raster for SA

parent 2fa8284a
......@@ -94,6 +94,49 @@
extern uint16_t sf_ahead;
int macrlc_has_f1 = 0;
// synchronization raster per band tables
// (38.101-1 Table 5.4.3.3-1 and 38.101-2 Table 5.4.3.3-1)
// band nb, sub-carrier spacing index, Range of GSCN (First, Step size, Last)
const uint32_t sync_raster[37][5] = {
{1, 0, 5279, 1, 5419},
{2, 0, 4829, 1, 4969},
{3, 0, 4517, 1, 4693},
{5, 0, 2177, 1, 2230},
{5, 1, 2183, 1, 2224},
{7, 0, 6554, 1, 6718},
{8, 0, 2318, 1, 2395},
{12, 0, 1828, 1, 1858},
{20, 0, 1982, 1, 2047},
{25, 0, 4829, 1, 4981},
{28, 0, 1901, 1, 2002},
{34, 0, 5030, 1, 5056},
{38, 0, 6431, 1, 6544},
{39, 0, 4706, 1, 4795},
{40, 0, 5756, 1, 5995},
{41, 0, 6246, 3, 6717},
{41, 1, 6254, 3, 6714},
{50, 0, 3584, 1, 3787},
{51, 0, 3572, 1, 3574},
{66, 0, 5279, 1, 5494},
{66, 1, 5285, 1, 5488},
{70, 0, 4993, 1, 5044},
{71, 0, 1547, 1, 1624},
{74, 0, 3692, 1, 3790},
{75, 0, 3584, 1, 3787},
{76, 0, 3572, 1, 3574},
{77, 1, 7711, 1, 8329},
{78, 1, 7711, 1, 8051},
{79, 1, 8480, 16, 8880},
{257, 3, 22388, 1, 22558},
{257, 4, 22390, 2, 22556},
{258, 3, 22257, 1, 22443},
{258, 4, 22258, 2, 22442},
{260, 3, 22995, 1, 23166},
{260, 4, 22996, 2, 23164},
{261, 3, 22446, 1, 22492},
{261, 4, 22446, 2, 22490},
};
extern int config_check_band_frequencies(int ind, int16_t band, uint64_t downlink_frequency,
int32_t uplink_frequency_offset, uint32_t frame_type);
......@@ -1073,7 +1116,59 @@ void config_security(gNB_RRC_INST *rrc)
}
}
void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) {
// Section 5.4.3 of 38.101-1 and -2
void check_ssb_raster(long absolutefreqssb, int band, int scs)
{
int start_GSCN = 0, step_GSCN = 0, end_GSCN = 0;
for (int i = 0; i < sizeof(sync_raster) / 20; i++) {
if (sync_raster[i][0] == band &&
sync_raster[i][1] == scs) {
start_GSCN = sync_raster[i][2];
step_GSCN = sync_raster[i][3];
end_GSCN = sync_raster[i][4];
break;
}
}
AssertFatal(start_GSCN != 0, "Couldn't find band %d with SCS %d\n", band, scs);
uint64_t freq = from_nrarfcn(band, scs, absolutefreqssb);
int GSCN;
if (freq <= 3000000000) {
int N = 0;
int M = 0;
for (int k = 0; k < 3; k++) {
M = (k << 1) + 1;
if ((freq - M * 50000) % 1200000) {
N = (freq - M * 50000) / 1200000;
break;
}
}
AssertFatal(N != 0, "absoluteFrequencySSB %ld (%lu) not on the synchronization raster (N * 1200kHz + M * 50 kHz)\n",
absolutefreqssb, freq);
GSCN = (3 * N) + (M - 3) / 2;
}
else if (freq <= 24250000000) {
AssertFatal((freq - 3000000000) % 1440000 == 0,
"absoluteFrequencySSB %ld (%lu) not on the synchronization raster (3000 MHz + N * 1.44 MHz)\n",
absolutefreqssb, freq);
GSCN = ((freq - 3000000000) / 1440000) + 7499;
}
else {
AssertFatal((freq - 24250080000) % 17280000 == 0,
"absoluteFrequencySSB %ld (%lu) not on the synchronization raster (24250.08 MHz + N * 17.28 MHz)\n",
absolutefreqssb, freq);
GSCN = ((freq - 24250080000) / 17280000) + 22256;
}
AssertFatal(GSCN >= start_GSCN && GSCN <= end_GSCN,
"GSCN %d corresponding to absoluteFrequencySSB %ld does not belong to GSCN range for band %d\n",
GSCN, absolutefreqssb, band);
int rel_GSCN = GSCN - start_GSCN;
AssertFatal(rel_GSCN % step_GSCN == 0,
"GSCN %d corresponding to absoluteFrequencySSB %ld not in accordance with GSCN step for band %d\n",
GSCN, absolutefreqssb, band);
}
void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc)
{
int num_gnbs = 0;
char aprefix[MAX_OPTNAME_SIZE*2 + 8];
......@@ -1106,11 +1201,10 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) {
num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt;
AssertFatal (i<num_gnbs,"Failed to parse config file no %uth element in %s \n",i, GNB_CONFIG_STRING_ACTIVE_GNBS);
if (num_gnbs>0) {
if (num_gnbs > 0) {
// Output a list of all gNBs. ////////// Identification parameters
config_getlist( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL);
if (GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr == NULL) {
// Calculate a default gNB ID
if (get_softmodem_params()->sa) {
......@@ -1129,7 +1223,7 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) {
config_getlist(&SCCsParamList, NULL, 0, aprefix);
if (SCCsParamList.numelt > 0) {
sprintf(aprefix, "%s.[%i].%s.[%i]", GNB_CONFIG_STRING_GNB_LIST,0,GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON, 0);
config_get( SCCsParams,sizeof(SCCsParams)/sizeof(paramdef_t),aprefix);
config_get(SCCsParams,sizeof(SCCsParams) / sizeof(paramdef_t), aprefix);
LOG_I(RRC,"Read in ServingCellConfigCommon (PhysCellId %d, ABSFREQSSB %d, DLBand %d, ABSFREQPOINTA %d, DLBW %d,RACH_TargetReceivedPower %d\n",
(int)*scc->physCellId,
(int)*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB,
......@@ -1137,7 +1231,12 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) {
(int)scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA,
(int)scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth,
(int)scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.preambleReceivedTargetPower);
fix_scc(scc,ssb_bitmap);
// SSB of the PCell is always on the sync raster
if (get_softmodem_params()->sa)
check_ssb_raster(*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB,
*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0],
*scc->ssbSubcarrierSpacing);
fix_scc(scc, ssb_bitmap);
}
sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0);
......
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