fix to handle a scenario where a CHOICE ASN1 structure changes type in a reconfiguration
This commit is contained in:
@@ -977,21 +977,7 @@ static void setup_pdschconfig(NR_PDSCH_Config_t *source, NR_PDSCH_Config_t *targ
|
|||||||
target->rbg_Size = source->rbg_Size;
|
target->rbg_Size = source->rbg_Size;
|
||||||
UPDATE_MAC_IE(target->mcs_Table, source->mcs_Table, long);
|
UPDATE_MAC_IE(target->mcs_Table, source->mcs_Table, long);
|
||||||
UPDATE_MAC_IE(target->maxNrofCodeWordsScheduledByDCI, source->maxNrofCodeWordsScheduledByDCI, long);
|
UPDATE_MAC_IE(target->maxNrofCodeWordsScheduledByDCI, source->maxNrofCodeWordsScheduledByDCI, long);
|
||||||
target->prb_BundlingType.present = source->prb_BundlingType.present;
|
UPDATE_MAC_NP_IE(target->prb_BundlingType, source->prb_BundlingType, struct NR_PDSCH_Config__prb_BundlingType);
|
||||||
switch (source->prb_BundlingType.present) {
|
|
||||||
case NR_PDSCH_Config__prb_BundlingType_PR_staticBundling:
|
|
||||||
UPDATE_MAC_IE(target->prb_BundlingType.choice.staticBundling,
|
|
||||||
source->prb_BundlingType.choice.staticBundling,
|
|
||||||
struct NR_PDSCH_Config__prb_BundlingType__staticBundling);
|
|
||||||
break;
|
|
||||||
case NR_PDSCH_Config__prb_BundlingType_PR_dynamicBundling:
|
|
||||||
UPDATE_MAC_IE(target->prb_BundlingType.choice.dynamicBundling,
|
|
||||||
source->prb_BundlingType.choice.dynamicBundling,
|
|
||||||
struct NR_PDSCH_Config__prb_BundlingType__dynamicBundling);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
AssertFatal(source->zp_CSI_RS_ResourceToAddModList == NULL, "Not handled\n");
|
AssertFatal(source->zp_CSI_RS_ResourceToAddModList == NULL, "Not handled\n");
|
||||||
AssertFatal(source->aperiodic_ZP_CSI_RS_ResourceSetsToAddModList == NULL, "Not handled\n");
|
AssertFatal(source->aperiodic_ZP_CSI_RS_ResourceSetsToAddModList == NULL, "Not handled\n");
|
||||||
AssertFatal(source->sp_ZP_CSI_RS_ResourceSetsToAddModList == NULL, "Not handled\n");
|
AssertFatal(source->sp_ZP_CSI_RS_ResourceSetsToAddModList == NULL, "Not handled\n");
|
||||||
@@ -1117,30 +1103,48 @@ static void setup_pucchconfig(NR_PUCCH_Config_t *source, NR_PUCCH_Config_t *targ
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void handle_aperiodic_srs_type(struct NR_SRS_ResourceSet__resourceType__aperiodic *source,
|
||||||
|
struct NR_SRS_ResourceSet__resourceType__aperiodic *target)
|
||||||
|
{
|
||||||
|
target->aperiodicSRS_ResourceTrigger = source->aperiodicSRS_ResourceTrigger;
|
||||||
|
if (source->csi_RS)
|
||||||
|
UPDATE_MAC_IE(target->csi_RS, source->csi_RS, NR_NZP_CSI_RS_ResourceId_t);
|
||||||
|
UPDATE_MAC_IE(target->slotOffset, source->slotOffset, long);
|
||||||
|
if (source->ext1 && source->ext1->aperiodicSRS_ResourceTriggerList)
|
||||||
|
UPDATE_MAC_IE(target->ext1->aperiodicSRS_ResourceTriggerList,
|
||||||
|
source->ext1->aperiodicSRS_ResourceTriggerList,
|
||||||
|
struct NR_SRS_ResourceSet__resourceType__aperiodic__ext1__aperiodicSRS_ResourceTriggerList);
|
||||||
|
}
|
||||||
|
|
||||||
static void setup_srsresourceset(NR_SRS_ResourceSet_t *target, NR_SRS_ResourceSet_t *source)
|
static void setup_srsresourceset(NR_SRS_ResourceSet_t *target, NR_SRS_ResourceSet_t *source)
|
||||||
{
|
{
|
||||||
target->srs_ResourceSetId = source->srs_ResourceSetId;
|
target->srs_ResourceSetId = source->srs_ResourceSetId;
|
||||||
if (source->srs_ResourceIdList)
|
if (source->srs_ResourceIdList)
|
||||||
UPDATE_MAC_IE(target->srs_ResourceIdList, source->srs_ResourceIdList, struct NR_SRS_ResourceSet__srs_ResourceIdList);
|
UPDATE_MAC_IE(target->srs_ResourceIdList, source->srs_ResourceIdList, struct NR_SRS_ResourceSet__srs_ResourceIdList);
|
||||||
target->resourceType.present = source->resourceType.present;
|
|
||||||
switch (source->resourceType.present) {
|
if (target->resourceType.present != source->resourceType.present) {
|
||||||
case NR_SRS_ResourceSet__resourceType_PR_aperiodic:
|
UPDATE_MAC_NP_IE(target->resourceType, source->resourceType, struct NR_SRS_ResourceSet__resourceType);
|
||||||
UPDATE_MAC_IE(target->resourceType.choice.aperiodic,
|
}
|
||||||
source->resourceType.choice.aperiodic,
|
else {
|
||||||
struct NR_SRS_ResourceSet__resourceType__aperiodic);
|
switch (source->resourceType.present) {
|
||||||
break;
|
case NR_SRS_ResourceSet__resourceType_PR_aperiodic:
|
||||||
case NR_SRS_ResourceSet__resourceType_PR_periodic:
|
handle_aperiodic_srs_type(source->resourceType.choice.aperiodic, target->resourceType.choice.aperiodic);
|
||||||
UPDATE_MAC_IE(target->resourceType.choice.periodic,
|
break;
|
||||||
source->resourceType.choice.periodic,
|
case NR_SRS_ResourceSet__resourceType_PR_periodic:
|
||||||
struct NR_SRS_ResourceSet__resourceType__periodic);
|
if (source->resourceType.choice.periodic->associatedCSI_RS)
|
||||||
break;
|
UPDATE_MAC_IE(target->resourceType.choice.periodic->associatedCSI_RS,
|
||||||
case NR_SRS_ResourceSet__resourceType_PR_semi_persistent:
|
source->resourceType.choice.periodic->associatedCSI_RS,
|
||||||
UPDATE_MAC_IE(target->resourceType.choice.semi_persistent,
|
NR_NZP_CSI_RS_ResourceId_t);
|
||||||
source->resourceType.choice.semi_persistent,
|
break;
|
||||||
struct NR_SRS_ResourceSet__resourceType__semi_persistent);
|
case NR_SRS_ResourceSet__resourceType_PR_semi_persistent:
|
||||||
break;
|
if (source->resourceType.choice.semi_persistent->associatedCSI_RS)
|
||||||
default:
|
UPDATE_MAC_IE(target->resourceType.choice.semi_persistent->associatedCSI_RS,
|
||||||
break;
|
source->resourceType.choice.semi_persistent->associatedCSI_RS,
|
||||||
|
NR_NZP_CSI_RS_ResourceId_t);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
target->usage = source->usage;
|
target->usage = source->usage;
|
||||||
UPDATE_MAC_IE(target->alpha, source->alpha, NR_Alpha_t);
|
UPDATE_MAC_IE(target->alpha, source->alpha, NR_Alpha_t);
|
||||||
@@ -1546,46 +1550,52 @@ static void configure_maccellgroup(NR_UE_MAC_INST_t *mac, const NR_MAC_CellGroup
|
|||||||
|
|
||||||
static void configure_csi_resourcemapping(NR_CSI_RS_ResourceMapping_t *target, NR_CSI_RS_ResourceMapping_t *source)
|
static void configure_csi_resourcemapping(NR_CSI_RS_ResourceMapping_t *target, NR_CSI_RS_ResourceMapping_t *source)
|
||||||
{
|
{
|
||||||
target->frequencyDomainAllocation.present = source->frequencyDomainAllocation.present;
|
if (target->frequencyDomainAllocation.present != source->frequencyDomainAllocation.present) {
|
||||||
switch (source->frequencyDomainAllocation.present) {
|
UPDATE_MAC_NP_IE(target->frequencyDomainAllocation,
|
||||||
case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row1:
|
source->frequencyDomainAllocation,
|
||||||
target->frequencyDomainAllocation.choice.row1.size = source->frequencyDomainAllocation.choice.row1.size;
|
struct NR_CSI_RS_ResourceMapping__frequencyDomainAllocation);
|
||||||
target->frequencyDomainAllocation.choice.row1.bits_unused = source->frequencyDomainAllocation.choice.row1.bits_unused;
|
}
|
||||||
if (!target->frequencyDomainAllocation.choice.row1.buf)
|
else {
|
||||||
target->frequencyDomainAllocation.choice.row1.buf =
|
switch (source->frequencyDomainAllocation.present) {
|
||||||
calloc(target->frequencyDomainAllocation.choice.row1.size, sizeof(uint8_t));
|
case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row1:
|
||||||
for (int i = 0; i < target->frequencyDomainAllocation.choice.row1.size; i++)
|
target->frequencyDomainAllocation.choice.row1.size = source->frequencyDomainAllocation.choice.row1.size;
|
||||||
target->frequencyDomainAllocation.choice.row1.buf[i] = source->frequencyDomainAllocation.choice.row1.buf[i];
|
target->frequencyDomainAllocation.choice.row1.bits_unused = source->frequencyDomainAllocation.choice.row1.bits_unused;
|
||||||
break;
|
if (!target->frequencyDomainAllocation.choice.row1.buf)
|
||||||
case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row2:
|
target->frequencyDomainAllocation.choice.row1.buf =
|
||||||
target->frequencyDomainAllocation.choice.row2.size = source->frequencyDomainAllocation.choice.row2.size;
|
calloc(target->frequencyDomainAllocation.choice.row1.size, sizeof(uint8_t));
|
||||||
target->frequencyDomainAllocation.choice.row2.bits_unused = source->frequencyDomainAllocation.choice.row2.bits_unused;
|
for (int i = 0; i < target->frequencyDomainAllocation.choice.row1.size; i++)
|
||||||
if (!target->frequencyDomainAllocation.choice.row2.buf)
|
target->frequencyDomainAllocation.choice.row1.buf[i] = source->frequencyDomainAllocation.choice.row1.buf[i];
|
||||||
target->frequencyDomainAllocation.choice.row2.buf =
|
break;
|
||||||
calloc(target->frequencyDomainAllocation.choice.row2.size, sizeof(uint8_t));
|
case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row2:
|
||||||
for (int i = 0; i < target->frequencyDomainAllocation.choice.row2.size; i++)
|
target->frequencyDomainAllocation.choice.row2.size = source->frequencyDomainAllocation.choice.row2.size;
|
||||||
target->frequencyDomainAllocation.choice.row2.buf[i] = source->frequencyDomainAllocation.choice.row2.buf[i];
|
target->frequencyDomainAllocation.choice.row2.bits_unused = source->frequencyDomainAllocation.choice.row2.bits_unused;
|
||||||
break;
|
if (!target->frequencyDomainAllocation.choice.row2.buf)
|
||||||
case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row4:
|
target->frequencyDomainAllocation.choice.row2.buf =
|
||||||
target->frequencyDomainAllocation.choice.row4.size = source->frequencyDomainAllocation.choice.row4.size;
|
calloc(target->frequencyDomainAllocation.choice.row2.size, sizeof(uint8_t));
|
||||||
target->frequencyDomainAllocation.choice.row4.bits_unused = source->frequencyDomainAllocation.choice.row4.bits_unused;
|
for (int i = 0; i < target->frequencyDomainAllocation.choice.row2.size; i++)
|
||||||
if (!target->frequencyDomainAllocation.choice.row4.buf)
|
target->frequencyDomainAllocation.choice.row2.buf[i] = source->frequencyDomainAllocation.choice.row2.buf[i];
|
||||||
target->frequencyDomainAllocation.choice.row4.buf =
|
break;
|
||||||
calloc(target->frequencyDomainAllocation.choice.row4.size, sizeof(uint8_t));
|
case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row4:
|
||||||
for (int i = 0; i < target->frequencyDomainAllocation.choice.row4.size; i++)
|
target->frequencyDomainAllocation.choice.row4.size = source->frequencyDomainAllocation.choice.row4.size;
|
||||||
target->frequencyDomainAllocation.choice.row4.buf[i] = source->frequencyDomainAllocation.choice.row4.buf[i];
|
target->frequencyDomainAllocation.choice.row4.bits_unused = source->frequencyDomainAllocation.choice.row4.bits_unused;
|
||||||
break;
|
if (!target->frequencyDomainAllocation.choice.row4.buf)
|
||||||
case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_other:
|
target->frequencyDomainAllocation.choice.row4.buf =
|
||||||
target->frequencyDomainAllocation.choice.other.size = source->frequencyDomainAllocation.choice.other.size;
|
calloc(target->frequencyDomainAllocation.choice.row4.size, sizeof(uint8_t));
|
||||||
target->frequencyDomainAllocation.choice.other.bits_unused = source->frequencyDomainAllocation.choice.other.bits_unused;
|
for (int i = 0; i < target->frequencyDomainAllocation.choice.row4.size; i++)
|
||||||
if (!target->frequencyDomainAllocation.choice.other.buf)
|
target->frequencyDomainAllocation.choice.row4.buf[i] = source->frequencyDomainAllocation.choice.row4.buf[i];
|
||||||
target->frequencyDomainAllocation.choice.other.buf =
|
break;
|
||||||
calloc(target->frequencyDomainAllocation.choice.other.size, sizeof(uint8_t));
|
case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_other:
|
||||||
for (int i = 0; i < target->frequencyDomainAllocation.choice.other.size; i++)
|
target->frequencyDomainAllocation.choice.other.size = source->frequencyDomainAllocation.choice.other.size;
|
||||||
target->frequencyDomainAllocation.choice.other.buf[i] = source->frequencyDomainAllocation.choice.other.buf[i];
|
target->frequencyDomainAllocation.choice.other.bits_unused = source->frequencyDomainAllocation.choice.other.bits_unused;
|
||||||
break;
|
if (!target->frequencyDomainAllocation.choice.other.buf)
|
||||||
default:
|
target->frequencyDomainAllocation.choice.other.buf =
|
||||||
AssertFatal(false, "Invalid entry\n");
|
calloc(target->frequencyDomainAllocation.choice.other.size, sizeof(uint8_t));
|
||||||
|
for (int i = 0; i < target->frequencyDomainAllocation.choice.other.size; i++)
|
||||||
|
target->frequencyDomainAllocation.choice.other.buf[i] = source->frequencyDomainAllocation.choice.other.buf[i];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
AssertFatal(false, "Invalid entry\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
target->nrofPorts = source->nrofPorts;
|
target->nrofPorts = source->nrofPorts;
|
||||||
target->firstOFDMSymbolInTimeDomain = source->firstOFDMSymbolInTimeDomain;
|
target->firstOFDMSymbolInTimeDomain = source->firstOFDMSymbolInTimeDomain;
|
||||||
|
|||||||
@@ -49,6 +49,14 @@
|
|||||||
DESTINATION = tmp; \
|
DESTINATION = tmp; \
|
||||||
} while(0); \
|
} while(0); \
|
||||||
|
|
||||||
|
// Same as above but swapping ASN1 elements that are not pointers
|
||||||
|
#define UPDATE_MAC_NP_IE(DESTINATION, ORIGIN, TYPE) \
|
||||||
|
do { \
|
||||||
|
TYPE tmp = ORIGIN; \
|
||||||
|
ORIGIN = DESTINATION; \
|
||||||
|
DESTINATION = tmp; \
|
||||||
|
} while(0); \
|
||||||
|
|
||||||
// Macro handles reception of SetupRelease element ORIGIN (see NR_SetupRelease.h)
|
// Macro handles reception of SetupRelease element ORIGIN (see NR_SetupRelease.h)
|
||||||
// If release (NR_SetupRelease_xxx_PR_release equivalent to 1), removing structure from DESTINATION
|
// If release (NR_SetupRelease_xxx_PR_release equivalent to 1), removing structure from DESTINATION
|
||||||
// If setup (NR_SetupRelease_xxx_PR_setup equivalent to 2), add or modify structure in DESTINATION
|
// If setup (NR_SetupRelease_xxx_PR_setup equivalent to 2), add or modify structure in DESTINATION
|
||||||
|
|||||||
Reference in New Issue
Block a user