Commit d280abce authored by Nick Ho's avatar Nick Ho

modify NDI

parent ac71394e
......@@ -184,6 +184,7 @@ typedef struct {
DLSCH_PDU_NB_IoT Security_pdu;
DLSCH_PDU_NB_IoT Attach_pdu;
DLSCH_PDU_NB_IoT ping_pdu;
DLSCH_PDU_NB_IoT Attach2_pdu;
/// DLSCH pdu
DLSCH_PDU_NB_IoT DLSCH_pdu;
......
......@@ -34,7 +34,7 @@
int Security_flag = 0;
int Attach_flag = 0;
int Attach_flag2 = 0;
int ping_flag = 0;
uint8_t from_R_dl_to_idx(uint8_t R)
{
......@@ -114,7 +114,7 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
#if 1
if(UE_info->HARQ_round==0)
{
if (Security_flag == 0 & Attach_flag == 0 && Attach_flag2 == 0)
if (Security_flag == 0 & Attach_flag == 0 && Attach_flag2 == 0 && ping_flag == 0)
{
//Get RLC status
rlc_status = mac_rlc_status_ind(
......@@ -280,6 +280,30 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
printf("%02x ",UE_info->DLSCH_pdu.payload[y]);
}
printf("\n");
}else if (ping_flag == 1)
{
memcpy(UE_info->DLSCH_pdu.payload,UE_info->ping_pdu.payload,UE_info->ping_pdu.pdu_size);
UE_info->DLSCH_pdu_size= UE_info->ping_pdu.pdu_size;
data_size = UE_info->DLSCH_pdu_size;
if(data_size == 0)
{
LOG_D(MAC,"[%04d][DLSchedulerUSS][Fail] No data in DCCH0_NB_IoT\n", mac_inst->current_subframe);
return -1;
}
if(TBS >= data_size) // control and data
{
TBS = get_tbs(data_size, I_tbs, &I_sf);
LOG_I(MAC,"[%04d][DLSchedulerUSS] TBS change to %d because data size is smaller than previous TBS\n", mac_inst->current_subframe, TBS);
}
printf("print the MAC DATA PDU including length payload, we have header %d byte \n",data_size);
//int y;
for (y=0;y<TBS;y++)
{
//for (y=0;y<payload_offset+mac_sdu_size2;y++){
printf("%02x ",UE_info->DLSCH_pdu.payload[y]);
}
printf("\n");
}
if (rlc_data_pdu_size == 20 && Security_flag == 0)
......@@ -306,6 +330,13 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
return -1;
}
if (rlc_data_pdu_size == 81 && ping_flag == 0)
{
memcpy(UE_info->ping_pdu.payload,UE_info->DLSCH_pdu.payload,TBS);
UE_info->ping_pdu.pdu_size = TBS;
ping_flag = 1;
return -1;
}
}
/*Retransmission*/
......@@ -377,7 +408,7 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
//toggle NDI
if(flag_retransmission==0)
{
if(TBS==26)
if(TBS==26 || ping_flag ==1)
{
UE_info->oldNDI_DL=1;
}else
......@@ -429,6 +460,8 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
Attach_flag = 0;
if (Attach_flag2 == 1)
Attach_flag2 = 0;
if (ping_flag == 1)
ping_flag = 0;
LOG_I(MAC,"[%04d][DLSchedulerUSS][%d][Success] Complete scheduling with data size %d\n", mac_inst->current_subframe, UE_info->rnti, data_size);
//LOG_D(MAC,"[%04d][DLSchedulerUSS] RNTI %d\n", mac_inst->current_subframe, UE_info->rnti);
LOG_I(MAC,"[%04d][DLSchedulerUSS][%d][Success] Allocate NPDCCH subframe %d to subframe %d candidate index %d\n", mac_inst->current_subframe, UE_info->rnti, NPDCCH_info->sf_start, NPDCCH_info->sf_end, cdd_num);
......@@ -737,6 +770,7 @@ void fill_DCI_N1(DCIFormatN1_t *DCI_N1, UE_TEMPLATE_NB_IoT *UE_info, UE_SCHED_CT
DCI_N1->mcs = UE_sched_ctrl_info->dci_n1_index_mcs;
DCI_N1->RepNum = UE_sched_ctrl_info->dci_n1_index_R_data;
DCI_N1->HARQackRes = UE_sched_ctrl_info->dci_n1_index_ack_nack;
DCI_N1->ndi = UE_info->oldNDI_DL;
//DCI_N1->DCIRep = 3-UE_info->R_max/UE_info->R_dci/2;
DCI_N1->DCIRep=get_DCI_REP(UE_sched_ctrl_info->R_dci, UE_info->R_max);
LOG_I(MAC,"[fill_DCI_N1] Type %d order %d I_delay %d I_SF %d I_mcs %d I_rep %d I_harq %d I_dci %d\n", DCI_N1->type, DCI_N1->orderIndicator, DCI_N1->Scheddly, DCI_N1->ResAssign, DCI_N1->mcs, DCI_N1->RepNum, DCI_N1->HARQackRes, DCI_N1->DCIRep);
......
......@@ -2621,6 +2621,8 @@ rlc_op_status_t rlc_data_req_NB_IoT (const protocol_ctxt_t* const ctxt_pP,
waiting_flag_from_RLC = 1;
block_RLC = 1;
}
waiting_flag_from_RLC = 1;
return RLC_OP_STATUS_OK;
} else {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
......
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