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
ZhouShuya
OpenXG-RAN
Commits
0b90e899
Commit
0b90e899
authored
Oct 04, 2017
by
Nick Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Scheduler function completes, still has some warning to solve
parent
25f8a1bb
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
2770 additions
and
153 deletions
+2770
-153
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+1
-1
openair2/LAYER2/MAC/defs_NB_IoT.h
openair2/LAYER2/MAC/defs_NB_IoT.h
+12
-77
openair2/LAYER2/MAC/eNB_scheduler_NB_IoT.c
openair2/LAYER2/MAC/eNB_scheduler_NB_IoT.c
+195
-6
openair2/LAYER2/MAC/eNB_scheduler_RA_NB_IoT.c
openair2/LAYER2/MAC/eNB_scheduler_RA_NB_IoT.c
+619
-1
openair2/LAYER2/MAC/eNB_scheduler_dlsch_NB_IoT.c
openair2/LAYER2/MAC/eNB_scheduler_dlsch_NB_IoT.c
+834
-0
openair2/LAYER2/MAC/eNB_scheduler_primitives_NB_IoT.c
openair2/LAYER2/MAC/eNB_scheduler_primitives_NB_IoT.c
+0
-30
openair2/LAYER2/MAC/eNB_scheduler_ulsch_NB_IoT.c
openair2/LAYER2/MAC/eNB_scheduler_ulsch_NB_IoT.c
+405
-21
openair2/LAYER2/MAC/extern_NB_IoT.h
openair2/LAYER2/MAC/extern_NB_IoT.h
+45
-0
openair2/LAYER2/MAC/main_NB_IoT.c
openair2/LAYER2/MAC/main_NB_IoT.c
+0
-2
openair2/LAYER2/MAC/proto_NB_IoT.h
openair2/LAYER2/MAC/proto_NB_IoT.h
+107
-3
openair2/LAYER2/MAC/schedule_tool_NB_IoT.c
openair2/LAYER2/MAC/schedule_tool_NB_IoT.c
+474
-12
openair2/LAYER2/MAC/vars_NB_IoT.h
openair2/LAYER2/MAC/vars_NB_IoT.h
+78
-0
No files found.
cmake_targets/CMakeLists.txt
View file @
0b90e899
...
...
@@ -1182,7 +1182,7 @@ set (MAC_SRC
${
MAC_DIR
}
/eNB_scheduler_bch.c
${
MAC_DIR
}
/eNB_scheduler_bch_NB_IoT.c
${
MAC_DIR
}
/eNB_scheduler_primitives.c
${
MAC_DIR
}
/
eNB_scheduler_primitives
_NB_IoT.c
${
MAC_DIR
}
/
output_handler
_NB_IoT.c
${
MAC_DIR
}
/eNB_scheduler_RA.c
${
MAC_DIR
}
/eNB_scheduler_RA_NB_IoT.c
${
MAC_DIR
}
/pre_processor.c
...
...
openair2/LAYER2/MAC/defs_NB_IoT.h
View file @
0b90e899
...
...
@@ -545,6 +545,15 @@ typedef struct {
}
eNB_MAC_INST_NB_IoT
;
// actually not here, but for now put it here
typedef
struct
{
uint32_t
bytes_in_buffer
;
/*!< \brief Bytes buffered in RLC protocol instance. */
uint32_t
pdus_in_buffer
;
/*!< \brief Number of PDUs buffered in RLC protocol instance (OBSOLETE). */
uint32_t
head_sdu_creation_time
;
/*!< \brief Head SDU creation time. */
uint32_t
head_sdu_remaining_size_to_send
;
/*!< \brief remaining size of sdu: could be the total size or the remaining size of already segmented sdu */
boolean_t
head_sdu_is_segmented
;
/*!< \brief 0 if head SDU has not been segmented, 1 if already segmented */
}
mac_rlc_status_resp_NB_IoT_t
;
// global variables
nprach_parameters_NB_IoT_t
nprach_list
[
3
];
...
...
@@ -552,9 +561,9 @@ nprach_parameters_NB_IoT_t nprach_list[3];
//SCHEDULE_NB_IoT_t *NB_IoT_schedule;
/******MAC Global Variable********/
available_resource_tones_UL_t
*
available_resource_UL
;
available_resource_DL_t
*
available_resource_DL
;
available_resource_DL_t
*
available_resource_DL_last
;
//
available_resource_tones_UL_t *available_resource_UL;
//
available_resource_DL_t *available_resource_DL;
//
available_resource_DL_t *available_resource_DL_last;
/*
schedule_result_t *schedule_result_list_UL;
...
...
@@ -563,78 +572,4 @@ available_resource_DL_t *available_resource_DL_last;
//DLSF Table
DLSF_INFO_t
DLSF_information
;
// array will be active when they are used
// 10 -> single-tone / 12 -> multi-tone
//static uint32_t max_mcs[2] = {10, 12};
// [CE level] [0 - 3] -> single-tone / [CE level] [4-7] -> multi-tone
/*static uint32_t mapped_mcs[3][8]={{1,5,9,10,3,7,11,12},
{0,3,7,10,3,7,11,12},
{0,2,6,10,0,4,8,12}};*/
//TBS table for NPUSCH transmission TS 36.213 v14.2 table Table 16.5.1.2-2:
/*static int UL_TBS_Table[14][8]=
{
{16,2,56,88,120,152,208,256},
{24,56,88,144,176,208,256,344},
{32,72,144,176,208,256,328,424},
{40,104,176,208,256,328,440,568},
{56,120,208,256,328,408,552,680},
{72,144,224,328,424,504,680,872},
{88,176,256,392,504,600,808,1000},
{104,224,328,472,584,712,1000,1224},
{120,256,392,536,680,808,1096,1384},
{136,296,456,616,776,936,1256,1544},
{144,328,504,680,872,1000,1384,1736},
{176,376,584,776,1000,1192,1608,2024},
{208,440,680,1000,1128,1352,1800,2280},
{224,488,744,1128,1256,1544,2024,2536}
};*/
//static uint32_t RU_table[8]={1,2,3,4,5,6,8,10};
//static uint32_t scheduling_delay[4]={8,16,32,64};
//static uint32_t msg3_scheduling_delay_table[4] = {12,16,32,64};
//static uint32_t ack_nack_delay[4]={13,15,17,18};
//static uint32_t R_dl_table[16]={1,2,4,8,16,32,64,128,192,256,384,512,768,1024,1536,2048};
// NB_IoT-IoT------------------
// TBS table for the case not containing SIB1-NB_IoT, Table 16.4.1.5.1-1 in TS 36.213 v14.2
/*static uint32_t TBStable_NB_IoT[14][8] ={ //[ITBS][ISF]
{16,32,56,88,120.152,208,256},
{24,56,88,144,176,208,256,344},
{32,72,144,176,208,256,328,424},
{40,104,176,208,256,328,440,568},
{56,120,208,256,328,408,552,680},
{72,144,244,328,424,504,680,872},
{88,176,256,392,504,600,808,1032},
{104,224,328,472,584,680,968,1224},
{120,256,392,536,680,808,1096,1352},
{136,296,456,616,776,936,1256,1544},
{144,328,504,680,872,1032,1384,1736},
{176,376,584,776,1000,1192,1608,2024},
{208,440,680,904,1128,1352,1800,2280},
{224,488,744,1128,1256,1544,2024,2536}
};*/
//TBS table for the case containing S1B1-NB_IoT, Table 16.4.1.5.2-1 in TS 36.213 v14.2 (Itbs = 12 ~ 15 is reserved field
//mapping ITBS to SIB1-NB_IoT
//static unsigned int TBStable_NB_IoT_SIB1[16] = {208,208,208,328,328,328,440,440,440,680,680,680};
//static int DV_table[16]={0,10,14,19,26,36,49,67,91,125,171,234,321,768,1500,1500};
/*static int BSR_table[64]= {0,10,12,14,17,19,22,26,31,36,42,49,57,67,78,91,
105,125,146,171,200,234,274,321,376,440,515,603,706,826,967,1132,
1326,1552,1817,2127,2490,2915,3413,3995,4677,5467,6411,7505,8787,10287,12043,14099,
16507,19325,22624,26487,31009,36304,42502,49759,58255,68201,79846,93479,109439,128125,150000,300000
};*/
//static int dl_rep[3] = {1, 2, 4};
//static uint32_t dci_rep[3] = {1, 2, 4};
//static uint32_t harq_rep[3] = {1, 2, 4};
#endif
/*__LAYER2_MAC_DEFS_NB_IoT_H__ */
openair2/LAYER2/MAC/eNB_scheduler_NB_IoT.c
View file @
0b90e899
...
...
@@ -29,21 +29,210 @@
*
*/
#include "defs_NB_IoT.h"
#include "proto_NB_IoT.h"
#include "extern_NB_IoT.h"
// scheduler
#define flag_css_type1 0x1
#define flag_css_type2 0x2
#define flag_uss_v 0x4
// common
#define flag_mib 0x1
#define flag_sib1 0x2
#define flag_npss 0x4
#define flag_nsss 0x8
/*function description
* top level of the scheduler, this will trigger in every subframe,
#define num_flags 2
int
extend_space
[
num_flags
]
=
{
160
,
160
};
int
extend_alpha_offset
[
num_flags
]
=
{
10
,
10
};
int
uss_space
=
320
;
int
uss_alpha_offset
=
10
;
void
eNB_scheduler_computing_flag_NB_IoT
(
eNB_MAC_INST_NB_IoT
*
mac_inst
,
uint32_t
abs_subframe
,
uint32_t
*
scheduler_flags
,
uint32_t
*
common_flags
){
uint32_t
subframe
=
abs_subframe
%
10
;
uint32_t
frame
=
abs_subframe
/
10
;
int
i
;
if
(
subframe
==
0
){
*
common_flags
|=
flag_mib
;
}
else
if
(
subframe
==
5
){
*
common_flags
|=
flag_npss
;
}
else
if
(
subframe
==
9
&&
(
frame
&
0x1
)
==
0
){
*
common_flags
|=
flag_nsss
;
}
else
if
(
subframe
==
4
&&
mac_inst
->
sib1_flag
[
frame
%
mac_inst
->
sib1_period
]){
*
common_flags
|=
flag_sib1
;
}
for
(
i
=
0
;
i
<
num_flags
;
++
i
){
if
(((
abs_subframe
+
1
)
%
extend_space
[
i
])
==
(
extend_space
[
i
]
>>
extend_alpha_offset
[
i
])){
*
scheduler_flags
|=
(
0x1
<<
i
);
}
}
//USS trigger flag
for
(
i
=
0
;
i
<
mac_inst
->
num_uss_list
;
++
i
)
{
//printf("[eNB Computing falg] USS trigger time %d ss start time %d\n", ((abs_subframe+1)%mac_inst->UE_list_spec[i].NPDCCH_config_dedicated.T), mac_inst->UE_list_spec[i].NPDCCH_config_dedicated.ss_start_uss);
if
(((
abs_subframe
+
1
)
%
mac_inst
->
UE_list_spec
[
i
].
NPDCCH_config_dedicated
.
T
)
==
mac_inst
->
UE_list_spec
[
i
].
NPDCCH_config_dedicated
.
ss_start_uss
)
{
//SCHEDULE_LOG("1\n");
*
scheduler_flags
|=
(
flag_uss_v
<<
i
);
}
}
//printf("[eNB Computing falg] scheduler_flags %X\n", *scheduler_flags);
/*
//USS trigger flag
if((abs_subframe%uss_space)==(uss_space>>uss_alpha_offset)){
*scheduler_flags |= flag_uss_v;
}
*/
}
/*function description:
* top level of the scheduler, this will trigger in every subframe,
* and determined if do the schedule by checking this current subframe is the start of the NPDCCH period or not
*/
void
eNB_dlsch_ulsch_scheduler_NB_IoT
(
eNB_MAC_INST_NB_IoT
*
mac_inst
,
uint32_t
abs_subframe
){
// eNB_MAC_INST_NB_IoT *eNB = &eNB_mac_inst_NB_IoT[module_id];
int
i
,
max_subframe
,
scheduler_flags
,
common_flags
,
MIB_flag
,
SIB1_flag
;
/*Check this subframe should schedule something, set the flag*/
scheduler_flags
=
0
;
common_flags
=
0
;
MIB_flag
=
0
;
SIB1_flag
=
0
;
int
h
,
f
,
sf
;
int
a
;
//DEBUG("--------------[%04d][eNB scheduler NB-IoT] Start Scheduling------------\n", mac_inst->current_subframe);
eNB_scheduler_computing_flag_NB_IoT
(
mac_inst
,
abs_subframe
,
&
scheduler_flags
,
&
common_flags
);
/*Update the available resource list to current state*/
//NB_IoT_maintain_available_resource(subframe, frame, hypersfn);
max_subframe
=
0
;
for
(
i
=
0
;
i
<
num_flags
;
++
i
){
if
(
1
==
(
scheduler_flags
&
(
0x1
<<
i
))){
if
(
max_subframe
<
extend_space
[
i
]){
max_subframe
=
extend_space
[
i
];
}
}
}
if
(
scheduler_flags
>
0
){
extend_available_resource_DL
(
mac_inst
,
mac_inst
->
current_subframe
+
1
+
max_subframe
);
}
maintain_available_resource
(
mac_inst
);
/* already defined in proto_NB_IoT.h
void eNB_dlsch_ulsch_scheduler_NB_IoT(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP, uint16_t hypersfn)
{
static
int
test
=
2
;
if
((
abs_subframe
%
rachperiod
[
4
])
==
rachstart
[
0
]){
add_UL_Resource
();
}
//Check if type2 searching space scheduling
if
((
scheduler_flags
&
flag_css_type2
)
>
0
){
schedule_RA_NB_IoT
(
mac_inst
);
scheduler_flags
&=
~
(
flag_css_type2
);
}
//Check if type1 searching space scheduling
if
((
scheduler_flags
&
flag_css_type1
)
>
0
){
scheduler_flags
&=
~
(
flag_css_type1
);
}
// loop all USS period
for
(
i
=
0
;
i
<
mac_inst
->
num_uss_list
;
++
i
)
{
if
((
scheduler_flags
&
(
flag_uss_v
<<
i
))
>
0
){
printf
(
"--------------[%04d][SchedulerUSS] Schedule USS list %d------------
\n
"
,
mac_inst
->
current_subframe
,
(
scheduler_flags
&
(
flag_uss_v
<<
i
))
>>
3
);
scheduler_flags
&=
~
(
flag_uss_v
<<
i
);
convert_system_number
(
abs_subframe
,
&
h
,
&
f
,
&
sf
);
//DEBUG("=====t:%d======\n", mac_inst->current_subframe);
//print_available_resource_DL();
schedule_uss_NB_IoT
(
0
,
mac_inst
,
sf
,
f
,
h
,
i
);
}
}
/*
//Check if UE-specific searching space scheduling
if((scheduler_flags&flag_uss_v)>0){
scheduler_flags &= ~(flag_uss_v);
convert_system_number(abs_subframe, &h, &f, &sf);
//DEBUG("=====t:%d======\n", mac_inst->current_subframe);
//print_available_resource_DL();
schedule_uss_NB_IoT(0, mac_inst,sf, f, h, 0);
}
*/
if
(
common_flags
==
flag_mib
)
MIB_flag
=
1
;
if
(
common_flags
==
flag_sib1
)
SIB1_flag
=
1
;
convert_system_number
(
abs_subframe
,
&
h
,
&
f
,
&
sf
);
a
=
output_handler
(
mac_inst
,
0
,
0
,
h
,
f
,
sf
,
MIB_flag
,
SIB1_flag
,
abs_subframe
);
//DEBUG("--------------[%04d][eNB scheduler NB-IoT] End Scheduling------------\n", mac_inst->current_subframe);
}
*/
void
schedule_uss_NB_IoT
(
module_id_t
module_id
,
eNB_MAC_INST_NB_IoT
*
mac_inst
,
uint32_t
subframe
,
uint32_t
frame
,
uint32_t
hypersfn
,
int
index_ss
)
{
int32_t
i
;
//SCHEDULE_NB_IoT_t *scheduler = &eNB->scheduler;
mac_inst
->
scheduling_flag
.
flag_uss
[
0
]
=
1
;
mac_inst
->
scheduling_flag
.
flag_uss
[
1
]
=
0
;
mac_inst
->
scheduling_flag
.
flag_uss
[
2
]
=
0
;
mac_inst
->
scheduling_flag
.
num_uss_run
=
0
;
//search space index
//int index_ss=0;
int
UE_ID
;
UE_TEMPLATE_NB_IoT
*
UE_template_temp
;
if
(
mac_inst
->
scheduling_flag
.
num_uss_run
>
1
)
{
//spectial case
}
else
{
//general case
}
UE_ID
=
mac_inst
->
UE_list_spec
[
index_ss
].
head
;
//DEBUG("t=%d UE ID head %d\n", mac_inst->current_subframe,UE_ID);
while
(
UE_ID
>-
1
)
{
UE_template_temp
=
&
(
mac_inst
->
UE_list_spec
[
index_ss
].
UE_template_NB_IoT
[
UE_ID
]);
printf
(
"------Start Scheduling USS UE RNTI %d------
\n
"
,
UE_template_temp
->
rnti
);
if
(
UE_template_temp
->
RRC_connected
!=
1
)
{
printf
(
"[schedule_uss_NB_IoT] UE ID %d RRC not connected
\n
"
,
UE_ID
);
printf
(
"[%04d][USS scheduler][UE%d] rrc not connected
\n
"
,
mac_inst
->
current_subframe
,
UE_template_temp
->
rnti
);
}
else
{
printf
(
"t=%d*******[schedule_uss_NB_IoT] schedule UE_ID %d direction %d*******%d %d %d
\n
"
,
mac_inst
->
current_subframe
,
UE_ID
,
UE_template_temp
->
direction
,
hypersfn
,
frame
,
subframe
);
printf
(
"[%04d][USS scheduler][UE%d] "
,
mac_inst
->
current_subframe
,
UE_template_temp
->
rnti
);
switch
(
UE_template_temp
->
direction
)
{
//Downlink Scheduling
case
1
:
printf
(
"uss downlink scheduling..
\n
"
);
schedule_DL_NB_IoT
(
0
,
mac_inst
,
UE_template_temp
,
hypersfn
,
frame
,
subframe
);
break
;
//Uplink Scheduling
case
0
:
DEBUG
(
"uss uplink scheduling..
\n
"
);
schedule_UL_NB_IoT
(
mac_inst
,
UE_template_temp
,
subframe
,
frame
,
hypersfn
);
break
;
case
-
1
:
printf
(
"current idle..
\n
"
);
default:
break
;
}
//printf("----------------End Scheduling USS UE RNTI %d-------------------\n", UE_template_temp->rnti);
UE_template_temp
->
direction
=
-
1
;
}
UE_ID
=
UE_template_temp
->
next
;
}
}
openair2/LAYER2/MAC/eNB_scheduler_RA_NB_IoT.c
View file @
0b90e899
This diff is collapsed.
Click to expand it.
openair2/LAYER2/MAC/eNB_scheduler_dlsch_NB_IoT.c
View file @
0b90e899
This diff is collapsed.
Click to expand it.
openair2/LAYER2/MAC/eNB_scheduler_primitives_NB_IoT.c
deleted
100644 → 0
View file @
25f8a1bb
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.0 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file eNB_scheduler_primitives.c
* \brief primitives used by eNB for BCH, RACH, ULSCH, DLSCH scheduling
* \author Navid Nikaein and Raymond Knopp
* \date 2010 - 2014
* \email: navid.nikaein@eurecom.fr
* \version 1.0
* @ingroup _mac
*/
openair2/LAYER2/MAC/eNB_scheduler_ulsch_NB_IoT.c
View file @
0b90e899
This diff is collapsed.
Click to expand it.
openair2/LAYER2/MAC/extern_NB_IoT.h
View file @
0b90e899
...
...
@@ -108,6 +108,51 @@ extern available_resource_DL_t *available_resource_DL_last;
extern
schedule_result_t
*
schedule_result_list_UL
;
extern
schedule_result_t
*
schedule_result_list_DL
;
// array will be active when they are used
// 10 -> single-tone / 12 -> multi-tone
extern
const
uint32_t
max_mcs
[
2
];
// [CE level] [0 - 3] -> single-tone / [CE level] [4-7] -> multi-tone
extern
const
uint32_t
mapped_mcs
[
3
][
8
];
//TBS table for NPUSCH transmission TS 36.213 v14.2 table Table 16.5.1.2-2:
extern
const
int
UL_TBS_Table
[
14
][
8
];
extern
const
int
rachperiod
[
8
];
extern
const
int
rachstart
[
8
];
extern
const
int
rachrepeat
[
8
];
extern
const
int
rachscofst
[
7
];
extern
const
int
rachnumsc
[
4
];
extern
const
uint32_t
RU_table
[
8
];
extern
const
uint32_t
scheduling_delay
[
4
];
extern
const
uint32_t
msg3_scheduling_delay_table
[
4
];
extern
const
uint32_t
ack_nack_delay
[
4
];
extern
const
uint32_t
R_dl_table
[
16
];
// TBS table for the case not containing SIB1-NB_IoT, Table 16.4.1.5.1-1 in TS 36.213 v14.2
extern
const
uint32_t
MAC_TBStable_NB_IoT
[
14
][
8
];
//TBS table for the case containing S1B1-NB_IoT, Table 16.4.1.5.2-1 in TS 36.213 v14.2 (Itbs = 12 ~ 15 is reserved field
//mapping ITBS to SIB1-NB_IoT
extern
const
unsigned
int
MAC_TBStable_NB_IoT_SIB1
[
16
];
//static int DV_table[16]={0,10,14,19,26,36,49,67,91,125,171,234,321,768,1500,1500};
/*static int BSR_table[64]= {0,10,12,14,17,19,22,26,31,36,42,49,57,67,78,91,
105,125,146,171,200,234,274,321,376,440,515,603,706,826,967,1132,
1326,1552,1817,2127,2490,2915,3413,3995,4677,5467,6411,7505,8787,10287,12043,14099,
16507,19325,22624,26487,31009,36304,42502,49759,58255,68201,79846,93479,109439,128125,150000,300000
};*/
extern
const
int
dl_rep
[
3
];
extern
const
uint32_t
dci_rep
[
3
];
extern
const
uint32_t
harq_rep
[
3
];
#endif //DEF_H
...
...
openair2/LAYER2/MAC/main_NB_IoT.c
View file @
0b90e899
...
...
@@ -236,8 +236,6 @@ int l2_init_eNB_NB_IoT()
init_mac_NB_IoT
(
mac_inst
);
return
(
1
);
}
openair2/LAYER2/MAC/proto_NB_IoT.h
View file @
0b90e899
...
...
@@ -37,7 +37,35 @@
* @{
*/
/*for NB-IoT*/
// main schedule functions
void
eNB_scheduler_computing_flag_NB_IoT
(
eNB_MAC_INST_NB_IoT
*
mac_inst
,
uint32_t
abs_subframe
,
uint32_t
*
scheduler_flags
,
uint32_t
*
common_flags
);
/*function description:
* top level of the scheduler, this will trigger in every subframe,
* and determined if do the schedule by checking this current subframe is the start of the NPDCCH period or not
*/
void
eNB_dlsch_ulsch_scheduler_NB_IoT
(
eNB_MAC_INST_NB_IoT
*
mac_inst
,
uint32_t
abs_subframe
);
void
schedule_sibs_NB_IoT
(
eNB_MAC_INST_NB_IoT
*
mac_inst
,
uint32_t
sibs_order
,
int
start_subframe1
);
void
schedule_uss_NB_IoT
(
module_id_t
module_id
,
eNB_MAC_INST_NB_IoT
*
mac_inst
,
uint32_t
subframe
,
uint32_t
frame
,
uint32_t
hypersfn
,
int
index_ss
);
void
schedule_RA_NB_IoT
(
eNB_MAC_INST_NB_IoT
*
mac_inst
);
void
schedule_msg3_retransimission_NB_IoT
(
eNB_MAC_INST_NB_IoT
*
mac_inst
);
void
schedule_msg4_NB_IoT
(
eNB_MAC_INST_NB_IoT
*
mac_inst
);
void
schedule_rar_NB_IoT
(
eNB_MAC_INST_NB_IoT
*
mac_inst
);
int
schedule_UL_NB_IoT
(
eNB_MAC_INST_NB_IoT
*
mac_inst
,
UE_TEMPLATE_NB_IoT
*
UE_info
,
uint32_t
subframe
,
uint32_t
frame
,
uint32_t
H_SFN
);
void
schedule_DL_NB_IoT
(
module_id_t
module_id
,
eNB_MAC_INST_NB_IoT
*
mac_inst
,
UE_TEMPLATE_NB_IoT
*
UE_info
,
uint32_t
hyperSF_start
,
uint32_t
frame_start
,
uint32_t
subframe_start
);
int
output_handler
(
eNB_MAC_INST_NB_IoT
*
mac_inst
,
module_id_t
module_id
,
int
CC_id
,
uint32_t
hypersfn
,
uint32_t
frame
,
uint32_t
subframe
,
uint8_t
MIB_flag
,
uint8_t
SIB1_flag
,
uint32_t
current_time
);
/*Scheduler resource/environment setting*/
void
init_tool_sib1
(
eNB_MAC_INST_NB_IoT
*
mac_inst
);
...
...
@@ -61,17 +89,93 @@ void Initialize_Resource(void);
void
extend_available_resource_DL
(
eNB_MAC_INST_NB_IoT
*
mac_inst
,
int
max_subframe
);
//Transfrom source into hyperSF, Frame, Subframe format
void
convert_system_number
(
uint32_t
source_sf
,
uint32_t
*
hyperSF
,
uint32_t
*
frame
,
uint32_t
*
subframe
);
uint32_t
convert_system_number_sf
(
uint32_t
hyperSF
,
uint32_t
frame
,
uint32_t
subframe
);
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
);
// schedule functinons
void
schedule_sibs_NB_IoT
(
eNB_MAC_INST_NB_IoT
*
mac_inst
,
uint32_t
sibs_order
,
int
start_subframe1
);
// schedule helper functinons
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
*
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
);
uint32_t
calculate_DLSF
(
eNB_MAC_INST_NB_IoT
*
mac_inst
,
int
abs_start_subframe
,
int
abs_end_subframe
);
// check_subframe must be DLSF, you can use is_dlsf() to check before call function
available_resource_DL_t
*
check_resource_DL
(
eNB_MAC_INST_NB_IoT
*
mac_inst
,
int
check_subframe
,
int
num_subframes
,
int
*
out_last_subframe
,
int
*
out_first_subframe
);
void
maintain_available_resource
(
eNB_MAC_INST_NB_IoT
*
mac_inst
);
int
multi_tone_ru_allocation
(
uint32_t
uplink_time
,
int
total_ru
,
sched_temp_UL_NB_IoT_t
*
NPUSCH_info
);
int
single_tone_ru_allocation
(
uint32_t
uplink_time
,
int
total_ru
,
sched_temp_UL_NB_IoT_t
*
NPUSCH_info
,
int
fmt2_flag
);
int
Check_UL_resource
(
uint32_t
uplink_time
,
int
total_ru
,
sched_temp_UL_NB_IoT_t
*
NPUSCH_info
,
int
multi_tone
,
int
fmt2_flag
);
void
insert_schedule_result
(
schedule_result_t
**
list
,
int
subframe
,
schedule_result_t
*
node
);
void
adjust_UL_resource_list
(
sched_temp_UL_NB_IoT_t
*
NPUSCH_info
);
void
generate_scheduling_result_UL
(
int32_t
DCI_subframe
,
int32_t
DCI_end_subframe
,
uint32_t
UL_subframe
,
uint32_t
UL_end_subframe
,
DCIFormatN0_t
*
DCI
,
rnti_t
rnti
,
uint8_t
*
ul_debug_str
,
uint8_t
*
dl_debug_str
);
uint32_t
get_I_mcs_NB_IoT
(
int
CE_level
);
int
get_TBS_UL_NB_IoT
(
uint32_t
mcs
,
uint32_t
multi_tone
,
int
Iru
);
// DL TBS
uint32_t
get_tbs
(
uint32_t
data_size
,
uint32_t
I_tbs
,
uint32_t
*
I_sf
);
uint32_t
get_max_tbs
(
uint32_t
I_tbs
);
uint32_t
get_num_sf
(
uint32_t
I_sf
);
uint16_t
find_suit_i_delay
(
uint32_t
rmax
,
uint32_t
r
,
uint32_t
dci_candidate
);
uint32_t
get_scheduling_delay
(
uint32_t
I_delay
,
uint32_t
R_max
);
uint32_t
get_HARQ_delay
(
int
subcarrier_spacing
,
uint32_t
HARQ_delay_index
);
int
get_resource_field_value
(
int
subcarrier
,
int
k0
);
void
fill_rar_NB_IoT
(
eNB_MAC_INST_NB_IoT
*
inst
,
RA_TEMPLATE_NB_IoT
*
ra_template
,
uint8_t
msg3_schedule_delay
,
uint8_t
msg3_rep
,
sched_temp_UL_NB_IoT_t
*
schedule_template
);
uint32_t
cal_num_dlsf
(
eNB_MAC_INST_NB_IoT
*
mac_inst
,
uint32_t
hyperSF
,
uint32_t
frame
,
uint32_t
subframe
,
uint32_t
*
hyperSF_result
,
uint32_t
*
frame_result
,
uint32_t
*
subframe_result
,
uint32_t
num_dlsf_require
);
int
check_resource_NPDCCH_NB_IoT
(
eNB_MAC_INST_NB_IoT
*
mac_inst
,
uint32_t
hyperSF_start
,
uint32_t
frame_start
,
uint32_t
subframe_start
,
sched_temp_DL_NB_IoT_t
*
NPDCCH_info
,
uint32_t
cdd_num
,
uint32_t
dci_rep
);
int
check_resource_NPDSCH_NB_IoT
(
eNB_MAC_INST_NB_IoT
*
mac_inst
,
sched_temp_DL_NB_IoT_t
*
NPDSCH_info
,
uint32_t
sf_end
,
uint32_t
I_delay
,
uint32_t
R_max
,
uint32_t
R_dl
,
uint32_t
n_sf
);
int
check_resource_DL_NB_IoT
(
eNB_MAC_INST_NB_IoT
*
mac_inst
,
uint32_t
hyperSF_start
,
uint32_t
frame_start
,
uint32_t
subframe_start
,
uint32_t
dlsf_require
,
sched_temp_DL_NB_IoT_t
*
schedule_info
);
void
fill_DCI_N1
(
DCIFormatN1_t
*
DCI_N1
,
UE_TEMPLATE_NB_IoT
*
UE_info
,
uint32_t
scheddly
,
uint32_t
I_sf
,
uint32_t
I_harq
);
uint32_t
generate_dlsch_header_NB_IoT
(
uint8_t
*
pdu
,
uint32_t
num_sdu
,
logical_chan_id_t
*
logical_channel
,
uint32_t
*
sdu_length
,
uint8_t
flag_drx
,
uint8_t
flag_ta
,
uint32_t
TBS
);
void
generate_scheduling_result_DL
(
uint32_t
DCI_subframe
,
uint32_t
NPDSCH_subframe
,
uint32_t
HARQ_subframe
,
DCIFormatN1_t
*
DCI_pdu
,
rnti_t
rnti
,
uint32_t
TBS
,
uint8_t
*
DLSCH_pdu
);
void
maintain_resource_DL
(
eNB_MAC_INST_NB_IoT
*
mac_inst
,
sched_temp_DL_NB_IoT_t
*
NPDCCH_info
,
sched_temp_DL_NB_IoT_t
*
NPDSCH_info
);
int
get_N_REP
(
int
CE_level
);
int
get_I_REP
(
int
N_rep
);
int
get_DCI_REP
(
uint32_t
R
,
uint32_t
R_max
);
int
get_I_TBS_NB_IoT
(
int
x
,
int
y
);
uint8_t
get_index_Rep_dl
(
uint16_t
R
);
//debug function
void
print_available_resource_DL
(
void
);
void
print_available_UL_resource
(
void
);
#endif
openair2/LAYER2/MAC/schedule_tool_NB_IoT.c
View file @
0b90e899
This diff is collapsed.
Click to expand it.
openair2/LAYER2/MAC/vars_NB_IoT.h
View file @
0b90e899
...
...
@@ -54,9 +54,87 @@ schedule_result_t *schedule_result_list_UL;
schedule_result_t
*
schedule_result_list_DL
;
available_resource_DL_t
*
available_resource_DL
;
available_resource_tones_UL_t
*
available_resource_UL
;
available_resource_DL_t
*
available_resource_DL_last
;
//should be utilized in: schedule_RA_NB_IoT,rx_sdu_NB_IoT, mac_top_init_NB_IoT,
uint8_t
Is_rrc_registered_NB_IoT
;
// array will be active when they are used
// 10 -> single-tone / 12 -> multi-tone
const
uint32_t
max_mcs
[
2
]
=
{
10
,
12
};
// [CE level] [0 - 3] -> single-tone / [CE level] [4-7] -> multi-tone
const
uint32_t
mapped_mcs
[
3
][
8
]
=
{{
1
,
5
,
9
,
10
,
3
,
7
,
11
,
12
},
{
0
,
3
,
7
,
10
,
3
,
7
,
11
,
12
},
{
0
,
2
,
6
,
10
,
0
,
4
,
8
,
12
}};
//TBS table for NPUSCH transmission TS 36.213 v14.2 table Table 16.5.1.2-2:
const
int
UL_TBS_Table
[
14
][
8
]
=
{
{
16
,
2
,
56
,
88
,
120
,
152
,
208
,
256
},
{
24
,
56
,
88
,
144
,
176
,
208
,
256
,
344
},
{
32
,
72
,
144
,
176
,
208
,
256
,
328
,
424
},
{
40
,
104
,
176
,
208
,
256
,
328
,
440
,
568
},
{
56
,
120
,
208
,
256
,
328
,
408
,
552
,
680
},
{
72
,
144
,
224
,
328
,
424
,
504
,
680
,
872
},
{
88
,
176
,
256
,
392
,
504
,
600
,
808
,
1000
},
{
104
,
224
,
328
,
472
,
584
,
712
,
1000
,
1224
},
{
120
,
256
,
392
,
536
,
680
,
808
,
1096
,
1384
},
{
136
,
296
,
456
,
616
,
776
,
936
,
1256
,
1544
},
{
144
,
328
,
504
,
680
,
872
,
1000
,
1384
,
1736
},
{
176
,
376
,
584
,
776
,
1000
,
1192
,
1608
,
2024
},
{
208
,
440
,
680
,
1000
,
1128
,
1352
,
1800
,
2280
},
{
224
,
488
,
744
,
1128
,
1256
,
1544
,
2024
,
2536
}
};
const
int
rachperiod
[
8
]
=
{
40
,
80
,
160
,
240
,
320
,
640
,
1280
,
2560
};
const
int
rachstart
[
8
]
=
{
8
,
16
,
32
,
64
,
128
,
256
,
512
,
1024
};
const
int
rachrepeat
[
8
]
=
{
1
,
2
,
4
,
8
,
16
,
32
,
64
,
128
};
const
int
rachscofst
[
7
]
=
{
0
,
12
,
24
,
36
,
2
,
18
,
34
};
const
int
rachnumsc
[
4
]
=
{
12
,
24
,
36
,
48
};
const
uint32_t
RU_table
[
8
]
=
{
1
,
2
,
3
,
4
,
5
,
6
,
8
,
10
};
const
uint32_t
scheduling_delay
[
4
]
=
{
8
,
16
,
32
,
64
};
const
uint32_t
msg3_scheduling_delay_table
[
4
]
=
{
12
,
16
,
32
,
64
};
const
uint32_t
ack_nack_delay
[
4
]
=
{
13
,
15
,
17
,
18
};
const
uint32_t
R_dl_table
[
16
]
=
{
1
,
2
,
4
,
8
,
16
,
32
,
64
,
128
,
192
,
256
,
384
,
512
,
768
,
1024
,
1536
,
2048
};
// TBS table for the case not containing SIB1-NB_IoT, Table 16.4.1.5.1-1 in TS 36.213 v14.2
const
uint32_t
MAC_TBStable_NB_IoT
[
14
][
8
]
=
{
//[ITBS][ISF]
{
16
,
32
,
56
,
88
,
120
.
152
,
208
,
256
},
{
24
,
56
,
88
,
144
,
176
,
208
,
256
,
344
},
{
32
,
72
,
144
,
176
,
208
,
256
,
328
,
424
},
{
40
,
104
,
176
,
208
,
256
,
328
,
440
,
568
},
{
56
,
120
,
208
,
256
,
328
,
408
,
552
,
680
},
{
72
,
144
,
244
,
328
,
424
,
504
,
680
,
872
},
{
88
,
176
,
256
,
392
,
504
,
600
,
808
,
1032
},
{
104
,
224
,
328
,
472
,
584
,
680
,
968
,
1224
},
{
120
,
256
,
392
,
536
,
680
,
808
,
1096
,
1352
},
{
136
,
296
,
456
,
616
,
776
,
936
,
1256
,
1544
},
{
144
,
328
,
504
,
680
,
872
,
1032
,
1384
,
1736
},
{
176
,
376
,
584
,
776
,
1000
,
1192
,
1608
,
2024
},
{
208
,
440
,
680
,
904
,
1128
,
1352
,
1800
,
2280
},
{
224
,
488
,
744
,
1128
,
1256
,
1544
,
2024
,
2536
}
};
//TBS table for the case containing S1B1-NB_IoT, Table 16.4.1.5.2-1 in TS 36.213 v14.2 (Itbs = 12 ~ 15 is reserved field
//mapping ITBS to SIB1-NB_IoT
const
unsigned
int
MAC_TBStable_NB_IoT_SIB1
[
16
]
=
{
208
,
208
,
208
,
328
,
328
,
328
,
440
,
440
,
440
,
680
,
680
,
680
};
//static int DV_table[16]={0,10,14,19,26,36,49,67,91,125,171,234,321,768,1500,1500};
/*static int BSR_table[64]= {0,10,12,14,17,19,22,26,31,36,42,49,57,67,78,91,
105,125,146,171,200,234,274,321,376,440,515,603,706,826,967,1132,
1326,1552,1817,2127,2490,2915,3413,3995,4677,5467,6411,7505,8787,10287,12043,14099,
16507,19325,22624,26487,31009,36304,42502,49759,58255,68201,79846,93479,109439,128125,150000,300000
};*/
const
int
dl_rep
[
3
]
=
{
1
,
2
,
4
};
const
uint32_t
dci_rep
[
3
]
=
{
1
,
2
,
4
};
const
uint32_t
harq_rep
[
3
]
=
{
1
,
2
,
4
};
#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