Commit ae73a19f authored by Nick Ho's avatar Nick Ho

RAR debug ongoing

parent be6e0e03
......@@ -194,7 +194,7 @@ void handle_nfapi_dlsch_pdu_NB_IoT(PHY_VARS_eNB *eNB,
//ue specific data or RAR (we already have received the DCI for this)
else if(rel13->rnti != 65535 && rel13->rnti_type == 1)
{
printf("rel13->rnti: %d, eNB->ndlsch_RAR->rnti: %d\n",rel13->rnti,eNB->ndlsch_RAR->rnti);
//check if the PDU is for RAR
if(eNB->ndlsch_RAR != NULL && rel13->rnti == eNB->ndlsch_RAR->rnti) //rnti for the RAR should have been set priviously by the DCI
{
......@@ -337,6 +337,7 @@ void schedule_response_NB_IoT(Sched_Rsp_NB_IoT_t *Sched_INFO)
{
case NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE:
//Remember: there is no DCI for SI information
LOG_I(PHY."Generate DL PDU information from scheduelr\n");
//TODO: separate the ndlsch structure configuration from the DCI (here we will encode only the DCI)
generate_eNB_dlsch_params_NB_IoT(eNB,proc,dl_config_pdu);
......
......@@ -2304,14 +2304,13 @@ void prach_procedures_NB_IoT(PHY_VARS_eNB *eNB) {
NFAPI_SFNSF2SF(UL_info->rach_ind.sfn_sf),
UL_info->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.preamble,
UL_info->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.timing_advance,
UL_info->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.rnti); */
UL_info->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.rnti);
mac_xface->initiate_ra_proc(eNB->Mod_id,
eNB->CC_id,
frame,
preamble_index[0],
(int16_t) timing_advance_preamble[0],
0,subframe,0);
0,subframe,0);*/
}
}
......
......@@ -756,7 +756,7 @@ void generate_eNB_dlsch_params_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_t *
ndlsch = eNB->ndlsch_ra;
ndlsch->ndlsch_type = RAR;
LOG_D(PHY,"Generating dlsch params for RA_RNTI and packing DCI\n");
LOG_I(PHY,"Generating dlsch params for RA_RNTI and packing DCI\n");
generate_eNB_dlsch_params_from_dci_NB_IoT(eNB,
frame,
subframe,
......@@ -814,7 +814,7 @@ void generate_eNB_dlsch_params_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_t *
//parameters we don't consider pdsch config dedicated since not calling the phy config dedicated step2
LOG_D(PHY,"Generating dlsch params for DCIN1 data and packing DCI\n");
LOG_I(PHY,"Generating dlsch params for DCIN1 data and packing DCI\n");
generate_eNB_dlsch_params_from_dci_NB_IoT(eNB,
frame,
subframe,
......
......@@ -517,10 +517,10 @@ void rrc_mac_config_req_NB_IoT(
nprach_parameter = radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[0];
LOG_I(MAC,"NPRACH 0 setting: NumRepetiion: %ld Period: %ld size of list %d\n",nprach_parameter->numRepetitionsPerPreambleAttempt_r13,nprach_parameter->nprach_Periodicity_r13,radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.size);
mac_config->mac_NPRACH_ConfigSIB[0].mac_numRepetitionsPerPreambleAttempt_NB_IoT = nprach_parameter->numRepetitionsPerPreambleAttempt_r13;
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_config->mac_NPRACH_ConfigSIB[0].mac_numRepetitionsPerPreambleAttempt_NB_IoT = rachrepeat[nprach_parameter->numRepetitionsPerPreambleAttempt_r13];
mac_config->mac_NPRACH_ConfigSIB[0].mac_npdcch_NumRepetitions_RA_NB_IoT = rmax[nprach_parameter->npdcch_NumRepetitions_RA_r13];
mac_config->mac_NPRACH_ConfigSIB[0].mac_npdcch_StartSF_CSS_RA_NB_IoT = gvalue[nprach_parameter->npdcch_StartSF_CSS_RA_r13];
mac_config->mac_NPRACH_ConfigSIB[0].mac_npdcch_Offset_RA_NB_IoT = pdcchoffset[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];
......@@ -531,10 +531,10 @@ void rrc_mac_config_req_NB_IoT(
if ( radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[1] != NULL) {
nprach_parameter = radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[1];
LOG_I(MAC,"NPRACH 1 setting: NumRepetiion: %ld size of list %d\n",nprach_parameter->numRepetitionsPerPreambleAttempt_r13,radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.size);
mac_config->mac_NPRACH_ConfigSIB[1].mac_numRepetitionsPerPreambleAttempt_NB_IoT = nprach_parameter->numRepetitionsPerPreambleAttempt_r13;
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_config->mac_NPRACH_ConfigSIB[1].mac_numRepetitionsPerPreambleAttempt_NB_IoT = rachrepeat[nprach_parameter->numRepetitionsPerPreambleAttempt_r13];
mac_config->mac_NPRACH_ConfigSIB[1].mac_npdcch_NumRepetitions_RA_NB_IoT = rmax[nprach_parameter->npdcch_NumRepetitions_RA_r13];
mac_config->mac_NPRACH_ConfigSIB[1].mac_npdcch_StartSF_CSS_RA_NB_IoT = gvalue[nprach_parameter->npdcch_StartSF_CSS_RA_r13];
mac_config->mac_NPRACH_ConfigSIB[1].mac_npdcch_Offset_RA_NB_IoT = pdcchoffset[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];
......@@ -544,10 +544,10 @@ void rrc_mac_config_req_NB_IoT(
if ( radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[2] != NULL) {
nprach_parameter = radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[2];
LOG_I(MAC,"NPRACH 2 setting: NumRepetiion: %ld size of list %d\n",nprach_parameter->numRepetitionsPerPreambleAttempt_r13,radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.size);
mac_config->mac_NPRACH_ConfigSIB[2].mac_numRepetitionsPerPreambleAttempt_NB_IoT = nprach_parameter->numRepetitionsPerPreambleAttempt_r13;
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_config->mac_NPRACH_ConfigSIB[2].mac_numRepetitionsPerPreambleAttempt_NB_IoT = rachrepeat[nprach_parameter->numRepetitionsPerPreambleAttempt_r13];
mac_config->mac_NPRACH_ConfigSIB[2].mac_npdcch_NumRepetitions_RA_NB_IoT = rmax[nprach_parameter->npdcch_NumRepetitions_RA_r13];
mac_config->mac_NPRACH_ConfigSIB[2].mac_npdcch_StartSF_CSS_RA_NB_IoT = gvalue[nprach_parameter->npdcch_StartSF_CSS_RA_r13];
mac_config->mac_NPRACH_ConfigSIB[2].mac_npdcch_Offset_RA_NB_IoT = pdcchoffset[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];
......
......@@ -112,18 +112,27 @@ void schedule_rar_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe){
sched_temp_UL_NB_IoT_t npusch_info;
int fail_num = 0;
int flag=0;
while((RA_TEMPLATE_NB_IoT *)0 != msg2_nodes){
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;
r = rmax/num_candidate;
num_dci_subframe = r;
dci_subframe = abs_subframe;//mac_inst->current_subframe;
LOG_D(MAC,"rmax : %d, num_dci_subframe : %d, dci_subframe: %d\n",rmax,r,dci_subframe);
for(dci_candidate=0; dci_candidate<num_candidate; ++dci_candidate){
while(!is_dlsf(mac_inst, dci_subframe)){
++dci_subframe;
}
dci_node = (available_resource_DL_t *)check_resource_DL(mac_inst, dci_subframe, num_dci_subframe, &dci_end_subframe, &dci_first_subframe);
if((available_resource_DL_t *)0 != dci_node){
//dci_subframe += dci_candidate*num_dci_subframe;
break;
......@@ -147,6 +156,7 @@ void schedule_rar_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe){
TBS = get_tbs(7, I_tbs, &I_sf); // rar 7 bytes
Nrep = dl_rep[msg2_nodes->ce_level];
num_msg2_subframe = get_num_sf(I_sf) * Nrep;
//num_msg2_subframe = 8;
msg2_i_delay = find_suit_i_delay(rmax, r, dci_candidate);
......@@ -192,7 +202,7 @@ void schedule_rar_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe){
LOG_D(MAC,"[%04d][RA scheduler][MSG2][CE%d] rnti: %d preamble: %d fail vector %d\n", abs_subframe-1, msg2_nodes->ce_level, msg2_nodes->ra_rnti, msg2_nodes->preamble_index, fail);
msg2_nodes = msg2_nodes->next;
}else{
LOG_D(MAC,"[%04d][RA scheduler][MSG2][CE%d] rnti: %d preamble: %d scheduling success\n", abs_subframe-1, msg2_nodes->ce_level, msg2_nodes->ra_rnti, msg2_nodes->preamble_index);
LOG_I(MAC,"[%04d][RA scheduler][MSG2][CE%d] rnti: %d preamble: %d scheduling success\n", abs_subframe-1, msg2_nodes->ce_level, msg2_nodes->ra_rnti, msg2_nodes->preamble_index);
dci_result = (schedule_result_t *)calloc(1, sizeof(schedule_result_t));
msg2_result = (schedule_result_t *)calloc(1, sizeof(schedule_result_t));
dci_n0 = (DCIFormatN0_t *)malloc(sizeof(DCIFormatN0_t));
......@@ -263,9 +273,9 @@ void schedule_rar_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe){
msg2_nodes->ue_rnti = tc_rnti;
LOG_D(MAC,"[%04d][RA scheduler][MSG2] RARDCI %d-%d RAR %d-%d MSG3 %d-%d\n", abs_subframe-1, dci_first_subframe, dci_end_subframe, msg2_first_subframe, msg2_end_subframe, npusch_info.sf_start, npusch_info.sf_end);
LOG_D(MAC,"[%04d][RA scheduler][MSG2][CE%d] Change RA-RNTI %d->T-CRNTI %d\n", abs_subframe-1, msg2_nodes->ce_level, msg2_nodes->ra_rnti, msg2_nodes->ue_rnti);
LOG_D(MAC,"[%04d][RA scheduler][MSG2][CE%d] RAR DCI %d-%d RAR %d-%d MSG3 %d-%d\n", abs_subframe-1, msg2_nodes->ce_level, dci_first_subframe, dci_end_subframe, msg2_first_subframe, msg2_end_subframe, npusch_info.sf_start, npusch_info.sf_end);
LOG_I(MAC,"[%04d][RA scheduler][MSG2] RARDCI %d-%d RAR %d-%d MSG3 %d-%d\n", abs_subframe-1, dci_first_subframe, dci_end_subframe, msg2_first_subframe, msg2_end_subframe, npusch_info.sf_start, npusch_info.sf_end);
LOG_I(MAC,"[%04d][RA scheduler][MSG2][CE%d] Change RA-RNTI %d->T-CRNTI %d\n", abs_subframe-1, msg2_nodes->ce_level, msg2_nodes->ra_rnti, msg2_nodes->ue_rnti);
LOG_I(MAC,"[%04d][RA scheduler][MSG2][CE%d] RAR DCI %d-%d RAR %d-%d MSG3 %d-%d\n", abs_subframe-1, msg2_nodes->ce_level, dci_first_subframe, dci_end_subframe, msg2_first_subframe, msg2_end_subframe, npusch_info.sf_start, npusch_info.sf_end);
// fill dci resource
fill_resource_DL(mac_inst, dci_node, dci_first_subframe, dci_end_subframe, dci_result);
......@@ -313,6 +323,8 @@ void schedule_rar_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe){
mac_inst->RA_msg3_list.tail = migrate_node;
}
LOG_I(MAC,"RAR schedule Done\n");
}
if(flag==1)
......@@ -863,10 +875,10 @@ void schedule_RA_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst){
schedule_subframe = schedule_subframe % 1048576; // 20 bits, 10 bits + 10 bits
// this is the priority order in current stage.
schedule_msg3_retransimission_NB_IoT(mac_inst, schedule_subframe);
schedule_rar_NB_IoT(mac_inst, schedule_subframe);
schedule_msg4_NB_IoT(mac_inst, schedule_subframe);
return ;
}
......
......@@ -175,7 +175,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
if(schedule_result_list_DL->direction == DL)
{
LOG_D(MAC,"NB-IoT fill DL_DCI\n");
LOG_I(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;
......@@ -204,7 +204,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;
}else if(schedule_result_list_DL->direction == UL)
{
LOG_D(MAC,"NB-IoT fill DL_DCI\n");
LOG_I(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]NB-IoT fill DL_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));
......@@ -227,7 +227,7 @@ 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");
LOG_I(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;
......
......@@ -1381,6 +1381,8 @@ available_resource_DL_t *check_resource_DL(eNB_MAC_INST_NB_IoT *mac_inst, int ch
if(num_subframes <= calculate_DLSF(mac_inst, check_subframe, pt->end_subframe)){
diff_gap = num_subframes - calculate_DLSF(mac_inst, check_subframe, end_subframe);
LOG_D(MAC,"Diff_gap : %d num_subframes : %d \n",diff_gap,num_subframes);
while(diff_gap){
++end_subframe;
......@@ -1388,6 +1390,7 @@ available_resource_DL_t *check_resource_DL(eNB_MAC_INST_NB_IoT *mac_inst, int ch
--diff_gap;
}
}
*out_last_subframe = end_subframe;
while(!is_dlsf(mac_inst, check_subframe)){
++check_subframe;
......
......@@ -11,28 +11,32 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO)
Sched_Rsp_NB_IoT_t *SCHED_info = &mac_inst->Sched_INFO;;
//UE_TEMPLATE_NB_IoT *UE_info;
/* Disable uplink RX function for now
//If there is a preamble, do the initiate RA procedure
if(UL_INFO->NRACH.number_of_initial_scs_detected>0)
if(UL_INFO->nrach_ind.number_of_initial_scs_detected>0)
{
for(i=0;i<UL_INFO->NRACH.number_of_initial_scs_detected;i++)
for(i=0;i<UL_INFO->nrach_ind.number_of_initial_scs_detected;i++)
{
// 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
LOG_I(MAC,"Init_RA_NB_IoT in\n");
init_RA_NB_IoT(mac_inst,
(UL_INFO->NRACH.nrach_pdu_list+i)->nrach_indication_rel13.initial_sc,
(UL_INFO->NRACH.nrach_pdu_list+i)->nrach_indication_rel13.nrach_ce_level,
(UL_INFO->nrach_ind.nrach_pdu_list+i)->nrach_indication_rel13.initial_sc,
(UL_INFO->nrach_ind.nrach_pdu_list+i)->nrach_indication_rel13.nrach_ce_level,
UL_INFO->frame,
//timing_offset = Timing_advance * 16
(UL_INFO->NRACH.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_I(MAC,"Init_RA_NB_IoT Out\n");
}
}
UL_INFO->nrach_ind.number_of_initial_scs_detected = 0;
/* Disable uplink RX function for now
// crc indication if there is error for this round UL transmission
if(UL_INFO->crc_ind.number_of_crcs>0)
......@@ -85,6 +89,8 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO)
eNB_dlsch_ulsch_scheduler_NB_IoT(mac_inst,abs_subframe);
mac_inst->if_inst_NB_IoT->schedule_response(&mac_inst->Sched_INFO);
LOG_D(MAC,"After scheduler & schedule response\n");
/*
free(SCHED_info->TX_req->tx_request_body.tx_pdu_list);
free(SCHED_info->HI_DCI0_req->hi_dci0_request_body.hi_dci0_pdu_list);
......
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