Commit c10d87dd authored by AlanLi's avatar AlanLi

fix sib23 transmission in MAC layer, need to check with PHY's timing

parent 27d7bdf4
......@@ -428,17 +428,21 @@ void rrc_mac_config_req_NB_IoT(
mac_config->sib1_NB_IoT_sched_config.starting_rf = *(sib1_NB_IoT->si_RadioFrameOffset_r13);
mac_config->si_window_length = sib1_NB_IoT->si_WindowLength_r13;
//mac_config->sib1_NB_IoT_sched_config.starting_rf = *(sib1_NB_IoT->si_RadioFrameOffset_r13);
mac_config->sib1_NB_IoT_sched_config.starting_rf = 2;
mac_config->si_window_length = ms160;
///OAI only supports SIB2/3-NB for the sibs
mac_config->sibs_NB_IoT_sched[0].si_periodicity = si_Periodicity_rf4096 ;
mac_config->sibs_NB_IoT_sched[0].si_periodicity = si_Periodicity_rf64 ;
mac_config->sibs_NB_IoT_sched[0].si_repetition_pattern = si_RepetitionPattern_every2ndRF;
mac_config->sibs_NB_IoT_sched[0].sib_mapping_info = sib3_v;
mac_config->sibs_NB_IoT_sched[0].si_tb = si_TB_680;
LOG_I(MAC,"si_periodicity:%d, siw: %d, start rf: %d\n",mac_config->sibs_NB_IoT_sched[0].si_periodicity, mac_config->si_window_length,mac_config->sib1_NB_IoT_sched_config.starting_rf);
/*
/// Thiese value is setting for different SIB set
if ( sib1_NB_IoT->schedulingInfoList_r13.list.array[1] != NULL) {
......@@ -500,6 +504,10 @@ void rrc_mac_config_req_NB_IoT(
mac_config->mac_NPRACH_ConfigSIB[0].mac_npdcch_NumRepetitions_RA_NB_IoT = nprach_parameter->npdcch_NumRepetitions_RA_r13;
mac_config->mac_NPRACH_ConfigSIB[0].mac_npdcch_StartSF_CSS_RA_NB_IoT = nprach_parameter->npdcch_StartSF_CSS_RA_r13;
mac_config->mac_NPRACH_ConfigSIB[0].mac_npdcch_Offset_RA_NB_IoT = nprach_parameter->npdcch_Offset_RA_r13;
mac_inst->npdcch_config_common[0].R_max = rmax[nprach_parameter->npdcch_NumRepetitions_RA_r13];
mac_inst->npdcch_config_common[0].G = gvalue[nprach_parameter->npdcch_StartSF_CSS_RA_r13];
mac_inst->npdcch_config_common[0].a_offset = pdcchoffset[nprach_parameter->npdcch_Offset_RA_r13];
LOG_I(MAC,"NPRACH 0 setting: Rmax: %ld G: %lf a: %lf\n",mac_inst->npdcch_config_common[0].R_max,mac_inst->npdcch_config_common[0].G,mac_inst->npdcch_config_common[0].a_offset);
}
///CE level 1
......@@ -510,6 +518,10 @@ void rrc_mac_config_req_NB_IoT(
mac_config->mac_NPRACH_ConfigSIB[1].mac_npdcch_NumRepetitions_RA_NB_IoT = nprach_parameter->npdcch_NumRepetitions_RA_r13;
mac_config->mac_NPRACH_ConfigSIB[1].mac_npdcch_StartSF_CSS_RA_NB_IoT = nprach_parameter->npdcch_StartSF_CSS_RA_r13;
mac_config->mac_NPRACH_ConfigSIB[1].mac_npdcch_Offset_RA_NB_IoT = nprach_parameter->npdcch_Offset_RA_r13;
mac_inst->npdcch_config_common[1].R_max = rmax[nprach_parameter->npdcch_NumRepetitions_RA_r13];
mac_inst->npdcch_config_common[1].G = gvalue[nprach_parameter->npdcch_StartSF_CSS_RA_r13];
mac_inst->npdcch_config_common[1].a_offset = pdcchoffset[nprach_parameter->npdcch_Offset_RA_r13];
LOG_I(MAC,"NPRACH 1 setting: Rmax: %ld G: %lf a: %lf\n",mac_inst->npdcch_config_common[1].R_max,mac_inst->npdcch_config_common[1].G,mac_inst->npdcch_config_common[1].a_offset);
}
///CE level 2
if ( radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[2] != NULL) {
......@@ -519,6 +531,10 @@ void rrc_mac_config_req_NB_IoT(
mac_config->mac_NPRACH_ConfigSIB[2].mac_npdcch_NumRepetitions_RA_NB_IoT = nprach_parameter->npdcch_NumRepetitions_RA_r13;
mac_config->mac_NPRACH_ConfigSIB[2].mac_npdcch_StartSF_CSS_RA_NB_IoT = nprach_parameter->npdcch_StartSF_CSS_RA_r13;
mac_config->mac_NPRACH_ConfigSIB[2].mac_npdcch_Offset_RA_NB_IoT = nprach_parameter->npdcch_Offset_RA_r13;
mac_inst->npdcch_config_common[2].R_max = rmax[nprach_parameter->npdcch_NumRepetitions_RA_r13];
mac_inst->npdcch_config_common[2].G = gvalue[nprach_parameter->npdcch_StartSF_CSS_RA_r13];
mac_inst->npdcch_config_common[2].a_offset = pdcchoffset[nprach_parameter->npdcch_Offset_RA_r13];
LOG_I(MAC,"NPRACH 2 setting: Rmax: %ld G: %lf a: %lf\n",mac_inst->npdcch_config_common[2].R_max,mac_inst->npdcch_config_common[2].G,mac_inst->npdcch_config_common[2].a_offset);
}
......@@ -584,16 +600,17 @@ void rrc_mac_config_req_NB_IoT(
LOG_I(MAC,"[NB-IoT] Init_MAC done\n");
/*
//for sacheduler testing
/*for(int i =0;i<30;i++)
for(int i =0;i<30;i++)
{
LOG_I(MAC,"[NB-IoT] scheduler testing start %d\n",i);
eNB_dlsch_ulsch_scheduler_NB_IoT(RC.nb_iot_mac[Mod_idP], i);
eNB_dlsch_ulsch_scheduler_NB_IoT(mac_inst, i);
LOG_I(MAC,"[NB-IoT] scheduler testing done %d\n",i);
}*/
}
*/
// RC.L1_NB_IoT[Mod_idP]->configured=1;
......
......@@ -44,13 +44,14 @@
#include "config_NB_IoT.h"
// MAC definition
#define MAX_FRAME 0xfffff
#define NUM_FRAME 0x100000
#define MAX_SUBFRAME 10485760
#define MAX_FRAME 0xfff
#define MAX_SUBFRAME 40960
#define MAX(a, b) (((a)>(b))?(a):(b))
// RNTI
//#define P_RNTI 0xffee
//#define SI_RNTI 0xffff
// RA-RNTI: 1+SFN_id>>2
#define RA_RNTI_LOW 0x0001 // SFN_id = 0
#define RA_RNTI_HIGH 0x0100 // SFN_id = 1023
......@@ -130,7 +131,6 @@ typedef enum{
#define BCCH1_NB_IoT 12 // SI-SIB-NB_IoTs
/*!\brief Values of PCCH logical channel */
#define PCCH_NB_IoT 13 // Paging XXX not used for the moment
#define MCCH_NB_IoT 14
/*!\brief Value of CCCH / SRB0 logical channel */
#define CCCH_NB_IoT 0 // srb0 ---> XXX exactly the same as in LTE (commented for compilation purposes)
/*!\brief DCCH0 / SRB1bis logical channel */
......@@ -231,11 +231,109 @@ typedef struct {
int prev;
// MSG4 complete
int RRC_connected;
uint8_t flag_schedule_success;
// UE active flag
boolean_t active;
uint8_t allocated_data_size_ul;
} UE_TEMPLATE_NB_IoT;
typedef struct available_resource_UL_s{
///Resource start subframe
uint32_t start_subframe;
///Resource end subframe
uint32_t end_subframe;
// pointer to next node
struct available_resource_UL_s *next, *prev;
}available_resource_UL_t;
typedef struct available_resource_DL_s{
uint32_t start_subframe;
uint32_t end_subframe;
//uint32_t DLSF_num;
struct available_resource_DL_s *next, *prev;
}available_resource_DL_t;
/*Structure used for scheduling*/
typedef struct{
//resource position info.
uint32_t sf_end,sf_start;
//resource position info. separate by HyperSF, Frame, Subframe
uint32_t start_h, end_h;
uint32_t start_f, end_f;
uint32_t start_sf, end_sf;
//whcih available resource node is used
available_resource_DL_t *node;
}sched_temp_DL_NB_IoT_t;
/*Structure used for UL scheduling*/
typedef struct{
//resource position info.
uint32_t sf_end, sf_start;
//resource position info. separate by HyperSF, Frame, Subframe
//uint32_t start_h, end_h;
//uint32_t start_f, end_f;
//uint32_t start_sf, end_sf;
// information for allocating the resource
int tone;
int scheduling_delay;
int subcarrier_indication;
int ACK_NACK_resource_field;
available_resource_UL_t *node;
}sched_temp_UL_NB_IoT_t;
/******Update******/
/*** the value of variable in this structure is able to be changed in Preprocessor**/
typedef struct{
uint16_t TBS;
uint8_t index_tbs;
uint32_t total_sdu_size;
//Repetition
uint16_t R_dci;
uint16_t R_dl_data;
uint16_t R_dl_harq;
uint16_t R_ul_data;
//DL relative
uint8_t dci_n1_index_R_dci;
uint8_t dci_n1_index_R_data;
uint8_t dci_n1_index_mcs;
uint8_t dci_n1_index_sf;
uint8_t dci_n1_index_delay;
uint8_t dci_n1_index_ack_nack;
uint32_t dci_n1_n_sf;
//UL relative
uint8_t dci_n0_index_R_dci;
uint8_t dci_n0_index_R_data;
uint8_t dci_n0_index_mcs;
uint8_t dci_n0_index_ru;
uint8_t dci_n0_index_delay;
uint8_t dci_n0_index_subcarrier;
uint32_t dci_n0_n_ru;
uint8_t dci_n0_index_rv;
uint8_t dci_n0_index_ndi;
// byte
uint16_t total_data_size_dl;
// byte
uint16_t total_data_size_ul;
//0:UL 1:DL 2:both
uint16_t transmit_direction;
/*resource allocation*/
// scheduling result for NPDCCH
uint32_t NPDCCH_sf_end, NPDCCH_sf_start;
// scheduling result for USS DL
uint32_t NPDSCH_sf_end, NPDSCH_sf_start;
uint32_t HARQ_sf_end, HARQ_sf_start;
// scheduling result for USS UL
uint32_t NPUSCH_sf_end, NPUSCH_sf_start;
// schedule success 1 failure 0
uint8_t flag_schedule_success;
}UE_SCHED_CTRL_NB_IoT_t;
/*36331 NPDCCH-ConfigDedicated-NB_IoT*/
typedef struct{
//npdcch-NumRepetitions-r13
......@@ -257,6 +355,8 @@ typedef struct {
/// DCI template and MAC connection parameters for UEs
UE_TEMPLATE_NB_IoT UE_template_NB_IoT[MAX_NUMBER_OF_UE_MAX_NB_IoT];
UE_SCHED_CTRL_NB_IoT_t UE_sched_ctrl_NB_IoT[MAX_NUMBER_OF_UE_MAX_NB_IoT];
/// NPDCCH Period and searching space info
NPDCCH_config_dedicated_NB_IoT_t NPDCCH_config_dedicated;
//int next[MAX_NUMBER_OF_UE_MAX_NB_IoT];
......@@ -295,36 +395,6 @@ typedef struct{
}scheduling_flag_t;
typedef struct available_resource_UL_s{
///Resource start subframe
uint32_t start_subframe;
///Resource end subframe
uint32_t end_subframe;
// pointer to next node
struct available_resource_UL_s *next, *prev;
}available_resource_UL_t;
typedef struct available_resource_DL_s{
uint32_t start_subframe;
uint32_t end_subframe;
struct available_resource_DL_s *next, *prev;
}available_resource_DL_t;
/*Structure used for scheduling*/
typedef struct{
//resource position info.
uint32_t sf_end,sf_start;
//resource position info. separate by HyperSF, Frame, Subframe
uint32_t start_h, end_h;
uint32_t start_f, end_f;
uint32_t start_sf, end_sf;
//whcih available resource node is used
available_resource_DL_t *node;
}sched_temp_DL_NB_IoT_t;
/*!\brief MAC subheader short with 7bit Length field */
typedef struct {
uint8_t LCID:5; // octet 1 LSB
......@@ -377,21 +447,6 @@ typedef struct {
uint8_t E:1;
} __attribute__((__packed__))RA_HEADER_RAPID_NB_IoT;
/*Structure used for UL scheduling*/
typedef struct{
//resource position info.
uint32_t sf_end, sf_start;
//resource position info. separate by HyperSF, Frame, Subframe
//uint32_t start_h, end_h;
//uint32_t start_f, end_f;
//uint32_t start_sf, end_sf;
// information for allocating the resource
int tone;
int scheduling_delay;
int subcarrier_indication;
int ACK_NACK_resource_field;
available_resource_UL_t *node;
}sched_temp_UL_NB_IoT_t;
typedef struct Available_available_resource_DL{
......@@ -443,6 +498,14 @@ typedef struct schedule_result{
uint8_t *rar_buffer;
int16_t dl_sdly;
int16_t ul_sdly;
int16_t num_sf;
//-----clare
int16_t harq_round;
//-----clare
}schedule_result_t;
/*Flag structure used for trigger each scheduler*/
......@@ -495,8 +558,23 @@ typedef struct RA_template_list_s{
}RA_template_list_t;
/*36331 NPDCCH-ConfigDedicated-NB_IoT*/
typedef struct{
//npdcch-NumRepetitions-r13
uint32_t R_max;
//npdcch-StartSF-CSS-r13
double G;
//npdcch-Offset-USS-r13
double a_offset;
//NPDCCH period
uint32_t T;
//Starting subfrane of Search Space which is mod T
uint32_t ss_start_css;
}NPDCCH_config_common_NB_IoT_t;
/*! \brief top level eNB MAC structure */
typedef struct {
typedef struct mac_NB_IoT_s{
uint8_t Mod_id;
......@@ -533,7 +611,8 @@ typedef struct {
scheduling_flag_t scheduling_flag;
uint32_t schedule_subframe_DL;
uint32_t schedule_subframe_UL;
//uint32_t schedule_subframe_UL;
NPDCCH_config_common_NB_IoT_t npdcch_config_common[3];
rrc_config_NB_IoT_t rrc_config;
......
This diff is collapsed.
......@@ -113,8 +113,6 @@ void schedule_rar_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe){
int fail_num = 0;
int flag=0;
while((RA_TEMPLATE_NB_IoT *)0 != msg2_nodes){
if(flag==0)
flag=1;
fail=0;
rmax = mac_inst->rrc_config.mac_NPRACH_ConfigSIB[msg2_nodes->ce_level].mac_npdcch_NumRepetitions_RA_NB_IoT;//32;
num_candidate = 8;//rmax / r;
......@@ -227,6 +225,11 @@ void schedule_rar_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe){
dci_result->R_harq = 0;
dci_result->next = (schedule_result_t *)0;
dci_result->DCI_pdu = (void *)dci_n1_rar;
//----------clare
dci_result->dl_sdly = msg2_subframe - dci_end_subframe;
dci_result->ul_sdly = msg3_subframe - msg2_end_subframe;
dci_result->num_sf = msg2_end_subframe - msg2_subframe+1;
//----------clare
// for msg2
msg2_result->output_subframe = msg2_first_subframe;//msg2_subframe;
msg2_result->end_subframe = msg2_end_subframe;
......@@ -242,6 +245,10 @@ void schedule_rar_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe){
msg2_result->next = (schedule_result_t *)0;
msg2_result->DCI_pdu = (void *)dci_n1_rar;
msg2_result->rar_buffer = msg2_nodes->rar_buffer;
//----------clare
msg2_result->dl_sdly = -1;
msg2_result->ul_sdly = -1;
//----------clare
// for msg3(fake DCI N0)
dci_n0->type = 0;
......@@ -542,6 +549,12 @@ void schedule_msg3_retransimission_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs
dci_result->R_harq = 0;
dci_result->next = (schedule_result_t *)0;
dci_result->DCI_pdu = (void *)dci_n0_msg3;
//----------clare
dci_result->dl_sdly = msg3_subframe - dci_end_subframe + 1;
dci_result->ul_sdly = -1;
dci_result->num_sf = -1;
dci_result->harq_round = msg3_nodes->msg3_retransmit_count;
//----------clare
// fill dci resource
fill_resource_DL(mac_inst, dci_node, dci_first_subframe, dci_end_subframe, dci_result);
......@@ -632,7 +645,7 @@ void schedule_msg4_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe){
available_resource_DL_t *dci_node, *msg4_node;
int rmax, fail, r;
int dci_subframe, dci_end_subframe, dci_first_subframe, num_dci_subframe;
int msg4_subframe, msg4_end_subframe, msg4_first_subframe, num_msg4_subframe;
int msg4_subframe = 0, msg4_end_subframe, msg4_first_subframe, num_msg4_subframe;
int harq_subframe, harq_end_subframe;
int dci_candidate, num_candidate;
......@@ -776,6 +789,12 @@ void schedule_msg4_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe){
dci_result->R_harq = 0;
dci_result->next = (schedule_result_t *)0;
dci_result->DCI_pdu = (void *)dci_n1_msg4;
//-------clare
dci_result->dl_sdly = msg4_subframe - dci_end_subframe;
dci_result->ul_sdly = harq_subframe - msg4_end_subframe;
dci_result->num_sf = msg4_end_subframe - msg4_subframe+1;
dci_result->harq_round = msg4_nodes->msg4_retransmit_count;
//-------clare
// for msg4
msg4_result = (schedule_result_t *)malloc(sizeof(schedule_result_t));
......@@ -805,6 +824,7 @@ void schedule_msg4_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe){
harq_result->channel = NPUSCH;
harq_result->next = (schedule_result_t *)0;
LOG_D(MAC,"[%04d][RA scheduler][MSG4] UE:%x MSG4DCI %d-%d MSG4 %d-%d HARQ %d-%d\n", abs_subframe-1, msg4_nodes->ue_rnti, dci_first_subframe, dci_end_subframe, msg4_first_subframe, msg4_end_subframe, HARQ_info.sf_start, HARQ_info.sf_end);
LOG_D(MAC,"[%04d][RA scheduler][MSG4][CE%d] MSG4 DCI %d-%d MSG4 %d-%d HARQ %d-%d\n", abs_subframe-1, msg4_nodes->ce_level, dci_first_subframe, dci_end_subframe, msg4_first_subframe, msg4_end_subframe, HARQ_info.sf_start, HARQ_info.sf_end);
msg4_nodes->msg4_retransmit_count++;
......
......@@ -27,8 +27,10 @@ void schedule_sibs(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t sibs_order, int start
schedule_result_t *new_node;
DCIFormatN1_t *sibs_dci;
uint32_t j, i, k;
uint8_t SIB23_size = 0;
uint8_t *SIB23_pdu = get_NB_IoT_SIB23();
//------clare
//uint8_t SIB23_size = 0;
//uint8_t *SIB23_pdu = get_NB_IoT_SIB23();
//------clare
int residual_subframe, num_subframe, last_subframe;
num_subframe = mac_inst->rrc_config.sibs_NB_IoT_sched[sibs_order].si_tb;
......@@ -75,15 +77,17 @@ void schedule_sibs(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t sibs_order, int start
sibs_dci->DCIRep = 0;
for(k=0, j=start_subframe1;j<=i;++k, j+=si_repetition_pattern[mac_inst->rrc_config.sibs_NB_IoT_sched[sibs_order].si_repetition_pattern]){
LOG_D(MAC,"for1 k=%d j=%d i=%d rep=%d\n", k, j, i, si_repetition_pattern[mac_inst->rrc_config.sibs_NB_IoT_sched[sibs_order].si_repetition_pattern]);
LOG_D(MAC,"for1 k=%d j=%d i=%d rep=%d\n", k, j, i, si_repetition_pattern[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
SIB23_size = get_NB_IoT_SIB23_size();
//SIB23_size = get_NB_IoT_SIB23_size();
new_node->output_subframe = first_subframe[k];
new_node->end_subframe = (j==i)?last_subframe:j+9;
new_node->sdu_length = SIB23_size;
new_node->DLSCH_pdu = SIB23_pdu;
//------clare
new_node->sdu_length = 0;
//new_node->DLSCH_pdu = SIB23_pdu;
//------clare
new_node->direction = DL;
new_node->DCI_release = (j==i);
new_node->channel = NPDSCH;
......@@ -94,11 +98,11 @@ LOG_D(MAC,"for1 k=%d j=%d i=%d rep=%d\n", k, j, i, si_repetition_pattern[mac_ins
new_node->next = (schedule_result_t *)0;
new_node->DCI_pdu = (void *)sibs_dci;
//new_node->debug_str = str[sibs_order];
LOG_D(MAC,"for*1 %d %d %d %p\n", pt[k]->start_subframe, first_subframe[k], (j==i)?last_subframe:j+9, new_node);
LOG_D(MAC,"for*1 %d %d %d %p\n", pt[k]->start_subframe, first_subframe[k], (j==i)?last_subframe:j+9, new_node);
fill_resource_DL(mac_inst, pt[k], first_subframe[k], (j==i)?last_subframe:j+9, new_node);
LOG_D(MAC,"for*2\n");
LOG_D(MAC,"for*2\n");
}
LOG_D(MAC,"for2\n");
LOG_D(MAC,"for2\n");
}
return ;
......
......@@ -105,6 +105,11 @@ extern const int rachstart[8];
extern const int rachrepeat[8];
extern const int rachscofst[7];
extern const int rachnumsc[4];
extern const int rmax[12];
extern const double gvalue[8];
extern const double pdcchoffset[4];
extern const uint32_t RU_table[8];
......
......@@ -57,10 +57,11 @@ void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst)
mac_inst->sib1_flag[i] = 0;
mac_inst->sib1_count[i] = 0;
}
//rrc_mac_config_req_NB_IoT(&mac_inst->rrc_config, 1, 1, 0, 0);
init_tool_sib1(mac_inst);
// output handler
// RA
mac_inst->RA_msg2_list.head = (RA_TEMPLATE_NB_IoT *)0;
mac_inst->RA_msg3_list.head = (RA_TEMPLATE_NB_IoT *)0;
......@@ -86,25 +87,25 @@ void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst)
}
mac_inst->sib1_count[i]=j;
}
//LOG_D(MAC,"%d", mac_inst->sib1_period);
//printf("%d", mac_inst->sib1_period);
for(i=0, j=0;i<640;++i){
//LOG_D(MAC,"*%d", i);
//printf("*%d", i);
if(is_dlsf(mac_inst, i)){
++j;
}
//LOG_D(MAC,"-");
//printf("-");
if(i%10==9){
mac_inst->dlsf_table[i/10] = j;
}
}
mac_inst->rrc_config.si_window_length = ms160;
mac_inst->rrc_config.sibs_NB_IoT_sched[0].si_periodicity = rf64;
mac_inst->rrc_config.si_radio_frame_offset = 1;
for(i=0;i<256;++i){
mac_inst->sibs_table[i] = -1;
}
mac_inst->rrc_config.si_window_length = ms160;
mac_inst->rrc_config.sibs_NB_IoT_sched[0].si_periodicity = rf64;
// mac_inst->rrc_config.si_radio_frame_offset = 1;
for(j=0;j<6;++j){
if(0x0 != mac_inst->rrc_config.sibs_NB_IoT_sched[j].sib_mapping_info){
k = mac_inst->rrc_config.sibs_NB_IoT_sched[j].si_periodicity / mac_inst->rrc_config.si_window_length;
......@@ -115,7 +116,7 @@ void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst)
}
mac_inst->schedule_subframe_DL = 0;
mac_inst->schedule_subframe_UL = 0;
//mac_inst->schedule_subframe_UL = 0;
available_resource_DL = available_resource_DL_last = (available_resource_DL_t *)0;
......@@ -135,36 +136,7 @@ void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst)
mac_inst->RA_template[i].wait_msg4_ack = 0;
mac_inst->RA_template[i].wait_msg3_ack = 0;
}
//3 CE level USS list
mac_inst->UE_list_spec = (UE_list_NB_IoT_t*)malloc(NUM_USS_PP*sizeof(UE_list_NB_IoT_t));
//initial UE list
LOG_I(MAC,"[NB-IoT] Initial UE list\n");
mac_inst->num_uss_list = NUM_USS_PP;
for(i=0;i<NUM_USS_PP;++i)
{
rrc_mac_config_req_NB_IoT(0,0,0,NULL,NULL,NULL,NULL,NULL,1,i);
(mac_inst->UE_list_spec+i)->head = -1;
(mac_inst->UE_list_spec+i)->tail = -1;
(mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.R_max = mac_inst->rrc_config.npdcch_ConfigDedicated[i].R_max;
(mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.G = mac_inst->rrc_config.npdcch_ConfigDedicated[i].G;
(mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.a_offset = mac_inst->rrc_config.npdcch_ConfigDedicated[i].a_offset;
//(mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.R_max = 8;
//(mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.G = 1;
//(mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.a_offset = 0;
(mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.T = (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.R_max * (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.G;
(mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.ss_start_uss = (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.T * (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.a_offset;
for(j=0;j<MAX_NUMBER_OF_UE_MAX_NB_IoT;++j)
{
(mac_inst->UE_list_spec+i)->UE_template_NB_IoT[j].active=0;
(mac_inst->UE_list_spec+i)->UE_template_NB_IoT[j].RRC_connected=0;
(mac_inst->UE_list_spec+i)->UE_template_NB_IoT[j].direction = -1;
}
//SCHEDULE_LOG("[%04d][init_mac_NB_IoT] List_number %d R_max %d G %.1f a_offset %.1f T %d SS_start %d\n", mac_inst->current_subframe, i, (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.R_max, (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.G, (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.a_offset, (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.T, (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.ss_start_uss);
LOG_I(MAC,"[NB-IoT] List_number %d R_max %d G %.1f a_offset %.1f T %d SS_start %d\n", i, (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.R_max, (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.G, (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.a_offset, (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.T, (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.ss_start_uss);
}
//UL initial
//Setting nprach configuration
......@@ -172,7 +144,7 @@ void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst)
//Initialize uplink resource from nprach configuration
Initialize_Resource();
//add_UL_Resource(mac_inst);
extend_available_resource_DL(mac_inst, mac_inst->current_subframe + 1 + mac_inst->rrc_config.si_window_length);
extend_available_resource_DL(mac_inst, mac_inst->current_subframe + 1 + 160);
}
......
......@@ -115,7 +115,8 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
//LOG_I(MAC,"NB-IoT fill MIB\n");
//dl_scheduled(mac_inst->current_subframe, _NPBCH, 0, "MIB");
}
else if((subframe == 4) && (frame%2==0) && (frame%32<16) /*SIB1_flag == 1*/) // TODO back to SIB1_flag
else if(SIB1_flag==1)
//else if((subframe == 4) && (frame%2==0) && (frame%32<16) /*SIB1_flag == 1*/) // TODO back to SIB1_flag
{
uint8_t *SIB1_pdu = get_NB_IoT_SIB1(0,0,carrier,208,92,1,3584,28,2,subframe,frame,hypersfn);
//SIB1_size = mac_rrc_data_req_eNB_NB_IoT(*SIB1);
......@@ -140,7 +141,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
//LOG_D(MAC,"A NB-IoT SIB1 pdu : %d \n",SIB1_pdu);
SCHED_info->TX_req->tx_request_body.tx_pdu_list[dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.pdu_index].segments[0].segment_data = SIB1_pdu;
LOG_D(MAC,"NB-IoT fill SIB1\n");
LOG_I(MAC,"NB-IoT fill SIB1\n");
//LOG_I(MAC,"NB-IoT fill SIB1\n");
//start symbol, Resource assignment, Repetition number, Number of subframe Resource assignment lost for now
//dl_scheduled(mac_inst->current_subframe, _NPDSCH, SI_RNTI, "SIB1");
......@@ -227,6 +228,8 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
break;
case NPDSCH:
LOG_D(MAC,"NB-IoT fill DL Data\n");
if(schedule_result_list_DL->rnti==SI_RNTI)
LOG_I(MAC,"NB-IoT fill SIB23\n");
//LOG_I(MAC,"NB-IoT fill DL Data\n");
//SCHED_info->DL_req = (nfapi_dl_config_request_t*) malloc (sizeof(nfapi_dl_config_request_t));
//SCHED_info->DL_req->dl_config_request_body.number_pdu = 0;
......
......@@ -145,7 +145,8 @@ void print_available_UL_resource(void);
/*set nprach configuration at intial time*/
void setting_nprach(void);
/*Uplink main scheduler*/
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);
//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);
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, UE_SCHED_CTRL_NB_IoT_t *UE_sched_info);
/*Check available uplink resource list, if there is available uplink resource, return 0, otherwise, return 1*/
int Check_UL_resource(uint32_t DL_end, int total_ru, sched_temp_UL_NB_IoT_t *NPUSCH_info, int multi_tone, int fmt2_flag);
/*Get I Repetition number in DCI*/
......@@ -177,7 +178,7 @@ int get_resource_field_value(int subcarrier, int k0);
uint8_t get_index_Rep_dl(uint16_t R);
/*******DL Scheduler********/
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);
//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 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);
......@@ -188,8 +189,9 @@ uint32_t get_num_sf(uint32_t I_sf);
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);
//void generate_scheduling_result_DL(uint32_t DCI_subframe, uint32_t NPDSCH_subframe, uint32_t HARQ_subframe, DCIFormatN1_t *DCI, rnti_t rnti, uint32_t TBS, uint8_t *DLSCH_pdu);
void generate_scheduling_result_DL(sched_temp_DL_NB_IoT_t* DCI_info, sched_temp_DL_NB_IoT_t* NPDSCH_info, sched_temp_UL_NB_IoT_t* HARQ_info, DCIFormatN1_t *DCI_inst, rnti_t rnti, uint32_t TBS, uint8_t *DLSCH_pdu);
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);
//void generate_scheduling_result_DL(sched_temp_DL_NB_IoT_t* DCI_info, sched_temp_DL_NB_IoT_t* NPDSCH_info, sched_temp_UL_NB_IoT_t* HARQ_info, DCIFormatN1_t *DCI_inst, rnti_t rnti, uint32_t TBS, uint8_t *DLSCH_pdu);
void generate_scheduling_result_DL(uint32_t NPDCCH_sf_end, uint32_t NPDCCH_sf_start, uint32_t NPDSCH_sf_end, uint32_t NPDSCH_sf_start, uint32_t HARQ_sf_end, uint32_t HARQ_sf_start, DCIFormatN1_t *DCI_pdu, rnti_t rnti, uint32_t TBS, uint8_t *DLSCH_pdu);
//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);
//Transfrom source into hyperSF, Frame, Subframe format
void convert_system_number(uint32_t source_sf,uint32_t *hyperSF, uint32_t *frame, uint32_t *subframe);
//Trnasform hyperSF, Frame, Subframe format into subframe unit
......@@ -221,4 +223,13 @@ uint32_t from_earfcn_NB_IoT(int eutra_bandP,uint32_t dl_earfcn, float m_dl);
int32_t get_uldl_offset_NB_IoT(int eutra_band);
/***Preprocessor***/
void preprocessor_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 UE_list_index);
void sort_UEs_uss(void);
int 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, UE_SCHED_CTRL_NB_IoT_t *UE_sched_ctrl_info);
void fill_DCI_N0(DCIFormatN0_t *DCI_N0, UE_TEMPLATE_NB_IoT *UE_info, UE_SCHED_CTRL_NB_IoT_t *UE_sched_ctrl_info);
void fill_DCI_N1(DCIFormatN1_t *DCI_N1, UE_TEMPLATE_NB_IoT *UE_info, UE_SCHED_CTRL_NB_IoT_t *UE_sched_ctrl_info);
void USS_scheduling_module(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t abs_subframe, uint8_t number_UE_list);
#endif
This diff is collapsed.
......@@ -464,7 +464,7 @@ int8_t mac_rrc_data_req_NB_IoT(
return (Sdu_size);
}
/*
#if defined(Rel10) || defined(Rel14)
if((Srb_id & RAB_OFFSET) == MCCH_NB_IoT) {
......@@ -520,6 +520,8 @@ int8_t mac_rrc_data_req_NB_IoT(
}
#endif //Rel10 || Rel14
*/
} else { //This is an UE
LOG_D(RRC,"[UE %d] Frame %d Filling CCCH SRB_ID %d\n",Mod_idP,frameP,Srb_id);
......
......@@ -662,6 +662,7 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam
eNB->UL_INFO.subframe = proc->subframe_rx;
eNB->UL_INFO.module_id = eNB->Mod_id;
eNB->UL_INFO.CC_id = eNB->CC_id;
eNB->UL_INFO.hypersfn = proc->HFN;
eNB->if_inst->UL_indication(&eNB->UL_INFO);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment