Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
spbro
OpenXG-RAN
Commits
56e510b2
Commit
56e510b2
authored
Sep 25, 2024
by
Guido Casati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use calloc_or_fail in gnb_config.c
parent
ee26e510
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
44 deletions
+53
-44
openair2/GNB_APP/gnb_config.c
openair2/GNB_APP/gnb_config.c
+53
-44
No files found.
openair2/GNB_APP/gnb_config.c
View file @
56e510b2
...
...
@@ -431,90 +431,99 @@ void fix_scc(NR_ServingCellConfigCommon_t *scc, uint64_t ssbmap)
/* Function to allocate dedicated serving cell config strutures */
void
prepare_scd
(
NR_ServingCellConfig_t
*
scd
)
{
// Allocate downlink structures
scd
->
downlinkBWP_ToAddModList
=
CALLOC
(
1
,
sizeof
(
*
scd
->
downlinkBWP_ToAddModList
));
scd
->
uplinkConfig
=
CALLOC
(
1
,
sizeof
(
*
scd
->
uplinkConfig
));
scd
->
uplinkConfig
->
uplinkBWP_ToAddModList
=
CALLOC
(
1
,
sizeof
(
*
scd
->
uplinkConfig
->
uplinkBWP_ToAddModList
));
scd
->
bwp_InactivityTimer
=
CALLOC
(
1
,
sizeof
(
*
scd
->
bwp_InactivityTimer
));
scd
->
uplinkConfig
->
firstActiveUplinkBWP_Id
=
CALLOC
(
1
,
sizeof
(
*
scd
->
uplinkConfig
->
firstActiveUplinkBWP_Id
));
scd
->
firstActiveDownlinkBWP_Id
=
CALLOC
(
1
,
sizeof
(
*
scd
->
firstActiveDownlinkBWP_Id
));
scd
->
downlinkBWP_ToAddModList
=
calloc_or_fail
(
1
,
sizeof
(
*
scd
->
downlinkBWP_ToAddModList
));
scd
->
uplinkConfig
=
calloc_or_fail
(
1
,
sizeof
(
*
scd
->
uplinkConfig
));
scd
->
uplinkConfig
->
uplinkBWP_ToAddModList
=
calloc_or_fail
(
1
,
sizeof
(
*
scd
->
uplinkConfig
->
uplinkBWP_ToAddModList
));
scd
->
bwp_InactivityTimer
=
calloc_or_fail
(
1
,
sizeof
(
*
scd
->
bwp_InactivityTimer
));
scd
->
uplinkConfig
->
firstActiveUplinkBWP_Id
=
calloc_or_fail
(
1
,
sizeof
(
*
scd
->
uplinkConfig
->
firstActiveUplinkBWP_Id
));
scd
->
firstActiveDownlinkBWP_Id
=
calloc_or_fail
(
1
,
sizeof
(
*
scd
->
firstActiveDownlinkBWP_Id
));
*
scd
->
firstActiveDownlinkBWP_Id
=
1
;
*
scd
->
uplinkConfig
->
firstActiveUplinkBWP_Id
=
1
;
scd
->
defaultDownlinkBWP_Id
=
CALLOC
(
1
,
sizeof
(
*
scd
->
defaultDownlinkBWP_Id
));
scd
->
defaultDownlinkBWP_Id
=
calloc_or_fail
(
1
,
sizeof
(
*
scd
->
defaultDownlinkBWP_Id
));
*
scd
->
defaultDownlinkBWP_Id
=
0
;
for
(
int
j
=
0
;
j
<
NR_MAX_NUM_BWP
;
j
++
)
{
// Downlink bandwidth part
NR_BWP_Downlink_t
*
bwp
=
calloc
(
1
,
sizeof
(
*
bwp
));
NR_BWP_Downlink_t
*
bwp
=
calloc
_or_fail
(
1
,
sizeof
(
*
bwp
));
bwp
->
bwp_Id
=
j
+
1
;
// Allocate downlink dedicated bandwidth part and PDSCH structures
bwp
->
bwp_Common
=
calloc
(
1
,
sizeof
(
*
bwp
->
bwp_Common
));
bwp
->
bwp_Common
->
pdcch_ConfigCommon
=
calloc
(
1
,
sizeof
(
*
bwp
->
bwp_Common
->
pdcch_ConfigCommon
));
bwp
->
bwp_Common
->
pdsch_ConfigCommon
=
calloc
(
1
,
sizeof
(
*
bwp
->
bwp_Common
->
pdsch_ConfigCommon
));
bwp
->
bwp_Dedicated
=
calloc
(
1
,
sizeof
(
*
bwp
->
bwp_Dedicated
));
bwp
->
bwp_Dedicated
->
pdsch_Config
=
calloc
(
1
,
sizeof
(
*
bwp
->
bwp_Dedicated
->
pdsch_Config
));
bwp
->
bwp_Dedicated
->
pdsch_Config
->
present
=
NR_SetupRelease_PDSCH_Config_PR_setup
;
bwp
->
bwp_Dedicated
->
pdsch_Config
->
choice
.
setup
=
calloc
(
1
,
sizeof
(
*
bwp
->
bwp_Dedicated
->
pdsch_Config
->
choice
.
setup
));
bwp
->
bwp_Dedicated
->
pdsch_Config
->
choice
.
setup
->
dmrs_DownlinkForPDSCH_MappingTypeA
=
calloc
(
1
,
sizeof
(
*
bwp
->
bwp_Dedicated
->
pdsch_Config
->
choice
.
setup
->
dmrs_DownlinkForPDSCH_MappingTypeA
));
bwp
->
bwp_Dedicated
->
pdsch_Config
->
choice
.
setup
->
dmrs_DownlinkForPDSCH_MappingTypeA
->
present
=
NR_SetupRelease_DMRS_DownlinkConfig_PR_setup
;
bwp
->
bwp_Common
=
calloc_or_fail
(
1
,
sizeof
(
*
bwp
->
bwp_Common
));
bwp
->
bwp_Common
->
pdcch_ConfigCommon
=
calloc_or_fail
(
1
,
sizeof
(
*
bwp
->
bwp_Common
->
pdcch_ConfigCommon
));
bwp
->
bwp_Common
->
pdsch_ConfigCommon
=
calloc_or_fail
(
1
,
sizeof
(
*
bwp
->
bwp_Common
->
pdsch_ConfigCommon
));
bwp
->
bwp_Dedicated
=
calloc_or_fail
(
1
,
sizeof
(
*
bwp
->
bwp_Dedicated
));
bwp
->
bwp_Dedicated
->
pdsch_Config
=
calloc_or_fail
(
1
,
sizeof
(
*
bwp
->
bwp_Dedicated
->
pdsch_Config
));
struct
NR_SetupRelease_PDSCH_Config
*
pdsch_Config
=
bwp
->
bwp_Dedicated
->
pdsch_Config
;
pdsch_Config
->
present
=
NR_SetupRelease_PDSCH_Config_PR_setup
;
pdsch_Config
->
choice
.
setup
=
calloc_or_fail
(
1
,
sizeof
(
*
pdsch_Config
->
choice
.
setup
));
struct
NR_PDSCH_Config
*
pc_setup
=
pdsch_Config
->
choice
.
setup
;
pc_setup
->
dmrs_DownlinkForPDSCH_MappingTypeA
=
calloc_or_fail
(
1
,
sizeof
(
*
pc_setup
->
dmrs_DownlinkForPDSCH_MappingTypeA
));
struct
NR_SetupRelease_DMRS_DownlinkConfig
*
typeA
=
pc_setup
->
dmrs_DownlinkForPDSCH_MappingTypeA
;
typeA
->
present
=
NR_SetupRelease_DMRS_DownlinkConfig_PR_setup
;
// Allocate DL DMRS and PTRS configuration
bwp
->
bwp_Dedicated
->
pdsch_Config
->
choice
.
setup
->
dmrs_DownlinkForPDSCH_MappingTypeA
->
choice
.
setup
=
calloc
(
1
,
sizeof
(
*
bwp
->
bwp_Dedicated
->
pdsch_Config
->
choice
.
setup
->
dmrs_DownlinkForPDSCH_MappingT
ypeA
->
choice
.
setup
));
NR_DMRS_DownlinkConfig_t
*
NR_DMRS_DownlinkCfg
=
bwp
->
bwp_Dedicated
->
pdsch_Config
->
choice
.
setup
->
dmrs_DownlinkForPDSCH_MappingT
ypeA
->
choice
.
setup
;
NR_DMRS_DownlinkCfg
->
phaseTrackingRS
=
CALLOC
(
1
,
sizeof
(
*
NR_DMRS_DownlinkCfg
->
phaseTrackingRS
));
typeA
->
choice
.
setup
=
calloc_or_fail
(
1
,
sizeof
(
*
t
ypeA
->
choice
.
setup
));
NR_DMRS_DownlinkConfig_t
*
NR_DMRS_DownlinkCfg
=
t
ypeA
->
choice
.
setup
;
NR_DMRS_DownlinkCfg
->
phaseTrackingRS
=
calloc_or_fail
(
1
,
sizeof
(
*
NR_DMRS_DownlinkCfg
->
phaseTrackingRS
));
NR_DMRS_DownlinkCfg
->
phaseTrackingRS
->
present
=
NR_SetupRelease_PTRS_DownlinkConfig_PR_setup
;
NR_DMRS_DownlinkCfg
->
phaseTrackingRS
->
choice
.
setup
=
CALLOC
(
1
,
sizeof
(
*
NR_DMRS_DownlinkCfg
->
phaseTrackingRS
->
choice
.
setup
));
NR_DMRS_DownlinkCfg
->
phaseTrackingRS
->
choice
.
setup
=
calloc_or_fail
(
1
,
sizeof
(
*
NR_DMRS_DownlinkCfg
->
phaseTrackingRS
->
choice
.
setup
));
NR_PTRS_DownlinkConfig_t
*
NR_PTRS_DownlinkCfg
=
NR_DMRS_DownlinkCfg
->
phaseTrackingRS
->
choice
.
setup
;
NR_PTRS_DownlinkCfg
->
frequencyDensity
=
CALLOC
(
1
,
sizeof
(
*
NR_PTRS_DownlinkCfg
->
frequencyDensity
));
long
*
dl_rbs
=
CALLOC
(
2
,
sizeof
(
long
));
NR_PTRS_DownlinkCfg
->
frequencyDensity
=
calloc_or_fail
(
1
,
sizeof
(
*
NR_PTRS_DownlinkCfg
->
frequencyDensity
));
long
*
dl_rbs
=
calloc_or_fail
(
2
,
sizeof
(
*
dl_rbs
));
for
(
int
i
=
0
;
i
<
2
;
i
++
)
{
asn1cSeqAdd
(
&
NR_PTRS_DownlinkCfg
->
frequencyDensity
->
list
,
&
dl_rbs
[
i
]);
}
NR_PTRS_DownlinkCfg
->
timeDensity
=
CALLOC
(
1
,
sizeof
(
*
NR_PTRS_DownlinkCfg
->
timeDensity
));
long
*
dl_mcs
=
CALLOC
(
3
,
sizeof
(
long
));
NR_PTRS_DownlinkCfg
->
timeDensity
=
calloc_or_fail
(
1
,
sizeof
(
*
NR_PTRS_DownlinkCfg
->
timeDensity
));
long
*
dl_mcs
=
calloc_or_fail
(
3
,
sizeof
(
*
dl_mcs
));
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
asn1cSeqAdd
(
&
NR_PTRS_DownlinkCfg
->
timeDensity
->
list
,
&
dl_mcs
[
i
]);
}
NR_PTRS_DownlinkCfg
->
epre_Ratio
=
CALLOC
(
1
,
sizeof
(
*
NR_PTRS_DownlinkCfg
->
epre_Ratio
));
NR_PTRS_DownlinkCfg
->
resourceElementOffset
=
CALLOC
(
1
,
sizeof
(
*
NR_PTRS_DownlinkCfg
->
resourceElementOffset
));
NR_PTRS_DownlinkCfg
->
epre_Ratio
=
calloc_or_fail
(
1
,
sizeof
(
*
NR_PTRS_DownlinkCfg
->
epre_Ratio
));
NR_PTRS_DownlinkCfg
->
resourceElementOffset
=
calloc_or_fail
(
1
,
sizeof
(
*
NR_PTRS_DownlinkCfg
->
resourceElementOffset
));
*
NR_PTRS_DownlinkCfg
->
resourceElementOffset
=
0
;
asn1cSeqAdd
(
&
scd
->
downlinkBWP_ToAddModList
->
list
,
bwp
);
// Allocate uplink structures
NR_PUSCH_Config_t
*
pusch_Config
=
CALLOC
(
1
,
sizeof
(
*
pusch_Config
));
NR_PUSCH_Config_t
*
pusch_Config
=
calloc_or_fail
(
1
,
sizeof
(
*
pusch_Config
));
// Allocate UL DMRS and PTRS structures
pusch_Config
->
dmrs_UplinkForPUSCH_MappingTypeB
=
CALLOC
(
1
,
sizeof
(
*
pusch_Config
->
dmrs_UplinkForPUSCH_MappingTypeB
));
pusch_Config
->
dmrs_UplinkForPUSCH_MappingTypeB
=
calloc_or_fail
(
1
,
sizeof
(
*
pusch_Config
->
dmrs_UplinkForPUSCH_MappingTypeB
));
pusch_Config
->
dmrs_UplinkForPUSCH_MappingTypeB
->
present
=
NR_SetupRelease_DMRS_UplinkConfig_PR_setup
;
pusch_Config
->
dmrs_UplinkForPUSCH_MappingTypeB
->
choice
.
setup
=
CALLOC
(
1
,
sizeof
(
*
pusch_Config
->
dmrs_UplinkForPUSCH_MappingTypeB
->
choice
.
setup
));
pusch_Config
->
dmrs_UplinkForPUSCH_MappingTypeB
->
choice
.
setup
=
calloc_or_fail
(
1
,
sizeof
(
*
pusch_Config
->
dmrs_UplinkForPUSCH_MappingTypeB
->
choice
.
setup
));
NR_DMRS_UplinkConfig_t
*
NR_DMRS_UplinkConfig
=
pusch_Config
->
dmrs_UplinkForPUSCH_MappingTypeB
->
choice
.
setup
;
NR_DMRS_UplinkConfig
->
phaseTrackingRS
=
CALLOC
(
1
,
sizeof
(
*
NR_DMRS_UplinkConfig
->
phaseTrackingRS
));
NR_DMRS_UplinkConfig
->
phaseTrackingRS
=
calloc_or_fail
(
1
,
sizeof
(
*
NR_DMRS_UplinkConfig
->
phaseTrackingRS
));
NR_DMRS_UplinkConfig
->
phaseTrackingRS
->
present
=
NR_SetupRelease_PTRS_UplinkConfig_PR_setup
;
NR_DMRS_UplinkConfig
->
phaseTrackingRS
->
choice
.
setup
=
CALLOC
(
1
,
sizeof
(
*
NR_DMRS_UplinkConfig
->
phaseTrackingRS
->
choice
.
setup
));
NR_DMRS_UplinkConfig
->
phaseTrackingRS
->
choice
.
setup
=
calloc_or_fail
(
1
,
sizeof
(
*
NR_DMRS_UplinkConfig
->
phaseTrackingRS
->
choice
.
setup
));
NR_PTRS_UplinkConfig_t
*
NR_PTRS_UplinkConfig
=
NR_DMRS_UplinkConfig
->
phaseTrackingRS
->
choice
.
setup
;
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
=
CALLOC
(
1
,
sizeof
(
*
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
));
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
->
frequencyDensity
=
CALLOC
(
1
,
sizeof
(
*
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
->
frequencyDensity
));
long
*
n_rbs
=
CALLOC
(
2
,
sizeof
(
long
));
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
=
calloc_or_fail
(
1
,
sizeof
(
*
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
));
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
->
frequencyDensity
=
calloc_or_fail
(
1
,
sizeof
(
*
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
->
frequencyDensity
));
long
*
n_rbs
=
calloc_or_fail
(
2
,
sizeof
(
*
n_rbs
));
for
(
int
i
=
0
;
i
<
2
;
i
++
)
{
asn1cSeqAdd
(
&
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
->
frequencyDensity
->
list
,
&
n_rbs
[
i
]);
}
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
->
timeDensity
=
CALLOC
(
1
,
sizeof
(
*
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
->
timeDensity
));
long
*
ptrs_mcs
=
CALLOC
(
3
,
sizeof
(
long
));
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
->
timeDensity
=
calloc_or_fail
(
1
,
sizeof
(
*
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
->
timeDensity
));
long
*
ptrs_mcs
=
calloc_or_fail
(
3
,
sizeof
(
*
ptrs_mcs
));
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
asn1cSeqAdd
(
&
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
->
timeDensity
->
list
,
&
ptrs_mcs
[
i
]);
}
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
->
resourceElementOffset
=
CALLOC
(
1
,
sizeof
(
*
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
->
resourceElementOffset
));
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
->
resourceElementOffset
=
calloc_or_fail
(
1
,
sizeof
(
*
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
->
resourceElementOffset
));
*
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
->
resourceElementOffset
=
0
;
// UL bandwidth part
NR_BWP_Uplink_t
*
ubwp
=
CALLOC
(
1
,
sizeof
(
*
ubwp
));
NR_BWP_Uplink_t
*
ubwp
=
calloc_or_fail
(
1
,
sizeof
(
*
ubwp
));
ubwp
->
bwp_Id
=
j
+
1
;
ubwp
->
bwp_Common
=
CALLOC
(
1
,
sizeof
(
*
ubwp
->
bwp_Common
));
ubwp
->
bwp_Dedicated
=
CALLOC
(
1
,
sizeof
(
*
ubwp
->
bwp_Dedicated
));
ubwp
->
bwp_Common
=
calloc_or_fail
(
1
,
sizeof
(
*
ubwp
->
bwp_Common
));
ubwp
->
bwp_Dedicated
=
calloc_or_fail
(
1
,
sizeof
(
*
ubwp
->
bwp_Dedicated
));
ubwp
->
bwp_Dedicated
->
pusch_Config
=
CALLOC
(
1
,
sizeof
(
*
ubwp
->
bwp_Dedicated
->
pusch_Config
));
ubwp
->
bwp_Dedicated
->
pusch_Config
=
calloc_or_fail
(
1
,
sizeof
(
*
ubwp
->
bwp_Dedicated
->
pusch_Config
));
ubwp
->
bwp_Dedicated
->
pusch_Config
->
present
=
NR_SetupRelease_PUSCH_Config_PR_setup
;
ubwp
->
bwp_Dedicated
->
pusch_Config
->
choice
.
setup
=
pusch_Config
;
...
...
@@ -930,7 +939,7 @@ void RCconfig_NR_L1(void)
static
NR_ServingCellConfigCommon_t
*
get_scc_config
(
configmodule_interface_t
*
cfg
,
int
minRXTXTIME
)
{
NR_ServingCellConfigCommon_t
*
scc
=
calloc
(
1
,
sizeof
(
*
scc
));
NR_ServingCellConfigCommon_t
*
scc
=
calloc
_or_fail
(
1
,
sizeof
(
*
scc
));
uint64_t
ssb_bitmap
=
0xff
;
prepare_scc
(
scc
);
paramdef_t
SCCsParams
[]
=
SCCPARAMS_DESC
(
scc
);
...
...
@@ -2119,7 +2128,7 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) {
paramlist_def_t
GNBParamList
=
{
GNB_CONFIG_STRING_GNB_LIST
,
NULL
,
0
};
/* get global parameters, defined outside any section in the config file */
config_get
(
config_get_if
(),
GNBSParams
,
sizeofArray
(
GNBSParams
),
NULL
);
NR_ServingCellConfigCommon_t
*
scc
=
calloc
(
1
,
sizeof
(
NR_ServingCellConfigCommon_t
));
NR_ServingCellConfigCommon_t
*
scc
=
calloc
_or_fail
(
1
,
sizeof
(
*
scc
));
uint64_t
ssb_bitmap
=
0xff
;
memset
((
void
*
)
scc
,
0
,
sizeof
(
NR_ServingCellConfigCommon_t
));
prepare_scc
(
scc
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment