Commit 4681ca53 authored by Nick Ho's avatar Nick Ho

fix RAR PDU value and Timing issue in MAC

parent d561abff
...@@ -149,6 +149,8 @@ int generate_SIB23(NB_IoT_eNB_NDLSCH_t *SIB23, ...@@ -149,6 +149,8 @@ int generate_SIB23(NB_IoT_eNB_NDLSCH_t *SIB23,
if( SIB23->active == 1 ) if( SIB23->active == 1 )
{ {
//LOG_I(PHY,"[Frame: %d][Subframe: %d]sent SIB23\n",frame,subframe);
uint8_t *SIB23_pdu = SIB23->harq_process->pdu; uint8_t *SIB23_pdu = SIB23->harq_process->pdu;
uint32_t rep = SIB23->resource_assignment; uint32_t rep = SIB23->resource_assignment;
uint8_t eutra_control_region = 3; uint8_t eutra_control_region = 3;
......
...@@ -48,7 +48,7 @@ void init_RA_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint8_t preamble_index, ce_le ...@@ -48,7 +48,7 @@ void init_RA_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint8_t preamble_index, ce_le
} }
migrate_node->active = 1; migrate_node->active = 1;
migrate_node->preamble_index = 0; migrate_node->preamble_index = preamble_index;
migrate_node->ce_level = ce_level; migrate_node->ce_level = ce_level;
migrate_node->ra_rnti = (sfn_id>>2) + 1; migrate_node->ra_rnti = (sfn_id>>2) + 1;
migrate_node->ta = ta; migrate_node->ta = ta;
...@@ -125,7 +125,7 @@ void schedule_rar_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe){ ...@@ -125,7 +125,7 @@ void schedule_rar_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe){
LOG_D(MAC,"rmax : %d, num_dci_subframe : %d, dci_subframe: %d\n",rmax,r,dci_subframe); LOG_D(MAC,"rmax : %d, num_dci_subframe : %d, dci_subframe: %d\n",rmax,r,dci_subframe);
//print_available_resource_DL(mac_inst); print_available_resource_DL(mac_inst);
for(dci_candidate=0; dci_candidate<num_candidate; ++dci_candidate){ for(dci_candidate=0; dci_candidate<num_candidate; ++dci_candidate){
...@@ -280,7 +280,7 @@ void schedule_rar_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe){ ...@@ -280,7 +280,7 @@ void schedule_rar_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe){
//msg2_nodes->ue_rnti = tc_rnti; //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_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_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] 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_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);
...@@ -931,9 +931,11 @@ void fill_rar_NB_IoT( ...@@ -931,9 +931,11 @@ void fill_rar_NB_IoT(
uint8_t subcarrier_indication = schedule_template->subcarrier_indication; // 6bits uint8_t subcarrier_indication = schedule_template->subcarrier_indication; // 6bits
uint8_t i_delay = msg3_schedule_delay; // 2bits uint8_t i_delay = msg3_schedule_delay; // 2bits
uint8_t msg3_repetition = msg3_rep;// 3bit uint8_t msg3_repetition = msg3_rep;// 3bit
uint8_t mcs_index = 0;//3bit, msg3 88bits 3'b000 uint8_t mcs_index = 2;//3bit, msg3 88bits 3'b000
rar[1] |= (subcarrier_spacing<<4) | (subcarrier_indication>>3); LOG_I(MAC,"Dump UL Grant: subcarrier spacing : %d, subcarrier indication: %d, delay : %d, Rep : %d, MCS : %d\n",subcarrier_spacing,subcarrier_indication,i_delay,msg3_repetition,mcs_index);
rar[1] |= (subcarrier_spacing<<3) | (subcarrier_indication>>3);
rar[2] = (uint8_t)(subcarrier_indication<<5) | (i_delay<<3) | msg3_repetition; rar[2] = (uint8_t)(subcarrier_indication<<5) | (i_delay<<3) | msg3_repetition;
rar[3] = (mcs_index<<5)&0xe0; // maped rar[3] = (mcs_index<<5)&0xe0; // maped
......
...@@ -49,7 +49,7 @@ int fixed_scheduler(uint32_t frame, uint32_t subframe, Sched_Rsp_NB_IoT_t *SCHED ...@@ -49,7 +49,7 @@ int fixed_scheduler(uint32_t frame, uint32_t subframe, Sched_Rsp_NB_IoT_t *SCHED
{ {
RARNTI = 1 + preamble_sfn/4; RARNTI = 1 + preamble_sfn/4;
//DCI //DCI
LOG_I(MAC,"[frame:%2d][subframe:%2d]NB-IoT fill DL_DCI\n",frame,subframe); 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; 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;
......
...@@ -1085,22 +1085,28 @@ void maintain_available_resource(eNB_MAC_INST_NB_IoT *mac_inst){ ...@@ -1085,22 +1085,28 @@ void maintain_available_resource(eNB_MAC_INST_NB_IoT *mac_inst){
available_resource_UL_t *pfree2, *iterator2; available_resource_UL_t *pfree2, *iterator2;
schedule_result_t *iterator1; schedule_result_t *iterator1;
if(available_resource_DL != (available_resource_DL_t *)0){ if(available_resource_DL != (available_resource_DL_t *)0){
LOG_D(MAC,"[maintain]current:%d, end:%d\n",mac_inst->current_subframe,available_resource_DL->end_subframe);
if(mac_inst->current_subframe >= available_resource_DL->end_subframe){ if(mac_inst->current_subframe >= available_resource_DL->end_subframe){
pfree = available_resource_DL; pfree = available_resource_DL;
if(available_resource_DL->next == (available_resource_DL_t *)0){ if(available_resource_DL->next == (available_resource_DL_t *)0){
//DEBUG("[maintain_available_resource]=====t:%d=====dl resource list next is NULL %d\n", mac_inst->current_subframe, available_resource_DL->end_subframe); LOG_D(MAC,"[maintain_available_resource]=====t:%d=====dl resource list next is NULL %d\n", mac_inst->current_subframe, available_resource_DL->end_subframe);
available_resource_DL = (available_resource_DL_t *)0; available_resource_DL = (available_resource_DL_t *)0;
}else{ }else{
//DEBUG("[maintain_available_resource]=====t:%d=====dl resource list remove next:%d-%d\n", mac_inst->current_subframe, available_resource_DL->next->start_subframe, available_resource_DL->next->end_subframe); LOG_D(MAC,"[maintain_available_resource]=====t:%d=====dl resource list remove next:%d-%d\n", mac_inst->current_subframe, available_resource_DL->next->start_subframe, available_resource_DL->next->end_subframe);
available_resource_DL = available_resource_DL->next; available_resource_DL = available_resource_DL->next;
available_resource_DL->prev = (available_resource_DL_t *)0; available_resource_DL->prev = (available_resource_DL_t *)0;
} }
free((available_resource_DL_t *)pfree); free((available_resource_DL_t *)pfree);
}else{ }else{
available_resource_DL->start_subframe = mac_inst->current_subframe; // only update when current subframe bigger than to start subframe
if(mac_inst->current_subframe > available_resource_DL->start_subframe)
{
LOG_D(MAC,"[maintain] update from %d to current %d, ori end %d\n",available_resource_DL->start_subframe,mac_inst->current_subframe,available_resource_DL->end_subframe);
available_resource_DL->start_subframe = mac_inst->current_subframe;
}else
LOG_D(MAC,"[maintain] do nothing\n");
} }
} }
// UL // UL
......
...@@ -29,7 +29,7 @@ void enable_preamble_simulation(UL_IND_NB_IoT_t *UL_INFO,int i) ...@@ -29,7 +29,7 @@ void enable_preamble_simulation(UL_IND_NB_IoT_t *UL_INFO,int i)
tmp++; tmp++;
} }
*/ */
if(UL_INFO->frame==528 && UL_INFO->subframe==8) if(UL_INFO->frame==516 && UL_INFO->subframe==8)
{ {
simulate_preamble(UL_INFO,2,26); simulate_preamble(UL_INFO,2,26);
//tmp++; //tmp++;
......
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