Commit fb83f468 authored by Nick Ho's avatar Nick Ho

remove extra useless code in MAC

parent 8e91fab0
...@@ -30,30 +30,9 @@ ...@@ -30,30 +30,9 @@
#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
// //#include "stdio.h"
// #endif //USER_MODE
// #include "PHY/defs.h"
// #include "defs.h"
// #include "COMMON/mac_rrc_primitives.h"
// #ifdef PHY_EMUL
// //#include "SIMULATION/simulation_defs.h"
// #endif //PHY_EMUL
#include "openair2/PHY_INTERFACE/defs_NB_IoT.h" #include "openair2/PHY_INTERFACE/defs_NB_IoT.h"
//#include "RRC/LITE/defs_NB_IoT.h"
//#include "LAYER2/MAC/vars_NB_IoT.h"
//NB-IoT
//extern IF_Module_NB_IoT_t *if_inst_NB_IoT;
//extern eNB_MAC_INST_NB_IoT *mac_inst_NB_IoT;
//#ifndef USER_MODE
// extern RRC_XFACE *Rrc_xface; //// to uncomment when it is used
extern uint8_t Is_rrc_registered; extern uint8_t Is_rrc_registered;
...@@ -79,9 +58,6 @@ extern EMULATION_VARS *Emul_vars; ...@@ -79,9 +58,6 @@ extern EMULATION_VARS *Emul_vars;
extern eNB_MAC_INST_NB_IoT *mac_inst; extern eNB_MAC_INST_NB_IoT *mac_inst;
extern uint8_t Is_rrc_registered_NB_IoT; extern uint8_t Is_rrc_registered_NB_IoT;
//extern BCCH_BCH_Message_NB_t MIB;
//extern BCCH_DL_SCH_Message_NB_t SIB;
//extern RRCConnectionSetup_NB_r13_IEs_t DED_Config;
extern available_resource_DL_t *available_resource_DL; extern available_resource_DL_t *available_resource_DL;
extern available_resource_tones_UL_t *available_resource_UL; extern available_resource_tones_UL_t *available_resource_UL;
...@@ -133,8 +109,6 @@ extern const int dl_rep[3]; ...@@ -133,8 +109,6 @@ 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];
extern int preamble_trigger;
extern int preamble_sfn;
//SIBs //SIBs
extern int extend_space[2]; extern int extend_space[2];
extern int extend_alpha_offset[2]; extern int extend_alpha_offset[2];
......
...@@ -145,10 +145,6 @@ void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst) ...@@ -145,10 +145,6 @@ void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst)
Initialize_Resource(); Initialize_Resource();
//add_UL_Resource(mac_inst); //add_UL_Resource(mac_inst);
extend_available_resource_DL(mac_inst, mac_inst->current_subframe + 1 + 160); extend_available_resource_DL(mac_inst, mac_inst->current_subframe + 1 + 160);
// for fixed scheduling
preamble_trigger = 0;
preamble_sfn = 0;
} }
......
...@@ -35,86 +35,12 @@ ...@@ -35,86 +35,12 @@
#include "openair2/RRC/LITE/proto_NB_IoT.h" #include "openair2/RRC/LITE/proto_NB_IoT.h"
#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h" #include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"
#define fixed_scheduling 0
int delay_time=0;
int rar_transmit = 0;
int fixed_scheduler(uint32_t frame, uint32_t subframe, Sched_Rsp_NB_IoT_t *SCHED_info)
{
int RARNTI = 0;
nfapi_dl_config_request_pdu_t *dl_config_pdu;
if(preamble_trigger==1 && subframe==7 && rar_transmit==0)
{
RARNTI = 1 + preamble_sfn/4;
//DCI
LOG_D(MAC,"[frame:%2d][subframe:%2d]NB-IoT fill DL_DCI\n",frame,subframe);
dl_config_pdu = SCHED_info->DL_req->dl_config_request_body.dl_config_pdu_list;
SCHED_info->DL_req->dl_config_request_body.number_dci = 1;
SCHED_info->DL_req->dl_config_request_body.number_pdu = 1;
// not consider the case transmitting 2 DCIs for the moment also not consider N2 now
dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE;
dl_config_pdu->pdu_size = 2+sizeof(nfapi_dl_config_npdcch_pdu_rel13_t);
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.length = 7;
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.pdu_index = 1;
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.ncce_index = 0;
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.aggregation_level = 1;
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.rnti_type = 1; // 1 =
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.rnti = RARNTI; // RA-RNTI = 1+floor(SFN/4)
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.dci_format = 0; // N1
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.scheduling_delay = 0;
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.resource_assignment = 0;
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.repetition_number = 2;
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.mcs = 4;
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.new_data_indicator = 0;
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.harq_ack_resource = 0;
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.npdcch_order_indication = 0;
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.dci_subframe_repetition_number = 2;
rar_transmit=1;
delay_time=1;
return 1;
}
if(rar_transmit==1)
delay_time++;
if(rar_transmit==1 && delay_time==10)
{
LOG_I(MAC,"[frame:%2d][subframe:%2d]NB-IoT fill DL Data\n",frame,subframe);
RARNTI = 1 + preamble_sfn/4;
uint8_t *rar_pdu;
rar_pdu = (uint8_t *)malloc(7*sizeof(uint8_t));
rar_pdu[0] = 64; // + preamble index
rar_pdu[1] = 0;
rar_pdu[2] = 9;
rar_pdu[3] = 96;
rar_pdu[4] = 64;
rar_pdu[5] = 255;
rar_pdu[6] = 242;
dl_config_pdu = SCHED_info->DL_req->dl_config_request_body.dl_config_pdu_list;
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_size = 2+sizeof(nfapi_dl_config_ndlsch_pdu_rel13_t);
dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.length = 56;
dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.pdu_index = 1;
dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.rnti_type = 1;
dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.rnti = RARNTI; // RA-RNTI
dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.resource_assignment = 0;
dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.repetition_number = 2;
dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.modulation = 2;
dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.number_of_subframes_for_resource_assignment = get_num_sf(dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.resource_assignment);
SCHED_info->TX_req->tx_request_body.tx_pdu_list[dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.pdu_index].segments[0].segment_data = rar_pdu;
rar_transmit = 0;
preamble_trigger =0;
delay_time =0;
return 1;
}
return 0;
}
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){
uint8_t MIB_size = 0; uint8_t MIB_size = 0;
uint8_t SIB1_size = 0, i = 0; uint8_t SIB1_size = 0, i = 0;
// to get MIB and SIB
rrc_eNB_carrier_data_NB_IoT_t *carrier = &eNB_rrc_inst_NB_IoT->carrier[0]; rrc_eNB_carrier_data_NB_IoT_t *carrier = &eNB_rrc_inst_NB_IoT->carrier[0];
Sched_Rsp_NB_IoT_t *SCHED_info = &mac_inst->Sched_INFO; Sched_Rsp_NB_IoT_t *SCHED_info = &mac_inst->Sched_INFO;
...@@ -125,14 +51,15 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -125,14 +51,15 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
schedule_result_t *tmp; schedule_result_t *tmp;
int DL_empty = 0, UL_empty = 0; int DL_empty = 0, UL_empty = 0;
int flag_malloc = 0 ; int flag_malloc = 0 ;
// filled common part of schedule_resoponse // filled common part of schedule_resoponse
SCHED_info->module_id = module_id; SCHED_info->module_id = module_id;
SCHED_info->hypersfn = hypersfn; SCHED_info->hypersfn = hypersfn;
SCHED_info->frame = frame; SCHED_info->frame = frame;
SCHED_info->subframe = subframe; SCHED_info->subframe = subframe;
void *DCI_pdu; void *DCI_pdu;
// free all the memory allocate to the previous subframe
if(flag_malloc) if(flag_malloc)
{ {
free(SCHED_info->TX_req->tx_request_body.tx_pdu_list); free(SCHED_info->TX_req->tx_request_body.tx_pdu_list);
...@@ -146,7 +73,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -146,7 +73,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
free(SCHED_info->UL_req); free(SCHED_info->UL_req);
} }
// allocate the memory for the current output subframe
SCHED_info->TX_req = (nfapi_tx_request_t *) malloc (sizeof(nfapi_tx_request_t)); SCHED_info->TX_req = (nfapi_tx_request_t *) malloc (sizeof(nfapi_tx_request_t));
SCHED_info->TX_req->tx_request_body.tx_pdu_list = (nfapi_tx_request_pdu_t *) malloc (sizeof(nfapi_tx_request_pdu_t)); SCHED_info->TX_req->tx_request_body.tx_pdu_list = (nfapi_tx_request_pdu_t *) malloc (sizeof(nfapi_tx_request_pdu_t));
SCHED_info->UL_req = (nfapi_ul_config_request_t*) malloc (sizeof(nfapi_ul_config_request_t)); SCHED_info->UL_req = (nfapi_ul_config_request_t*) malloc (sizeof(nfapi_ul_config_request_t));
...@@ -161,22 +88,13 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -161,22 +88,13 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
SCHED_info->UL_req->ul_config_request_body.number_of_pdus = 0; SCHED_info->UL_req->ul_config_request_body.number_of_pdus = 0;
SCHED_info->HI_DCI0_req->hi_dci0_request_body.number_of_dci = 0; SCHED_info->HI_DCI0_req->hi_dci0_request_body.number_of_dci = 0;
#if (fixed_scheduling == 1)
if(fixed_scheduler(frame,subframe,SCHED_info))
return 0;
#endif
// process downlink data transmission, there will only be single DL_REQ in one subframe (e.g. 1ms), check common signal first // process downlink data transmission, there will only be single DL_REQ in one subframe (e.g. 1ms), check common signal first
if(subframe == 0 /*MIB_flag == 1*/) // TODO back to MIB_flag if(subframe == 0) // MIB session
{ {
// get the MIB pdu from carrier (RRC structure)
uint8_t *MIB_pdu = get_NB_IoT_MIB(carrier,1,subframe,frame,hypersfn); uint8_t *MIB_pdu = get_NB_IoT_MIB(carrier,1,subframe,frame,hypersfn);
//LOG_D(MAC,"[%d]MIB\n",current_time); // get the size of MIB
//MIB_size = mac_rrc_data_req_eNB_NB_IoT(*MIB);
//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;
//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));
MIB_size = get_NB_IoT_MIB_size(); MIB_size = get_NB_IoT_MIB_size();
//LOG_I(MAC,"NB-IoT get MIB size \n");
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;
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;
...@@ -184,27 +102,16 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -184,27 +102,16 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
dl_config_pdu->nbch_pdu.nbch_pdu_rel13.length = MIB_size; dl_config_pdu->nbch_pdu.nbch_pdu_rel13.length = MIB_size;
dl_config_pdu->nbch_pdu.nbch_pdu_rel13.pdu_index = 1; dl_config_pdu->nbch_pdu.nbch_pdu_rel13.pdu_index = 1;
dl_config_pdu->nbch_pdu.nbch_pdu_rel13.transmission_power = 6000; dl_config_pdu->nbch_pdu.nbch_pdu_rel13.transmission_power = 6000;
// fill MIB PDU
//LOG_I(MAC,"B NB-IoT get MIB pdu \n");
//MIB_pdu = get_NB_IoT_MIB();
//LOG_D(MAC,"A NB-IoT MIB pdu : %d \n",MIB_pdu);
//printf("NB-IoT output MIB:%02X , size :%d\n",MIB_pdu, MIB_size);
//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_pdu;
// fill MIB PDU
SCHED_info->TX_req->tx_request_body.tx_pdu_list[dl_config_pdu->nbch_pdu.nbch_pdu_rel13.pdu_index].segments[0].segment_data = MIB_pdu; SCHED_info->TX_req->tx_request_body.tx_pdu_list[dl_config_pdu->nbch_pdu.nbch_pdu_rel13.pdu_index].segments[0].segment_data = MIB_pdu;
LOG_D(MAC,"NB-IoT fill MIB\n"); LOG_D(MAC,"NB-IoT fill MIB\n");
//LOG_I(MAC,"NB-IoT fill MIB\n");
//dl_scheduled(mac_inst->current_subframe, _NPBCH, 0, "MIB");
} }
else if(SIB1_flag==1) else if(SIB1_flag==1) // SIB1 flag, calculated by scheduler
//else if((subframe == 4) && (frame%2==0) && (frame%32<16) /*SIB1_flag == 1*/) // TODO back to SIB1_flag
{ {
// get SIB1 PDU from carrier and updated by time
uint8_t *SIB1_pdu = get_NB_IoT_SIB1(0,0,carrier,208,92,1,3584,28,2,subframe,frame,hypersfn); 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); // get the size of SIB1
//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;
//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));
SIB1_size = get_NB_IoT_SIB1_size(); SIB1_size = get_NB_IoT_SIB1_size();
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;
SCHED_info->DL_req->dl_config_request_body.number_pdu = 1; SCHED_info->DL_req->dl_config_request_body.number_pdu = 1;
...@@ -215,22 +122,17 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -215,22 +122,17 @@ 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.rnti_type = 0; dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.rnti_type = 0;
dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.rnti = 0xFFFF; // SI-rnti dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.rnti = 0xFFFF; // SI-rnti
dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.modulation = 2; dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.modulation = 2;
dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.repetition_number = 10; //value between 0-15, should be get from MIB // to fix later !!!!!!!!!!!! dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.repetition_number = 10; // should derived from MIB
dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.number_of_subframes_for_resource_assignment = 8; dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.number_of_subframes_for_resource_assignment = 8;
//SIB1_pdu = get_NB_IoT_SIB1();
//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; 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,"[hypersfn:%2d][frame:%2d][subframe:%2d]NB-IoT fill SIB1\n",hypersfn,frame,subframe); LOG_D(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]NB-IoT fill SIB1\n",hypersfn,frame,subframe);
//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");
}else if(schedule_result_list_DL == NULL){ }else if(schedule_result_list_DL == NULL){
DL_empty = 1; DL_empty = 1;
//LOG_D(MAC,"no remaining node of DL scheduling result\n"); LOG_D(MAC,"no remaining node of DL scheduling result\n");
}else{ }else{
// here shouldn't be run into // here shouldn't be run into, to prevent DL scheduling result node is less than curent time
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)
...@@ -239,29 +141,23 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -239,29 +141,23 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
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);
//LOG_D(MAC,"test2 current: %d\n",current_time);
//break;
if(schedule_result_list_DL == NULL){ if(schedule_result_list_DL == NULL){
return -1; return -1;
} }
} }
//LOG_D(MAC,"return\n");
//return -1;
} }
else if (schedule_result_list_DL->output_subframe == current_time) else if (schedule_result_list_DL->output_subframe == current_time) // output dci or data by using nfapi format
{ {
switch(schedule_result_list_DL->channel) switch(schedule_result_list_DL->channel)
{ {
case NPDCCH: case NPDCCH:
if(schedule_result_list_DL->direction == DL) if(schedule_result_list_DL->direction == DL) // DCI for Downlink
{ {
LOG_D(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]NB-IoT fill DL_DCI\n",hypersfn,frame,subframe); LOG_D(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]NB-IoT fill DL_DCI\n",hypersfn,frame,subframe);
//LOG_D(MAC,"Sched Info DL DCI here\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;
//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;
SCHED_info->DL_req->dl_config_request_body.number_dci = 1; SCHED_info->DL_req->dl_config_request_body.number_dci = 1;
SCHED_info->DL_req->dl_config_request_body.number_pdu = 1; SCHED_info->DL_req->dl_config_request_body.number_pdu = 1;
...@@ -284,12 +180,9 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -284,12 +180,9 @@ 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.harq_ack_resource = ((DCIFormatN1_t *)DCI_pdu)->HARQackRes; dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.harq_ack_resource = ((DCIFormatN1_t *)DCI_pdu)->HARQackRes;
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.npdcch_order_indication = ((DCIFormatN1_t *)DCI_pdu)->orderIndicator; dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.npdcch_order_indication = ((DCIFormatN1_t *)DCI_pdu)->orderIndicator;
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) // DCI for uplink
{ {
LOG_D(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]NB-IoT fill UL_DCI\n",hypersfn,frame,subframe); LOG_D(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]NB-IoT fill UL_DCI\n",hypersfn,frame,subframe);
//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.number_of_dci = 0;
//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;
DCI_pdu = schedule_result_list_DL-> DCI_pdu; DCI_pdu = schedule_result_list_DL-> DCI_pdu;
SCHED_info-> HI_DCI0_req->hi_dci0_request_body.number_of_dci =1; SCHED_info-> HI_DCI0_req->hi_dci0_request_body.number_of_dci =1;
...@@ -308,17 +201,10 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -308,17 +201,10 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
hi_dci0_pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13.dci_subframe_repetition_number = ((DCIFormatN0_t *)DCI_pdu)->DCIRep; hi_dci0_pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13.dci_subframe_repetition_number = ((DCIFormatN0_t *)DCI_pdu)->DCIRep;
} }
break; break;
case NPDSCH: case NPDSCH: // Downlink Data
LOG_D(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]NB-IoT fill DL Data\n",hypersfn,frame,subframe); LOG_D(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]NB-IoT fill DL Data\n",hypersfn,frame,subframe);
//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;
//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;
DCI_pdu = schedule_result_list_DL-> DCI_pdu; DCI_pdu = schedule_result_list_DL-> DCI_pdu;
//if(schedule_result_list_DL->rnti==SI_RNTI)
// LOG_D(MAC,"frame:%d, subframe:%d NB-IoT fill SIB23 ResAssign: %d\n",frame,subframe,((DCIFormatN1_t *)DCI_pdu)->ResAssign);
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;
dl_config_pdu->pdu_size = 2+sizeof(nfapi_dl_config_ndlsch_pdu_rel13_t); dl_config_pdu->pdu_size = 2+sizeof(nfapi_dl_config_ndlsch_pdu_rel13_t);
...@@ -333,15 +219,13 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -333,15 +219,13 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
SCHED_info->TX_req->tx_request_body.tx_pdu_list[dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.pdu_index].segments[0].segment_data = schedule_result_list_DL->DLSCH_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 = schedule_result_list_DL->DLSCH_pdu;
if(schedule_result_list_DL->rnti==SI_RNTI) if(schedule_result_list_DL->rnti==SI_RNTI)
{ {
// the table for SIB information is different from the table for normal uplink data
dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.number_of_subframes_for_resource_assignment =((DCIFormatN1_t *)DCI_pdu)->ResAssign; dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.number_of_subframes_for_resource_assignment =((DCIFormatN1_t *)DCI_pdu)->ResAssign;
dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.length = schedule_result_list_DL->sdu_length; dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.length = schedule_result_list_DL->sdu_length;
LOG_D(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]NB-IoT fill SIBs\n",hypersfn,frame,subframe); LOG_D(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]NB-IoT fill SIBs\n",hypersfn,frame,subframe);
}else }else
LOG_D(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]NB-IoT fill DL Data, length = %d\n",hypersfn,frame,subframe,dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.length); LOG_D(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]NB-IoT fill DL Data, length = %d\n",hypersfn,frame,subframe,dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.length);
//LOG_D(MAC,"A NB-IoT fill DL Data pdu : %d \n",schedule_result_list_DL->DLSCH_pdu);
break; break;
default: default:
break; break;
...@@ -353,8 +237,6 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -353,8 +237,6 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
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;
//LOG_D(MAC,"subframe check scheduling result next %d\n",schedule_result_list_DL->output_subframe);
} }
} }
...@@ -363,7 +245,6 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -363,7 +245,6 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
{ {
UL_empty = 1; UL_empty = 1;
LOG_D(MAC,"no remaining node of UL scheduling result\n"); LOG_D(MAC,"no remaining node of UL scheduling result\n");
//LOG_I(MAC,"no remaining node of UL scheduling result\n");
}else }else
{ {
// here shouldn't be run into // here shouldn't be run into
...@@ -392,7 +273,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -392,7 +273,7 @@ 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)
{ {
//LOG_D(MAC,"first UL \n"); //LOG_D(MAC,"first UL \n");
LOG_D(MAC,"NB-IoT fill ul_config_pdu\n"); LOG_I(MAC,"NB-IoT fill ul_config_pdu\n");
//SCHED_info->UL_req = (nfapi_ul_config_request_t *)malloc(sizeof(nfapi_ul_config_request_t)); //SCHED_info->UL_req = (nfapi_ul_config_request_t *)malloc(sizeof(nfapi_ul_config_request_t));
//SCHED_info->UL_req->ul_config_request_body.number_of_pdus = 0; //SCHED_info->UL_req->ul_config_request_body.number_of_pdus = 0;
//SCHED_info->UL_req->ul_config_request_body.ul_config_pdu_list = (nfapi_ul_config_request_pdu_t *)malloc(5 * sizeof(nfapi_ul_config_request_pdu_t)); //SCHED_info->UL_req->ul_config_request_body.ul_config_pdu_list = (nfapi_ul_config_request_pdu_t *)malloc(5 * sizeof(nfapi_ul_config_request_pdu_t));
......
...@@ -33,22 +33,12 @@ ...@@ -33,22 +33,12 @@
#ifdef USER_MODE #ifdef USER_MODE
//#include "stdio.h" //#include "stdio.h"
#endif //USER_MODE #endif //USER_MODE
//#include "PHY/defs.h"
//#include "defs.h"
#include "LAYER2/MAC/defs_NB_IoT.h"
//#include "PHY_INTERFACE/defs.h"
//#include "COMMON/mac_rrc_primitives.h"
int preamble_trigger; #include "LAYER2/MAC/defs_NB_IoT.h"
int preamble_sfn;
//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;
//BCCH_BCH_Message_NB_t MIB;
//BCCH_DL_SCH_Message_NB_t SIB;
//RRCConnectionSetup_NB_r13_IEs_t DED_Config;
schedule_result_t *schedule_result_list_UL; schedule_result_t *schedule_result_list_UL;
schedule_result_t *schedule_result_list_DL; schedule_result_t *schedule_result_list_DL;
available_resource_DL_t *available_resource_DL; available_resource_DL_t *available_resource_DL;
......
...@@ -68,8 +68,6 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO) ...@@ -68,8 +68,6 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO)
(UL_INFO->nrach_ind.nrach_pdu_list+i)->nrach_indication_rel13.timing_advance*16 (UL_INFO->nrach_ind.nrach_pdu_list+i)->nrach_indication_rel13.timing_advance*16
); );
LOG_D(MAC,"Init_RA_NB_IoT Out\n"); LOG_D(MAC,"Init_RA_NB_IoT Out\n");
preamble_trigger=1;
preamble_sfn = UL_INFO->frame;
} }
} }
//} //}
......
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