Commit 0f720d39 authored by francescomani's avatar francescomani

macro based on ASN_STRUCT_RESET to replace ASN_STRUCT_FREE because the latter...

macro based on ASN_STRUCT_RESET to replace ASN_STRUCT_FREE because the latter does not reset to NULL pointers inside the structure
parent 6dc9ec77
...@@ -117,5 +117,11 @@ static inline uint64_t BIT_STRING_to_uint64(BIT_STRING_t *asn) { ...@@ -117,5 +117,11 @@ static inline uint64_t BIT_STRING_to_uint64(BIT_STRING_t *asn) {
#define asn1cSequenceAdd(VaR, TyPe, lOcPtr) \ #define asn1cSequenceAdd(VaR, TyPe, lOcPtr) \
TyPe *lOcPtr= calloc(1,sizeof(TyPe)); \ TyPe *lOcPtr= calloc(1,sizeof(TyPe)); \
asn1cSeqAdd(&VaR,lOcPtr) asn1cSeqAdd(&VaR,lOcPtr)
#define asn1cFreeStruc(ASN_DEF, STRUCT) \
do { \
ASN_STRUCT_RESET(ASN_DEF, STRUCT); \
free(STRUCT); \
STRUCT = NULL; \
} while (0)
#endif #endif
...@@ -445,22 +445,12 @@ static void config_common_ue(NR_UE_MAC_INST_t *mac, ...@@ -445,22 +445,12 @@ static void config_common_ue(NR_UE_MAC_INST_t *mac,
void release_common_ss_cset(NR_BWP_PDCCH_t *pdcch) void release_common_ss_cset(NR_BWP_PDCCH_t *pdcch)
{ {
if (pdcch->otherSI_SS) { asn1cFreeStruc(asn_DEF_NR_SearchSpace, pdcch->otherSI_SS);
ASN_STRUCT_FREE(asn_DEF_NR_SearchSpace, pdcch->otherSI_SS); asn1cFreeStruc(asn_DEF_NR_SearchSpace, pdcch->ra_SS);
pdcch->otherSI_SS = NULL; asn1cFreeStruc(asn_DEF_NR_SearchSpace, pdcch->paging_SS);
} asn1cFreeStruc(asn_DEF_NR_SearchSpace, pdcch->search_space_zero);
if (pdcch->ra_SS) { asn1cFreeStruc(asn_DEF_NR_ControlResourceSet, pdcch->commonControlResourceSet);
ASN_STRUCT_FREE(asn_DEF_NR_SearchSpace, pdcch->ra_SS); asn1cFreeStruc(asn_DEF_NR_ControlResourceSet, pdcch->coreset0);
pdcch->otherSI_SS = NULL;
}
if (pdcch->paging_SS) {
ASN_STRUCT_FREE(asn_DEF_NR_SearchSpace, pdcch->paging_SS);
pdcch->paging_SS = NULL;
}
if (pdcch->commonControlResourceSet) {
ASN_STRUCT_FREE(asn_DEF_NR_ControlResourceSet, pdcch->commonControlResourceSet);
pdcch->commonControlResourceSet = NULL;
}
} }
static void modlist_ss(NR_SearchSpace_t *source, NR_SearchSpace_t *target) static void modlist_ss(NR_SearchSpace_t *source, NR_SearchSpace_t *target)
...@@ -503,15 +493,13 @@ static NR_SearchSpace_t *get_common_search_space(const struct NR_PDCCH_ConfigCom ...@@ -503,15 +493,13 @@ static NR_SearchSpace_t *get_common_search_space(const struct NR_PDCCH_ConfigCom
static void configure_common_ss_coreset(NR_BWP_PDCCH_t *pdcch, NR_PDCCH_ConfigCommon_t *pdcch_ConfigCommon) static void configure_common_ss_coreset(NR_BWP_PDCCH_t *pdcch, NR_PDCCH_ConfigCommon_t *pdcch_ConfigCommon)
{ {
if (pdcch_ConfigCommon) { if (pdcch_ConfigCommon) {
ASN_STRUCT_FREE(asn_DEF_NR_SearchSpace, pdcch->otherSI_SS); asn1cFreeStruc(asn_DEF_NR_SearchSpace, pdcch->otherSI_SS);
pdcch->otherSI_SS = NULL;
if (pdcch_ConfigCommon->searchSpaceOtherSystemInformation) if (pdcch_ConfigCommon->searchSpaceOtherSystemInformation)
pdcch->otherSI_SS = get_common_search_space(pdcch_ConfigCommon->commonSearchSpaceList, pdcch->otherSI_SS = get_common_search_space(pdcch_ConfigCommon->commonSearchSpaceList,
pdcch, pdcch,
*pdcch_ConfigCommon->searchSpaceOtherSystemInformation); *pdcch_ConfigCommon->searchSpaceOtherSystemInformation);
ASN_STRUCT_FREE(asn_DEF_NR_SearchSpace, pdcch->ra_SS); asn1cFreeStruc(asn_DEF_NR_SearchSpace, pdcch->ra_SS);
pdcch->ra_SS = NULL;
if (pdcch_ConfigCommon->ra_SearchSpace) { if (pdcch_ConfigCommon->ra_SearchSpace) {
if (pdcch->otherSI_SS && *pdcch_ConfigCommon->ra_SearchSpace == pdcch->otherSI_SS->searchSpaceId) if (pdcch->otherSI_SS && *pdcch_ConfigCommon->ra_SearchSpace == pdcch->otherSI_SS->searchSpaceId)
pdcch->ra_SS = pdcch->otherSI_SS; pdcch->ra_SS = pdcch->otherSI_SS;
...@@ -520,8 +508,7 @@ static void configure_common_ss_coreset(NR_BWP_PDCCH_t *pdcch, NR_PDCCH_ConfigCo ...@@ -520,8 +508,7 @@ static void configure_common_ss_coreset(NR_BWP_PDCCH_t *pdcch, NR_PDCCH_ConfigCo
get_common_search_space(pdcch_ConfigCommon->commonSearchSpaceList, pdcch, *pdcch_ConfigCommon->ra_SearchSpace); get_common_search_space(pdcch_ConfigCommon->commonSearchSpaceList, pdcch, *pdcch_ConfigCommon->ra_SearchSpace);
} }
ASN_STRUCT_FREE(asn_DEF_NR_SearchSpace, pdcch->paging_SS); asn1cFreeStruc(asn_DEF_NR_SearchSpace, pdcch->paging_SS);
pdcch->paging_SS = NULL;
if (pdcch_ConfigCommon->pagingSearchSpace) { if (pdcch_ConfigCommon->pagingSearchSpace) {
if (pdcch->otherSI_SS && *pdcch_ConfigCommon->pagingSearchSpace == pdcch->otherSI_SS->searchSpaceId) if (pdcch->otherSI_SS && *pdcch_ConfigCommon->pagingSearchSpace == pdcch->otherSI_SS->searchSpaceId)
pdcch->paging_SS = pdcch->otherSI_SS; pdcch->paging_SS = pdcch->otherSI_SS;
...@@ -678,9 +665,9 @@ static int lcid_cmp(const void *lc1, const void *lc2, void *mac_inst) ...@@ -678,9 +665,9 @@ static int lcid_cmp(const void *lc1, const void *lc2, void *mac_inst)
void nr_release_mac_config_logicalChannelBearer(NR_UE_MAC_INST_t *mac, long channel_identity) void nr_release_mac_config_logicalChannelBearer(NR_UE_MAC_INST_t *mac, long channel_identity)
{ {
if (mac->logicalChannelConfig[channel_identity - 1] != NULL) { if (mac->logicalChannelConfig[channel_identity - 1] != NULL) {
ASN_STRUCT_FREE(asn_DEF_NR_LogicalChannelConfig, mac->logicalChannelConfig[channel_identity - 1]); asn1cFreeStruc(asn_DEF_NR_LogicalChannelConfig, mac->logicalChannelConfig[channel_identity - 1]);
mac->logicalChannelConfig[channel_identity - 1] = NULL; }
} else { else {
LOG_E(NR_MAC, "Trying to release a non configured logical channel bearer %li\n", channel_identity); LOG_E(NR_MAC, "Trying to release a non configured logical channel bearer %li\n", channel_identity);
} }
} }
...@@ -907,10 +894,8 @@ static void setup_puschconfig(NR_PUSCH_Config_t *source, NR_PUSCH_Config_t *targ ...@@ -907,10 +894,8 @@ static void setup_puschconfig(NR_PUSCH_Config_t *source, NR_PUSCH_Config_t *targ
UPDATE_MAC_IE(target->rbg_Size, source->rbg_Size, long); UPDATE_MAC_IE(target->rbg_Size, source->rbg_Size, long);
UPDATE_MAC_IE(target->tp_pi2BPSK, source->tp_pi2BPSK, long); UPDATE_MAC_IE(target->tp_pi2BPSK, source->tp_pi2BPSK, long);
if (source->uci_OnPUSCH) { if (source->uci_OnPUSCH) {
if (source->uci_OnPUSCH->present == NR_SetupRelease_UCI_OnPUSCH_PR_release) { if (source->uci_OnPUSCH->present == NR_SetupRelease_UCI_OnPUSCH_PR_release)
ASN_STRUCT_FREE(asn_DEF_NR_UCI_OnPUSCH, target->uci_OnPUSCH); asn1cFreeStruc(asn_DEF_NR_UCI_OnPUSCH, target->uci_OnPUSCH);
target->uci_OnPUSCH = NULL;
}
if (source->uci_OnPUSCH->present == NR_SetupRelease_UCI_OnPUSCH_PR_setup) { if (source->uci_OnPUSCH->present == NR_SetupRelease_UCI_OnPUSCH_PR_setup) {
if (target->uci_OnPUSCH) { if (target->uci_OnPUSCH) {
target->uci_OnPUSCH->choice.setup->scaling = source->uci_OnPUSCH->choice.setup->scaling; target->uci_OnPUSCH->choice.setup->scaling = source->uci_OnPUSCH->choice.setup->scaling;
...@@ -1208,11 +1193,9 @@ static void configure_dedicated_BWP_dl(NR_UE_MAC_INST_t *mac, int bwp_id, NR_BWP ...@@ -1208,11 +1193,9 @@ static void configure_dedicated_BWP_dl(NR_UE_MAC_INST_t *mac, int bwp_id, NR_BWP
NR_UE_DL_BWP_t *bwp = get_dl_bwp_structure(mac, bwp_id, true); NR_UE_DL_BWP_t *bwp = get_dl_bwp_structure(mac, bwp_id, true);
bwp->bwp_id = bwp_id; bwp->bwp_id = bwp_id;
NR_BWP_PDCCH_t *pdcch = &mac->config_BWP_PDCCH[bwp_id]; NR_BWP_PDCCH_t *pdcch = &mac->config_BWP_PDCCH[bwp_id];
if (dl_dedicated->pdsch_Config) { if(dl_dedicated->pdsch_Config) {
if (dl_dedicated->pdsch_Config->present == NR_SetupRelease_PDSCH_Config_PR_release) { if (dl_dedicated->pdsch_Config->present == NR_SetupRelease_PDSCH_Config_PR_release)
ASN_STRUCT_FREE(asn_DEF_NR_PDSCH_Config, bwp->pdsch_Config); asn1cFreeStruc(asn_DEF_NR_PDSCH_Config, bwp->pdsch_Config);
bwp->pdsch_Config = NULL;
}
if (dl_dedicated->pdsch_Config->present == NR_SetupRelease_PDSCH_Config_PR_setup) { if (dl_dedicated->pdsch_Config->present == NR_SetupRelease_PDSCH_Config_PR_setup) {
if (!bwp->pdsch_Config) if (!bwp->pdsch_Config)
bwp->pdsch_Config = calloc(1, sizeof(*bwp->pdsch_Config)); bwp->pdsch_Config = calloc(1, sizeof(*bwp->pdsch_Config));
...@@ -1237,33 +1220,27 @@ static void configure_dedicated_BWP_ul(NR_UE_MAC_INST_t *mac, int bwp_id, NR_BWP ...@@ -1237,33 +1220,27 @@ static void configure_dedicated_BWP_ul(NR_UE_MAC_INST_t *mac, int bwp_id, NR_BWP
if (ul_dedicated) { if (ul_dedicated) {
NR_UE_UL_BWP_t *bwp = get_ul_bwp_structure(mac, bwp_id, true); NR_UE_UL_BWP_t *bwp = get_ul_bwp_structure(mac, bwp_id, true);
bwp->bwp_id = bwp_id; bwp->bwp_id = bwp_id;
if (ul_dedicated->pucch_Config) { if(ul_dedicated->pucch_Config) {
if (ul_dedicated->pucch_Config->present == NR_SetupRelease_PUCCH_Config_PR_release) { if (ul_dedicated->pucch_Config->present == NR_SetupRelease_PUCCH_Config_PR_release)
ASN_STRUCT_FREE(asn_DEF_NR_PUCCH_Config, bwp->pucch_Config); asn1cFreeStruc(asn_DEF_NR_PUCCH_Config, bwp->pucch_Config);
bwp->pucch_Config = NULL;
}
if (ul_dedicated->pucch_Config->present == NR_SetupRelease_PUCCH_Config_PR_setup) { if (ul_dedicated->pucch_Config->present == NR_SetupRelease_PUCCH_Config_PR_setup) {
if (!bwp->pucch_Config) if (!bwp->pucch_Config)
bwp->pucch_Config = calloc(1, sizeof(*bwp->pucch_Config)); bwp->pucch_Config = calloc(1, sizeof(*bwp->pucch_Config));
setup_pucchconfig(ul_dedicated->pucch_Config->choice.setup, bwp->pucch_Config); setup_pucchconfig(ul_dedicated->pucch_Config->choice.setup, bwp->pucch_Config);
} }
} }
if (ul_dedicated->pusch_Config) { if(ul_dedicated->pusch_Config) {
if (ul_dedicated->pusch_Config->present == NR_SetupRelease_PUSCH_Config_PR_release) { if (ul_dedicated->pusch_Config->present == NR_SetupRelease_PUSCH_Config_PR_release)
ASN_STRUCT_FREE(asn_DEF_NR_PUSCH_Config, bwp->pusch_Config); asn1cFreeStruc(asn_DEF_NR_PUSCH_Config, bwp->pusch_Config);
bwp->pusch_Config = NULL;
}
if (ul_dedicated->pusch_Config->present == NR_SetupRelease_PUSCH_Config_PR_setup) { if (ul_dedicated->pusch_Config->present == NR_SetupRelease_PUSCH_Config_PR_setup) {
if (!bwp->pusch_Config) if (!bwp->pusch_Config)
bwp->pusch_Config = calloc(1, sizeof(*bwp->pusch_Config)); bwp->pusch_Config = calloc(1, sizeof(*bwp->pusch_Config));
setup_puschconfig(ul_dedicated->pusch_Config->choice.setup, bwp->pusch_Config); setup_puschconfig(ul_dedicated->pusch_Config->choice.setup, bwp->pusch_Config);
} }
} }
if (ul_dedicated->srs_Config) { if(ul_dedicated->srs_Config) {
if (ul_dedicated->srs_Config->present == NR_SetupRelease_SRS_Config_PR_release) { if (ul_dedicated->srs_Config->present == NR_SetupRelease_SRS_Config_PR_release)
ASN_STRUCT_FREE(asn_DEF_NR_SRS_Config, bwp->srs_Config); asn1cFreeStruc(asn_DEF_NR_SRS_Config, bwp->srs_Config);
bwp->srs_Config = NULL;
}
if (ul_dedicated->srs_Config->present == NR_SetupRelease_SRS_Config_PR_setup) { if (ul_dedicated->srs_Config->present == NR_SetupRelease_SRS_Config_PR_setup) {
if (!bwp->srs_Config) if (!bwp->srs_Config)
bwp->srs_Config = calloc(1, sizeof(*bwp->srs_Config)); bwp->srs_Config = calloc(1, sizeof(*bwp->srs_Config));
...@@ -1293,10 +1270,8 @@ static void configure_common_BWP_dl(NR_UE_MAC_INST_t *mac, int bwp_id, NR_BWP_Do ...@@ -1293,10 +1270,8 @@ static void configure_common_BWP_dl(NR_UE_MAC_INST_t *mac, int bwp_id, NR_BWP_Do
UPDATE_MAC_IE(bwp->tdaList_Common, UPDATE_MAC_IE(bwp->tdaList_Common,
dl_common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList, dl_common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList,
NR_PDSCH_TimeDomainResourceAllocationList_t); NR_PDSCH_TimeDomainResourceAllocationList_t);
if (dl_common->pdsch_ConfigCommon->present == NR_SetupRelease_PDSCH_ConfigCommon_PR_release) { if (dl_common->pdsch_ConfigCommon->present == NR_SetupRelease_PDSCH_ConfigCommon_PR_release)
ASN_STRUCT_FREE(asn_DEF_NR_PDSCH_TimeDomainResourceAllocationList, bwp->tdaList_Common); asn1cFreeStruc(asn_DEF_NR_PDSCH_TimeDomainResourceAllocationList, bwp->tdaList_Common);
bwp->tdaList_Common = NULL;
}
} }
NR_BWP_PDCCH_t *pdcch = &mac->config_BWP_PDCCH[bwp_id]; NR_BWP_PDCCH_t *pdcch = &mac->config_BWP_PDCCH[bwp_id];
if (dl_common->pdcch_ConfigCommon) { if (dl_common->pdcch_ConfigCommon) {
...@@ -1341,8 +1316,7 @@ static void configure_common_BWP_ul(NR_UE_MAC_INST_t *mac, int bwp_id, NR_BWP_Up ...@@ -1341,8 +1316,7 @@ static void configure_common_BWP_ul(NR_UE_MAC_INST_t *mac, int bwp_id, NR_BWP_Up
UPDATE_MAC_IE(bwp->msg3_DeltaPreamble, ul_common->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble, long); UPDATE_MAC_IE(bwp->msg3_DeltaPreamble, ul_common->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble, long);
} }
if (ul_common->pusch_ConfigCommon->present == NR_SetupRelease_PUSCH_ConfigCommon_PR_release) { if (ul_common->pusch_ConfigCommon->present == NR_SetupRelease_PUSCH_ConfigCommon_PR_release) {
ASN_STRUCT_FREE(asn_DEF_NR_PUSCH_TimeDomainResourceAllocationList, bwp->tdaList_Common); asn1cFreeStruc(asn_DEF_NR_PUSCH_TimeDomainResourceAllocationList, bwp->tdaList_Common);
bwp->tdaList_Common = NULL;
free(bwp->msg3_DeltaPreamble); free(bwp->msg3_DeltaPreamble);
bwp->msg3_DeltaPreamble = NULL; bwp->msg3_DeltaPreamble = NULL;
} }
...@@ -1613,9 +1587,8 @@ static void configure_csiconfig(NR_UE_ServingCell_Info_t *sc_info, struct NR_Set ...@@ -1613,9 +1587,8 @@ static void configure_csiconfig(NR_UE_ServingCell_Info_t *sc_info, struct NR_Set
switch (csi_MeasConfig_sr->present) { switch (csi_MeasConfig_sr->present) {
case NR_SetupRelease_CSI_MeasConfig_PR_NOTHING: case NR_SetupRelease_CSI_MeasConfig_PR_NOTHING:
break; break;
case NR_SetupRelease_CSI_MeasConfig_PR_release: case NR_SetupRelease_CSI_MeasConfig_PR_release :
ASN_STRUCT_FREE(asn_DEF_NR_CSI_MeasConfig, sc_info->csi_MeasConfig); asn1cFreeStruc(asn_DEF_NR_CSI_MeasConfig, sc_info->csi_MeasConfig);
sc_info->csi_MeasConfig = NULL;
break; break;
case NR_SetupRelease_CSI_MeasConfig_PR_setup: case NR_SetupRelease_CSI_MeasConfig_PR_setup:
if (!sc_info->csi_MeasConfig) { // setup if (!sc_info->csi_MeasConfig) { // setup
...@@ -1757,10 +1730,8 @@ static void configure_servingcell_info(NR_UE_ServingCell_Info_t *sc_info, NR_Ser ...@@ -1757,10 +1730,8 @@ static void configure_servingcell_info(NR_UE_ServingCell_Info_t *sc_info, NR_Ser
break; break;
case NR_SetupRelease_PDSCH_ServingCellConfig_PR_release: case NR_SetupRelease_PDSCH_ServingCellConfig_PR_release:
// release all configurations // release all configurations
if (sc_info->pdsch_CGB_Transmission) { if (sc_info->pdsch_CGB_Transmission)
ASN_STRUCT_FREE(asn_DEF_NR_PDSCH_CodeBlockGroupTransmission, sc_info->pdsch_CGB_Transmission); asn1cFreeStruc(asn_DEF_NR_PDSCH_CodeBlockGroupTransmission, sc_info->pdsch_CGB_Transmission);
sc_info->pdsch_CGB_Transmission = NULL;
}
if (sc_info->xOverhead_PDSCH) { if (sc_info->xOverhead_PDSCH) {
free(sc_info->xOverhead_PDSCH); free(sc_info->xOverhead_PDSCH);
sc_info->xOverhead_PDSCH = NULL; sc_info->xOverhead_PDSCH = NULL;
...@@ -1792,10 +1763,8 @@ static void configure_servingcell_info(NR_UE_ServingCell_Info_t *sc_info, NR_Ser ...@@ -1792,10 +1763,8 @@ static void configure_servingcell_info(NR_UE_ServingCell_Info_t *sc_info, NR_Ser
break; break;
case NR_SetupRelease_PUSCH_ServingCellConfig_PR_release: case NR_SetupRelease_PUSCH_ServingCellConfig_PR_release:
// release all configurations // release all configurations
if (sc_info->pusch_CGB_Transmission) { if (sc_info->pusch_CGB_Transmission)
ASN_STRUCT_FREE(asn_DEF_NR_PUSCH_CodeBlockGroupTransmission, sc_info->pusch_CGB_Transmission); asn1cFreeStruc(asn_DEF_NR_PUSCH_CodeBlockGroupTransmission, sc_info->pusch_CGB_Transmission);
sc_info->pdsch_CGB_Transmission = NULL;
}
if (sc_info->rateMatching_PUSCH) { if (sc_info->rateMatching_PUSCH) {
free(sc_info->rateMatching_PUSCH); free(sc_info->rateMatching_PUSCH);
sc_info->rateMatching_PUSCH = NULL; sc_info->rateMatching_PUSCH = NULL;
...@@ -1840,10 +1809,8 @@ void release_dl_BWP(NR_UE_MAC_INST_t *mac, int bwp_id) ...@@ -1840,10 +1809,8 @@ void release_dl_BWP(NR_UE_MAC_INST_t *mac, int bwp_id)
} }
AssertFatal(bwp, "No DL-BWP %d to release\n", bwp_id); AssertFatal(bwp, "No DL-BWP %d to release\n", bwp_id);
free(bwp->cyclicprefix); free(bwp->cyclicprefix);
ASN_STRUCT_FREE(asn_DEF_NR_PDSCH_TimeDomainResourceAllocationList, bwp->tdaList_Common); asn1cFreeStruc(asn_DEF_NR_PDSCH_TimeDomainResourceAllocationList, bwp->tdaList_Common);
bwp->tdaList_Common = NULL; asn1cFreeStruc(asn_DEF_NR_PDSCH_Config, bwp->pdsch_Config);
ASN_STRUCT_FREE(asn_DEF_NR_PDSCH_Config, bwp->pdsch_Config);
bwp->pdsch_Config = NULL;
free(bwp); free(bwp);
NR_BWP_PDCCH_t *pdcch = &mac->config_BWP_PDCCH[bwp_id]; NR_BWP_PDCCH_t *pdcch = &mac->config_BWP_PDCCH[bwp_id];
...@@ -1866,20 +1833,13 @@ void release_ul_BWP(NR_UE_MAC_INST_t *mac, int bwp_id) ...@@ -1866,20 +1833,13 @@ void release_ul_BWP(NR_UE_MAC_INST_t *mac, int bwp_id)
} }
AssertFatal(bwp, "No UL-BWP %d to release\n", bwp_id); AssertFatal(bwp, "No UL-BWP %d to release\n", bwp_id);
free(bwp->cyclicprefix); free(bwp->cyclicprefix);
ASN_STRUCT_FREE(asn_DEF_NR_RACH_ConfigCommon, bwp->rach_ConfigCommon); asn1cFreeStruc(asn_DEF_NR_RACH_ConfigCommon, bwp->rach_ConfigCommon);
bwp->rach_ConfigCommon = NULL; asn1cFreeStruc(asn_DEF_NR_PUSCH_TimeDomainResourceAllocationList, bwp->tdaList_Common);
ASN_STRUCT_FREE(asn_DEF_NR_PUSCH_TimeDomainResourceAllocationList, bwp->tdaList_Common); asn1cFreeStruc(asn_DEF_NR_ConfiguredGrantConfig, bwp->configuredGrantConfig);
bwp->tdaList_Common = NULL; asn1cFreeStruc(asn_DEF_NR_PUSCH_Config, bwp->pusch_Config);
ASN_STRUCT_FREE(asn_DEF_NR_ConfiguredGrantConfig, bwp->configuredGrantConfig); asn1cFreeStruc(asn_DEF_NR_PUCCH_Config, bwp->pucch_Config);
bwp->configuredGrantConfig = NULL; asn1cFreeStruc(asn_DEF_NR_PUCCH_ConfigCommon, bwp->pucch_ConfigCommon);
ASN_STRUCT_FREE(asn_DEF_NR_PUSCH_Config, bwp->pusch_Config); asn1cFreeStruc(asn_DEF_NR_SRS_Config, bwp->srs_Config);
bwp->pusch_Config = NULL;
ASN_STRUCT_FREE(asn_DEF_NR_PUCCH_Config, bwp->pucch_Config);
bwp->pucch_Config = NULL;
ASN_STRUCT_FREE(asn_DEF_NR_PUCCH_ConfigCommon, bwp->pucch_ConfigCommon);
bwp->pucch_ConfigCommon = NULL;
ASN_STRUCT_FREE(asn_DEF_NR_SRS_Config, bwp->srs_Config);
bwp->srs_Config = NULL;
free(bwp->msg3_DeltaPreamble); free(bwp->msg3_DeltaPreamble);
free(bwp); free(bwp);
} }
...@@ -1957,5 +1917,5 @@ void nr_rrc_mac_config_req_cg(module_id_t module_id, ...@@ -1957,5 +1917,5 @@ void nr_rrc_mac_config_req_cg(module_id_t module_id,
if (!mac->dl_config_request || !mac->ul_config_request) if (!mac->dl_config_request || !mac->ul_config_request)
ue_init_config_request(mac, mac->current_DL_BWP->scs); ue_init_config_request(mac, mac->current_DL_BWP->scs);
ASN_STRUCT_FREE(asn_DEF_NR_CellGroupConfig, cell_group_config); asn1cFreeStruc(asn_DEF_NR_CellGroupConfig, cell_group_config);
} }
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#define __LAYER2_MAC_UE_PROTO_H__ #define __LAYER2_MAC_UE_PROTO_H__
#include "mac_defs.h" #include "mac_defs.h"
#include "oai_asn1.h"
#include "RRC/NR_UE/rrc_defs.h" #include "RRC/NR_UE/rrc_defs.h"
#define NR_DL_MAX_DAI (4) /* TS 38.213 table 9.1.3-1 Value of counter DAI for DCI format 1_0 and 1_1 */ #define NR_DL_MAX_DAI (4) /* TS 38.213 table 9.1.3-1 Value of counter DAI for DCI format 1_0 and 1_1 */
...@@ -49,8 +50,7 @@ ...@@ -49,8 +50,7 @@
#define HANDLE_SETUPRELEASE_DIRECT(DESTINATION, ORIGIN, TYPE, ASN_DEF) \ #define HANDLE_SETUPRELEASE_DIRECT(DESTINATION, ORIGIN, TYPE, ASN_DEF) \
do { \ do { \
if (ORIGIN->present == 1) { \ if (ORIGIN->present == 1) { \
ASN_STRUCT_FREE(ASN_DEF, DESTINATION); \ asn1cFreeStruc(ASN_DEF, DESTINATION); \
DESTINATION = NULL; \
} \ } \
if (ORIGIN->present == 2) \ if (ORIGIN->present == 2) \
UPDATE_MAC_IE(DESTINATION, ORIGIN->choice.setup, TYPE); \ UPDATE_MAC_IE(DESTINATION, ORIGIN->choice.setup, TYPE); \
...@@ -59,8 +59,7 @@ ...@@ -59,8 +59,7 @@
#define HANDLE_SETUPRELEASE_IE(DESTINATION, ORIGIN, TYPE, ASN_DEF) \ #define HANDLE_SETUPRELEASE_IE(DESTINATION, ORIGIN, TYPE, ASN_DEF) \
do { \ do { \
if (ORIGIN->present == 1) { \ if (ORIGIN->present == 1) { \
ASN_STRUCT_FREE(ASN_DEF, DESTINATION); \ asn1cFreeStruc(ASN_DEF, DESTINATION); \
DESTINATION = NULL; \
} \ } \
if (ORIGIN->present == 2) { \ if (ORIGIN->present == 2) { \
if (!DESTINATION) \ if (!DESTINATION) \
...@@ -123,7 +122,6 @@ ...@@ -123,7 +122,6 @@
} \ } \
} while (0) } while (0)
/**\brief initialize the field in nr_mac instance /**\brief initialize the field in nr_mac instance
\param module_id module id */ \param module_id module id */
void nr_ue_init_mac(module_id_t module_idP); void nr_ue_init_mac(module_id_t module_idP);
......
...@@ -181,10 +181,7 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac) ...@@ -181,10 +181,7 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac)
void release_mac_configuration(NR_UE_MAC_INST_t *mac) void release_mac_configuration(NR_UE_MAC_INST_t *mac)
{ {
if(mac->mib) { asn1cFreeStruc(asn_DEF_NR_MIB, mac->mib);
ASN_STRUCT_FREE(asn_DEF_NR_MIB, mac->mib);
mac->mib = NULL;
}
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
NR_BWP_PDCCH_t *pdcch = &mac->config_BWP_PDCCH[5]; NR_BWP_PDCCH_t *pdcch = &mac->config_BWP_PDCCH[5];
release_common_ss_cset(pdcch); release_common_ss_cset(pdcch);
...@@ -204,6 +201,6 @@ void release_mac_configuration(NR_UE_MAC_INST_t *mac) ...@@ -204,6 +201,6 @@ void release_mac_configuration(NR_UE_MAC_INST_t *mac)
void reset_ra(RA_config_t *ra) void reset_ra(RA_config_t *ra)
{ {
if(ra->rach_ConfigDedicated) if(ra->rach_ConfigDedicated)
ASN_STRUCT_FREE(asn_DEF_NR_RACH_ConfigDedicated, ra->rach_ConfigDedicated); asn1cFreeStruc(asn_DEF_NR_RACH_ConfigDedicated, ra->rach_ConfigDedicated);
memset(ra, 0, sizeof(RA_config_t)); memset(ra, 0, sizeof(RA_config_t));
} }
...@@ -688,8 +688,7 @@ static int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(instance_t instance, ...@@ -688,8 +688,7 @@ static int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(instance_t instance,
switch (bcch_message->message.choice.c1->present) { switch (bcch_message->message.choice.c1->present) {
case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1: case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1:
LOG_D(NR_RRC, "[UE %ld] Decoding SIB1\n", instance); LOG_D(NR_RRC, "[UE %ld] Decoding SIB1\n", instance);
ASN_STRUCT_FREE(asn_DEF_NR_SIB1, SI_info->sib1); asn1cFreeStruc(asn_DEF_NR_SIB1, SI_info->sib1);
SI_info->sib1 = NULL;
NR_SIB1_t *sib1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1; NR_SIB1_t *sib1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1;
if(!SI_info->sib1) if(!SI_info->sib1)
SI_info->sib1 = calloc(1, sizeof(*SI_info->sib1)); SI_info->sib1 = calloc(1, sizeof(*SI_info->sib1));
...@@ -1938,70 +1937,26 @@ void nr_rrc_going_to_IDLE(instance_t instance, ...@@ -1938,70 +1937,26 @@ void nr_rrc_going_to_IDLE(instance_t instance,
} }
} }
if(rrc->meas_config) { asn1cFreeStruc(asn_DEF_NR_MeasConfig, rrc->meas_config);
ASN_STRUCT_FREE(asn_DEF_NR_MeasConfig, rrc->meas_config);
rrc->meas_config = NULL; rrc->meas_config = NULL;
}
for (int i = 0; i < NB_CNX_UE; i++) { for (int i = 0; i < NB_CNX_UE; i++) {
rrcPerNB_t *nb = &rrc->perNB[i]; rrcPerNB_t *nb = &rrc->perNB[i];
NR_UE_RRC_SI_INFO *SI_info = &nb->SInfo; NR_UE_RRC_SI_INFO *SI_info = &nb->SInfo;
if(SI_info->sib1) { asn1cFreeStruc(asn_DEF_NR_SIB1, SI_info->sib1);
ASN_STRUCT_FREE(asn_DEF_NR_SIB1, SI_info->sib1); asn1cFreeStruc(asn_DEF_NR_SIB2, SI_info->sib2);
SI_info->sib1 = NULL; asn1cFreeStruc(asn_DEF_NR_SIB3, SI_info->sib3);
} asn1cFreeStruc(asn_DEF_NR_SIB4, SI_info->sib4);
if(SI_info->sib2) { asn1cFreeStruc(asn_DEF_NR_SIB5, SI_info->sib5);
ASN_STRUCT_FREE(asn_DEF_NR_SIB2, SI_info->sib2); asn1cFreeStruc(asn_DEF_NR_SIB6, SI_info->sib6);
SI_info->sib2 = NULL; asn1cFreeStruc(asn_DEF_NR_SIB7, SI_info->sib7);
} asn1cFreeStruc(asn_DEF_NR_SIB8, SI_info->sib8);
if(SI_info->sib3) { asn1cFreeStruc(asn_DEF_NR_SIB9, SI_info->sib9);
ASN_STRUCT_FREE(asn_DEF_NR_SIB3, SI_info->sib3); asn1cFreeStruc(asn_DEF_NR_SIB10_r16, SI_info->sib10);
SI_info->sib3 = NULL; asn1cFreeStruc(asn_DEF_NR_SIB11_r16, SI_info->sib11);
} asn1cFreeStruc(asn_DEF_NR_SIB12_r16, SI_info->sib12);
if(SI_info->sib4) { asn1cFreeStruc(asn_DEF_NR_SIB13_r16, SI_info->sib13);
ASN_STRUCT_FREE(asn_DEF_NR_SIB4, SI_info->sib4); asn1cFreeStruc(asn_DEF_NR_SIB14_r16, SI_info->sib14);
SI_info->sib4 = NULL;
}
if(SI_info->sib5) {
ASN_STRUCT_FREE(asn_DEF_NR_SIB5, SI_info->sib5);
SI_info->sib5 = NULL;
}
if(SI_info->sib6) {
ASN_STRUCT_FREE(asn_DEF_NR_SIB6, SI_info->sib6);
SI_info->sib6 = NULL;
}
if(SI_info->sib7) {
ASN_STRUCT_FREE(asn_DEF_NR_SIB7, SI_info->sib7);
SI_info->sib7 = NULL;
}
if(SI_info->sib8) {
ASN_STRUCT_FREE(asn_DEF_NR_SIB8, SI_info->sib8);
SI_info->sib8 = NULL;
}
if(SI_info->sib9) {
ASN_STRUCT_FREE(asn_DEF_NR_SIB9, SI_info->sib9);
SI_info->sib9 = NULL;
}
if(SI_info->sib10) {
ASN_STRUCT_FREE(asn_DEF_NR_SIB10_r16, SI_info->sib10);
SI_info->sib10 = NULL;
}
if(SI_info->sib11) {
ASN_STRUCT_FREE(asn_DEF_NR_SIB11_r16, SI_info->sib11);
SI_info->sib11 = NULL;
}
if(SI_info->sib12) {
ASN_STRUCT_FREE(asn_DEF_NR_SIB12_r16, SI_info->sib12);
SI_info->sib12 = NULL;
}
if(SI_info->sib13) {
ASN_STRUCT_FREE(asn_DEF_NR_SIB13_r16, SI_info->sib13);
SI_info->sib13 = NULL;
}
if(SI_info->sib14) {
ASN_STRUCT_FREE(asn_DEF_NR_SIB14_r16, SI_info->sib14);
SI_info->sib14 = NULL;
}
} }
// reset MAC // reset MAC
......
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