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
canghaiwuhen
OpenXG-RAN
Commits
25f8a1bb
Commit
25f8a1bb
authored
Oct 03, 2017
by
Nick Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit remaining files
parent
0fc1cf2e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
999 additions
and
0 deletions
+999
-0
openair2/LAYER2/MAC/config_NB_IoT.c
openair2/LAYER2/MAC/config_NB_IoT.c
+230
-0
openair2/LAYER2/MAC/config_NB_IoT.h
openair2/LAYER2/MAC/config_NB_IoT.h
+291
-0
openair2/LAYER2/MAC/eNB_scheduler_bch_NB_IoT.c
openair2/LAYER2/MAC/eNB_scheduler_bch_NB_IoT.c
+64
-0
openair2/LAYER2/MAC/schedule_tool_NB_IoT.c
openair2/LAYER2/MAC/schedule_tool_NB_IoT.c
+414
-0
No files found.
openair2/LAYER2/MAC/config_NB_IoT.c
0 → 100644
View file @
25f8a1bb
#include "LAYER2/MAC/defs_NB_IoT.h"
#include "LAYER2/MAC/proto_NB_IoT.h"
#include "LAYER2/MAC/extern_NB_IoT.h"
///-------------------------------------------Function---------------------------------------------///
void
init_rrc_NB_IoT
(
void
)
{
int
i
;
MIB
.
message
.
schedulingInfoSIB1_r13
=
0
;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
si_RadioFrameOffset_r13
=
(
long
*
)
malloc
(
sizeof
(
long
));
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
si_RadioFrameOffset_r13
[
0
]
=
0
;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
si_WindowLength_r13
=
SystemInformationBlockType1_NB__si_WindowLength_r13_ms480
;
//SIB.message.choice.c1.choice.systemInformationBlockType1_r13.schedulingInfoList_r13 = (SchedulingInfoList_NB_r13_t*)malloc(sizeof(SchedulingInfoList_NB_r13_t));
/// Allocate Three CE level to schedulingInfoList
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
=
(
SchedulingInfo_NB_r13_t
**
)
malloc
(
3
*
sizeof
(
SchedulingInfo_NB_r13_t
*
));
for
(
i
=
0
;
i
<
3
;
++
i
)
{
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
i
]
=
(
SchedulingInfo_NB_r13_t
*
)
malloc
(
sizeof
(
SchedulingInfo_NB_r13_t
));
}
/// Allocate how many SIB mapping-----------------------------------------------------------------------------------------------------///
/// CE0
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
0
]
->
sib_MappingInfo_r13
.
list
.
array
=
(
SIB_Type_NB_r13_t
**
)
malloc
(
2
*
sizeof
(
SIB_Type_NB_r13_t
*
));
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
0
]
->
sib_MappingInfo_r13
.
list
.
array
[
0
]
=
(
SIB_Type_NB_r13_t
*
)
malloc
(
sizeof
(
SIB_Type_NB_r13_t
));
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
0
]
->
sib_MappingInfo_r13
.
list
.
array
[
1
]
=
(
SIB_Type_NB_r13_t
*
)
malloc
(
sizeof
(
SIB_Type_NB_r13_t
));
/// CE1
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
1
]
->
sib_MappingInfo_r13
.
list
.
array
=
(
SIB_Type_NB_r13_t
**
)
malloc
(
2
*
sizeof
(
SIB_Type_NB_r13_t
*
));
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
1
]
->
sib_MappingInfo_r13
.
list
.
array
[
0
]
=
(
SIB_Type_NB_r13_t
*
)
malloc
(
sizeof
(
SIB_Type_NB_r13_t
));
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
1
]
->
sib_MappingInfo_r13
.
list
.
array
[
1
]
=
(
SIB_Type_NB_r13_t
*
)
malloc
(
sizeof
(
SIB_Type_NB_r13_t
));
/// CE2
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
2
]
->
sib_MappingInfo_r13
.
list
.
array
=
(
SIB_Type_NB_r13_t
**
)
malloc
(
2
*
sizeof
(
SIB_Type_NB_r13_t
*
));
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
2
]
->
sib_MappingInfo_r13
.
list
.
array
[
0
]
=
(
SIB_Type_NB_r13_t
*
)
malloc
(
sizeof
(
SIB_Type_NB_r13_t
));
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
2
]
->
sib_MappingInfo_r13
.
list
.
array
[
1
]
=
(
SIB_Type_NB_r13_t
*
)
malloc
(
sizeof
(
SIB_Type_NB_r13_t
));
/// End Allocate SIB mapping----------------------------------------------------------------------------------------------------------///
/// Setting Scheduling Information SI for Three CE level------------------------------------------------------------------------------///
/// CE0
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
0
]
->
si_Periodicity_r13
=
SchedulingInfo_NB_r13__si_Periodicity_r13_rf4096
;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
0
]
->
si_RepetitionPattern_r13
=
SchedulingInfo_NB_r13__si_RepetitionPattern_r13_every2ndRF
;
//SIB.message.choice.c1.choice.systemInformationBlockType1_r13.schedulingInfoList_r13.list.array[0]->sib_MappingInfo_r13.list.array[0][0] = SIB_Type_NB_r13_sibType2_NB_r13;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
0
]
->
sib_MappingInfo_r13
.
list
.
array
[
1
][
0
]
=
SIB_Type_NB_r13_sibType3_NB_r13
;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
0
]
->
si_TB_r13
=
SchedulingInfo_NB_r13__si_TB_r13_b680
;
/// CE1
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
1
]
->
si_Periodicity_r13
=
SchedulingInfo_NB_r13__si_Periodicity_r13_rf4096
;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
1
]
->
si_RepetitionPattern_r13
=
SchedulingInfo_NB_r13__si_RepetitionPattern_r13_every2ndRF
;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
1
]
->
sib_MappingInfo_r13
.
list
.
array
[
0
][
0
]
=
SIB_Type_NB_r13_sibType4_NB_r13
;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
1
]
->
sib_MappingInfo_r13
.
list
.
array
[
1
][
0
]
=
SIB_Type_NB_r13_sibType5_NB_r13
;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
1
]
->
si_TB_r13
=
SchedulingInfo_NB_r13__si_TB_r13_b680
;
/// CE2
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
2
]
->
si_Periodicity_r13
=
SchedulingInfo_NB_r13__si_Periodicity_r13_rf4096
;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
2
]
->
si_RepetitionPattern_r13
=
SchedulingInfo_NB_r13__si_RepetitionPattern_r13_every2ndRF
;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
2
]
->
sib_MappingInfo_r13
.
list
.
array
[
0
][
0
]
=
SIB_Type_NB_r13_sibType14_NB_r13
;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
2
]
->
sib_MappingInfo_r13
.
list
.
array
[
1
][
0
]
=
SIB_Type_NB_r13_sibType16_NB_r13
;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
2
]
->
si_TB_r13
=
SchedulingInfo_NB_r13__si_TB_r13_b680
;
/// End Setting Scheduling Information SI---------------------------------------------------------------------------------------------///
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
=
(
struct
SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member
**
)
malloc
(
sizeof
(
struct
SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member
*
));
/// Allocate RACH_ConfigCommon_NB_IoT for Three CE level
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
rach_ConfigCommon_r13
.
rach_InfoList_r13
.
list
.
array
=
(
RACH_Info_NB_r13_t
**
)
malloc
(
3
*
sizeof
(
RACH_Info_NB_r13_t
*
));
for
(
i
=
0
;
i
<
3
;
i
++
){
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
rach_ConfigCommon_r13
.
rach_InfoList_r13
.
list
.
array
[
i
]
=
(
RACH_Info_NB_r13_t
*
)
malloc
(
sizeof
(
RACH_Info_NB_r13_t
));
}
/// Allocate NPRACH_ConfigSIB_NB_IoT for Three CE level
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
=
(
NPRACH_Parameters_NB_r13_t
**
)
malloc
(
3
*
sizeof
(
NPRACH_Parameters_NB_r13_t
*
));
for
(
i
=
0
;
i
<
3
;
i
++
){
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
i
]
=
(
NPRACH_Parameters_NB_r13_t
*
)
malloc
(
sizeof
(
NPRACH_Parameters_NB_r13_t
));
}
/// Setting RACH_ConfigCommon_NB_IoT ra_ResponseWindowSize for Three CE level
/// CE0
//SIB.message.choice.c1.choice.systemInformation_r13.criticalExtensions.choice.systemInformation_r13.sib_TypeAndInfo_r13.choice.sib2_r13.radioResourceConfigCommon_r13.rach_ConfigCommon_r13.rach_InfoList_r13.list.array[0].ra_ResponseWindowSize_r13
/// CE1
//SIB.message.choice.c1.choice.systemInformation_r13.criticalExtensions.choice.systemInformation_r13.sib_TypeAndInfo_r13.choice.sib2_r13.radioResourceConfigCommon_r13.rach_ConfigCommon_r13.rach_InfoList_r13.list.array[1].ra_ResponseWindowSize_r13
/// CE2
//SIB.message.choice.c1.choice.systemInformation_r13.criticalExtensions.choice.systemInformation_r13.sib_TypeAndInfo_r13.choice.sib2_r13.radioResourceConfigCommon_r13.rach_ConfigCommon_r13.rach_InfoList_r13.list.array[2].ra_ResponseWindowSize_r13
/// Setting NPRACH_ConfigSIB_NB_IoT for Three CE level
/// CE0
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
0
]
->
nprach_Periodicity_r13
=
NPRACH_Parameters_NB_r13__nprach_Periodicity_r13_ms320
;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
0
]
->
nprach_StartTime_r13
=
NPRACH_Parameters_NB_r13__nprach_StartTime_r13_ms8
;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
0
]
->
nprach_SubcarrierOffset_r13
=
NPRACH_Parameters_NB_r13__nprach_SubcarrierOffset_r13_n0
;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
0
]
->
nprach_NumSubcarriers_r13
=
NPRACH_Parameters_NB_r13__nprach_NumSubcarriers_r13_n12
;
//SIB.message.choice.c1.choice.systemInformation_r13.criticalExtensions.choice.systemInformation_r13.sib_TypeAndInfo_r13.choice.sib2_r13.radioResourceConfigCommon_r13.nprach_Config_r13.nprach_ParametersList_r13.list.array[0]->nprach_SubcarrierMSG3_RangeStart_r13 =
//SIB.message.choice.c1.choice.systemInformation_r13.criticalExtensions.choice.systemInformation_r13.sib_TypeAndInfo_r13.choice.sib2_r13.radioResourceConfigCommon_r13.nprach_Config_r13.nprach_ParametersList_r13.list.array[0]->maxNumPreambleAttemptCE_r13 =
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
0
]
->
numRepetitionsPerPreambleAttempt_r13
=
NPRACH_Parameters_NB_r13__numRepetitionsPerPreambleAttempt_r13_n1
;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
0
]
->
npdcch_NumRepetitions_RA_r13
=
NPRACH_Parameters_NB_r13__npdcch_NumRepetitions_RA_r13_r64
;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
0
]
->
npdcch_StartSF_CSS_RA_r13
=
NPRACH_Parameters_NB_r13__npdcch_StartSF_CSS_RA_r13_v4
;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
0
]
->
npdcch_Offset_RA_r13
=
NPRACH_Parameters_NB_r13__npdcch_Offset_RA_r13_zero
;
/// CE1
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
1
]
->
nprach_Periodicity_r13
=
NPRACH_Parameters_NB_r13__nprach_Periodicity_r13_ms320
;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
1
]
->
nprach_StartTime_r13
=
NPRACH_Parameters_NB_r13__nprach_StartTime_r13_ms8
;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
1
]
->
nprach_SubcarrierOffset_r13
=
NPRACH_Parameters_NB_r13__nprach_SubcarrierOffset_r13_n12
;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
1
]
->
nprach_NumSubcarriers_r13
=
NPRACH_Parameters_NB_r13__nprach_NumSubcarriers_r13_n12
;
//SIB.message.choice.c1.choice.systemInformation_r13.criticalExtensions.choice.systemInformation_r13.sib_TypeAndInfo_r13.choice.sib2_r13.radioResourceConfigCommon_r13.nprach_Config_r13.nprach_ParametersList_r13.list.array[1]->nprach_SubcarrierMSG3_RangeStart_r13 =
//SIB.message.choice.c1.choice.systemInformation_r13.criticalExtensions.choice.systemInformation_r13.sib_TypeAndInfo_r13.choice.sib2_r13.radioResourceConfigCommon_r13.nprach_Config_r13.nprach_ParametersList_r13.list.array[1]->maxNumPreambleAttemptCE_r13 =
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
1
]
->
numRepetitionsPerPreambleAttempt_r13
=
NPRACH_Parameters_NB_r13__numRepetitionsPerPreambleAttempt_r13_n2
;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
1
]
->
npdcch_NumRepetitions_RA_r13
=
NPRACH_Parameters_NB_r13__npdcch_NumRepetitions_RA_r13_r64
;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
1
]
->
npdcch_StartSF_CSS_RA_r13
=
NPRACH_Parameters_NB_r13__npdcch_StartSF_CSS_RA_r13_v4
;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
1
]
->
npdcch_Offset_RA_r13
=
NPRACH_Parameters_NB_r13__npdcch_Offset_RA_r13_zero
;
/// CE2
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
2
]
->
nprach_Periodicity_r13
=
NPRACH_Parameters_NB_r13__nprach_Periodicity_r13_ms320
;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
2
]
->
nprach_StartTime_r13
=
NPRACH_Parameters_NB_r13__nprach_StartTime_r13_ms8
;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
2
]
->
nprach_SubcarrierOffset_r13
=
NPRACH_Parameters_NB_r13__nprach_SubcarrierOffset_r13_n24
;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
2
]
->
nprach_NumSubcarriers_r13
=
NPRACH_Parameters_NB_r13__nprach_NumSubcarriers_r13_n24
;
//SIB.message.choice.c1.choice.systemInformation_r13.criticalExtensions.choice.systemInformation_r13.sib_TypeAndInfo_r13.choice.sib2_r13.radioResourceConfigCommon_r13.nprach_Config_r13.nprach_ParametersList_r13.list.array[2]->nprach_SubcarrierMSG3_RangeStart_r13 =
//SIB.message.choice.c1.choice.systemInformation_r13.criticalExtensions.choice.systemInformation_r13.sib_TypeAndInfo_r13.choice.sib2_r13.radioResourceConfigCommon_r13.nprach_Config_r13.nprach_ParametersList_r13.list.array[2]->maxNumPreambleAttemptCE_r13 =
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
2
]
->
numRepetitionsPerPreambleAttempt_r13
=
NPRACH_Parameters_NB_r13__numRepetitionsPerPreambleAttempt_r13_n4
;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
2
]
->
npdcch_NumRepetitions_RA_r13
=
NPRACH_Parameters_NB_r13__npdcch_NumRepetitions_RA_r13_r64
;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
2
]
->
npdcch_StartSF_CSS_RA_r13
=
NPRACH_Parameters_NB_r13__npdcch_StartSF_CSS_RA_r13_v4
;
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
2
]
->
npdcch_Offset_RA_r13
=
NPRACH_Parameters_NB_r13__npdcch_Offset_RA_r13_zero
;
/// Allocate RRCConnectionSetup_NB_IoT RadioResourceConfigDedicated for Three CE level
DED_Config
.
radioResourceConfigDedicated_r13
.
physicalConfigDedicated_r13
=
(
PhysicalConfigDedicated_NB_r13_t
*
)
malloc
(
3
*
sizeof
(
PhysicalConfigDedicated_NB_r13_t
));
for
(
i
=
0
;
i
<
3
;
i
++
){
DED_Config
.
radioResourceConfigDedicated_r13
.
physicalConfigDedicated_r13
[
i
].
npdcch_ConfigDedicated_r13
=
(
NPDCCH_ConfigDedicated_NB_r13_t
*
)
malloc
(
sizeof
(
NPDCCH_ConfigDedicated_NB_r13_t
));
DED_Config
.
radioResourceConfigDedicated_r13
.
physicalConfigDedicated_r13
[
i
].
npusch_ConfigDedicated_r13
=
(
NPUSCH_ConfigDedicated_NB_r13_t
*
)
malloc
(
sizeof
(
NPUSCH_ConfigDedicated_NB_r13_t
));
DED_Config
.
radioResourceConfigDedicated_r13
.
physicalConfigDedicated_r13
[
i
].
npusch_ConfigDedicated_r13
->
ack_NACK_NumRepetitions_r13
=
(
ACK_NACK_NumRepetitions_NB_r13_t
*
)
malloc
(
sizeof
(
ACK_NACK_NumRepetitions_NB_r13_t
));
}
/// Setting Dedicated Configuration for Three CE level
/// CE0
DED_Config
.
radioResourceConfigDedicated_r13
.
physicalConfigDedicated_r13
[
0
].
npdcch_ConfigDedicated_r13
->
npdcch_NumRepetitions_r13
=
NPDCCH_ConfigDedicated_NB_r13__npdcch_NumRepetitions_r13_r8
;
DED_Config
.
radioResourceConfigDedicated_r13
.
physicalConfigDedicated_r13
[
0
].
npdcch_ConfigDedicated_r13
->
npdcch_StartSF_USS_r13
=
NPDCCH_ConfigDedicated_NB_r13__npdcch_StartSF_USS_r13_v8
;
DED_Config
.
radioResourceConfigDedicated_r13
.
physicalConfigDedicated_r13
[
0
].
npdcch_ConfigDedicated_r13
->
npdcch_Offset_USS_r13
=
NPDCCH_ConfigDedicated_NB_r13__npdcch_Offset_USS_r13_zero
;
DED_Config
.
radioResourceConfigDedicated_r13
.
physicalConfigDedicated_r13
[
0
].
npusch_ConfigDedicated_r13
->
ack_NACK_NumRepetitions_r13
[
0
]
=
ACK_NACK_NumRepetitions_NB_r13_r1
;
/// CE1
DED_Config
.
radioResourceConfigDedicated_r13
.
physicalConfigDedicated_r13
[
1
].
npdcch_ConfigDedicated_r13
->
npdcch_NumRepetitions_r13
=
NPDCCH_ConfigDedicated_NB_r13__npdcch_NumRepetitions_r13_r16
;
DED_Config
.
radioResourceConfigDedicated_r13
.
physicalConfigDedicated_r13
[
1
].
npdcch_ConfigDedicated_r13
->
npdcch_StartSF_USS_r13
=
NPDCCH_ConfigDedicated_NB_r13__npdcch_StartSF_USS_r13_v4
;
DED_Config
.
radioResourceConfigDedicated_r13
.
physicalConfigDedicated_r13
[
1
].
npdcch_ConfigDedicated_r13
->
npdcch_Offset_USS_r13
=
NPDCCH_ConfigDedicated_NB_r13__npdcch_Offset_USS_r13_zero
;
DED_Config
.
radioResourceConfigDedicated_r13
.
physicalConfigDedicated_r13
[
1
].
npusch_ConfigDedicated_r13
->
ack_NACK_NumRepetitions_r13
[
0
]
=
ACK_NACK_NumRepetitions_NB_r13_r2
;
/// CE2
DED_Config
.
radioResourceConfigDedicated_r13
.
physicalConfigDedicated_r13
[
2
].
npdcch_ConfigDedicated_r13
->
npdcch_NumRepetitions_r13
=
NPDCCH_ConfigDedicated_NB_r13__npdcch_NumRepetitions_r13_r32
;
DED_Config
.
radioResourceConfigDedicated_r13
.
physicalConfigDedicated_r13
[
2
].
npdcch_ConfigDedicated_r13
->
npdcch_StartSF_USS_r13
=
NPDCCH_ConfigDedicated_NB_r13__npdcch_StartSF_USS_r13_v2
;
DED_Config
.
radioResourceConfigDedicated_r13
.
physicalConfigDedicated_r13
[
2
].
npdcch_ConfigDedicated_r13
->
npdcch_Offset_USS_r13
=
NPDCCH_ConfigDedicated_NB_r13__npdcch_Offset_USS_r13_zero
;
DED_Config
.
radioResourceConfigDedicated_r13
.
physicalConfigDedicated_r13
[
2
].
npusch_ConfigDedicated_r13
->
ack_NACK_NumRepetitions_r13
[
0
]
=
ACK_NACK_NumRepetitions_NB_r13_r4
;
// printf("ack_NACK_NumRepetitions_r13 %d\n",DED_Config.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13[2].npusch_ConfigDedicated_r13->ack_NACK_NumRepetitions_r13[0] );
// printf("RRC Initial Success ! :D \n");
}
void
rrc_mac_config_req_NB_IoT
(
rrc_config_NB_IoT_t
*
mac_config
,
uint8_t
mib_flag
,
uint8_t
sib_flag
,
uint8_t
ded_flag
,
uint8_t
ue_list_ded_num
)
{
if
(
mib_flag
!=
0
){
}
if
(
sib_flag
!=
0
){
mac_config
->
sib1_NB_IoT_sched_config
.
repetitions
=
4
;
mac_config
->
sib1_NB_IoT_sched_config
.
starting_rf
=
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
si_RadioFrameOffset_r13
[
0
];
mac_config
->
si_window_length
=
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
si_WindowLength_r13
;
mac_config
->
sibs_NB_IoT_sched
[
0
].
si_periodicity
=
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
0
]
->
si_Periodicity_r13
;
mac_config
->
sibs_NB_IoT_sched
[
0
].
si_repetition_pattern
=
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
0
]
->
si_RepetitionPattern_r13
;
mac_config
->
sibs_NB_IoT_sched
[
0
].
sib_mapping_info
=
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
0
]
->
sib_MappingInfo_r13
.
list
.
array
[
0
][
0
]
|
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
0
]
->
sib_MappingInfo_r13
.
list
.
array
[
1
][
0
];
mac_config
->
sibs_NB_IoT_sched
[
0
].
si_tb
=
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
0
]
->
si_TB_r13
;
//printf("si_tb %d\n",mac_config->sibs_NB_IoT_sched[0].si_tb);
mac_config
->
sibs_NB_IoT_sched
[
1
].
si_periodicity
=
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
1
]
->
si_Periodicity_r13
;
mac_config
->
sibs_NB_IoT_sched
[
1
].
si_repetition_pattern
=
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
1
]
->
si_RepetitionPattern_r13
;
mac_config
->
sibs_NB_IoT_sched
[
1
].
sib_mapping_info
=
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
1
]
->
sib_MappingInfo_r13
.
list
.
array
[
0
][
0
]
|
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
1
]
->
sib_MappingInfo_r13
.
list
.
array
[
1
][
0
];
mac_config
->
sibs_NB_IoT_sched
[
1
].
si_tb
=
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
0
]
->
si_TB_r13
;
mac_config
->
sibs_NB_IoT_sched
[
2
].
si_periodicity
=
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
2
]
->
si_Periodicity_r13
;
mac_config
->
sibs_NB_IoT_sched
[
2
].
si_repetition_pattern
=
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
2
]
->
si_RepetitionPattern_r13
;
mac_config
->
sibs_NB_IoT_sched
[
2
].
sib_mapping_info
=
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
2
]
->
sib_MappingInfo_r13
.
list
.
array
[
0
][
0
]
|
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
2
]
->
sib_MappingInfo_r13
.
list
.
array
[
1
][
0
];
mac_config
->
sibs_NB_IoT_sched
[
2
].
si_tb
=
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformationBlockType1_r13
.
schedulingInfoList_r13
.
list
.
array
[
0
]
->
si_TB_r13
;
mac_config
->
sibs_NB_IoT_sched
[
3
].
sib_mapping_info
=
0x0
;
mac_config
->
sibs_NB_IoT_sched
[
4
].
sib_mapping_info
=
0x0
;
mac_config
->
sibs_NB_IoT_sched
[
5
].
sib_mapping_info
=
0x0
;
/// testing
mac_config
->
mac_NPRACH_ConfigSIB
[
0
].
mac_numRepetitionsPerPreambleAttempt_NB_IoT
=
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
0
]
->
numRepetitionsPerPreambleAttempt_r13
;
mac_config
->
mac_NPRACH_ConfigSIB
[
1
].
mac_numRepetitionsPerPreambleAttempt_NB_IoT
=
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
1
]
->
numRepetitionsPerPreambleAttempt_r13
;
mac_config
->
mac_NPRACH_ConfigSIB
[
2
].
mac_numRepetitionsPerPreambleAttempt_NB_IoT
=
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
2
]
->
numRepetitionsPerPreambleAttempt_r13
;
mac_config
->
mac_NPRACH_ConfigSIB
[
0
].
mac_npdcch_NumRepetitions_RA_NB_IoT
=
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
0
]
->
npdcch_NumRepetitions_RA_r13
;
mac_config
->
mac_NPRACH_ConfigSIB
[
1
].
mac_npdcch_NumRepetitions_RA_NB_IoT
=
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
1
]
->
npdcch_NumRepetitions_RA_r13
;
mac_config
->
mac_NPRACH_ConfigSIB
[
2
].
mac_npdcch_NumRepetitions_RA_NB_IoT
=
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
2
]
->
npdcch_NumRepetitions_RA_r13
;
mac_config
->
mac_NPRACH_ConfigSIB
[
0
].
mac_npdcch_StartSF_CSS_RA_NB_IoT
=
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
0
]
->
npdcch_StartSF_CSS_RA_r13
;
mac_config
->
mac_NPRACH_ConfigSIB
[
1
].
mac_npdcch_StartSF_CSS_RA_NB_IoT
=
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
1
]
->
npdcch_StartSF_CSS_RA_r13
;
mac_config
->
mac_NPRACH_ConfigSIB
[
2
].
mac_npdcch_StartSF_CSS_RA_NB_IoT
=
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
2
]
->
npdcch_StartSF_CSS_RA_r13
;
mac_config
->
mac_NPRACH_ConfigSIB
[
0
].
mac_npdcch_Offset_RA_NB_IoT
=
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
0
]
->
npdcch_Offset_RA_r13
;
mac_config
->
mac_NPRACH_ConfigSIB
[
1
].
mac_npdcch_Offset_RA_NB_IoT
=
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
1
]
->
npdcch_Offset_RA_r13
;
mac_config
->
mac_NPRACH_ConfigSIB
[
2
].
mac_npdcch_Offset_RA_NB_IoT
=
SIB
.
message
.
choice
.
c1
.
choice
.
systemInformation_r13
.
criticalExtensions
.
choice
.
systemInformation_r13
.
sib_TypeAndInfo_r13
.
list
.
array
[
0
]
->
choice
.
sib2_r13
.
radioResourceConfigCommon_r13
.
nprach_Config_r13
.
nprach_ParametersList_r13
.
list
.
array
[
2
]
->
npdcch_Offset_RA_r13
;
}
if
(
ded_flag
!=
0
)
{
/*
mac_config->npdcch_ConfigDedicated[0].R_max =DED_Config.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13[0].npdcch_ConfigDedicated_r13->npdcch_NumRepetitions_r13;
mac_config->npdcch_ConfigDedicated[1].R_max =DED_Config.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13[1].npdcch_ConfigDedicated_r13->npdcch_NumRepetitions_r13;
mac_config->npdcch_ConfigDedicated[2].R_max =DED_Config.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13[2].npdcch_ConfigDedicated_r13->npdcch_NumRepetitions_r13;
mac_config->npdcch_ConfigDedicated[0].G =DED_Config.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13[0].npdcch_ConfigDedicated_r13->npdcch_StartSF_USS_r13;
mac_config->npdcch_ConfigDedicated[1].G =DED_Config.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13[1].npdcch_ConfigDedicated_r13->npdcch_StartSF_USS_r13;
mac_config->npdcch_ConfigDedicated[2].G =DED_Config.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13[2].npdcch_ConfigDedicated_r13->npdcch_StartSF_USS_r13;
mac_config->npdcch_ConfigDedicated[0].a_offset =DED_Config.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13[0].npdcch_ConfigDedicated_r13->npdcch_Offset_USS_r13;
mac_config->npdcch_ConfigDedicated[1].a_offset =DED_Config.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13[1].npdcch_ConfigDedicated_r13->npdcch_Offset_USS_r13;
mac_config->npdcch_ConfigDedicated[2].a_offset =DED_Config.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13[2].npdcch_ConfigDedicated_r13->npdcch_Offset_USS_r13;
*/
// now we only have 3 UE list USS
mac_config
->
npdcch_ConfigDedicated
[
ue_list_ded_num
].
R_max
=
DED_Config
.
radioResourceConfigDedicated_r13
.
physicalConfigDedicated_r13
[
ue_list_ded_num
].
npdcch_ConfigDedicated_r13
->
npdcch_NumRepetitions_r13
;
mac_config
->
npdcch_ConfigDedicated
[
ue_list_ded_num
].
G
=
DED_Config
.
radioResourceConfigDedicated_r13
.
physicalConfigDedicated_r13
[
ue_list_ded_num
].
npdcch_ConfigDedicated_r13
->
npdcch_StartSF_USS_r13
;
mac_config
->
npdcch_ConfigDedicated
[
ue_list_ded_num
].
a_offset
=
DED_Config
.
radioResourceConfigDedicated_r13
.
physicalConfigDedicated_r13
[
ue_list_ded_num
].
npdcch_ConfigDedicated_r13
->
npdcch_Offset_USS_r13
;
}
return
;
}
\ No newline at end of file
openair2/LAYER2/MAC/config_NB_IoT.h
0 → 100644
View file @
25f8a1bb
#ifndef _CONFIG_H_
#define _CONFIG_H_
//#include "NB_IoT_Message_definitions.h"
#define NUMBER_OF_SIBS_MAX_NB_IoT 6
///MIB
typedef
enum
operationModeInf
{
iNB_IoTand_SamePCI_r13
=
1
,
iNB_IoTand_DifferentPCI_r13
=
2
,
guardband_r13
=
3
,
standalone_r13
=
4
}
operationModeInf_t
;
///SIB1_SchedulingInfo_NB_IoT_r13
typedef
enum
si_Periodicity
{
si_Periodicity_rf64
=
640
,
si_Periodicity_rf128
=
1280
,
si_Periodicity_rf256
=
2560
,
si_Periodicity_rf512
=
5120
,
si_Periodicity_rf1024
=
10240
,
si_Periodicity_rf2048
=
20480
,
si_Periodicity_rf4096
=
40960
}
si_Periodicity_NB_IoT
;
typedef
enum
si_RepetitionPattern
{
si_RepetitionPattern_every2ndRF
=
20
,
si_RepetitionPattern_every4thRF
=
40
,
si_RepetitionPattern_every8thRF
=
80
,
si_RepetitionPattern_every16thRF
=
160
}
si_RepetitionPattern_NB_IoT
;
typedef
enum
sib_MappingInfo
{
sib2_v
=
0x1
,
sib3_v
=
0x2
,
sib4_v
=
0x4
,
sib5_v
=
0x8
,
sib14_v
=
0x10
,
sib16_v
=
0x20
}
sib_MappingInfo_NB_IoT
;
typedef
enum
si_TB
{
si_TB_56
=
56
,
si_TB_120
=
120
,
si_TB_208
=
208
,
si_TB_256
=
256
,
si_TB_328
=
328
,
si_TB_440
=
440
,
si_TB_552
=
552
,
si_TB_680
=
680
}
si_TB_NB_IoT
;
///RACH_ConfigCommon configuration
typedef
enum
ra_ResponseWindowSize
{
ra_ResponseWindowSize_pp2
=
2
,
ra_ResponseWindowSize_pp3
=
3
,
ra_ResponseWindowSize_pp4
=
4
,
ra_ResponseWindowSize_pp5
=
5
,
ra_ResponseWindowSize_pp6
=
6
,
ra_ResponseWindowSize_pp7
=
7
,
ra_ResponseWindowSize_pp8
=
8
,
ra_ResponseWindowSize_pp10
=
10
}
ra_ResponseWindowSize_NB_IoT
;
typedef
enum
mac_ContentionResolutionTimer
{
mac_ContentionResolutionTimer_pp1
=
1
,
mac_ContentionResolutionTimer_pp2
=
2
,
mac_ContentionResolutionTimer_pp3
=
3
,
mac_ContentionResolutionTimer_pp4
=
4
,
mac_ContentionResolutionTimer_pp8
=
8
,
mac_ContentionResolutionTimer_pp16
=
16
,
mac_ContentionResolutionTimer_pp32
=
32
,
mac_ContentionResolutionTimer_pp64
=
64
}
mac_ContentionResolutionTimer_NB_IoT
;
///NPRACH_ConfigSIB configuration
typedef
enum
nprach_Periodicity
{
nprach_Periodicity_ms40
=
40
,
nprach_Periodicity_ms80
=
80
,
nprach_Periodicity_ms160
=
160
,
nprach_Periodicity_ms240
=
240
,
nprach_Periodicity_ms320
=
320
,
nprach_Periodicity_ms640
=
640
,
nprach_Periodicity_ms1280
=
1280
,
nprach_Periodicity_ms2560
=
2560
}
nprach_Periodicity_NB_IoT
;
typedef
enum
nprach_StartTime
{
nprach_StartTime_ms8
=
8
,
nprach_StartTime_ms16
=
16
,
nprach_StartTime_ms32
=
32
,
nprach_StartTime_ms64
=
64
,
nprach_StartTime_ms128
=
128
,
nprach_StartTime_ms256
=
256
,
nprach_StartTime_ms512
=
512
,
nprach_StartTime_ms1024
=
1024
}
nprach_StartTime_NB_IoT
;
typedef
enum
nprach_SubcarrierOffset
{
nprach_SubcarrierOffset_n0
=
0
,
nprach_SubcarrierOffset_n12
=
12
,
nprach_SubcarrierOffset_n24
=
24
,
nprach_SubcarrierOffset_n36
=
36
,
nprach_SubcarrierOffset_n2
=
2
,
nprach_SubcarrierOffset_n18
=
18
,
nprach_SubcarrierOffset_n34
=
34
}
nprach_SubcarrierOffset_NB_IoT
;
typedef
enum
nprach_NumSubcarriers
{
nprach_NumSubcarriers_n12
=
12
,
nprach_NumSubcarriers_n24
=
24
,
nprach_NumSubcarriers_n36
=
36
,
nprach_NumSubcarriers_n48
=
48
}
nprach_NumSubcarriers_NB_IoT
;
typedef
enum
nprach_SubcarrierMSG3_RangeStart
{
nprach_SubcarrierMSG3_RangeStart_zero
=
0
,
nprach_SubcarrierMSG3_RangeStart_oneThird
=
1
/
3
,
nprach_SubcarrierMSG3_RangeStart_twoThird
=
2
/
3
,
nprach_SubcarrierMSG3_RangeStart_one
=
1
}
nprach_SubcarrierMSG3_RangeStart_NB_IoT
;
typedef
enum
maxNumPreambleAttemptCE
{
maxNumPreambleAttemptCE_n3
=
3
,
maxNumPreambleAttemptCE_n4
=
4
,
maxNumPreambleAttemptCE_n5
=
5
,
maxNumPreambleAttemptCE_n6
=
6
,
maxNumPreambleAttemptCE_n7
=
7
,
maxNumPreambleAttemptCE_n8
=
8
,
maxNumPreambleAttemptCE_n10
=
10
}
maxNumPreambleAttemptCE_NB_IoT
;
typedef
enum
numRepetitionsPerPreambleAttempt
{
numRepetitionsPerPreambleAttempt_n1
=
1
,
numRepetitionsPerPreambleAttempt_n2
=
2
,
numRepetitionsPerPreambleAttempt_n4
=
4
,
numRepetitionsPerPreambleAttempt_n8
=
8
,
numRepetitionsPerPreambleAttempt_n16
=
16
,
numRepetitionsPerPreambleAttempt_n32
=
32
,
numRepetitionsPerPreambleAttempt_n64
=
64
,
numRepetitionsPerPreambleAttempt_n128
=
128
}
numRepetitionsPerPreambleAttempt_NB_IoT
;
typedef
enum
npdcch_NumRepetitions_RA
{
npdcch_NumRepetitions_RA_r1
=
1
,
npdcch_NumRepetitions_RA_r2
=
2
,
npdcch_NumRepetitions_RA_r4
=
4
,
npdcch_NumRepetitions_RA_r8
=
8
,
npdcch_NumRepetitions_RA_r16
=
16
,
npdcch_NumRepetitions_RA_r32
=
32
,
npdcch_NumRepetitions_RA_r64
=
64
,
npdcch_NumRepetitions_RA_r128
=
128
,
npdcch_NumRepetitions_RA_r256
=
256
,
npdcch_NumRepetitions_RA_r512
=
512
,
npdcch_NumRepetitions_RA_r1024
=
1024
,
npdcch_NumRepetitions_RA_r2048
=
2048
}
npdcch_NumRepetitions_RA_NB_IoT
;
typedef
enum
npdcch_StartSF_CSS_RA
{
npdcch_StartSF_CSS_RA_v1dot5
=
3
/
2
,
npdcch_StartSF_CSS_RA_v2
=
2
,
npdcch_StartSF_CSS_RA_v4
=
4
,
npdcch_StartSF_CSS_RA_v8
=
8
,
npdcch_StartSF_CSS_RA_v16
=
16
,
npdcch_StartSF_CSS_RA_v32
=
32
,
npdcch_StartSF_CSS_RA_v48
=
48
,
npdcch_StartSF_CSS_RA_v64
=
64
}
npdcch_StartSF_CSS_RA_NB_IoT
;
typedef
enum
npdcch_Offset_RA
{
zero
=
0
,
oneEighth
=
1
/
8
,
oneFourth
=
1
/
4
,
threeEighth
=
3
/
8
}
npdcch_Offset_RA_NB_IoT
;
typedef
enum
si_window_length_e
{
ms160
=
160
,
ms320
=
320
,
ms480
=
480
,
ms640
=
640
,
ms960
=
960
,
ms1280
=
1280
,
ms1600
=
1600
}
si_window_length_t
;
typedef
enum
si_periodicity_e
{
rf64
=
640
,
rf128
=
1280
,
rf256
=
2560
,
rf512
=
5120
,
rf1024
=
10240
,
rf2048
=
20480
,
rf4096
=
40960
}
si_periodicity_t
;
typedef
enum
si_repetition_pattern_e
{
every2ndRF
=
20
,
every4thRF
=
40
,
every8thRF
=
80
,
every16thRF
=
160
}
si_repetition_pattern_t
;
typedef
enum
si_tb_e
{
b56
=
2
,
b120
=
2
,
b208
=
8
,
b256
=
8
,
b328
=
8
,
b440
=
8
,
b552
=
8
,
b680
=
8
}
si_tb_t
;
typedef
struct
sibs_NB_IoT_sched_s
{
si_periodicity_t
si_periodicity
;
si_repetition_pattern_t
si_repetition_pattern
;
sib_MappingInfo_NB_IoT
sib_mapping_info
;
//bit vector
si_tb_t
si_tb
;
}
sibs_NB_IoT_sched_t
;
///-------------------------------------------------------MAC--------------------------------------------------------------------///
typedef
struct
sib1_NB_IoT_sched_s
{
int
repetitions
;
// 4, 8, 16
int
starting_rf
;
}
sib1_NB_IoT_sched_t
;
typedef
struct
{
uint32_t
mac_ra_ResponseWindowSize_NB_IoT
;
uint32_t
mac_ContentionResolutionTimer_NB_IoT
;
}
mac_RACH_ConfigCommon_NB_IoT
;
typedef
struct
{
uint32_t
mac_nprach_Periodicity_NB_IoT
;
uint32_t
mac_nprach_StartTime_NB_IoT
;
uint32_t
mac_nprach_SubcarrierOffset_NB_IoT
;
uint32_t
mac_nprach_NumSubcarriers_NB_IoT
;
uint32_t
mac_nprach_SubcarrierMSG3_RangeStart_NB_IoT
;
uint32_t
mac_maxNumPreambleAttemptCE_NB_IoT
;
uint32_t
mac_numRepetitionsPerPreambleAttempt_NB_IoT
;
// css
uint32_t
mac_npdcch_NumRepetitions_RA_NB_IoT
;
// rmax
uint32_t
mac_npdcch_StartSF_CSS_RA_NB_IoT
;
// G
uint32_t
mac_npdcch_Offset_RA_NB_IoT
;
// alpha offset
}
mac_NPRACH_ConfigSIB_NB_IoT
;
typedef
struct
{
//npdcch-NumRepetitions-r13
uint32_t
R_max
;
//npdcch-StartSF-USS-r13
double
G
;
//npdcch-Offset-USS-r13
double
a_offset
;
}
npdcch_ConfigDedicated_NB_IoT
;
typedef
struct
rrc_config_NB_IoT_s
{
///MIB
uint16_t
schedulingInfoSIB1_NB_IoT
;
///SIB1
uint32_t
cellIdentity_NB_IoT
;
sib1_NB_IoT_sched_t
sib1_NB_IoT_sched_config
;
///SIBS
sibs_NB_IoT_sched_t
sibs_NB_IoT_sched
[
NUMBER_OF_SIBS_MAX_NB_IoT
];
si_window_length_t
si_window_length
;
uint32_t
si_radio_frame_offset
;
///SIB2 mac_RACH_ConfigCommon_NB_IoT
mac_RACH_ConfigCommon_NB_IoT
mac_RACH_ConfigCommon
[
3
];
///SIB2 mac_NPRACH_ConfigSIB_NB_IoT
mac_NPRACH_ConfigSIB_NB_IoT
mac_NPRACH_ConfigSIB
[
3
];
///NPDCCH Dedicated config
npdcch_ConfigDedicated_NB_IoT
npdcch_ConfigDedicated
[
3
];
}
rrc_config_NB_IoT_t
;
#endif
openair2/LAYER2/MAC/eNB_scheduler_bch_NB_IoT.c
0 → 100644
View file @
25f8a1bb
// function for schedule SI
#include "defs_NB_IoT.h"
#include "proto_NB_IoT.h"
#include "extern_NB_IoT.h"
char
str
[
6
][
7
]
=
{
"SIBs_1"
,
"SIBs_2"
,
"SIBs_3"
,
"SIBs_4"
,
"SIBs_5"
,
"SIBs_6"
};
void
schedule_sibs_NB_IoT
(
eNB_MAC_INST_NB_IoT
*
mac_inst
,
uint32_t
sibs_order
,
int
start_subframe1
){
available_resource_DL_t
*
pt
[
8
]
=
{
(
available_resource_DL_t
*
)
0
};
uint32_t
first_subframe
[
8
]
=
{
-
1
};
//uint32_t end_subframe[8] = { -1 };
schedule_result_t
*
new_node
;
DCIFormatN1_t
*
sibs_dci
;
uint32_t
j
,
i
,
k
,
num_subframe
,
last_subframe
,
residual_subframe
;
num_subframe
=
mac_inst
->
rrc_config
.
sibs_NB_IoT_sched
[
sibs_order
].
si_tb
;
for
(
k
=
0
,
i
=
start_subframe1
;
i
<
(
start_subframe1
+
mac_inst
->
rrc_config
.
si_window_length
);
i
+=
mac_inst
->
rrc_config
.
sibs_NB_IoT_sched
[
sibs_order
].
si_repetition_pattern
,
++
k
){
//printf("[debug][sibs%d] subframe: %d, check %d", sibs_order, i, num_subframe);
pt
[
k
]
=
(
available_resource_DL_t
*
)
check_sibs_resource
(
mac_inst
,
i
,
i
+
9
,
num_subframe
,
&
residual_subframe
,
&
last_subframe
,
&
first_subframe
[
k
]);
num_subframe
=
residual_subframe
;
//printf("-- rest: %d, last: %d start: %d\n", num_subframe, last_subframe, start_subframe1);
if
(
0
==
residual_subframe
){
sibs_dci
=
(
DCIFormatN1_t
*
)
malloc
(
sizeof
(
DCIFormatN1_t
));
sibs_dci
->
type
=
1
;
sibs_dci
->
orderIndicator
=
0
;
sibs_dci
->
Scheddly
=
0
;
sibs_dci
->
ResAssign
=
mac_inst
->
rrc_config
.
sibs_NB_IoT_sched
[
sibs_order
].
si_tb
;
sibs_dci
->
mcs
=
2
;
sibs_dci
->
RepNum
=
0
;
sibs_dci
->
ndi
=
0
;
sibs_dci
->
HARQackRes
=
0
;
sibs_dci
->
DCIRep
=
0
;
for
(
k
=
0
,
j
=
start_subframe1
;
j
<=
i
;
++
k
,
j
+=
mac_inst
->
rrc_config
.
sibs_NB_IoT_sched
[
sibs_order
].
si_repetition_pattern
){
if
((
available_resource_DL_t
*
)
0
!=
pt
[
k
]){
new_node
=
(
schedule_result_t
*
)
malloc
(
sizeof
(
schedule_result_t
));
// fill new node
new_node
->
output_subframe
=
first_subframe
[
k
];
new_node
->
end_subframe
=
(
j
==
i
)
?
last_subframe
:
j
+
9
;
new_node
->
sdu_length
=
0
;
new_node
->
direction
=
DL
;
new_node
->
DCI_release
=
(
j
==
i
);
new_node
->
channel
=
NPDSCH
;
new_node
->
rnti
=
SI_RNTI
;
new_node
->
rnti_type
=
3
;
new_node
->
npusch_format
=
0
;
// useless
new_node
->
R_harq
=
0
;
// useless
new_node
->
next
=
(
schedule_result_t
*
)
0
;
new_node
->
DCI_pdu
=
(
void
*
)
sibs_dci
;
new_node
->
debug_str
=
str
[
sibs_order
];
fill_resource_DL
(
mac_inst
,
pt
[
k
],
first_subframe
[
k
],
(
j
==
i
)
?
last_subframe
:
j
+
9
,
new_node
);
}
}
return
;
}
}
return
;
}
openair2/LAYER2/MAC/schedule_tool_NB_IoT.c
0 → 100644
View file @
25f8a1bb
#include "defs_NB_IoT.h"
#include "proto_NB_IoT.h"
#include "extern_NB_IoT.h"
int
rachperiod
[
8
]
=
{
40
,
80
,
160
,
240
,
320
,
640
,
1280
,
2560
};
int
rachstart
[
8
]
=
{
8
,
16
,
32
,
64
,
128
,
256
,
512
,
1024
};
int
rachrepeat
[
8
]
=
{
1
,
2
,
4
,
8
,
16
,
32
,
64
,
128
};
//int rawindow[8]={2,3,4,5,6,7,8,10}; // unit PP
//int rmax[12]={1,2,4,8,16,32,64,128,256,512,1024,2048};
//double gvalue[8]={1.5,2,4,8,16,32,48,64};
//int candidate[4]={1,2,4,8};
//double pdcchoffset[4]={0,0.125,0.25,0.375};
//int dlrepeat[16]={1,2,4,8,16,32,64,128,192,256,384,512,768,1024,1536,2048};
int
rachscofst
[
7
]
=
{
0
,
12
,
24
,
36
,
2
,
18
,
34
};
int
rachnumsc
[
4
]
=
{
12
,
24
,
36
,
48
};
void
init_tool_sib1
(
eNB_MAC_INST_NB_IoT
*
mac_inst
){
int
i
,
j
;
//int repetition_pattern = 1;// 1:every2frame, 2:every4frame, 3:every8frame, 4:every16frame
for
(
i
=
0
;
i
<
8
;
++
i
){
mac_inst
->
sib1_flag
[(
i
<<
1
)
+
mac_inst
->
rrc_config
.
sib1_NB_IoT_sched_config
.
starting_rf
]
=
1
;
}
for
(
i
=
0
,
j
=
0
;
i
<
64
;
++
i
){
if
(
mac_inst
->
sib1_flag
[
i
]
==
1
){
++
j
;
}
mac_inst
->
sib1_count
[
i
]
=
j
;
}
mac_inst
->
sib1_period
=
256
/
mac_inst
->
rrc_config
.
sib1_NB_IoT_sched_config
.
repetitions
;
return
;
}
void
init_dlsf_info
(
eNB_MAC_INST_NB_IoT
*
mac_inst
,
DLSF_INFO_t
*
DLSF_info
)
{
uint16_t
dlsf_num_temp
=
0
;
uint16_t
i
;
uint16_t
j
=
0
;
DLSF_info
->
sf_to_dlsf_table
=
(
uint16_t
*
)
malloc
(
mac_inst
->
sib1_period
*
10
*
sizeof
(
uint16_t
));
for
(
i
=
0
;
i
<
mac_inst
->
sib1_period
*
10
;
++
i
)
{
if
(
is_dlsf
(
mac_inst
,
i
)
==
1
)
{
dlsf_num_temp
++
;
DLSF_info
->
sf_to_dlsf_table
[
i
]
=
dlsf_num_temp
;
}
else
{
DLSF_info
->
sf_to_dlsf_table
[
i
]
=
dlsf_num_temp
;
}
}
DLSF_info
->
num_dlsf_per_period
=
dlsf_num_temp
;
DLSF_info
->
dlsf_to_sf_table
=
(
uint16_t
*
)
malloc
(
dlsf_num_temp
*
sizeof
(
uint16_t
));
for
(
i
=
0
;
i
<
mac_inst
->
sib1_period
*
10
;
++
i
)
{
if
(
is_dlsf
(
mac_inst
,
i
)
==
1
)
{
DLSF_info
->
dlsf_to_sf_table
[
j
]
=
i
;
j
++
;
}
}
}
int
is_dlsf
(
eNB_MAC_INST_NB_IoT
*
mac_inst
,
int
abs_subframe
){
int
frame
=
abs_subframe
/
10
;
int
subframe
=
abs_subframe
%
10
;
return
!
(
subframe
==
0
||
subframe
==
5
||
((
frame
&
0x1
)
==
0
&&
subframe
==
9
)
||
(
mac_inst
->
sib1_flag
[
frame
%
mac_inst
->
sib1_period
]
==
1
&&
subframe
==
4
));
}
void
init_dl_list
(
eNB_MAC_INST_NB_IoT
*
mac_inst
){
available_resource_DL_t
*
node
;
node
=
(
available_resource_DL_t
*
)
malloc
(
sizeof
(
available_resource_DL_t
));
node
->
next
=
(
available_resource_DL_t
*
)
0
;
node
->
prev
=
(
available_resource_DL_t
*
)
0
;
available_resource_DL
=
node
;
available_resource_DL_last
=
node
;
node
->
start_subframe
=
0
;
node
->
end_subframe
=
mac_inst
->
rrc_config
.
si_window_length
;
node
->
DLSF_num
=
calculate_DLSF
(
mac_inst
,
node
->
start_subframe
,
node
->
end_subframe
);
mac_inst
->
schedule_subframe_DL
=
mac_inst
->
rrc_config
.
si_window_length
;
// init sibs for first si-window
schedule_sibs_NB_IoT
(
mac_inst
,
0
,
0
);
}
void
setting_nprach
(
void
){
nprach_list
[
0
].
nprach_Periodicity
=
rachperiod
[
4
];
nprach_list
[
0
].
nprach_StartTime
=
rachstart
[
0
];
nprach_list
[
0
].
nprach_SubcarrierOffset
=
rachscofst
[
0
];
nprach_list
[
0
].
nprach_NumSubcarriers
=
rachnumsc
[
0
];
nprach_list
[
0
].
numRepetitionsPerPreambleAttempt
=
rachrepeat
[
1
];
nprach_list
[
1
].
nprach_Periodicity
=
rachperiod
[
4
];
nprach_list
[
1
].
nprach_StartTime
=
rachstart
[
0
];
nprach_list
[
1
].
nprach_SubcarrierOffset
=
rachscofst
[
1
];
nprach_list
[
1
].
nprach_NumSubcarriers
=
rachnumsc
[
0
];
nprach_list
[
1
].
numRepetitionsPerPreambleAttempt
=
rachrepeat
[
3
];
nprach_list
[
2
].
nprach_Periodicity
=
rachperiod
[
4
];
nprach_list
[
2
].
nprach_StartTime
=
rachstart
[
0
];
nprach_list
[
2
].
nprach_SubcarrierOffset
=
rachscofst
[
2
];
nprach_list
[
2
].
nprach_NumSubcarriers
=
rachnumsc
[
1
];
nprach_list
[
2
].
numRepetitionsPerPreambleAttempt
=
rachrepeat
[
5
];
// fixed nprach configuration
}
void
add_UL_Resource_node
(
available_resource_UL_t
**
head
,
uint32_t
*
end_subframe
,
uint32_t
ce_level
){
available_resource_UL_t
*
new_node
,
*
iterator
;
new_node
=
(
available_resource_UL_t
*
)
malloc
(
sizeof
(
available_resource_UL_t
));
new_node
->
next
=
(
available_resource_UL_t
*
)
0
;
new_node
->
start_subframe
=
*
end_subframe
+
ceil
(
(
nprach_list
+
ce_level
)
->
nprach_StartTime
+
1
.
4
*
4
*
((
nprach_list
+
ce_level
)
->
numRepetitionsPerPreambleAttempt
)
)
;
new_node
->
end_subframe
=
*
end_subframe
+
(
nprach_list
+
ce_level
)
->
nprach_Periodicity
-
1
;
if
(
(
available_resource_UL_t
*
)
0
==
*
head
){
*
head
=
new_node
;
new_node
->
prev
=
(
available_resource_UL_t
*
)
0
;
}
else
{
iterator
=
*
head
;
while
(
(
available_resource_UL_t
*
)
0
!=
iterator
->
next
){
iterator
=
iterator
->
next
;
}
iterator
->
next
=
new_node
;
new_node
->
prev
=
iterator
;
}
*
end_subframe
+=
(
nprach_list
+
ce_level
)
->
nprach_Periodicity
;
}
/// Use to extend the UL resource grid (5 list) at the end of nprach peroid time
/// void add_UL_Resource(eNB_MAC_INST_NB_IoT *mac_inst)
void
add_UL_Resource
(
void
)
{
add_UL_Resource_node
(
&
available_resource_UL
->
sixtone_Head
,
&
available_resource_UL
->
sixtone_end_subframe
,
2
);
add_UL_Resource_node
(
&
available_resource_UL
->
threetone_Head
,
&
available_resource_UL
->
threetone_end_subframe
,
1
);
add_UL_Resource_node
(
&
available_resource_UL
->
singletone1_Head
,
&
available_resource_UL
->
singletone1_end_subframe
,
0
);
add_UL_Resource_node
(
&
available_resource_UL
->
singletone2_Head
,
&
available_resource_UL
->
singletone2_end_subframe
,
0
);
add_UL_Resource_node
(
&
available_resource_UL
->
singletone3_Head
,
&
available_resource_UL
->
singletone3_end_subframe
,
0
);
//print_available_UL_resource(); getchar();
}
/*when there is SIB-2 configuration coming to MAC, filled the uplink resource grid*/
void
Initialize_Resource
(
void
){
///memory allocate to Head
available_resource_UL
=
(
available_resource_tones_UL_t
*
)
malloc
(
sizeof
(
available_resource_tones_UL_t
));
available_resource_UL
->
sixtone_Head
=
(
available_resource_UL_t
*
)
0
;
available_resource_UL
->
threetone_Head
=
(
available_resource_UL_t
*
)
0
;
available_resource_UL
->
singletone1_Head
=
(
available_resource_UL_t
*
)
0
;
available_resource_UL
->
singletone2_Head
=
(
available_resource_UL_t
*
)
0
;
available_resource_UL
->
singletone3_Head
=
(
available_resource_UL_t
*
)
0
;
available_resource_UL
->
sixtone_end_subframe
=
0
;
available_resource_UL
->
threetone_end_subframe
=
0
;
available_resource_UL
->
singletone1_end_subframe
=
0
;
available_resource_UL
->
singletone2_end_subframe
=
0
;
available_resource_UL
->
singletone3_end_subframe
=
0
;
add_UL_Resource
();
add_UL_Resource
();
printf
(
"Initialization of the UL Resource grid has been done
\n
"
);
}
// extend subframe align to si-period
void
extend_available_resource_DL
(
eNB_MAC_INST_NB_IoT
*
mac_inst
,
int
max_subframe
){
// assume max_subframe is found.
available_resource_DL_t
*
pt
,
*
new_node
;
//int temp;
uint32_t
i
,
i_div_si_window
;
//uint32_t si_period_div_window;
pt
=
available_resource_DL
;
printf
(
"%d %d
\n
"
,
max_subframe
,
mac_inst
->
schedule_subframe_DL
);
if
(
max_subframe
>
mac_inst
->
schedule_subframe_DL
){
// align to si-period
max_subframe
=
((
max_subframe
%
mac_inst
->
rrc_config
.
si_window_length
)
==
0
)
?
max_subframe
:
(((
max_subframe
/
mac_inst
->
rrc_config
.
si_window_length
)
+
1
)
*
mac_inst
->
rrc_config
.
si_window_length
);
printf
(
"max %d last->end %p
\n
"
,
max_subframe
,
available_resource_DL_last
);
if
(
mac_inst
->
schedule_subframe_DL
==
available_resource_DL_last
->
end_subframe
){
available_resource_DL_last
->
end_subframe
=
max_subframe
;
//available_resource_DL_last->DLSF_num += calculate_DLSF(mac_inst, mac_inst->schedule_subframe_DL+1, max_subframe);
}
else
{
new_node
=
(
available_resource_DL_t
*
)
malloc
(
sizeof
(
available_resource_DL_t
));
available_resource_DL_last
->
next
=
new_node
;
new_node
->
start_subframe
=
mac_inst
->
schedule_subframe_DL
+
1
;
new_node
->
end_subframe
=
max_subframe
;
new_node
->
next
=
(
available_resource_DL_t
*
)
0
;
//new_node->DLSF_num = calculate_DLSF(mac_inst, mac_inst->schedule_subframe_DL+1, max_subframe);
}
// do schedule sibs after extend.
for
(
i
=
mac_inst
->
schedule_subframe_DL
;
i
<
max_subframe
;
i
+=
mac_inst
->
rrc_config
.
si_window_length
){
i_div_si_window
=
i
/
mac_inst
->
rrc_config
.
si_window_length
;
if
(
-
1
!=
mac_inst
->
sibs_table
[
i_div_si_window
]){
printf
(
"[sibs%d] %d
\n
"
,
mac_inst
->
sibs_table
[
i_div_si_window
],
i
);
schedule_sibs_NB_IoT
(
mac_inst
,
mac_inst
->
sibs_table
[
i_div_si_window
],
i
);
}
}
mac_inst
->
schedule_subframe_DL
=
max_subframe
;
}
return
;
}
void
fill_resource_DL
(
eNB_MAC_INST_NB_IoT
*
mac_inst
,
available_resource_DL_t
*
node
,
int
start_subframe
,
int
end_subframe
,
schedule_result_t
*
new_node
){
available_resource_DL_t
*
temp
;
schedule_result_t
*
iterator
,
*
temp1
;
// divided into two node
// keep one node(align left or right)
// delete node
int
align_left
=
(
node
->
start_subframe
==
start_subframe
)
||
(
calculate_DLSF
(
mac_inst
,
node
->
start_subframe
,
start_subframe
-
1
)
==
0
);
int
align_right
=
(
end_subframe
==
node
->
end_subframe
)
||
(
calculate_DLSF
(
mac_inst
,
end_subframe
+
1
,
node
->
end_subframe
)
==
0
);
//print_available_resource_DL();
//DEBUG("[debug] align : %d %d\n", align_left, align_right);
switch
(
align_left
+
align_right
){
case
0
:
// divided into two node
// A | node | B
// A | temp | node | B
temp
=
(
available_resource_DL_t
*
)
malloc
(
sizeof
(
available_resource_DL_t
));
if
(
node
->
prev
){
node
->
prev
->
next
=
temp
;
}
else
{
available_resource_DL
=
temp
;
}
temp
->
prev
=
node
->
prev
;
temp
->
next
=
node
;
node
->
prev
=
temp
;
//node->next don't need to change
temp
->
start_subframe
=
node
->
start_subframe
;
temp
->
end_subframe
=
start_subframe
-
1
;
node
->
start_subframe
=
end_subframe
+
1
;
node
->
DLSF_num
=
calculate_DLSF
(
mac_inst
,
node
->
start_subframe
,
node
->
end_subframe
);
temp
->
DLSF_num
=
calculate_DLSF
(
mac_inst
,
temp
->
start_subframe
,
temp
->
end_subframe
);
break
;
case
1
:
// keep one node
if
(
align_left
){
node
->
start_subframe
=
end_subframe
+
1
;
}
else
{
node
->
end_subframe
=
start_subframe
-
1
;
}
node
->
DLSF_num
=
calculate_DLSF
(
mac_inst
,
node
->
start_subframe
,
node
->
end_subframe
);
break
;
case
2
:
// delete
if
(
node
->
next
){
node
->
next
->
prev
=
node
->
prev
;
}
else
{
available_resource_DL_last
=
node
->
prev
;
}
if
(
node
->
prev
){
node
->
prev
->
next
=
node
->
next
;
}
else
{
available_resource_DL
=
node
->
next
;
}
free
(
node
);
break
;
default:
//error
break
;
}
// new node allocate from up-layer calling function.
iterator
=
schedule_result_list_DL
;
temp1
=
(
schedule_result_t
*
)
0
;
if
((
schedule_result_t
*
)
0
==
schedule_result_list_DL
){
schedule_result_list_DL
=
new_node
;
}
else
{
while
((
schedule_result_t
*
)
0
!=
iterator
){
if
(
start_subframe
<
iterator
->
output_subframe
){
break
;
}
temp1
=
iterator
;
iterator
=
iterator
->
next
;
}
if
((
schedule_result_t
*
)
0
==
iterator
){
temp1
->
next
=
new_node
;
}
else
{
new_node
->
next
=
iterator
;
if
(
temp1
){
temp1
->
next
=
new_node
;
}
else
{
schedule_result_list_DL
=
new_node
;
}
}
}
}
available_resource_DL_t
*
check_sibs_resource
(
eNB_MAC_INST_NB_IoT
*
mac_inst
,
int
check_start_subframe
,
int
check_end_subframe
,
int
num_subframe
,
int
*
residual_subframe
,
int
*
out_last_subframe
,
int
*
out_first_subframe
){
available_resource_DL_t
*
pt
,
*
pt_free
;
uint32_t
num_dlsf
;
uint8_t
output
=
0x0
;
pt
=
available_resource_DL
;
// TODO find the pt which can cover part of check_start_subframe, e.g. 1280-> 1281-1440
while
((
available_resource_DL_t
*
)
0
!=
pt
){
if
(
pt
->
start_subframe
<=
check_start_subframe
&&
pt
->
end_subframe
>=
check_start_subframe
){
break
;
}
pt
=
pt
->
next
;
}
//print_available_resource_DL();
//DEBUG("sibs %d", check_start_subframe);
if
((
available_resource_DL_t
*
)
0
==
pt
){
return
(
available_resource_DL_t
*
)
0
;
}
num_dlsf
=
calculate_DLSF
(
mac_inst
,
check_start_subframe
,
pt
->
end_subframe
);
if
((
available_resource_DL_t
*
)
0
==
pt
){
return
(
available_resource_DL_t
*
)
0
;
}
else
{
if
(
num_subframe
<=
num_dlsf
){
while
(
num_subframe
>
0
){
if
(
is_dlsf
(
mac_inst
,
check_start_subframe
)){
--
num_subframe
;
if
(
output
==
0x0
){
*
out_first_subframe
=
check_start_subframe
;
output
=
0x1
;
}
}
if
(
num_subframe
==
0
||
check_start_subframe
>=
check_end_subframe
){
break
;
}
else
{
++
check_start_subframe
;
}
}
*
residual_subframe
=
num_subframe
;
*
out_last_subframe
=
check_start_subframe
;
}
else
{
if
(
num_dlsf
==
0
){
return
(
available_resource_DL_t
*
)
0
;
}
else
{
while
(
!
is_dlsf
(
mac_inst
,
check_start_subframe
)){
++
check_start_subframe
;
}
*
out_first_subframe
=
check_start_subframe
;
}
*
residual_subframe
=
num_subframe
-
num_dlsf
;
*
out_last_subframe
=
pt
->
end_subframe
;
}
return
pt
;
}
}
uint32_t
calculate_DLSF
(
eNB_MAC_INST_NB_IoT
*
mac_inst
,
int
abs_start_subframe
,
int
abs_end_subframe
){
int
i
;
int
num_dlsf
=
0
;
int
diff_subframe
=
abs_end_subframe
-
abs_start_subframe
;
int
start_frame
=
abs_start_subframe
/
10
;
int
end_frame
=
abs_end_subframe
/
10
;
int
start_subframe
=
abs_start_subframe
%
10
;
int
end_subframe
=
abs_end_subframe
%
10
;
int
start_frame_mod_64
=
start_frame
&
0x0000003f
;
int
end_frame_mod_64
=
end_frame
&
0x0000003f
;
int
start_frame_div_64
=
(
start_frame
&
0xffffffc0
)
>>
6
;
int
end_frame_div_64
=
(
end_frame
&
0xffffffc0
)
>>
6
;
if
(
start_frame
>
end_frame
){
return
calculate_DLSF
(
mac_inst
,
abs_start_subframe
,
MAX_FRAME
*
10
+
9
)
+
calculate_DLSF
(
mac_inst
,
0
,
abs_end_subframe
);
}
if
(
start_frame_div_64
==
end_frame_div_64
&&
start_frame
==
end_frame
){
for
(
i
=
abs_start_subframe
;
i
<=
abs_end_subframe
;
++
i
){
num_dlsf
+=
is_dlsf
(
mac_inst
,
i
);
}
}
else
{
num_dlsf
=
mac_inst
->
dlsf_table
[
end_frame_mod_64
];
num_dlsf
-=
(
start_frame_mod_64
==
0
)
?
0
:
mac_inst
->
dlsf_table
[
start_frame_mod_64
-
1
];
for
(
i
=
0
;
i
<
start_subframe
;
++
i
,
--
abs_start_subframe
){
num_dlsf
-=
is_dlsf
(
mac_inst
,
abs_start_subframe
-
1
);
}
for
(
i
=
end_subframe
;
i
<
9
;
++
i
,
++
abs_end_subframe
){
num_dlsf
-=
is_dlsf
(
mac_inst
,
abs_end_subframe
+
1
);
}
if
(
start_frame_div_64
!=
end_frame_div_64
){
num_dlsf
+=
(
472
+
(
end_frame_div_64
-
start_frame_div_64
-
1
)
*
472
);
}
}
return
num_dlsf
;
}
\ No newline at end of file
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