Commit aa9e906b authored by Nick Ho's avatar Nick Ho

scheduler test with USRP

parent 96e4e6f4
...@@ -428,7 +428,7 @@ void rrc_mac_config_req_NB_IoT( ...@@ -428,7 +428,7 @@ void rrc_mac_config_req_NB_IoT(
mac_config->sib1_NB_IoT_sched_config.starting_rf = (intptr_t)(sib1_NB_IoT->si_RadioFrameOffset_r13); 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->si_window_length = sib1_NB_IoT->si_WindowLength_r13;
...@@ -580,7 +580,7 @@ void rrc_mac_config_req_NB_IoT( ...@@ -580,7 +580,7 @@ void rrc_mac_config_req_NB_IoT(
//return 0; //return 0;
//init_mac_NB_IoT(mac_inst); init_mac_NB_IoT(mac_inst);
LOG_I(MAC,"[NB-IoT] Init_MAC done\n"); LOG_I(MAC,"[NB-IoT] Init_MAC done\n");
......
...@@ -23,11 +23,13 @@ ...@@ -23,11 +23,13 @@
#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h" #include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"
#include "config_NB_IoT.h" #include "config_NB_IoT.h"
#define sim_end_time 100000
// MAC definition // MAC definition
#define MAX_FRAME 0xfffff #define MAX_FRAME 0xfffff
#define MAX(a, b) ((a>b)?a:b) #define NUM_FRAME 0x100000
#define MAX_SUBFRAME 10485760
#define MAX(a, b) (((a)>(b))?(a):(b))
// RA-RNTI: 1+SFN_id>>2 // RA-RNTI: 1+SFN_id>>2
#define RA_RNTI_LOW 0x0001 // SFN_id = 0 #define RA_RNTI_LOW 0x0001 // SFN_id = 0
...@@ -287,7 +289,6 @@ typedef struct available_resource_UL_s{ ...@@ -287,7 +289,6 @@ typedef struct available_resource_UL_s{
typedef struct available_resource_DL_s{ typedef struct available_resource_DL_s{
uint32_t start_subframe; uint32_t start_subframe;
uint32_t end_subframe; uint32_t end_subframe;
uint32_t DLSF_num;
struct available_resource_DL_s *next, *prev; struct available_resource_DL_s *next, *prev;
}available_resource_DL_t; }available_resource_DL_t;
...@@ -422,8 +423,6 @@ typedef struct schedule_result{ ...@@ -422,8 +423,6 @@ typedef struct schedule_result{
uint8_t *rar_buffer; uint8_t *rar_buffer;
uint8_t *debug_str;
}schedule_result_t; }schedule_result_t;
/*Flag structure used for trigger each scheduler*/ /*Flag structure used for trigger each scheduler*/
......
This diff is collapsed.
...@@ -12,31 +12,55 @@ ...@@ -12,31 +12,55 @@
#include "proto_NB_IoT.h" #include "proto_NB_IoT.h"
#include "extern_NB_IoT.h" #include "extern_NB_IoT.h"
unsigned char str[6][7] = { "SIBs_1", "SIBs_2", "SIBs_3", "SIBs_4", "SIBs_5", "SIBs_6" };
unsigned char si_repetition_pattern_table[4] = { 20, 40, 80, 160};
void schedule_sibs_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t sibs_order, int start_subframe1){ char str[6][7] = { "SIBs_1", "SIBs_2", "SIBs_3", "SIBs_4", "SIBs_5", "SIBs_6" };
#define num_flags 2
extern int extend_space[num_flags];
extern int extend_alpha_offset[num_flags];
void schedule_sibs(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 }; available_resource_DL_t *pt[8] = { (available_resource_DL_t *)0 };
uint32_t first_subframe[8] = { -1 }; int first_subframe[8] = { -1 };
//uint32_t end_subframe[8] = { -1 }; //uint32_t end_subframe[8] = { -1 };
schedule_result_t *new_node; schedule_result_t *new_node;
DCIFormatN1_t *sibs_dci; DCIFormatN1_t *sibs_dci;
uint32_t j, i, k, num_subframe, last_subframe, residual_subframe; uint32_t j, i, k;
int residual_subframe, num_subframe, last_subframe;
num_subframe = mac_inst->rrc_config.sibs_NB_IoT_sched[sibs_order].si_tb; 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+=si_repetition_pattern_table[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]); int rmax = mac_inst->rrc_config.mac_NPRACH_ConfigSIB[0].mac_npdcch_NumRepetitions_RA_NB_IoT;
rmax = (rmax * 10) >> 3; // x1.25
for(k=0, i=start_subframe1; i<(start_subframe1+mac_inst->rrc_config.si_window_length); i+=si_repetition_pattern[mac_inst->rrc_config.sibs_NB_IoT_sched[sibs_order].si_repetition_pattern], ++k){
LOG_D(MAC,"[debug][sibs%d] subframe: %d, check %d", sibs_order, i, num_subframe);
LOG_D(MAC,"[%d][%d][%d] [%d][%d]\n", i, start_subframe1, mac_inst->rrc_config.si_window_length, sibs_order, si_repetition_pattern[mac_inst->rrc_config.sibs_NB_IoT_sched[sibs_order].si_repetition_pattern]);
//system("pause");
#if 0 //disable new feature
// avoid to occupied others searching space. TODO: css, uss connect with configuration module
// start start+rmax
// i i+9
int continue_flag=0;
for(l=0; l<num_flags; ++l){
if((extend_space[l]>>extend_alpha_offset[l] <= i%extend_space[l] && ((extend_space[l]>>extend_alpha_offset[l])+rmax) >= i%extend_space[l]) ||
(extend_space[l]>>extend_alpha_offset[l] <= (i+9)%extend_space[l] && ((extend_space[l]>>extend_alpha_offset[l])+rmax) >= (i+9)%extend_space[l])){
continue_flag = 1;
}
}
if(continue_flag == 1)
continue;
#endif
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; num_subframe = residual_subframe;
//printf("-- rest: %d, last: %d start: %d\n", num_subframe, last_subframe, start_subframe1); LOG_D(MAC,"-- rest: %d, last: %d start: %d\n", num_subframe, last_subframe, start_subframe1);
if(0==residual_subframe){ if(0==residual_subframe){LOG_D(MAC,"output\n\n");
sibs_dci = (DCIFormatN1_t *)malloc(sizeof(DCIFormatN1_t)); sibs_dci = (DCIFormatN1_t *)malloc(sizeof(DCIFormatN1_t));
sibs_dci->type = 1; sibs_dci->type = 1;
sibs_dci->orderIndicator = 0; sibs_dci->orderIndicator = 0;
...@@ -48,8 +72,8 @@ void schedule_sibs_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t sibs_order, in ...@@ -48,8 +72,8 @@ void schedule_sibs_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t sibs_order, in
sibs_dci->HARQackRes = 0; sibs_dci->HARQackRes = 0;
sibs_dci->DCIRep = 0; sibs_dci->DCIRep = 0;
for(k=0, j=start_subframe1;j<=i;++k, j+=si_repetition_pattern_table[mac_inst->rrc_config.sibs_NB_IoT_sched[sibs_order].si_repetition_pattern]){ 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]);
if((available_resource_DL_t *)0 != pt[k]){ if((available_resource_DL_t *)0 != pt[k]){
new_node = (schedule_result_t *)malloc(sizeof(schedule_result_t)); new_node = (schedule_result_t *)malloc(sizeof(schedule_result_t));
// fill new node // fill new node
...@@ -65,11 +89,14 @@ void schedule_sibs_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t sibs_order, in ...@@ -65,11 +89,14 @@ void schedule_sibs_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t sibs_order, in
new_node->R_harq = 0; // useless new_node->R_harq = 0; // useless
new_node->next = (schedule_result_t *)0; new_node->next = (schedule_result_t *)0;
new_node->DCI_pdu = (void *)sibs_dci; new_node->DCI_pdu = (void *)sibs_dci;
new_node->debug_str = str[sibs_order]; //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);
fill_resource_DL(mac_inst, pt[k], 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,"for2\n");
} }
return ; return ;
} }
} }
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#ifndef __MAC_EXTERN_NB_IOT_H__ #ifndef __MAC_EXTERN_NB_IOT_H__
#define __MAC_EXTERN_NB_IOT_H__ #define __MAC_EXTERN_NB_IOT_H__
// #ifdef USER_MODE // #ifdef USER_MODE
// //#include "stdio.h" // //#include "stdio.h"
// #endif //USER_MODE // #endif //USER_MODE
...@@ -27,26 +26,10 @@ ...@@ -27,26 +26,10 @@
//#include "LAYER2/MAC/vars_NB_IoT.h" //#include "LAYER2/MAC/vars_NB_IoT.h"
//NB-IoT //NB-IoT
//extern IF_Module_NB_IoT_t *if_inst_NB_IoT;
//extern eNB_MAC_INST_NB_IoT *mac_inst_NB_IoT;
extern eNB_MAC_INST_NB_IoT *mac_inst;
// //extern uint32_t EBSR_Level[63];
// extern const uint32_t Extended_BSR_TABLE[BSR_TABLE_SIZE];
// //extern uint32_t Extended_BSR_TABLE[63]; ----currently not used
// extern const uint8_t cqi2fmt0_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE];
// extern const uint8_t cqi2fmt1x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE];
// extern const uint8_t cqi2fmt2x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE];
// extern UE_MAC_INST *UE_mac_inst;
// extern eNB_MAC_INST *eNB_mac_inst;
// extern eNB_RRC_INST *eNB_rrc_inst;
//extern UE_RRC_INST_NB_IoT *UE_rrc_inst_NB_IoT;
// extern UE_MAC_INST *ue_mac_inst;
// extern MAC_RLC_XFACE *Mac_rlc_xface;
// extern uint8_t Is_rrc_registered;
//#ifndef USER_MODE //#ifndef USER_MODE
...@@ -126,8 +109,10 @@ extern const int dl_rep[3]; ...@@ -126,8 +109,10 @@ extern const int dl_rep[3];
extern const uint32_t dci_rep[3]; extern const uint32_t dci_rep[3];
extern const uint32_t harq_rep[3]; extern const uint32_t harq_rep[3];
//SIBs
extern int extend_space[2];
extern int extend_alpha_offset[2];
extern const int si_repetition_pattern[4];
#endif //DEF_H #endif //DEF_H
...@@ -56,8 +56,7 @@ void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst) ...@@ -56,8 +56,7 @@ void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst)
mac_inst->sib1_flag[i] = 0; mac_inst->sib1_flag[i] = 0;
mac_inst->sib1_count[i] = 0; mac_inst->sib1_count[i] = 0;
} }
//rrc_mac_config_req_NB_IoT(&mac_inst->rrc_config, 1, 1, 0, 0);
//rrc_mac_config_req_NB_IoT(&mac_inst->rrc_config, 1, 1, 0, 0);
init_tool_sib1(mac_inst); init_tool_sib1(mac_inst);
// output handler // output handler
...@@ -70,7 +69,7 @@ void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst) ...@@ -70,7 +69,7 @@ void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst)
mac_inst->RA_msg4_list.tail = (RA_TEMPLATE_NB_IoT *)0; mac_inst->RA_msg4_list.tail = (RA_TEMPLATE_NB_IoT *)0;
sib1_NB_IoT_sched_t *config = &mac_inst->rrc_config.sib1_NB_IoT_sched_config; sib1_NB_IoT_sched_t *config = &mac_inst->rrc_config.sib1_NB_IoT_sched_config;
// DLSF Table // DLSF Table
init_dlsf_info(mac_inst, &DLSF_information); init_dlsf_info(mac_inst, &DLSF_information);
...@@ -86,13 +85,13 @@ void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst) ...@@ -86,13 +85,13 @@ void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst)
} }
mac_inst->sib1_count[i]=j; mac_inst->sib1_count[i]=j;
} }
//printf("%d", mac_inst->sib1_period); //LOG_D(MAC,"%d", mac_inst->sib1_period);
for(i=0, j=0;i<640;++i){ for(i=0, j=0;i<640;++i){
//printf("*%d", i); //LOG_D(MAC,"*%d", i);
if(is_dlsf(mac_inst, i)){ if(is_dlsf(mac_inst, i)){
++j; ++j;
} }
//printf("-"); //LOG_D(MAC,"-");
if(i%10==9){ if(i%10==9){
mac_inst->dlsf_table[i/10] = j; mac_inst->dlsf_table[i/10] = j;
} }
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
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) 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)
{ {
//if(schedule_result_list_UL != (schedule_result_t *)0){ //if(schedule_result_list_UL != (schedule_result_t *)0){
// printf("time %d\n", mac_inst->current_subframe); // LOG_D(MAC,"time %d\n", mac_inst->current_subframe);
// print_schedule_result_DL(); print_schedule_result_UL(); getchar(); // print_schedule_result_DL(); print_schedule_result_UL(); getchar();
//} //}
...@@ -23,7 +23,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -23,7 +23,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
uint8_t MIB_size = 0; uint8_t MIB_size = 0;
uint8_t SIB1_size = 0, i = 0; uint8_t SIB1_size = 0, i = 0;
Sched_Rsp_NB_IoT_t *SCHED_info = &(mac_inst->Sched_INFO); Sched_Rsp_NB_IoT_t *SCHED_info = (Sched_Rsp_NB_IoT_t*) malloc(sizeof(Sched_Rsp_NB_IoT_t));
nfapi_dl_config_request_pdu_t *dl_config_pdu; nfapi_dl_config_request_pdu_t *dl_config_pdu;
nfapi_hi_dci0_request_pdu_t* hi_dci0_pdu; nfapi_hi_dci0_request_pdu_t* hi_dci0_pdu;
nfapi_ul_config_request_pdu_t* ul_config_pdu = NULL; nfapi_ul_config_request_pdu_t* ul_config_pdu = NULL;
...@@ -46,13 +46,13 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -46,13 +46,13 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
SCHED_info->DL_req->dl_config_request_body.dl_config_pdu_list = (nfapi_dl_config_request_pdu_t*)malloc(sizeof(nfapi_dl_config_request_pdu_t)); SCHED_info->DL_req->dl_config_request_body.dl_config_pdu_list = (nfapi_dl_config_request_pdu_t*)malloc(sizeof(nfapi_dl_config_request_pdu_t));
dl_config_pdu = SCHED_info->DL_req->dl_config_request_body.dl_config_pdu_list; dl_config_pdu = SCHED_info->DL_req->dl_config_request_body.dl_config_pdu_list;
//printf("first DL node output: %d current: %d\n",schedule_result_list_DL->output_subframe,current_time); //LOG_D(MAC,"first DL node output: %d current: %d\n",schedule_result_list_DL->output_subframe,current_time);
//printf("test current: %d\n",current_time); //LOG_D(MAC,"test current: %d\n",current_time);
if(MIB_flag == 1) if(MIB_flag == 1)
{ {
//printf("[%d]MIB\n",current_time); //LOG_D(MAC,"[%d]MIB\n",current_time);
//MIB_size = mac_rrc_data_req_eNB_NB_IoT(*MIB) //MIB_size = mac_rrc_data_req_eNB_NB_IoT(*MIB)
SCHED_info->DL_req->dl_config_request_body.number_pdu = 1; SCHED_info->DL_req->dl_config_request_body.number_pdu = 1;
dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_NBCH_PDU_TYPE; dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_NBCH_PDU_TYPE;
...@@ -63,7 +63,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -63,7 +63,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
// fill MIB PDU // fill MIB PDU
//SCHED_info->TX_req->tx_request_body.tx_pdu_list[dl_config_pdu->NB_IoTch_pdu.NB_IoTch_pdu_rel13.pdu_index].segments[0].segment_data = MIB; //SCHED_info->TX_req->tx_request_body.tx_pdu_list[dl_config_pdu->NB_IoTch_pdu.NB_IoTch_pdu_rel13.pdu_index].segments[0].segment_data = MIB;
LOG_I(MAC,"NB-IoT fill MIB\n"); LOG_D(MAC,"NB-IoT fill MIB\n");
//dl_scheduled(mac_inst->current_subframe, _NPBCH, 0, "MIB"); //dl_scheduled(mac_inst->current_subframe, _NPBCH, 0, "MIB");
} }
else if(SIB1_flag == 1) else if(SIB1_flag == 1)
...@@ -79,7 +79,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -79,7 +79,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.modulation = 2; dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.modulation = 2;
//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; //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;
LOG_I(MAC,"NB-IoT fill SIB1\n"); LOG_D(MAC,"NB-IoT fill SIB1\n");
//start symbol, Resource assignment, Repetition number, Number of subframe Resource assignment lost for now //start symbol, Resource assignment, Repetition number, Number of subframe Resource assignment lost for now
//dl_scheduled(mac_inst->current_subframe, _NPDSCH, SI_RNTI, "SIB1"); //dl_scheduled(mac_inst->current_subframe, _NPDSCH, SI_RNTI, "SIB1");
} }
...@@ -87,24 +87,24 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -87,24 +87,24 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
else if(schedule_result_list_DL==NULL) else if(schedule_result_list_DL==NULL)
{ {
DL_empty = 1; DL_empty = 1;
//printf("no remaining node of DL scheduling result\n"); //LOG_D(MAC,"no remaining node of DL scheduling result\n");
}else }else
{ {
if(schedule_result_list_DL->output_subframe < current_time) if(schedule_result_list_DL->output_subframe < current_time)
{ {
while(schedule_result_list_DL->output_subframe < current_time) while(schedule_result_list_DL->output_subframe < current_time)
{ {
//printf("This error if there is DL scheduling result node before the current time\n"); //LOG_D(MAC,"This error if there is DL scheduling result node before the current time\n");
tmp = schedule_result_list_DL; tmp = schedule_result_list_DL;
schedule_result_list_DL = schedule_result_list_DL->next; schedule_result_list_DL = schedule_result_list_DL->next;
free(tmp); free(tmp);
//printf("test2 current: %d\n",current_time); //LOG_D(MAC,"test2 current: %d\n",current_time);
//break; //break;
if(schedule_result_list_DL == NULL){ if(schedule_result_list_DL == NULL){
return -1; return -1;
} }
} }
//printf("return\n"); //LOG_D(MAC,"return\n");
//return -1; //return -1;
} }
else if (schedule_result_list_DL->output_subframe == current_time) else if (schedule_result_list_DL->output_subframe == current_time)
...@@ -115,8 +115,8 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -115,8 +115,8 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
if(schedule_result_list_DL->direction == DL) if(schedule_result_list_DL->direction == DL)
{ {
LOG_I(MAC,"NB-IoT fill DL_DCI\n"); LOG_D(MAC,"NB-IoT fill DL_DCI\n");
//printf("Sched Info DL DCI here\n"); //LOG_D(MAC,"Sched Info DL DCI here\n");
SCHED_info->DL_req->dl_config_request_body.number_dci = 1; SCHED_info->DL_req->dl_config_request_body.number_dci = 1;
DCI_pdu = schedule_result_list_DL->DCI_pdu; DCI_pdu = schedule_result_list_DL->DCI_pdu;
// not consider the case transmitting 2 DCIs for the moment also not consider N2 now // not consider the case transmitting 2 DCIs for the moment also not consider N2 now
...@@ -139,7 +139,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -139,7 +139,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.dci_subframe_repetition_number = ((DCIFormatN1_t *)DCI_pdu)->DCIRep; dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.dci_subframe_repetition_number = ((DCIFormatN1_t *)DCI_pdu)->DCIRep;
}else if(schedule_result_list_DL->direction == UL) }else if(schedule_result_list_DL->direction == UL)
{ {
LOG_I(MAC,"NB-IoT fill DL_DCI\n"); LOG_D(MAC,"NB-IoT fill DL_DCI\n");
SCHED_info->HI_DCI0_req = (nfapi_hi_dci0_request_t*)malloc(sizeof(nfapi_hi_dci0_request_t)); SCHED_info->HI_DCI0_req = (nfapi_hi_dci0_request_t*)malloc(sizeof(nfapi_hi_dci0_request_t));
SCHED_info->HI_DCI0_req->hi_dci0_request_body.hi_dci0_pdu_list = (nfapi_hi_dci0_request_pdu_t*)malloc(sizeof(nfapi_hi_dci0_request_pdu_t)); SCHED_info->HI_DCI0_req->hi_dci0_request_body.hi_dci0_pdu_list = (nfapi_hi_dci0_request_pdu_t*)malloc(sizeof(nfapi_hi_dci0_request_pdu_t));
hi_dci0_pdu = SCHED_info->HI_DCI0_req->hi_dci0_request_body.hi_dci0_pdu_list; hi_dci0_pdu = SCHED_info->HI_DCI0_req->hi_dci0_request_body.hi_dci0_pdu_list;
...@@ -161,7 +161,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -161,7 +161,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
} }
break; break;
case NPDSCH: case NPDSCH:
LOG_I(MAC,"NB-IoT fill DL Data\n"); LOG_D(MAC,"NB-IoT fill DL Data\n");
DCI_pdu = schedule_result_list_DL-> DCI_pdu; DCI_pdu = schedule_result_list_DL-> DCI_pdu;
SCHED_info->DL_req->dl_config_request_body.number_pdu = 1; SCHED_info->DL_req->dl_config_request_body.number_pdu = 1;
dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE; dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE;
...@@ -187,30 +187,30 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -187,30 +187,30 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
schedule_result_list_DL = schedule_result_list_DL->next; schedule_result_list_DL = schedule_result_list_DL->next;
//printf("subframe check scheduling result next %d\n",schedule_result_list_DL->output_subframe); //LOG_D(MAC,"subframe check scheduling result next %d\n",schedule_result_list_DL->output_subframe);
} }
} }
//printf("There is no downlink transmission\n"); //LOG_D(MAC,"There is no downlink transmission\n");
if(schedule_result_list_UL==NULL) if(schedule_result_list_UL==NULL)
{ {
UL_empty = 1; UL_empty = 1;
//printf("no remaining node of UL scheduling result\n"); //LOG_D(MAC,"no remaining node of UL scheduling result\n");
}else }else
{ {
if(schedule_result_list_UL->output_subframe < current_time) if(schedule_result_list_UL->output_subframe < current_time)
{ {
while(schedule_result_list_UL->output_subframe < current_time) while(schedule_result_list_UL->output_subframe < current_time)
{ {
//printf("This error if there is UL scheduling result node before the current time\n"); //LOG_D(MAC,"This error if there is UL scheduling result node before the current time\n");
tmp = schedule_result_list_UL; tmp = schedule_result_list_UL;
schedule_result_list_UL = schedule_result_list_UL->next; schedule_result_list_UL = schedule_result_list_UL->next;
free(tmp); free(tmp);
return -1; return -1;
} }
//printf("return\n"); //LOG_D(MAC,"return\n");
//return -1; //return -1;
} }
else if(schedule_result_list_UL->output_subframe == current_time) else if(schedule_result_list_UL->output_subframe == current_time)
...@@ -224,8 +224,8 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -224,8 +224,8 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
{ {
if(schedule_result_list_UL->channel == NPUSCH) if(schedule_result_list_UL->channel == NPUSCH)
{ {
//printf("first UL \n"); //LOG_D(MAC,"first UL \n");
LOG_I(MAC,"NB-IoT fill ul_config_pdu\n"); LOG_D(MAC,"NB-IoT fill ul_config_pdu\n");
SCHED_info->UL_req->ul_config_request_body.number_of_pdus ++; SCHED_info->UL_req->ul_config_request_body.number_of_pdus ++;
//SCHED_info->UL_req.sfn_sf = ; //SCHED_info->UL_req.sfn_sf = ;
(ul_config_pdu + i) ->pdu_type = NFAPI_UL_CONFIG_NULSCH_PDU_TYPE; (ul_config_pdu + i) ->pdu_type = NFAPI_UL_CONFIG_NULSCH_PDU_TYPE;
...@@ -237,7 +237,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -237,7 +237,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
// bug here // bug here
(ul_config_pdu + i) ->nulsch_pdu.nulsch_pdu_rel13.nulsch_format = 0; (ul_config_pdu + i) ->nulsch_pdu.nulsch_pdu_rel13.nulsch_format = 0;
(ul_config_pdu + i) ->nulsch_pdu.nulsch_pdu_rel13.size = UL_TBS_Table[((DCIFormatN0_t *)DCI_pdu)->mcs][((DCIFormatN0_t *)DCI_pdu)->ResAssign]; (ul_config_pdu + i) ->nulsch_pdu.nulsch_pdu_rel13.size = UL_TBS_Table[((DCIFormatN0_t *)DCI_pdu)->mcs][((DCIFormatN0_t *)DCI_pdu)->ResAssign];
//printf("test\n"); //LOG_D(MAC,"test\n");
(ul_config_pdu + i) ->nulsch_pdu.nulsch_pdu_rel13.rnti = schedule_result_list_UL->rnti; (ul_config_pdu + i) ->nulsch_pdu.nulsch_pdu_rel13.rnti = schedule_result_list_UL->rnti;
(ul_config_pdu + i) ->nulsch_pdu.nulsch_pdu_rel13.subcarrier_indication = ((DCIFormatN0_t *)DCI_pdu)->scind; (ul_config_pdu + i) ->nulsch_pdu.nulsch_pdu_rel13.subcarrier_indication = ((DCIFormatN0_t *)DCI_pdu)->scind;
(ul_config_pdu + i) ->nulsch_pdu.nulsch_pdu_rel13.resource_assignment = ((DCIFormatN0_t *)DCI_pdu)->ResAssign; (ul_config_pdu + i) ->nulsch_pdu.nulsch_pdu_rel13.resource_assignment = ((DCIFormatN0_t *)DCI_pdu)->ResAssign;
...@@ -270,21 +270,21 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -270,21 +270,21 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
if(schedule_result_list_UL == NULL) if(schedule_result_list_UL == NULL)
break; break;
}else{ }else{
printf("error\n"); LOG_D(MAC,"error\n");
} }
} }
} }
if(DL_empty == 1 ) if(DL_empty == 1 )
{ {
//printf("[hypersfn:%2d][frame:%2d][subframe:%2d]No remaining DL result\n",hypersfn,frame,subframe); //LOG_D(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]No remaining DL result\n",hypersfn,frame,subframe);
} }
if(UL_empty == 1) if(UL_empty == 1)
{ {
//printf("[hypersfn:%2d][frame:%2d][subframe:%2d]no remaining UL result\n",hypersfn,frame,subframe); //LOG_D(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]no remaining UL result\n",hypersfn,frame,subframe);
} }
//printf("[hypersfn:%2d][frame:%2d][subframe:%2d]filling the schedule response successfully\n",hypersfn,frame,subframe); //LOG_D(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]filling the schedule response successfully\n",hypersfn,frame,subframe);
return 0; return 0;
} }
This diff is collapsed.
This diff is collapsed.
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
//#include "COMMON/mac_rrc_primitives.h" //#include "COMMON/mac_rrc_primitives.h"
//IF_Module_NB_IoT_t *if_inst_NB_IoT;
//NB-IoT-------------------------------------- //NB-IoT--------------------------------------
eNB_MAC_INST_NB_IoT *mac_inst; eNB_MAC_INST_NB_IoT *mac_inst;
...@@ -70,6 +72,13 @@ const int rachrepeat[8]={1,2,4,8,16,32,64,128}; ...@@ -70,6 +72,13 @@ 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 rachscofst[7]={0,12,24,36,2,18,34};
const int rachnumsc[4]={12,24,36,48}; const int rachnumsc[4]={12,24,36,48};
const int rawindow[8] = {2, 3, 4, 5, 6, 7, 8, 10};
const int rmax[12] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048};
const double gvalue[8] = {1.5f, 2, 4, 8, 16, 32, 48, 64};
const int candidate[4] = {1, 2, 4, 8};
const double pdcchoffset[4] = {0, 0.125f, 0.25f, 0.375f};
const int dlrepeat[16] = {1, 2, 4, 8, 16, 32, 64, 128, 192, 256, 384, 512, 768, 1024, 1536, 2048};
const uint32_t RU_table[8]={1,2,3,4,5,6,8,10}; 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 scheduling_delay[4]={8,16,32,64};
...@@ -112,6 +121,13 @@ const int dl_rep[3] = {1, 2, 4}; ...@@ -112,6 +121,13 @@ const int dl_rep[3] = {1, 2, 4};
const uint32_t dci_rep[3] = {1, 2, 4}; const uint32_t dci_rep[3] = {1, 2, 4};
const uint32_t harq_rep[3] = {1, 2, 4}; const uint32_t harq_rep[3] = {1, 2, 4};
int extend_space[2] = {256, 256};
int extend_alpha_offset[2] = {10, 10};
int uss_space = 320;
int uss_alpha_offset = 10;
const int si_repetition_pattern[4] = {20, 40, 80, 160};
#endif #endif
......
...@@ -71,9 +71,9 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO) ...@@ -71,9 +71,9 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO)
abs_subframe = UL_INFO->frame*10+UL_INFO->subframe; abs_subframe = UL_INFO->frame*10+UL_INFO->subframe;
LOG_I(MAC,"Enter scheduler in subframe %d\n",abs_subframe); //LOG_I(MAC,"Enter scheduler in subframe %d\n",abs_subframe);
//scheduler here //scheduler here
//Schedule subframe should be next four subframe, means that UL_INFO->frame*10+UL_INFO->subframe + 4 //Schedule subframe should be next four subframe, means that UL_INFO->frame*10+UL_INFO->subframe + 4
eNB_dlsch_ulsch_scheduler_NB_IoT(mac_inst,abs_subframe); eNB_dlsch_ulsch_scheduler_NB_IoT(mac_inst,abs_subframe);
LOG_I(MAC,"After scheduler\n");
} }
\ No newline at end of file
...@@ -106,7 +106,7 @@ uint8_t do_MIB_NB_IoT( ...@@ -106,7 +106,7 @@ uint8_t do_MIB_NB_IoT(
/* /*
* systemFrameNumber-MSB: (TS 36.331 pag 576) * systemFrameNumber-MSB: (TS 36.331 pag 576)
* define the 4 MSB of the SFN (10 bits). The last significant 6 bits will be acquired implicitly by decoding the NPBCH * define the 4 MSB of the SFN (10 bits). The last significant 6 bits will be acquired implicitly by decoding the NPBCH
* NOTE: 6 LSB will be used for counting the 64 radio frames in the TTI period (640 ms) that is exactly the MIB period * NOTE: 6 LSB will be used for counting the 64 frames in the TTI period (640 ms) that is exactly the MIB period
* *
* hyperSFN-LSB: * hyperSFN-LSB:
* indicates the 2 least significant bits of the HSFN. The remaining 8 bits are present in SIB1-NB * indicates the 2 least significant bits of the HSFN. The remaining 8 bits are present in SIB1-NB
......
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