Refactor reconfigurationWithSync ASN.1 to separate function
Will be reused later for handover. Co-authored-by: batuhanduyuler <batuhan.duyuler@firecell.io>
This commit is contained in:
co-authored by
batuhanduyuler
parent
c854b9cebb
commit
fef589cf88
@@ -3293,46 +3293,8 @@ NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigC
|
||||
secondaryCellGroup->spCellConfig->reconfigurationWithSync =
|
||||
calloc(1, sizeof(*secondaryCellGroup->spCellConfig->reconfigurationWithSync));
|
||||
|
||||
NR_ReconfigurationWithSync_t *reconfigurationWithSync = secondaryCellGroup->spCellConfig->reconfigurationWithSync;
|
||||
reconfigurationWithSync->spCellConfigCommon = clone_ServingCellConfigCommon(servingcellconfigcommon);
|
||||
reconfigurationWithSync->newUE_Identity =
|
||||
(get_softmodem_params()->phy_test == 1) ? 0x1234 : (taus() & 0xffff);
|
||||
reconfigurationWithSync->t304 = NR_ReconfigurationWithSync__t304_ms2000;
|
||||
reconfigurationWithSync->rach_ConfigDedicated = NULL;
|
||||
reconfigurationWithSync->ext1 = NULL;
|
||||
|
||||
// For 2-step contention-free random access procedure
|
||||
reconfigurationWithSync->rach_ConfigDedicated = calloc(1, sizeof(*reconfigurationWithSync->rach_ConfigDedicated));
|
||||
reconfigurationWithSync->rach_ConfigDedicated->present = NR_ReconfigurationWithSync__rach_ConfigDedicated_PR_uplink;
|
||||
reconfigurationWithSync->rach_ConfigDedicated->choice.uplink = calloc(1, sizeof(struct NR_RACH_ConfigDedicated));
|
||||
reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra = calloc(1, sizeof(struct NR_CFRA));
|
||||
reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->ra_Prioritization = NULL;
|
||||
reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions = calloc(1, sizeof(struct NR_CFRA__occasions));
|
||||
memcpy(&reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->rach_ConfigGeneric,
|
||||
&servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric,
|
||||
sizeof(NR_RACH_ConfigGeneric_t));
|
||||
asn1cCallocOne(reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->ssb_perRACH_Occasion,
|
||||
NR_CFRA__occasions__ssb_perRACH_Occasion_one);
|
||||
reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.present = NR_CFRA__resources_PR_ssb;
|
||||
reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb =
|
||||
calloc(1, sizeof(struct NR_CFRA__resources__ssb));
|
||||
reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ra_ssb_OccasionMaskIndex = 0;
|
||||
|
||||
int n_ssb = 0;
|
||||
struct NR_CFRA_SSB_Resource *ssbElem[64];
|
||||
for (int i = 0; i < 64; i++) {
|
||||
if ((bitmap >> (63 - i)) & 0x01) {
|
||||
ssbElem[n_ssb] = calloc(1, sizeof(struct NR_CFRA_SSB_Resource));
|
||||
ssbElem[n_ssb]->ssb = i;
|
||||
ssbElem[n_ssb]->ra_PreambleIndex = 63 - (uid % 64);
|
||||
asn1cSeqAdd(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources
|
||||
.choice.ssb->ssb_ResourceList.list,
|
||||
ssbElem[n_ssb]);
|
||||
n_ssb++;
|
||||
}
|
||||
}
|
||||
|
||||
secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->ext1 = NULL;
|
||||
rnti_t rnti = get_softmodem_params()->phy_test == 1 ? 0x1234 : (taus() & 0xffff);
|
||||
secondaryCellGroup->spCellConfig->reconfigurationWithSync = get_reconfiguration_with_sync(rnti, uid, servingcellconfigcommon);
|
||||
|
||||
secondaryCellGroup->spCellConfig->rlf_TimersAndConstants =
|
||||
calloc(1, sizeof(*secondaryCellGroup->spCellConfig->rlf_TimersAndConstants));
|
||||
@@ -3602,3 +3564,43 @@ NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigC
|
||||
}
|
||||
return secondaryCellGroup;
|
||||
}
|
||||
|
||||
NR_ReconfigurationWithSync_t *get_reconfiguration_with_sync(rnti_t rnti, uid_t uid, const NR_ServingCellConfigCommon_t *scc)
|
||||
{
|
||||
NR_ReconfigurationWithSync_t *reconfigurationWithSync = calloc(1, sizeof(*reconfigurationWithSync));
|
||||
reconfigurationWithSync->newUE_Identity = rnti;
|
||||
reconfigurationWithSync->t304 = NR_ReconfigurationWithSync__t304_ms2000;
|
||||
reconfigurationWithSync->rach_ConfigDedicated = NULL;
|
||||
reconfigurationWithSync->ext1 = NULL;
|
||||
|
||||
reconfigurationWithSync->spCellConfigCommon = clone_ServingCellConfigCommon(scc);
|
||||
|
||||
reconfigurationWithSync->rach_ConfigDedicated = calloc(1, sizeof(*reconfigurationWithSync->rach_ConfigDedicated));
|
||||
reconfigurationWithSync->rach_ConfigDedicated->present = NR_ReconfigurationWithSync__rach_ConfigDedicated_PR_uplink;
|
||||
NR_RACH_ConfigDedicated_t *uplink = calloc(1, sizeof(*uplink));
|
||||
reconfigurationWithSync->rach_ConfigDedicated->choice.uplink = uplink;
|
||||
uplink->ra_Prioritization = NULL;
|
||||
uplink->cfra = calloc(1, sizeof(struct NR_CFRA));
|
||||
uplink->cfra->ext1 = NULL;
|
||||
uplink->cfra->occasions = calloc(1, sizeof(struct NR_CFRA__occasions));
|
||||
memcpy(&uplink->cfra->occasions->rach_ConfigGeneric,
|
||||
&scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric,
|
||||
sizeof(NR_RACH_ConfigGeneric_t));
|
||||
asn1cCallocOne(uplink->cfra->occasions->ssb_perRACH_Occasion, NR_CFRA__occasions__ssb_perRACH_Occasion_one);
|
||||
uplink->cfra->resources.present = NR_CFRA__resources_PR_ssb;
|
||||
uplink->cfra->resources.choice.ssb = calloc(1, sizeof(struct NR_CFRA__resources__ssb));
|
||||
uplink->cfra->resources.choice.ssb->ra_ssb_OccasionMaskIndex = 0;
|
||||
|
||||
uint64_t bitmap = get_ssb_bitmap(scc);
|
||||
for (int i = 0; i < 64; i++) {
|
||||
if (((bitmap >> (63 - i)) & 0x01) == 0)
|
||||
continue;
|
||||
|
||||
NR_CFRA_SSB_Resource_t *ssbElem = calloc(1, sizeof(*ssbElem));
|
||||
ssbElem->ssb = i;
|
||||
ssbElem->ra_PreambleIndex = 63 - (uid % 64);
|
||||
asn1cSeqAdd(&uplink->cfra->resources.choice.ssb->ssb_ResourceList.list, ssbElem);
|
||||
}
|
||||
|
||||
return reconfigurationWithSync;
|
||||
}
|
||||
|
||||
@@ -102,4 +102,6 @@ NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigC
|
||||
const nr_mac_config_t *configuration,
|
||||
int uid);
|
||||
|
||||
NR_ReconfigurationWithSync_t *get_reconfiguration_with_sync(rnti_t rnti, uid_t uid, const NR_ServingCellConfigCommon_t *scc);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user