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
50797cc9
Commit
50797cc9
authored
Oct 04, 2017
by
Nick Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update IF Module
parent
270e0067
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
248 additions
and
32 deletions
+248
-32
openair2/LAYER2/MAC/defs_NB_IoT.h
openair2/LAYER2/MAC/defs_NB_IoT.h
+0
-11
openair2/LAYER2/MAC/eNB_scheduler_RA_NB_IoT.c
openair2/LAYER2/MAC/eNB_scheduler_RA_NB_IoT.c
+41
-0
openair2/LAYER2/MAC/eNB_scheduler_ulsch_NB_IoT.c
openair2/LAYER2/MAC/eNB_scheduler_ulsch_NB_IoT.c
+146
-0
openair2/LAYER2/MAC/extern_NB_IoT.h
openair2/LAYER2/MAC/extern_NB_IoT.h
+2
-7
openair2/LAYER2/MAC/proto_NB_IoT.h
openair2/LAYER2/MAC/proto_NB_IoT.h
+8
-0
openair2/LAYER2/MAC/schedule_tool_NB_IoT.c
openair2/LAYER2/MAC/schedule_tool_NB_IoT.c
+13
-0
openair2/LAYER2/MAC/vars_NB_IoT.h
openair2/LAYER2/MAC/vars_NB_IoT.h
+3
-3
openair2/PHY_INTERFACE/IF_Module_L2_primitives_NB_IoT.c
openair2/PHY_INTERFACE/IF_Module_L2_primitives_NB_IoT.c
+35
-11
No files found.
openair2/LAYER2/MAC/defs_NB_IoT.h
View file @
50797cc9
...
...
@@ -535,17 +535,6 @@ typedef struct {
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;
/*
schedule_result_t *schedule_result_list_UL;
schedule_result_t *schedule_result_list_DL;
*/
//DLSF Table
DLSF_INFO_t
DLSF_information
;
...
...
openair2/LAYER2/MAC/eNB_scheduler_RA_NB_IoT.c
View file @
50797cc9
...
...
@@ -25,6 +25,47 @@ unsigned char str10[] = "ack_msg4(retransmit)";
unsigned
char
str11
[]
=
"msg3"
;
unsigned
char
str12
[]
=
"msg3(retransmit)"
;
/*void init_RA_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint8_t preamble_index, ce_level_t ce_level, uint32_t sfn_id, uint16_t ta){
int i;
RA_TEMPLATE_NB_IoT *msg2_list_tail = mac_inst->RA_msg2_list.tail;
RA_TEMPLATE_NB_IoT *migrate_node;
static int static_count=0;
printf("[%04d][RA scheduler][MSG1] RX %d\n", mac_inst->current_subframe, static_count++);
for(i=0; i<MAX_NUMBER_OF_UE_MAX_NB_IoT; ++i){
if(0 == mac_inst->RA_template[i].active){
migrate_node = &mac_inst->RA_template[i];
break;
}
}
if(i==MAX_NUMBER_OF_UE_MAX_NB_IoT){
printf("[%04d][RA scheduler][MSG1] number of RA procedures is up to maximum..\n", mac_inst->current_subframe);
return ;
}
migrate_node->active = 1;
migrate_node->preamble_index = preamble_index;
migrate_node->ce_level = ce_level;
migrate_node->ra_rnti = (sfn_id>>2) + 1;
migrate_node->ta = ta;
migrate_node->next = (RA_template_NB_IoT *)0;
migrate_node->prev = (RA_template_NB_IoT *)0;
// insert to end of list
if((RA_template_NB_IoT *)0 == mac_inst->RA_msg2_list.head){
mac_inst->RA_msg2_list.head = migrate_node;
}else{
// not empty
mac_inst->RA_msg2_list.tail->next = migrate_node;
migrate_node->prev = mac_inst->RA_msg2_list.tail;
}
mac_inst->RA_msg2_list.tail = migrate_node;
}*/
// 7bytes
void
fill_rar_NB_IoT
(
eNB_MAC_INST_NB_IoT
*
inst
,
...
...
openair2/LAYER2/MAC/eNB_scheduler_ulsch_NB_IoT.c
View file @
50797cc9
...
...
@@ -413,4 +413,150 @@ void adjust_UL_resource_list(sched_temp_UL_NB_IoT_t *NPUSCH_info)
}
// free(NPUSCH_info);
}
uint8_t
*
parse_ulsch_header_NB_IoT
(
uint8_t
*
mac_header
,
uint8_t
*
num_ce
,
uint8_t
*
num_sdu
,
uint8_t
*
rx_ces
,
uint8_t
*
rx_lcids
,
uint16_t
*
rx_lengths
,
uint16_t
tb_length
){
uint8_t
not_done
=
1
,
num_ces
=
0
,
num_sdus
=
0
,
lcid
,
num_sdu_cnt
;
uint8_t
*
mac_header_ptr
=
mac_header
;
uint16_t
length
,
ce_len
=
0
;
while
(
not_done
==
1
){
if
(((
SCH_SUBHEADER_FIXED_NB_IoT
*
)
mac_header_ptr
)
->
E
==
0
){
not_done
=
0
;
}
lcid
=
((
SCH_SUBHEADER_FIXED_NB_IoT
*
)
mac_header_ptr
)
->
LCID
;
if
(
lcid
<
EXTENDED_POWER_HEADROOM
){
if
(
not_done
==
0
)
{
// last MAC SDU, length is implicit
mac_header_ptr
++
;
length
=
tb_length
-
(
mac_header_ptr
-
mac_header
)
-
ce_len
;
for
(
num_sdu_cnt
=
0
;
num_sdu_cnt
<
num_sdus
;
num_sdu_cnt
++
){
length
-=
rx_lengths
[
num_sdu_cnt
];
}
}
else
{
if
(((
SCH_SUBHEADER_SHORT_NB_IoT
*
)
mac_header_ptr
)
->
F
==
0
){
length
=
((
SCH_SUBHEADER_SHORT_NB_IoT
*
)
mac_header_ptr
)
->
L
;
mac_header_ptr
+=
2
;
//sizeof(SCH_SUBHEADER_SHORT);
}
else
{
// F = 1
length
=
((((
SCH_SUBHEADER_LONG_NB_IoT
*
)
mac_header_ptr
)
->
L_MSB
&
0x7f
)
<<
8
)
|
(((
SCH_SUBHEADER_LONG_NB_IoT
*
)
mac_header_ptr
)
->
L_LSB
&
0xff
);
mac_header_ptr
+=
3
;
//sizeof(SCH_SUBHEADER_LONG);
}
}
rx_lcids
[
num_sdus
]
=
lcid
;
rx_lengths
[
num_sdus
]
=
length
;
num_sdus
++
;
}
else
{
// This is a control element subheader POWER_HEADROOM, BSR and CRNTI
if
(
lcid
==
SHORT_PADDING
){
mac_header_ptr
++
;
}
else
{
rx_ces
[
num_ces
]
=
lcid
;
num_ces
++
;
mac_header_ptr
++
;
if
(
lcid
==
LONG_BSR
){
ce_len
+=
3
;
}
else
if
(
lcid
==
CRNTI
){
ce_len
+=
2
;
}
else
if
((
lcid
==
POWER_HEADROOM
)
||
(
lcid
==
TRUNCATED_BSR
)
||
(
lcid
==
SHORT_BSR
))
{
ce_len
++
;
}
else
{
// wrong lcid
}
}
}
}
*
num_ce
=
num_ces
;
*
num_sdu
=
num_sdus
;
return
(
mac_header_ptr
);
}
void
rx_sdu_NB_IoT
(
module_id_t
module_id
,
int
CC_id
,
frame_t
frame
,
sub_frame_t
subframe
,
uint16_t
rnti
,
uint8_t
*
sdu
,
uint16_t
length
)
{
unsigned
char
rx_ces
[
5
],
num_ce
=
0
,
num_sdu
=
0
,
*
payload_ptr
,
i
;
// MAX Control element
unsigned
char
rx_lcids
[
5
];
//for NB_IoT-IoT, NB_IoT_RB_MAX should be fixed to 5 (2 DRB+ 3SRB)
unsigned
short
rx_lengths
[
5
];
int
UE_id
=
0
;
int
BSR_index
=
0
;
int
DVI_index
=
0
;
int
PHR
=
0
;
int
ul_total_buffer
=
0
;
//mac_NB_IoT_t *mac_inst;
UE_TEMPLATE_NB_IoT
*
UE_info
;
//mac_inst = get_mac_inst(module_id);
// note: if lcid < 25 this is sdu, otherwise this is CE
payload_ptr
=
parse_ulsch_header_NB_IoT
(
sdu
,
&
num_ce
,
&
num_sdu
,
rx_ces
,
rx_lcids
,
rx_lengths
,
length
);
//printf("num_CE= %d, num_sdu= %d, rx_ces[0] = %d, rx_lcids = %d, rx_lengths[0] = %d, length = %d\n",num_ce,num_sdu,rx_ces[0],rx_lcids[0],rx_lengths[0],length);
for
(
i
=
0
;
i
<
num_ce
;
i
++
)
{
switch
(
rx_ces
[
i
])
{
case
CRNTI
:
// find UE id again, confirm the UE, intial some ue specific parameters
payload_ptr
+=
2
;
break
;
case
SHORT_BSR
:
// update BSR here
UE_info
=
get_ue_from_rnti
(
mac_inst
,
rnti
);
BSR_index
=
payload_ptr
[
0
]
&
0x3f
;
UE_info
->
ul_total_buffer
=
BSR_table
[
BSR_index
];
payload_ptr
+=
1
;
break
;
default:
printf
(
"Received unknown MAC header (0x%02x)
\n
"
,
rx_ces
[
i
]);
break
;
}
}
for
(
i
=
0
;
i
<
num_sdu
;
i
++
)
{
switch
(
rx_lcids
[
i
])
{
case
CCCH_NB_IoT
:
// MSG3 content: |R|R|PHR|PHR|DVI|DVI|DVI|DVI|CCCH payload
PHR
=
((
payload_ptr
[
0
]
>>
5
)
&
0x01
)
*
2
+
((
payload_ptr
[
0
]
>>
4
)
&
0x01
);
DVI_index
=
(
payload_ptr
[
0
]
>>
3
&
0x01
)
*
8
+
(
payload_ptr
[
0
]
>>
2
&
0x01
)
*
4
+
(
payload_ptr
[
0
]
>>
1
&
0x01
)
*
2
+
(
payload_ptr
[
0
]
>>
0
&
0x01
);
//printf("DVI_index= %d\n",DVI_index);
ul_total_buffer
=
DV_table
[
DVI_index
];
printf
(
"PHR = %d, ul_total_buffer = %d
\n
"
,
PHR
,
ul_total_buffer
);
// go to payload
payload_ptr
+=
1
;
rx_lengths
[
i
]
-=
1
;
printf
(
"rx_lengths : %d
\n
"
,
rx_lengths
[
i
]);
//NB_IoT_mac_rrc_data_ind(payload_ptr,mac_inst,rnti);
//NB_IoT_receive_msg3(mac_inst,rnti,PHR,ul_total_buffer);
break
;
case
DCCH0_NB_IoT
:
case
DCCH1_NB_IoT
:
// UE specific here
//NB_IoT_mac_rlc_data_ind(payload_ptr,mac_inst,rnti);
break
;
// all the DRBS
case
DTCH0_NB_IoT
:
default:
//NB_IoT_mac_rlc_data_ind(payload_ptr,mac_inst,rnti);
break
;
}
payload_ptr
+=
rx_lengths
[
i
];
}
}
\ No newline at end of file
openair2/LAYER2/MAC/extern_NB_IoT.h
View file @
50797cc9
...
...
@@ -119,13 +119,8 @@ extern const uint32_t MAC_TBStable_NB_IoT[14][8];
//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
DV_table
[
16
];
extern
const
int
BSR_table
[
64
];
extern
const
int
dl_rep
[
3
];
extern
const
uint32_t
dci_rep
[
3
];
...
...
openair2/LAYER2/MAC/proto_NB_IoT.h
View file @
50797cc9
...
...
@@ -174,10 +174,18 @@ int get_I_TBS_NB_IoT(int x,int y);
uint8_t
get_index_Rep_dl
(
uint16_t
R
);
UE_TEMPLATE_NB_IoT
*
get_ue_from_rnti
(
eNB_MAC_INST_NB_IoT
*
inst
,
rnti_t
rnti
);
//debug function
void
print_available_resource_DL
(
void
);
void
print_available_UL_resource
(
void
);
//interface with IF
uint8_t
*
parse_ulsch_header_NB_IoT
(
uint8_t
*
mac_header
,
uint8_t
*
num_ce
,
uint8_t
*
num_sdu
,
uint8_t
*
rx_ces
,
uint8_t
*
rx_lcids
,
uint16_t
*
rx_lengths
,
uint16_t
tb_length
);
void
rx_sdu_NB_IoT
(
module_id_t
module_id
,
int
CC_id
,
frame_t
frame
,
sub_frame_t
subframe
,
uint16_t
rnti
,
uint8_t
*
sdu
,
uint16_t
length
);
#endif
openair2/LAYER2/MAC/schedule_tool_NB_IoT.c
View file @
50797cc9
...
...
@@ -883,4 +883,17 @@ void print_available_UL_resource(void){
available_resource
=
available_resource
->
next
;
}
}
// maybe we can try to use hash table to enhance searching time.
UE_TEMPLATE_NB_IoT
*
get_ue_from_rnti
(
eNB_MAC_INST_NB_IoT
*
inst
,
rnti_t
rnti
){
uint32_t
i
;
for
(
i
=
0
;
i
<
MAX_NUMBER_OF_UE_MAX_NB_IoT
;
++
i
){
if
(
inst
->
UE_list_spec
->
UE_template_NB_IoT
[
i
].
active
==
1
){
if
(
inst
->
UE_list_spec
->
UE_template_NB_IoT
[
i
].
rnti
==
rnti
){
return
&
inst
->
UE_list_spec
->
UE_template_NB_IoT
[
i
];
}
}
}
return
(
UE_TEMPLATE_NB_IoT
*
)
0
;
}
\ No newline at end of file
openair2/LAYER2/MAC/vars_NB_IoT.h
View file @
50797cc9
...
...
@@ -102,13 +102,13 @@ const uint32_t MAC_TBStable_NB_IoT[14][8] ={ //[ITBS][ISF]
//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};
const
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,
const
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
};
...
...
openair2/PHY_INTERFACE/IF_Module_L2_primitives_NB_IoT.c
View file @
50797cc9
#include "IF_Module_L2_primitives_NB_IoT.h"
#include "LAYER2/MAC/proto_NB_IoT.h"
// Sched_INFO as a input for the scheduler
void
UL_indication
(
UL_IND_t
*
UL_INFO
)
{
int
i
=
0
;
UE_TEMPLATE_NB_IoT
*
UE_info
;
//mac_NB_IoT_t *mac_inst;
/
*If there is a preamble, do the initiate RA procedure*/
/
/If there is a preamble, do the initiate RA procedure
if
(
UL_INFO
->
NRACH
.
number_of_initial_scs_detected
>
0
)
{
for
(
i
=
0
;
i
<
UL_INFO
->
NRACH
.
number_of_initial_scs_detected
;
i
++
)
{
/*
initiate_ra_proc_NB_IoT(UL_INFO->module_id,
// initiate_ra here, some useful inforamtion :
//(UL_INFO->NRACH.nrach_pdu_list+i)->nrach_indication_rel13.initial_sc
//(UL_INFO->NRACH.nrach_pdu_list+i)->nrach_indication_rel13.timing_advance
/*init_RA_NB_IoT(UL_INFO->module_id,
UL_INFO->CC_id,
UL_INFO->frame,
(UL_INFO->NRACH.nrach_pdu_list+i)->nrach_indication_rel13.initial_sc,
...
...
@@ -19,28 +25,46 @@ void UL_indication(UL_IND_t *UL_INFO)
(UL_INFO->NRACH.nrach_pdu_list+i)->nrach_indication_rel13.timing_advance * 16,
UL_INFO->subframe
);*/
}
}
// crc indication if there is error for this round UL transmission
if
(
UL_INFO
->
crc_ind
.
number_of_crcs
>
0
)
{
for
(
i
=
0
;
i
<
UL_INFO
->
crc_ind
.
number_of_crcs
;
i
++
)
{
if
((
UL_INFO
->
crc_ind
.
crc_pdu_list
+
i
)
->
crc_indication_rel8
.
crc_flag
==
0
)
{
//unsuccessfully received this UE PDU
//UE_info = get_ue_from_rnti(mac_inst,((UL_INFO->crc_ind.crc_pdu_list)+i)->rx_ue_information.rnti);
UE_info
->
HARQ_round
++
;
}
}
}
/*If there is a Uplink SDU which needs to send to MAC*/
if
(
UL_INFO
->
RX_NPUSCH
.
number_of_pdus
>
0
)
{
/*If there is a Uplink SDU (even MSG3, NAK) need to send to MAC*/
for
(
i
=
0
;
i
<
UL_INFO
->
RX_NPUSCH
.
number_of_pdus
;
i
++
)
{
/*For MSG3, Normal Uplink Data, NAK
/*For MSG3, Normal Uplink Data, NAK
*/
rx_sdu_NB_IoT
(
UL_INFO
->
module_id
,
UL_INFO
->
CC_id
,
UL_INFO
->
frame
,
UL_INFO
->
subframe
,
(
UL_INFO
->
RX_NPUSCH
.
rx_pdu_list
+
i
)
->
rx_ue_information
.
rnti
,
(
UL_INFO
->
RX_NPUSCH
.
rx_pdu_list
+
i
)
->
data
,
(UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_indication_rel8.length,
(UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.harq_pid
);*/
(
UL_INFO
->
RX_NPUSCH
.
rx_pdu_list
+
i
)
->
rx_indication_rel8
.
length
);
}
}
//eNB_dlsch_ulsch_scheduler_NB_IoT(UL_INFO.module_id,0,UL_INFO.frame,UL_INFO.subframe); TODO: to be implemented
}
//scheduler here
printf
(
"Enter scheduler
\n
"
);
//eNB_dlsch_ulsch_scheduler_NB_IoT(mac_inst,abs_subframe);
}
\ 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