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
Michael Black
OpenXG-RAN
Commits
44d5b378
Commit
44d5b378
authored
Mar 27, 2023
by
Robert Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor get_initial_cellGroupConfig()
parent
88e6d9df
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
322 additions
and
309 deletions
+322
-309
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
+5
-26
openair2/RRC/NR/MESSAGES/asn1_msg.c
openair2/RRC/NR/MESSAGES/asn1_msg.c
+2
-272
openair2/RRC/NR/MESSAGES/asn1_msg.h
openair2/RRC/NR/MESSAGES/asn1_msg.h
+4
-11
openair2/RRC/NR/nr_rrc_config.c
openair2/RRC/NR/nr_rrc_config.c
+303
-0
openair2/RRC/NR/nr_rrc_config.h
openair2/RRC/NR/nr_rrc_config.h
+8
-0
No files found.
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
View file @
44d5b378
...
...
@@ -2884,24 +2884,16 @@ void send_initial_ul_rrc_message(gNB_MAC_INST *mac, int rnti, const uint8_t *sdu
NR_UE_info_t
*
UE
=
(
NR_UE_info_t
*
)
rawUE
;
uint8_t
du2cu_rrc_container
[
1024
];
asn_enc_rval_t
enc_rval
=
uper_encode_to_buffer
(
&
asn_DEF_NR_CellGroupConfig
,
NULL
,
UE
->
CellGroup
,
du2cu_rrc_container
,
sizeof
(
du2cu_rrc_container
));
AssertFatal
(
enc_rval
.
encoded
>
0
,
"Could not encode cellGroupConfig for UE %04x, failed element %s
\n
"
,
rnti
,
enc_rval
.
failed_type
->
name
);
uint8_t
du2cu
[
1024
];
int
encoded
=
encode_cellGroupConfig
(
UE
->
CellGroup
,
du2cu
,
sizeof
(
du2cu
));
const
f1ap_initial_ul_rrc_message_t
ul_rrc_msg
=
{
/* TODO: add mcc, mnc, cell_id, ..., is not available at MAC yet */
.
crnti
=
rnti
,
.
rrc_container
=
(
uint8_t
*
)
sdu
,
.
rrc_container_length
=
sdu_len
,
.
du2cu_rrc_container
=
(
uint8_t
*
)
du2cu
_rrc_container
,
.
du2cu_rrc_container_length
=
(
enc_rval
.
encoded
+
7
)
/
8
.
du2cu_rrc_container
=
(
uint8_t
*
)
du2cu
,
.
du2cu_rrc_container_length
=
encoded
};
mac
->
mac_rrc
.
initial_ul_rrc_message_transfer
(
0
,
&
ul_rrc_msg
);
}
...
...
@@ -2915,20 +2907,7 @@ void prepare_initial_ul_rrc_message(gNB_MAC_INST *mac, NR_UE_info_t *UE)
gNB_RRC_INST
*
rrc
=
RC
.
nrrrc
[
mod_id
];
const
NR_ServingCellConfigCommon_t
*
scc
=
rrc
->
carrier
.
servingcellconfigcommon
;
const
NR_ServingCellConfig_t
*
sccd
=
rrc
->
configuration
.
scd
;
NR_CellGroupConfig_t
*
cellGroupConfig
=
calloc
(
1
,
sizeof
(
*
cellGroupConfig
));
AssertFatal
(
cellGroupConfig
!=
NULL
,
"out of memory
\n
"
);
fill_initial_cellGroupConfig
(
UE
->
uid
,
cellGroupConfig
,
scc
,
sccd
,
&
rrc
->
configuration
);
uint8_t
du2cu_rrc_container
[
1024
];
asn_enc_rval_t
enc_rval
=
uper_encode_to_buffer
(
&
asn_DEF_NR_CellGroupConfig
,
NULL
,
cellGroupConfig
,
du2cu_rrc_container
,
sizeof
(
du2cu_rrc_container
));
AssertFatal
(
enc_rval
.
encoded
>
0
,
"Could not encode cellGroupConfig for UE %04x, failed element %s
\n
"
,
UE
->
rnti
,
enc_rval
.
failed_type
->
name
);
NR_CellGroupConfig_t
*
cellGroupConfig
=
get_initial_cellGroupConfig
(
UE
->
uid
,
scc
,
sccd
,
&
rrc
->
configuration
);
UE
->
CellGroup
=
cellGroupConfig
;
nr_mac_update_cellgroup
(
mac
,
UE
->
rnti
,
cellGroupConfig
);
...
...
openair2/RRC/NR/MESSAGES/asn1_msg.c
View file @
44d5b378
...
...
@@ -292,239 +292,6 @@ int do_RRCReject(uint8_t Mod_id,
return
(
enc_rval
.
encoded
+
7
)
/
8
;
}
void
fill_initial_SpCellConfig
(
int
uid
,
NR_SpCellConfig_t
*
SpCellConfig
,
const
NR_ServingCellConfigCommon_t
*
scc
,
const
NR_ServingCellConfig_t
*
servingcellconfigdedicated
,
const
gNB_RrcConfigurationReq
*
configuration
)
{
// This assert will never happen in the current implementation because NUMBER_OF_UE_MAX = 4.
// However, if in the future NUMBER_OF_UE_MAX is increased, it will be necessary to improve the allocation of SRS resources,
// where the startPosition = 2 or 3 and sl160 = 17, 17, 27 ... 157 only give us 30 different allocations.
AssertFatal
(
uid
>=
0
&&
uid
<
30
,
"gNB cannot allocate the SRS resources
\n
"
);
const
int
pdsch_AntennaPorts
=
configuration
->
pdsch_AntennaPorts
.
N1
*
configuration
->
pdsch_AntennaPorts
.
N2
*
configuration
->
pdsch_AntennaPorts
.
XP
;
int
curr_bwp
=
NRRIV2BW
(
scc
->
downlinkConfigCommon
->
initialDownlinkBWP
->
genericParameters
.
locationAndBandwidth
,
MAX_BWP_SIZE
);
SpCellConfig
->
servCellIndex
=
NULL
;
SpCellConfig
->
reconfigurationWithSync
=
NULL
;
SpCellConfig
->
rlmInSyncOutOfSyncThreshold
=
NULL
;
SpCellConfig
->
rlf_TimersAndConstants
=
NULL
;
SpCellConfig
->
spCellConfigDedicated
=
calloc
(
1
,
sizeof
(
*
SpCellConfig
->
spCellConfigDedicated
));
SpCellConfig
->
spCellConfigDedicated
->
uplinkConfig
=
calloc
(
1
,
sizeof
(
*
SpCellConfig
->
spCellConfigDedicated
->
uplinkConfig
));
NR_UplinkConfig_t
*
uplinkConfig
=
SpCellConfig
->
spCellConfigDedicated
->
uplinkConfig
;
NR_BWP_UplinkDedicated_t
*
initialUplinkBWP
=
calloc
(
1
,
sizeof
(
*
initialUplinkBWP
));
uplinkConfig
->
initialUplinkBWP
=
initialUplinkBWP
;
initialUplinkBWP
->
pucch_Config
=
calloc
(
1
,
sizeof
(
*
initialUplinkBWP
->
pucch_Config
));
initialUplinkBWP
->
pucch_Config
->
present
=
NR_SetupRelease_PUCCH_Config_PR_setup
;
NR_PUCCH_Config_t
*
pucch_Config
=
calloc
(
1
,
sizeof
(
*
pucch_Config
));
initialUplinkBWP
->
pucch_Config
->
choice
.
setup
=
pucch_Config
;
pucch_Config
->
resourceSetToAddModList
=
calloc
(
1
,
sizeof
(
*
pucch_Config
->
resourceSetToAddModList
));
pucch_Config
->
resourceSetToReleaseList
=
NULL
;
pucch_Config
->
resourceToAddModList
=
calloc
(
1
,
sizeof
(
*
pucch_Config
->
resourceToAddModList
));
pucch_Config
->
resourceToReleaseList
=
NULL
;
config_pucch_resset0
(
pucch_Config
,
uid
,
curr_bwp
,
NULL
);
config_pucch_resset1
(
pucch_Config
,
NULL
);
set_pucch_power_config
(
pucch_Config
,
configuration
->
do_CSIRS
);
initialUplinkBWP
->
pusch_Config
=
config_pusch
(
NULL
);
long
maxMIMO_Layers
=
uplinkConfig
&&
uplinkConfig
->
pusch_ServingCellConfig
&&
uplinkConfig
->
pusch_ServingCellConfig
->
choice
.
setup
->
ext1
&&
uplinkConfig
->
pusch_ServingCellConfig
->
choice
.
setup
->
ext1
->
maxMIMO_Layers
?
*
uplinkConfig
->
pusch_ServingCellConfig
->
choice
.
setup
->
ext1
->
maxMIMO_Layers
:
1
;
// We are using do_srs = 0 here because the periodic SRS will only be enabled in update_cellGroupConfig() if do_srs == 1
initialUplinkBWP
->
srs_Config
=
calloc
(
1
,
sizeof
(
*
initialUplinkBWP
->
srs_Config
));
config_srs
(
scc
,
initialUplinkBWP
->
srs_Config
,
NULL
,
curr_bwp
,
uid
,
0
,
maxMIMO_Layers
,
0
);
scheduling_request_config
(
scc
,
pucch_Config
,
scc
->
uplinkConfigCommon
->
initialUplinkBWP
->
genericParameters
.
subcarrierSpacing
);
set_dl_DataToUL_ACK
(
pucch_Config
,
configuration
->
minRXTXTIME
,
scc
->
uplinkConfigCommon
->
initialUplinkBWP
->
genericParameters
.
subcarrierSpacing
);
SpCellConfig
->
spCellConfigDedicated
->
initialDownlinkBWP
=
calloc
(
1
,
sizeof
(
*
SpCellConfig
->
spCellConfigDedicated
->
initialDownlinkBWP
));
NR_BWP_DownlinkDedicated_t
*
bwp_Dedicated
=
SpCellConfig
->
spCellConfigDedicated
->
initialDownlinkBWP
;
bwp_Dedicated
->
pdcch_Config
=
calloc
(
1
,
sizeof
(
*
bwp_Dedicated
->
pdcch_Config
));
bwp_Dedicated
->
pdcch_Config
->
present
=
NR_SetupRelease_PDCCH_Config_PR_setup
;
bwp_Dedicated
->
pdcch_Config
->
choice
.
setup
=
calloc
(
1
,
sizeof
(
*
bwp_Dedicated
->
pdcch_Config
->
choice
.
setup
));
bwp_Dedicated
->
pdcch_Config
->
choice
.
setup
->
searchSpacesToAddModList
=
calloc
(
1
,
sizeof
(
*
bwp_Dedicated
->
pdcch_Config
->
choice
.
setup
->
searchSpacesToAddModList
));
bwp_Dedicated
->
pdcch_Config
->
choice
.
setup
->
controlResourceSetToAddModList
=
calloc
(
1
,
sizeof
(
*
bwp_Dedicated
->
pdcch_Config
->
choice
.
setup
->
controlResourceSetToAddModList
));
uint64_t
bitmap
=
get_ssb_bitmap
(
scc
);
NR_ControlResourceSet_t
*
coreset
=
get_coreset_config
(
0
,
curr_bwp
,
bitmap
);
asn1cSeqAdd
(
&
bwp_Dedicated
->
pdcch_Config
->
choice
.
setup
->
controlResourceSetToAddModList
->
list
,
coreset
);
bwp_Dedicated
->
pdcch_Config
->
choice
.
setup
->
searchSpacesToAddModList
=
calloc
(
1
,
sizeof
(
*
bwp_Dedicated
->
pdcch_Config
->
choice
.
setup
->
searchSpacesToAddModList
));
NR_SearchSpace_t
*
ss2
=
rrc_searchspace_config
(
false
,
5
,
coreset
->
controlResourceSetId
);
asn1cSeqAdd
(
&
bwp_Dedicated
->
pdcch_Config
->
choice
.
setup
->
searchSpacesToAddModList
->
list
,
ss2
);
bwp_Dedicated
->
pdsch_Config
=
config_pdsch
(
bitmap
,
0
,
pdsch_AntennaPorts
);
SpCellConfig
->
spCellConfigDedicated
->
tag_Id
=
0
;
SpCellConfig
->
spCellConfigDedicated
->
pdsch_ServingCellConfig
=
calloc
(
1
,
sizeof
(
*
SpCellConfig
->
spCellConfigDedicated
->
pdsch_ServingCellConfig
));
NR_PDSCH_ServingCellConfig_t
*
pdsch_servingcellconfig
=
calloc
(
1
,
sizeof
(
*
pdsch_servingcellconfig
));
SpCellConfig
->
spCellConfigDedicated
->
pdsch_ServingCellConfig
->
present
=
NR_SetupRelease_PDSCH_ServingCellConfig_PR_setup
;
SpCellConfig
->
spCellConfigDedicated
->
pdsch_ServingCellConfig
->
choice
.
setup
=
pdsch_servingcellconfig
;
// Downlink BWPs
int
n_dl_bwp
=
0
;
if
(
servingcellconfigdedicated
&&
servingcellconfigdedicated
->
downlinkBWP_ToAddModList
&&
servingcellconfigdedicated
->
downlinkBWP_ToAddModList
->
list
.
count
>
0
)
{
n_dl_bwp
=
servingcellconfigdedicated
->
downlinkBWP_ToAddModList
->
list
.
count
;
}
if
(
n_dl_bwp
>
0
){
SpCellConfig
->
spCellConfigDedicated
->
downlinkBWP_ToAddModList
=
calloc
(
1
,
sizeof
(
*
SpCellConfig
->
spCellConfigDedicated
->
downlinkBWP_ToAddModList
));
for
(
int
bwp_loop
=
0
;
bwp_loop
<
n_dl_bwp
;
bwp_loop
++
)
{
NR_BWP_Downlink_t
*
bwp
=
calloc
(
1
,
sizeof
(
*
bwp
));
config_downlinkBWP
(
bwp
,
scc
,
servingcellconfigdedicated
,
NULL
,
0
,
false
,
bwp_loop
,
true
);
asn1cSeqAdd
(
&
SpCellConfig
->
spCellConfigDedicated
->
downlinkBWP_ToAddModList
->
list
,
bwp
);
}
SpCellConfig
->
spCellConfigDedicated
->
firstActiveDownlinkBWP_Id
=
calloc
(
1
,
sizeof
(
*
SpCellConfig
->
spCellConfigDedicated
->
firstActiveDownlinkBWP_Id
));
*
SpCellConfig
->
spCellConfigDedicated
->
firstActiveDownlinkBWP_Id
=
servingcellconfigdedicated
->
firstActiveDownlinkBWP_Id
?
*
servingcellconfigdedicated
->
firstActiveDownlinkBWP_Id
:
1
;
SpCellConfig
->
spCellConfigDedicated
->
defaultDownlinkBWP_Id
=
calloc
(
1
,
sizeof
(
*
SpCellConfig
->
spCellConfigDedicated
->
defaultDownlinkBWP_Id
));
*
SpCellConfig
->
spCellConfigDedicated
->
defaultDownlinkBWP_Id
=
servingcellconfigdedicated
->
defaultDownlinkBWP_Id
?
*
servingcellconfigdedicated
->
defaultDownlinkBWP_Id
:
1
;
}
// Uplink BWPs
int
n_ul_bwp
=
0
;
if
(
servingcellconfigdedicated
&&
servingcellconfigdedicated
->
uplinkConfig
&&
servingcellconfigdedicated
->
uplinkConfig
->
uplinkBWP_ToAddModList
&&
servingcellconfigdedicated
->
uplinkConfig
->
uplinkBWP_ToAddModList
->
list
.
count
>
0
)
{
n_ul_bwp
=
servingcellconfigdedicated
->
uplinkConfig
->
uplinkBWP_ToAddModList
->
list
.
count
;
}
if
(
n_ul_bwp
>
0
)
{
uplinkConfig
->
uplinkBWP_ToAddModList
=
calloc
(
1
,
sizeof
(
*
uplinkConfig
->
uplinkBWP_ToAddModList
));
for
(
int
bwp_loop
=
0
;
bwp_loop
<
n_ul_bwp
;
bwp_loop
++
)
{
NR_BWP_Uplink_t
*
ubwp
=
calloc
(
1
,
sizeof
(
*
ubwp
));
config_uplinkBWP
(
ubwp
,
bwp_loop
,
true
,
uid
,
configuration
,
servingcellconfigdedicated
,
scc
,
NULL
);
asn1cSeqAdd
(
&
uplinkConfig
->
uplinkBWP_ToAddModList
->
list
,
ubwp
);
}
uplinkConfig
->
firstActiveUplinkBWP_Id
=
calloc
(
1
,
sizeof
(
*
uplinkConfig
->
firstActiveUplinkBWP_Id
));
*
uplinkConfig
->
firstActiveUplinkBWP_Id
=
servingcellconfigdedicated
->
uplinkConfig
->
firstActiveUplinkBWP_Id
?
*
servingcellconfigdedicated
->
uplinkConfig
->
firstActiveUplinkBWP_Id
:
1
;
}
SpCellConfig
->
spCellConfigDedicated
->
csi_MeasConfig
=
calloc
(
1
,
sizeof
(
*
SpCellConfig
->
spCellConfigDedicated
->
csi_MeasConfig
));
SpCellConfig
->
spCellConfigDedicated
->
csi_MeasConfig
->
present
=
NR_SetupRelease_CSI_MeasConfig_PR_setup
;
NR_CSI_MeasConfig_t
*
csi_MeasConfig
=
calloc
(
1
,
sizeof
(
*
csi_MeasConfig
));
SpCellConfig
->
spCellConfigDedicated
->
csi_MeasConfig
->
choice
.
setup
=
csi_MeasConfig
;
csi_MeasConfig
->
csi_SSB_ResourceSetToAddModList
=
calloc
(
1
,
sizeof
(
*
csi_MeasConfig
->
csi_SSB_ResourceSetToAddModList
));
csi_MeasConfig
->
csi_SSB_ResourceSetToReleaseList
=
NULL
;
csi_MeasConfig
->
csi_ResourceConfigToAddModList
=
calloc
(
1
,
sizeof
(
*
csi_MeasConfig
->
csi_ResourceConfigToAddModList
));
csi_MeasConfig
->
csi_ResourceConfigToReleaseList
=
NULL
;
csi_MeasConfig
->
csi_ReportConfigToAddModList
=
calloc
(
1
,
sizeof
(
*
csi_MeasConfig
->
csi_ReportConfigToAddModList
));
csi_MeasConfig
->
csi_ReportConfigToReleaseList
=
NULL
;
NR_CSI_SSB_ResourceSet_t
*
ssbresset0
=
calloc
(
1
,
sizeof
(
*
ssbresset0
));
ssbresset0
->
csi_SSB_ResourceSetId
=
0
;
for
(
int
i
=
0
;
i
<
64
;
i
++
)
{
if
((
bitmap
>>
(
63
-
i
))
&
0x01
)
{
NR_SSB_Index_t
*
ssbres
=
NULL
;
asn1cCallocOne
(
ssbres
,
i
);
asn1cSeqAdd
(
&
ssbresset0
->
csi_SSB_ResourceList
.
list
,
ssbres
);
}
}
asn1cSeqAdd
(
&
csi_MeasConfig
->
csi_SSB_ResourceSetToAddModList
->
list
,
ssbresset0
);
int
bwp_loop_end
=
n_dl_bwp
>
0
?
n_dl_bwp
:
1
;
for
(
int
bwp_loop
=
0
;
bwp_loop
<
bwp_loop_end
;
bwp_loop
++
)
{
int
curr_bwp
,
bwp_id
;
struct
NR_SetupRelease_PDSCH_Config
*
pdsch_Config
;
if
(
n_dl_bwp
==
0
)
{
pdsch_Config
=
SpCellConfig
->
spCellConfigDedicated
->
initialDownlinkBWP
->
pdsch_Config
;
curr_bwp
=
NRRIV2BW
(
scc
->
downlinkConfigCommon
->
initialDownlinkBWP
->
genericParameters
.
locationAndBandwidth
,
MAX_BWP_SIZE
);
bwp_id
=
0
;
}
else
{
NR_BWP_Downlink_t
*
bwp
=
SpCellConfig
->
spCellConfigDedicated
->
downlinkBWP_ToAddModList
->
list
.
array
[
bwp_loop
];
pdsch_Config
=
bwp
->
bwp_Dedicated
->
pdsch_Config
;
curr_bwp
=
NRRIV2BW
(
bwp
->
bwp_Common
->
genericParameters
.
locationAndBandwidth
,
MAX_BWP_SIZE
);
bwp_id
=
bwp
->
bwp_Id
;
}
config_csirs
(
scc
,
csi_MeasConfig
,
uid
,
pdsch_AntennaPorts
,
curr_bwp
,
configuration
->
do_CSIRS
,
bwp_loop
);
config_csiim
(
configuration
->
do_CSIRS
,
pdsch_AntennaPorts
,
curr_bwp
,
csi_MeasConfig
,
bwp_loop
);
NR_CSI_ResourceConfig_t
*
csires1
=
calloc
(
1
,
sizeof
(
*
csires1
));
csires1
->
csi_ResourceConfigId
=
bwp_id
+
20
;
csires1
->
csi_RS_ResourceSetList
.
present
=
NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB
;
csires1
->
csi_RS_ResourceSetList
.
choice
.
nzp_CSI_RS_SSB
=
calloc
(
1
,
sizeof
(
*
csires1
->
csi_RS_ResourceSetList
.
choice
.
nzp_CSI_RS_SSB
));
csires1
->
csi_RS_ResourceSetList
.
choice
.
nzp_CSI_RS_SSB
->
csi_SSB_ResourceSetList
=
calloc
(
1
,
sizeof
(
*
csires1
->
csi_RS_ResourceSetList
.
choice
.
nzp_CSI_RS_SSB
->
csi_SSB_ResourceSetList
));
NR_CSI_SSB_ResourceSetId_t
*
ssbres00
=
calloc
(
1
,
sizeof
(
*
ssbres00
));
*
ssbres00
=
0
;
asn1cSeqAdd
(
&
csires1
->
csi_RS_ResourceSetList
.
choice
.
nzp_CSI_RS_SSB
->
csi_SSB_ResourceSetList
->
list
,
ssbres00
);
csires1
->
bwp_Id
=
bwp_id
;
csires1
->
resourceType
=
NR_CSI_ResourceConfig__resourceType_periodic
;
asn1cSeqAdd
(
&
csi_MeasConfig
->
csi_ResourceConfigToAddModList
->
list
,
csires1
);
NR_PUCCH_CSI_Resource_t
*
pucchcsires1
=
calloc
(
1
,
sizeof
(
*
pucchcsires1
));
pucchcsires1
->
uplinkBandwidthPartId
=
bwp_id
;
pucchcsires1
->
pucch_Resource
=
2
;
if
(
configuration
->
do_CSIRS
)
{
NR_CSI_ResourceConfig_t
*
csires0
=
calloc
(
1
,
sizeof
(
*
csires0
));
csires0
->
csi_ResourceConfigId
=
bwp_id
;
csires0
->
csi_RS_ResourceSetList
.
present
=
NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB
;
csires0
->
csi_RS_ResourceSetList
.
choice
.
nzp_CSI_RS_SSB
=
calloc
(
1
,
sizeof
(
*
csires0
->
csi_RS_ResourceSetList
.
choice
.
nzp_CSI_RS_SSB
));
csires0
->
csi_RS_ResourceSetList
.
choice
.
nzp_CSI_RS_SSB
->
nzp_CSI_RS_ResourceSetList
=
calloc
(
1
,
sizeof
(
*
csires0
->
csi_RS_ResourceSetList
.
choice
.
nzp_CSI_RS_SSB
->
nzp_CSI_RS_ResourceSetList
));
NR_NZP_CSI_RS_ResourceSetId_t
*
nzp0
=
calloc
(
1
,
sizeof
(
*
nzp0
));
*
nzp0
=
bwp_loop
;
asn1cSeqAdd
(
&
csires0
->
csi_RS_ResourceSetList
.
choice
.
nzp_CSI_RS_SSB
->
nzp_CSI_RS_ResourceSetList
->
list
,
nzp0
);
csires0
->
bwp_Id
=
bwp_id
;
csires0
->
resourceType
=
NR_CSI_ResourceConfig__resourceType_periodic
;
asn1cSeqAdd
(
&
csi_MeasConfig
->
csi_ResourceConfigToAddModList
->
list
,
csires0
);
}
if
(
configuration
->
do_CSIRS
&&
pdsch_AntennaPorts
>
1
)
{
NR_CSI_ResourceConfig_t
*
csires2
=
calloc
(
1
,
sizeof
(
*
csires2
));
csires2
->
csi_ResourceConfigId
=
bwp_id
+
10
;
csires2
->
csi_RS_ResourceSetList
.
present
=
NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_csi_IM_ResourceSetList
;
csires2
->
csi_RS_ResourceSetList
.
choice
.
csi_IM_ResourceSetList
=
calloc
(
1
,
sizeof
(
*
csires2
->
csi_RS_ResourceSetList
.
choice
.
csi_IM_ResourceSetList
));
NR_CSI_IM_ResourceSetId_t
*
csiim00
=
calloc
(
1
,
sizeof
(
*
csiim00
));
*
csiim00
=
bwp_loop
;
asn1cSeqAdd
(
&
csires2
->
csi_RS_ResourceSetList
.
choice
.
csi_IM_ResourceSetList
->
list
,
csiim00
);
csires2
->
bwp_Id
=
bwp_id
;
csires2
->
resourceType
=
NR_CSI_ResourceConfig__resourceType_periodic
;
asn1cSeqAdd
(
&
csi_MeasConfig
->
csi_ResourceConfigToAddModList
->
list
,
csires2
);
config_csi_meas_report
(
csi_MeasConfig
,
scc
,
pucchcsires1
,
pdsch_Config
,
&
configuration
->
pdsch_AntennaPorts
,
NR_MAX_SUPPORTED_DL_LAYERS
,
bwp_id
,
uid
);
}
config_rsrp_meas_report
(
csi_MeasConfig
,
scc
,
pucchcsires1
,
configuration
->
do_CSIRS
,
bwp_id
+
10
,
uid
);
}
pdsch_servingcellconfig
->
codeBlockGroupTransmission
=
NULL
;
pdsch_servingcellconfig
->
xOverhead
=
NULL
;
pdsch_servingcellconfig
->
nrofHARQ_ProcessesForPDSCH
=
calloc
(
1
,
sizeof
(
*
pdsch_servingcellconfig
->
nrofHARQ_ProcessesForPDSCH
));
*
pdsch_servingcellconfig
->
nrofHARQ_ProcessesForPDSCH
=
NR_PDSCH_ServingCellConfig__nrofHARQ_ProcessesForPDSCH_n16
;
pdsch_servingcellconfig
->
pucch_Cell
=
NULL
;
pdsch_servingcellconfig
->
ext1
=
calloc
(
1
,
sizeof
(
*
pdsch_servingcellconfig
->
ext1
));
pdsch_servingcellconfig
->
ext1
->
maxMIMO_Layers
=
calloc
(
1
,
sizeof
(
*
pdsch_servingcellconfig
->
ext1
->
maxMIMO_Layers
));
*
pdsch_servingcellconfig
->
ext1
->
maxMIMO_Layers
=
2
;
if
(
LOG_DEBUGFLAG
(
DEBUG_ASN1
)
)
{
xer_fprint
(
stdout
,
&
asn_DEF_NR_SpCellConfig
,
(
void
*
)
SpCellConfig
);
}
}
NR_RLC_BearerConfig_t
*
get_SRB_RLC_BearerConfig
(
long
channelId
,
long
priority
,
e_NR_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration
bucketSizeDuration
)
...
...
@@ -750,41 +517,6 @@ void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig,
}
}
void
fill_initial_cellGroupConfig
(
int
uid
,
NR_CellGroupConfig_t
*
cellGroupConfig
,
const
NR_ServingCellConfigCommon_t
*
scc
,
const
NR_ServingCellConfig_t
*
servingcellconfigdedicated
,
const
gNB_RrcConfigurationReq
*
configuration
)
{
NR_PhysicalCellGroupConfig_t
*
physicalCellGroupConfig
=
NULL
;
cellGroupConfig
->
cellGroupId
=
0
;
/* Rlc Bearer Config */
/* TS38.331 9.2.1 Default SRB configurations */
cellGroupConfig
->
rlc_BearerToAddModList
=
calloc
(
1
,
sizeof
(
*
cellGroupConfig
->
rlc_BearerToAddModList
));
NR_RLC_BearerConfig_t
*
rlc_BearerConfig
=
get_SRB_RLC_BearerConfig
(
1
,
1
,
NR_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms1000
);
asn1cSeqAdd
(
&
cellGroupConfig
->
rlc_BearerToAddModList
->
list
,
rlc_BearerConfig
);
cellGroupConfig
->
rlc_BearerToReleaseList
=
NULL
;
/* mac CellGroup Config */
cellGroupConfig
->
mac_CellGroupConfig
=
configure_mac_cellgroup
();
physicalCellGroupConfig
=
calloc
(
1
,
sizeof
(
*
physicalCellGroupConfig
));
physicalCellGroupConfig
->
p_NR_FR1
=
NULL
;
physicalCellGroupConfig
->
pdsch_HARQ_ACK_Codebook
=
NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic
;
cellGroupConfig
->
physicalCellGroupConfig
=
physicalCellGroupConfig
;
cellGroupConfig
->
spCellConfig
=
calloc
(
1
,
sizeof
(
*
cellGroupConfig
->
spCellConfig
));
fill_initial_SpCellConfig
(
uid
,
cellGroupConfig
->
spCellConfig
,
scc
,
servingcellconfigdedicated
,
configuration
);
cellGroupConfig
->
sCellToAddModList
=
NULL
;
cellGroupConfig
->
sCellToReleaseList
=
NULL
;
}
//------------------------------------------------------------------------------
int
do_RRCSetup
(
rrc_gNB_ue_context_t
*
const
ue_context_pP
,
uint8_t
*
const
buffer
,
...
...
@@ -800,7 +532,6 @@ int do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP,
NR_RRCSetup_IEs_t
*
ie
;
NR_SRB_ToAddMod_t
*
SRB1_config
=
NULL
;
NR_PDCP_Config_t
*
pdcp_Config
=
NULL
;
NR_CellGroupConfig_t
*
cellGroupConfig
=
NULL
;
AssertFatal
(
ue_context_pP
!=
NULL
,
"ue_context_p is null
\n
"
);
gNB_RRC_UE_t
*
ue_p
=
&
ue_context_pP
->
ue_context
;
...
...
@@ -850,11 +581,10 @@ int do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP,
ie
->
masterCellGroup
.
size
=
masterCellGroup_len
;
// decode masterCellGroup OCTET_STRING received from DU and place in ue context
uper_decode
(
NULL
,
&
asn_DEF_NR_CellGroupConfig
,
(
void
**
)
&
cellGroupConfig
,
masterCellGroup
,
masterCellGroup_len
,
0
,
0
);
ue_p
->
masterCellGroup
=
cellGroupConfig
;
ue_p
->
masterCellGroup
=
decode_cellGroupConfig
(
masterCellGroup
,
masterCellGroup_len
);
if
(
LOG_DEBUGFLAG
(
DEBUG_ASN1
)
)
{
xer_fprint
(
stdout
,
&
asn_DEF_NR_CellGroupConfig
,
(
const
void
*
)
cellGroupConfig
);
xer_fprint
(
stdout
,
&
asn_DEF_NR_CellGroupConfig
,
ue_p
->
masterCellGroup
);
xer_fprint
(
stdout
,
&
asn_DEF_NR_DL_CCCH_Message
,
(
void
*
)
&
dl_ccch_msg
);
}
...
...
openair2/RRC/NR/MESSAGES/asn1_msg.h
View file @
44d5b378
...
...
@@ -64,17 +64,10 @@ void do_SpCellConfig(gNB_RRC_INST *rrc,
int
do_RRCReject
(
uint8_t
Mod_id
,
uint8_t
*
const
buffer
);
void
fill_initial_SpCellConfig
(
int
uid
,
NR_SpCellConfig_t
*
SpCellConfig
,
const
NR_ServingCellConfigCommon_t
*
scc
,
const
NR_ServingCellConfig_t
*
servingcellconfigdedicated
,
const
gNB_RrcConfigurationReq
*
configuration
);
void
fill_initial_cellGroupConfig
(
int
uid
,
NR_CellGroupConfig_t
*
cellGroupConfig
,
const
NR_ServingCellConfigCommon_t
*
scc
,
const
NR_ServingCellConfig_t
*
servingcellconfigdedicated
,
const
gNB_RrcConfigurationReq
*
configuration
);
NR_RLC_BearerConfig_t
*
get_SRB_RLC_BearerConfig
(
long
channelId
,
long
priority
,
e_NR_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration
bucketSizeDuration
);
void
update_cellGroupConfig
(
NR_CellGroupConfig_t
*
cellGroupConfig
,
const
int
uid
,
...
...
openair2/RRC/NR/nr_rrc_config.c
View file @
44d5b378
...
...
@@ -2000,3 +2000,306 @@ int encode_SIB1_NR(NR_BCCH_DL_SCH_Message_t *sib1, uint8_t *buffer, int max_buff
AssertFatal
(
enc_rval
.
encoded
>
0
&&
enc_rval
.
encoded
<=
max_buffer_size
*
8
,
"ASN1 message encoding failed (%s, %lu)!
\n
"
,
enc_rval
.
failed_type
->
name
,
enc_rval
.
encoded
);
return
(
enc_rval
.
encoded
+
7
)
/
8
;
}
static
NR_SpCellConfig_t
*
get_initial_SpCellConfig
(
int
uid
,
const
NR_ServingCellConfigCommon_t
*
scc
,
const
NR_ServingCellConfig_t
*
servingcellconfigdedicated
,
const
gNB_RrcConfigurationReq
*
configuration
)
{
// This assert will never happen in the current implementation because NUMBER_OF_UE_MAX = 4.
// However, if in the future NUMBER_OF_UE_MAX is increased, it will be necessary to improve the allocation of SRS resources,
// where the startPosition = 2 or 3 and sl160 = 17, 17, 27 ... 157 only give us 30 different allocations.
AssertFatal
(
uid
>=
0
&&
uid
<
30
,
"gNB cannot allocate the SRS resources
\n
"
);
const
int
pdsch_AntennaPorts
=
configuration
->
pdsch_AntennaPorts
.
N1
*
configuration
->
pdsch_AntennaPorts
.
N2
*
configuration
->
pdsch_AntennaPorts
.
XP
;
int
curr_bwp
=
NRRIV2BW
(
scc
->
downlinkConfigCommon
->
initialDownlinkBWP
->
genericParameters
.
locationAndBandwidth
,
MAX_BWP_SIZE
);
NR_SpCellConfig_t
*
SpCellConfig
=
calloc
(
1
,
sizeof
(
*
SpCellConfig
));
SpCellConfig
->
servCellIndex
=
NULL
;
SpCellConfig
->
reconfigurationWithSync
=
NULL
;
SpCellConfig
->
rlmInSyncOutOfSyncThreshold
=
NULL
;
SpCellConfig
->
rlf_TimersAndConstants
=
NULL
;
SpCellConfig
->
spCellConfigDedicated
=
calloc
(
1
,
sizeof
(
*
SpCellConfig
->
spCellConfigDedicated
));
SpCellConfig
->
spCellConfigDedicated
->
uplinkConfig
=
calloc
(
1
,
sizeof
(
*
SpCellConfig
->
spCellConfigDedicated
->
uplinkConfig
));
NR_UplinkConfig_t
*
uplinkConfig
=
SpCellConfig
->
spCellConfigDedicated
->
uplinkConfig
;
NR_BWP_UplinkDedicated_t
*
initialUplinkBWP
=
calloc
(
1
,
sizeof
(
*
initialUplinkBWP
));
uplinkConfig
->
initialUplinkBWP
=
initialUplinkBWP
;
initialUplinkBWP
->
pucch_Config
=
calloc
(
1
,
sizeof
(
*
initialUplinkBWP
->
pucch_Config
));
initialUplinkBWP
->
pucch_Config
->
present
=
NR_SetupRelease_PUCCH_Config_PR_setup
;
NR_PUCCH_Config_t
*
pucch_Config
=
calloc
(
1
,
sizeof
(
*
pucch_Config
));
initialUplinkBWP
->
pucch_Config
->
choice
.
setup
=
pucch_Config
;
pucch_Config
->
resourceSetToAddModList
=
calloc
(
1
,
sizeof
(
*
pucch_Config
->
resourceSetToAddModList
));
pucch_Config
->
resourceSetToReleaseList
=
NULL
;
pucch_Config
->
resourceToAddModList
=
calloc
(
1
,
sizeof
(
*
pucch_Config
->
resourceToAddModList
));
pucch_Config
->
resourceToReleaseList
=
NULL
;
config_pucch_resset0
(
pucch_Config
,
uid
,
curr_bwp
,
NULL
);
config_pucch_resset1
(
pucch_Config
,
NULL
);
set_pucch_power_config
(
pucch_Config
,
configuration
->
do_CSIRS
);
initialUplinkBWP
->
pusch_Config
=
config_pusch
(
NULL
);
long
maxMIMO_Layers
=
uplinkConfig
&&
uplinkConfig
->
pusch_ServingCellConfig
&&
uplinkConfig
->
pusch_ServingCellConfig
->
choice
.
setup
->
ext1
&&
uplinkConfig
->
pusch_ServingCellConfig
->
choice
.
setup
->
ext1
->
maxMIMO_Layers
?
*
uplinkConfig
->
pusch_ServingCellConfig
->
choice
.
setup
->
ext1
->
maxMIMO_Layers
:
1
;
// We are using do_srs = 0 here because the periodic SRS will only be enabled in update_cellGroupConfig() if do_srs == 1
initialUplinkBWP
->
srs_Config
=
calloc
(
1
,
sizeof
(
*
initialUplinkBWP
->
srs_Config
));
config_srs
(
scc
,
initialUplinkBWP
->
srs_Config
,
NULL
,
curr_bwp
,
uid
,
0
,
maxMIMO_Layers
,
0
);
scheduling_request_config
(
scc
,
pucch_Config
,
scc
->
uplinkConfigCommon
->
initialUplinkBWP
->
genericParameters
.
subcarrierSpacing
);
set_dl_DataToUL_ACK
(
pucch_Config
,
configuration
->
minRXTXTIME
,
scc
->
uplinkConfigCommon
->
initialUplinkBWP
->
genericParameters
.
subcarrierSpacing
);
SpCellConfig
->
spCellConfigDedicated
->
initialDownlinkBWP
=
calloc
(
1
,
sizeof
(
*
SpCellConfig
->
spCellConfigDedicated
->
initialDownlinkBWP
));
NR_BWP_DownlinkDedicated_t
*
bwp_Dedicated
=
SpCellConfig
->
spCellConfigDedicated
->
initialDownlinkBWP
;
bwp_Dedicated
->
pdcch_Config
=
calloc
(
1
,
sizeof
(
*
bwp_Dedicated
->
pdcch_Config
));
bwp_Dedicated
->
pdcch_Config
->
present
=
NR_SetupRelease_PDCCH_Config_PR_setup
;
bwp_Dedicated
->
pdcch_Config
->
choice
.
setup
=
calloc
(
1
,
sizeof
(
*
bwp_Dedicated
->
pdcch_Config
->
choice
.
setup
));
bwp_Dedicated
->
pdcch_Config
->
choice
.
setup
->
searchSpacesToAddModList
=
calloc
(
1
,
sizeof
(
*
bwp_Dedicated
->
pdcch_Config
->
choice
.
setup
->
searchSpacesToAddModList
));
bwp_Dedicated
->
pdcch_Config
->
choice
.
setup
->
controlResourceSetToAddModList
=
calloc
(
1
,
sizeof
(
*
bwp_Dedicated
->
pdcch_Config
->
choice
.
setup
->
controlResourceSetToAddModList
));
uint64_t
bitmap
=
get_ssb_bitmap
(
scc
);
NR_ControlResourceSet_t
*
coreset
=
get_coreset_config
(
0
,
curr_bwp
,
bitmap
);
asn1cSeqAdd
(
&
bwp_Dedicated
->
pdcch_Config
->
choice
.
setup
->
controlResourceSetToAddModList
->
list
,
coreset
);
bwp_Dedicated
->
pdcch_Config
->
choice
.
setup
->
searchSpacesToAddModList
=
calloc
(
1
,
sizeof
(
*
bwp_Dedicated
->
pdcch_Config
->
choice
.
setup
->
searchSpacesToAddModList
));
NR_SearchSpace_t
*
ss2
=
rrc_searchspace_config
(
false
,
5
,
coreset
->
controlResourceSetId
);
asn1cSeqAdd
(
&
bwp_Dedicated
->
pdcch_Config
->
choice
.
setup
->
searchSpacesToAddModList
->
list
,
ss2
);
bwp_Dedicated
->
pdsch_Config
=
config_pdsch
(
bitmap
,
0
,
pdsch_AntennaPorts
);
SpCellConfig
->
spCellConfigDedicated
->
tag_Id
=
0
;
SpCellConfig
->
spCellConfigDedicated
->
pdsch_ServingCellConfig
=
calloc
(
1
,
sizeof
(
*
SpCellConfig
->
spCellConfigDedicated
->
pdsch_ServingCellConfig
));
NR_PDSCH_ServingCellConfig_t
*
pdsch_servingcellconfig
=
calloc
(
1
,
sizeof
(
*
pdsch_servingcellconfig
));
SpCellConfig
->
spCellConfigDedicated
->
pdsch_ServingCellConfig
->
present
=
NR_SetupRelease_PDSCH_ServingCellConfig_PR_setup
;
SpCellConfig
->
spCellConfigDedicated
->
pdsch_ServingCellConfig
->
choice
.
setup
=
pdsch_servingcellconfig
;
// Downlink BWPs
int
n_dl_bwp
=
0
;
if
(
servingcellconfigdedicated
&&
servingcellconfigdedicated
->
downlinkBWP_ToAddModList
&&
servingcellconfigdedicated
->
downlinkBWP_ToAddModList
->
list
.
count
>
0
)
{
n_dl_bwp
=
servingcellconfigdedicated
->
downlinkBWP_ToAddModList
->
list
.
count
;
}
if
(
n_dl_bwp
>
0
)
{
SpCellConfig
->
spCellConfigDedicated
->
downlinkBWP_ToAddModList
=
calloc
(
1
,
sizeof
(
*
SpCellConfig
->
spCellConfigDedicated
->
downlinkBWP_ToAddModList
));
for
(
int
bwp_loop
=
0
;
bwp_loop
<
n_dl_bwp
;
bwp_loop
++
)
{
NR_BWP_Downlink_t
*
bwp
=
calloc
(
1
,
sizeof
(
*
bwp
));
config_downlinkBWP
(
bwp
,
scc
,
servingcellconfigdedicated
,
NULL
,
0
,
false
,
bwp_loop
,
true
);
asn1cSeqAdd
(
&
SpCellConfig
->
spCellConfigDedicated
->
downlinkBWP_ToAddModList
->
list
,
bwp
);
}
SpCellConfig
->
spCellConfigDedicated
->
firstActiveDownlinkBWP_Id
=
calloc
(
1
,
sizeof
(
*
SpCellConfig
->
spCellConfigDedicated
->
firstActiveDownlinkBWP_Id
));
*
SpCellConfig
->
spCellConfigDedicated
->
firstActiveDownlinkBWP_Id
=
servingcellconfigdedicated
->
firstActiveDownlinkBWP_Id
?
*
servingcellconfigdedicated
->
firstActiveDownlinkBWP_Id
:
1
;
SpCellConfig
->
spCellConfigDedicated
->
defaultDownlinkBWP_Id
=
calloc
(
1
,
sizeof
(
*
SpCellConfig
->
spCellConfigDedicated
->
defaultDownlinkBWP_Id
));
*
SpCellConfig
->
spCellConfigDedicated
->
defaultDownlinkBWP_Id
=
servingcellconfigdedicated
->
defaultDownlinkBWP_Id
?
*
servingcellconfigdedicated
->
defaultDownlinkBWP_Id
:
1
;
}
// Uplink BWPs
int
n_ul_bwp
=
0
;
if
(
servingcellconfigdedicated
&&
servingcellconfigdedicated
->
uplinkConfig
&&
servingcellconfigdedicated
->
uplinkConfig
->
uplinkBWP_ToAddModList
&&
servingcellconfigdedicated
->
uplinkConfig
->
uplinkBWP_ToAddModList
->
list
.
count
>
0
)
{
n_ul_bwp
=
servingcellconfigdedicated
->
uplinkConfig
->
uplinkBWP_ToAddModList
->
list
.
count
;
}
if
(
n_ul_bwp
>
0
)
{
uplinkConfig
->
uplinkBWP_ToAddModList
=
calloc
(
1
,
sizeof
(
*
uplinkConfig
->
uplinkBWP_ToAddModList
));
for
(
int
bwp_loop
=
0
;
bwp_loop
<
n_ul_bwp
;
bwp_loop
++
)
{
NR_BWP_Uplink_t
*
ubwp
=
calloc
(
1
,
sizeof
(
*
ubwp
));
config_uplinkBWP
(
ubwp
,
bwp_loop
,
true
,
uid
,
configuration
,
servingcellconfigdedicated
,
scc
,
NULL
);
asn1cSeqAdd
(
&
uplinkConfig
->
uplinkBWP_ToAddModList
->
list
,
ubwp
);
}
uplinkConfig
->
firstActiveUplinkBWP_Id
=
calloc
(
1
,
sizeof
(
*
uplinkConfig
->
firstActiveUplinkBWP_Id
));
*
uplinkConfig
->
firstActiveUplinkBWP_Id
=
servingcellconfigdedicated
->
uplinkConfig
->
firstActiveUplinkBWP_Id
?
*
servingcellconfigdedicated
->
uplinkConfig
->
firstActiveUplinkBWP_Id
:
1
;
}
SpCellConfig
->
spCellConfigDedicated
->
csi_MeasConfig
=
calloc
(
1
,
sizeof
(
*
SpCellConfig
->
spCellConfigDedicated
->
csi_MeasConfig
));
SpCellConfig
->
spCellConfigDedicated
->
csi_MeasConfig
->
present
=
NR_SetupRelease_CSI_MeasConfig_PR_setup
;
NR_CSI_MeasConfig_t
*
csi_MeasConfig
=
calloc
(
1
,
sizeof
(
*
csi_MeasConfig
));
SpCellConfig
->
spCellConfigDedicated
->
csi_MeasConfig
->
choice
.
setup
=
csi_MeasConfig
;
csi_MeasConfig
->
csi_SSB_ResourceSetToAddModList
=
calloc
(
1
,
sizeof
(
*
csi_MeasConfig
->
csi_SSB_ResourceSetToAddModList
));
csi_MeasConfig
->
csi_SSB_ResourceSetToReleaseList
=
NULL
;
csi_MeasConfig
->
csi_ResourceConfigToAddModList
=
calloc
(
1
,
sizeof
(
*
csi_MeasConfig
->
csi_ResourceConfigToAddModList
));
csi_MeasConfig
->
csi_ResourceConfigToReleaseList
=
NULL
;
csi_MeasConfig
->
csi_ReportConfigToAddModList
=
calloc
(
1
,
sizeof
(
*
csi_MeasConfig
->
csi_ReportConfigToAddModList
));
csi_MeasConfig
->
csi_ReportConfigToReleaseList
=
NULL
;
NR_CSI_SSB_ResourceSet_t
*
ssbresset0
=
calloc
(
1
,
sizeof
(
*
ssbresset0
));
ssbresset0
->
csi_SSB_ResourceSetId
=
0
;
for
(
int
i
=
0
;
i
<
64
;
i
++
)
{
if
((
bitmap
>>
(
63
-
i
))
&
0x01
)
{
NR_SSB_Index_t
*
ssbres
=
NULL
;
asn1cCallocOne
(
ssbres
,
i
);
asn1cSeqAdd
(
&
ssbresset0
->
csi_SSB_ResourceList
.
list
,
ssbres
);
}
}
asn1cSeqAdd
(
&
csi_MeasConfig
->
csi_SSB_ResourceSetToAddModList
->
list
,
ssbresset0
);
int
bwp_loop_end
=
n_dl_bwp
>
0
?
n_dl_bwp
:
1
;
for
(
int
bwp_loop
=
0
;
bwp_loop
<
bwp_loop_end
;
bwp_loop
++
)
{
int
curr_bwp
,
bwp_id
;
struct
NR_SetupRelease_PDSCH_Config
*
pdsch_Config
;
if
(
n_dl_bwp
==
0
)
{
pdsch_Config
=
SpCellConfig
->
spCellConfigDedicated
->
initialDownlinkBWP
->
pdsch_Config
;
curr_bwp
=
NRRIV2BW
(
scc
->
downlinkConfigCommon
->
initialDownlinkBWP
->
genericParameters
.
locationAndBandwidth
,
MAX_BWP_SIZE
);
bwp_id
=
0
;
}
else
{
NR_BWP_Downlink_t
*
bwp
=
SpCellConfig
->
spCellConfigDedicated
->
downlinkBWP_ToAddModList
->
list
.
array
[
bwp_loop
];
pdsch_Config
=
bwp
->
bwp_Dedicated
->
pdsch_Config
;
curr_bwp
=
NRRIV2BW
(
bwp
->
bwp_Common
->
genericParameters
.
locationAndBandwidth
,
MAX_BWP_SIZE
);
bwp_id
=
bwp
->
bwp_Id
;
}
config_csirs
(
scc
,
csi_MeasConfig
,
uid
,
pdsch_AntennaPorts
,
curr_bwp
,
configuration
->
do_CSIRS
,
bwp_loop
);
config_csiim
(
configuration
->
do_CSIRS
,
pdsch_AntennaPorts
,
curr_bwp
,
csi_MeasConfig
,
bwp_loop
);
NR_CSI_ResourceConfig_t
*
csires1
=
calloc
(
1
,
sizeof
(
*
csires1
));
csires1
->
csi_ResourceConfigId
=
bwp_id
+
20
;
csires1
->
csi_RS_ResourceSetList
.
present
=
NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB
;
csires1
->
csi_RS_ResourceSetList
.
choice
.
nzp_CSI_RS_SSB
=
calloc
(
1
,
sizeof
(
*
csires1
->
csi_RS_ResourceSetList
.
choice
.
nzp_CSI_RS_SSB
));
csires1
->
csi_RS_ResourceSetList
.
choice
.
nzp_CSI_RS_SSB
->
csi_SSB_ResourceSetList
=
calloc
(
1
,
sizeof
(
*
csires1
->
csi_RS_ResourceSetList
.
choice
.
nzp_CSI_RS_SSB
->
csi_SSB_ResourceSetList
));
NR_CSI_SSB_ResourceSetId_t
*
ssbres00
=
calloc
(
1
,
sizeof
(
*
ssbres00
));
*
ssbres00
=
0
;
asn1cSeqAdd
(
&
csires1
->
csi_RS_ResourceSetList
.
choice
.
nzp_CSI_RS_SSB
->
csi_SSB_ResourceSetList
->
list
,
ssbres00
);
csires1
->
bwp_Id
=
bwp_id
;
csires1
->
resourceType
=
NR_CSI_ResourceConfig__resourceType_periodic
;
asn1cSeqAdd
(
&
csi_MeasConfig
->
csi_ResourceConfigToAddModList
->
list
,
csires1
);
NR_PUCCH_CSI_Resource_t
*
pucchcsires1
=
calloc
(
1
,
sizeof
(
*
pucchcsires1
));
pucchcsires1
->
uplinkBandwidthPartId
=
bwp_id
;
pucchcsires1
->
pucch_Resource
=
2
;
if
(
configuration
->
do_CSIRS
)
{
NR_CSI_ResourceConfig_t
*
csires0
=
calloc
(
1
,
sizeof
(
*
csires0
));
csires0
->
csi_ResourceConfigId
=
bwp_id
;
csires0
->
csi_RS_ResourceSetList
.
present
=
NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB
;
csires0
->
csi_RS_ResourceSetList
.
choice
.
nzp_CSI_RS_SSB
=
calloc
(
1
,
sizeof
(
*
csires0
->
csi_RS_ResourceSetList
.
choice
.
nzp_CSI_RS_SSB
));
csires0
->
csi_RS_ResourceSetList
.
choice
.
nzp_CSI_RS_SSB
->
nzp_CSI_RS_ResourceSetList
=
calloc
(
1
,
sizeof
(
*
csires0
->
csi_RS_ResourceSetList
.
choice
.
nzp_CSI_RS_SSB
->
nzp_CSI_RS_ResourceSetList
));
NR_NZP_CSI_RS_ResourceSetId_t
*
nzp0
=
calloc
(
1
,
sizeof
(
*
nzp0
));
*
nzp0
=
bwp_loop
;
asn1cSeqAdd
(
&
csires0
->
csi_RS_ResourceSetList
.
choice
.
nzp_CSI_RS_SSB
->
nzp_CSI_RS_ResourceSetList
->
list
,
nzp0
);
csires0
->
bwp_Id
=
bwp_id
;
csires0
->
resourceType
=
NR_CSI_ResourceConfig__resourceType_periodic
;
asn1cSeqAdd
(
&
csi_MeasConfig
->
csi_ResourceConfigToAddModList
->
list
,
csires0
);
}
if
(
configuration
->
do_CSIRS
&&
pdsch_AntennaPorts
>
1
)
{
NR_CSI_ResourceConfig_t
*
csires2
=
calloc
(
1
,
sizeof
(
*
csires2
));
csires2
->
csi_ResourceConfigId
=
bwp_id
+
10
;
csires2
->
csi_RS_ResourceSetList
.
present
=
NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_csi_IM_ResourceSetList
;
csires2
->
csi_RS_ResourceSetList
.
choice
.
csi_IM_ResourceSetList
=
calloc
(
1
,
sizeof
(
*
csires2
->
csi_RS_ResourceSetList
.
choice
.
csi_IM_ResourceSetList
));
NR_CSI_IM_ResourceSetId_t
*
csiim00
=
calloc
(
1
,
sizeof
(
*
csiim00
));
*
csiim00
=
bwp_loop
;
asn1cSeqAdd
(
&
csires2
->
csi_RS_ResourceSetList
.
choice
.
csi_IM_ResourceSetList
->
list
,
csiim00
);
csires2
->
bwp_Id
=
bwp_id
;
csires2
->
resourceType
=
NR_CSI_ResourceConfig__resourceType_periodic
;
asn1cSeqAdd
(
&
csi_MeasConfig
->
csi_ResourceConfigToAddModList
->
list
,
csires2
);
config_csi_meas_report
(
csi_MeasConfig
,
scc
,
pucchcsires1
,
pdsch_Config
,
&
configuration
->
pdsch_AntennaPorts
,
NR_MAX_SUPPORTED_DL_LAYERS
,
bwp_id
,
uid
);
}
config_rsrp_meas_report
(
csi_MeasConfig
,
scc
,
pucchcsires1
,
configuration
->
do_CSIRS
,
bwp_id
+
10
,
uid
);
}
pdsch_servingcellconfig
->
codeBlockGroupTransmission
=
NULL
;
pdsch_servingcellconfig
->
xOverhead
=
NULL
;
pdsch_servingcellconfig
->
nrofHARQ_ProcessesForPDSCH
=
calloc
(
1
,
sizeof
(
*
pdsch_servingcellconfig
->
nrofHARQ_ProcessesForPDSCH
));
*
pdsch_servingcellconfig
->
nrofHARQ_ProcessesForPDSCH
=
NR_PDSCH_ServingCellConfig__nrofHARQ_ProcessesForPDSCH_n16
;
pdsch_servingcellconfig
->
pucch_Cell
=
NULL
;
pdsch_servingcellconfig
->
ext1
=
calloc
(
1
,
sizeof
(
*
pdsch_servingcellconfig
->
ext1
));
pdsch_servingcellconfig
->
ext1
->
maxMIMO_Layers
=
calloc
(
1
,
sizeof
(
*
pdsch_servingcellconfig
->
ext1
->
maxMIMO_Layers
));
*
pdsch_servingcellconfig
->
ext1
->
maxMIMO_Layers
=
2
;
if
(
LOG_DEBUGFLAG
(
DEBUG_ASN1
))
{
xer_fprint
(
stdout
,
&
asn_DEF_NR_SpCellConfig
,
SpCellConfig
);
}
return
SpCellConfig
;
}
NR_CellGroupConfig_t
*
get_initial_cellGroupConfig
(
int
uid
,
const
NR_ServingCellConfigCommon_t
*
scc
,
const
NR_ServingCellConfig_t
*
servingcellconfigdedicated
,
const
gNB_RrcConfigurationReq
*
configuration
)
{
NR_CellGroupConfig_t
*
cellGroupConfig
=
calloc
(
1
,
sizeof
(
*
cellGroupConfig
));
cellGroupConfig
->
cellGroupId
=
0
;
/* Rlc Bearer Config */
/* TS38.331 9.2.1 Default SRB configurations */
cellGroupConfig
->
rlc_BearerToAddModList
=
calloc
(
1
,
sizeof
(
*
cellGroupConfig
->
rlc_BearerToAddModList
));
NR_RLC_BearerConfig_t
*
rlc_BearerConfig
=
get_SRB_RLC_BearerConfig
(
1
,
1
,
NR_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms1000
);
asn1cSeqAdd
(
&
cellGroupConfig
->
rlc_BearerToAddModList
->
list
,
rlc_BearerConfig
);
cellGroupConfig
->
rlc_BearerToReleaseList
=
NULL
;
/* mac CellGroup Config */
cellGroupConfig
->
mac_CellGroupConfig
=
configure_mac_cellgroup
();
NR_PhysicalCellGroupConfig_t
*
physicalCellGroupConfig
=
calloc
(
1
,
sizeof
(
*
physicalCellGroupConfig
));
physicalCellGroupConfig
->
p_NR_FR1
=
NULL
;
physicalCellGroupConfig
->
pdsch_HARQ_ACK_Codebook
=
NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic
;
cellGroupConfig
->
physicalCellGroupConfig
=
physicalCellGroupConfig
;
cellGroupConfig
->
spCellConfig
=
get_initial_SpCellConfig
(
uid
,
scc
,
servingcellconfigdedicated
,
configuration
);
cellGroupConfig
->
sCellToAddModList
=
NULL
;
cellGroupConfig
->
sCellToReleaseList
=
NULL
;
return
cellGroupConfig
;
}
void
free_cellGroupConfig
(
NR_CellGroupConfig_t
*
cellGroupConfig
)
{
ASN_STRUCT_FREE
(
asn_DEF_NR_CellGroupConfig
,
cellGroupConfig
);
}
int
encode_cellGroupConfig
(
NR_CellGroupConfig_t
*
cellGroupConfig
,
uint8_t
*
buffer
,
int
max_buffer_size
)
{
asn_enc_rval_t
enc_rval
=
uper_encode_to_buffer
(
&
asn_DEF_NR_CellGroupConfig
,
NULL
,
cellGroupConfig
,
buffer
,
max_buffer_size
);
AssertFatal
(
enc_rval
.
encoded
>
0
&&
enc_rval
.
encoded
<=
max_buffer_size
*
8
,
"ASN1 message encoding failed (%s, %lu)!
\n
"
,
enc_rval
.
failed_type
->
name
,
enc_rval
.
encoded
);
return
(
enc_rval
.
encoded
+
7
)
/
8
;
}
NR_CellGroupConfig_t
*
decode_cellGroupConfig
(
const
uint8_t
*
buffer
,
int
buffer_size
)
{
NR_CellGroupConfig_t
*
cellGroupConfig
=
NULL
;
asn_dec_rval_t
rval
=
uper_decode
(
NULL
,
&
asn_DEF_NR_CellGroupConfig
,
(
void
**
)
&
cellGroupConfig
,
buffer
,
buffer_size
,
0
,
0
);
AssertFatal
(
rval
.
code
==
RC_OK
,
"could not decode cellGroupConfig
\n
"
);
return
cellGroupConfig
;
}
openair2/RRC/NR/nr_rrc_config.h
View file @
44d5b378
...
...
@@ -115,4 +115,12 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configurati
void
free_SIB1_NR
(
NR_BCCH_DL_SCH_Message_t
*
sib1
);
int
encode_SIB1_NR
(
NR_BCCH_DL_SCH_Message_t
*
sib1
,
uint8_t
*
buffer
,
int
max_buffer_size
);
NR_CellGroupConfig_t
*
get_initial_cellGroupConfig
(
int
uid
,
const
NR_ServingCellConfigCommon_t
*
scc
,
const
NR_ServingCellConfig_t
*
servingcellconfigdedicated
,
const
gNB_RrcConfigurationReq
*
configuration
);
void
free_cellGroupConfig
(
NR_CellGroupConfig_t
*
cellGroupConfig
);
int
encode_cellGroupConfig
(
NR_CellGroupConfig_t
*
cellGroupConfig
,
uint8_t
*
buffer
,
int
max_buffer_size
);
NR_CellGroupConfig_t
*
decode_cellGroupConfig
(
const
uint8_t
*
buffer
,
int
max_buffer_size
);
#endif
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