Commit f9f541cd authored by Matthieu Kanj's avatar Matthieu Kanj

UL_indication for ACK

parent 84b310c2
......@@ -1646,12 +1646,12 @@ uint32_t turbo_decoding_NB_IoT(PHY_VARS_eNB *eNB,
offset += (Kr_bytes- ((ulsch_harq->C>1)?3:0));
}
fill_crc_indication_NB_IoT(eNB,0,rx_frame,rx_subframe,1,1); // indicate ACK to MAC
fill_rx_indication_NB_IoT(eNB,proc,npusch_format,ulsch_NB_IoT->Msg3_flag,1);
fill_crc_indication_NB_IoT(eNB,0,rx_frame,rx_subframe,1); // indicate ACK to MAC
fill_rx_indication_NB_IoT(eNB,proc,npusch_format,1);
printf(" MSG3 OK");
} else {
fill_crc_indication_NB_IoT(eNB,0,rx_frame,rx_subframe,0,0); // indicate NAK to MAC
fill_rx_indication_NB_IoT(eNB,proc,npusch_format,ulsch_NB_IoT->Msg3_flag,0);
fill_crc_indication_NB_IoT(eNB,0,rx_frame,rx_subframe,0); // indicate NAK to MAC
fill_rx_indication_NB_IoT(eNB,proc,npusch_format,0);
printf(" MSG3 NOT OK");
}
} //////////// r loop end ////////////
......@@ -1789,14 +1789,14 @@ void decode_NPUSCH_msg_NB_IoT(PHY_VARS_eNB *eNB,
printf("\n\n\n");
if (counter_ack>8) //hard decision
{
fill_crc_indication_NB_IoT(eNB,0,rx_frame,rx_subframe,1,1); // indicate ACK to MAC
fill_rx_indication_NB_IoT(eNB,proc,npusch_format,ulsch_NB_IoT->Msg3_flag,1);
//fill_crc_indication_NB_IoT(eNB,0,rx_frame,rx_subframe,1); // indicate ACK to MAC
fill_rx_indication_NB_IoT(eNB,proc,npusch_format,1);
printf(" decoded msg5: ACK ");
} else if (counter_ack<8) { //hard decision
fill_crc_indication_NB_IoT(eNB,0,rx_frame,rx_subframe,0,0); // indicate NAK to MAC
fill_rx_indication_NB_IoT(eNB,proc,npusch_format,ulsch_NB_IoT->Msg3_flag,0);
//fill_crc_indication_NB_IoT(eNB,0,rx_frame,rx_subframe,0); // indicate NAK to MAC
fill_rx_indication_NB_IoT(eNB,proc,npusch_format,0);
printf(" decoded msg5: NACK ");
} else { //when equality (8 bits 0 vs 8 bits 1), soft decision
......@@ -1809,12 +1809,12 @@ void decode_NPUSCH_msg_NB_IoT(PHY_VARS_eNB *eNB,
}
if (counter_ack_soft>=0) // decision
{
fill_crc_indication_NB_IoT(eNB,0,rx_frame,rx_subframe,1,1); // indicate ACK to MAC
fill_rx_indication_NB_IoT(eNB,proc,npusch_format,ulsch_NB_IoT->Msg3_flag,1);
// fill_crc_indication_NB_IoT(eNB,0,rx_frame,rx_subframe,1); // indicate ACK to MAC
fill_rx_indication_NB_IoT(eNB,proc,npusch_format,1);
printf(" decoded msg5 (soft): ACK ");
} else {
fill_crc_indication_NB_IoT(eNB,0,rx_frame,rx_subframe,0,0); // indicate NAK to MAC
fill_rx_indication_NB_IoT(eNB,proc,npusch_format,ulsch_NB_IoT->Msg3_flag,1);
//fill_crc_indication_NB_IoT(eNB,0,rx_frame,rx_subframe,0); // indicate NAK to MAC
fill_rx_indication_NB_IoT(eNB,proc,npusch_format,0);
printf(" decoded msg5 (soft): NACK ");
}
}
......
......@@ -53,9 +53,9 @@ uint32_t rx_nprach_NB_IoT(PHY_VARS_eNB *eNB,int frame, uint8_t subframe, uint16_
void npusch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc);
////////////////// NB-IoT testing ////////////////////
void fill_rx_indication_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t data_or_control, uint8_t msg3_flag, uint8_t ACK_NACK);
void fill_rx_indication_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t data_or_control, uint8_t decode_flag);
void fill_crc_indication_NB_IoT(PHY_VARS_eNB *eNB,int UE_id,int frame,int subframe,uint8_t crc_flag, uint8_t ACK_NACK);
void fill_crc_indication_NB_IoT(PHY_VARS_eNB *eNB,int UE_id,int frame,int subframe,uint8_t decode_flag);
#endif
......
......@@ -1575,12 +1575,24 @@ uint32_t rx_nprach_NB_IoT(PHY_VARS_eNB *eNB, int frame, uint8_t subframe, uint16
}
void fill_crc_indication_NB_IoT(PHY_VARS_eNB *eNB,int UE_id,int frame,int subframe,uint8_t crc_flag, uint8_t ACK_NACK) {
void fill_crc_indication_NB_IoT(PHY_VARS_eNB *eNB,int UE_id,int frame,int subframe,uint8_t decode_flag) {
pthread_mutex_lock(&eNB->UL_INFO_mutex);
// nfapi_crc_indication_pdu_t* crc_pdu_list
nfapi_crc_indication_pdu_t *pdu = &eNB->UL_INFO.crc_ind.crc_pdu_list[0]; //[eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs];
pdu->rx_ue_information.rnti = eNB->ulsch_NB_IoT[0]->rnti; /// OK
pdu->crc_indication_rel8.crc_flag = decode_flag;
if(decode_flag == 1)
{
eNB->UL_INFO.crc_ind.number_of_crcs++;
} else {
eNB->UL_INFO.crc_ind.number_of_crcs =0;
}
// nfapi_crc_indication_pdu_t* crc_pdu_list
///eNB->UL_INFO.crc_ind.sfn_sf = frame<<4 | subframe;
//eNB->UL_INFO.crc_ind.header.message_id = NFAPI_CRC_INDICATION;
//eNB->UL_INFO.crc_ind.crc_indication_body.tl.tag = NFAPI_CRC_INDICATION_BODY_TAG;
......@@ -1588,42 +1600,59 @@ void fill_crc_indication_NB_IoT(PHY_VARS_eNB *eNB,int UE_id,int frame,int subfra
//pdu->instance_length = 0; // don't know what to do with this
// pdu->rx_ue_information.handle = handle;
///////////////////////pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
pdu->rx_ue_information.rnti = eNB->ulsch_NB_IoT[0]->rnti; /// OK
//////////////////////////pdu->crc_indication_rel8.tl.tag = NFAPI_CRC_INDICATION_REL8_TAG;
pdu->crc_indication_rel8.crc_flag = crc_flag;
if(ACK_NACK == 1)
{
eNB->UL_INFO.crc_ind.number_of_crcs++;
} else {
eNB->UL_INFO.crc_ind.number_of_crcs =0;
}
//LOG_D(PHY, "%s() rnti:%04x crcs:%d crc_flag:%d\n", __FUNCTION__, pdu->rx_ue_information.rnti, eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs, crc_flag);
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
}
void fill_rx_indication_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t data_or_control, uint8_t msg3_flag, uint8_t ACK_NACK)
void fill_rx_indication_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t data_or_control, uint8_t decode_flag)
{
nfapi_rx_indication_pdu_t *pdu;
nfapi_nb_harq_indication_pdu_t *ack_ind; // &eNB->UL_INFO.nb_harq_ind.nb_harq_indication_body.nb_harq_pdu_list[0] // nb_harq_indication_fdd_rel13->harq_tb1
pthread_mutex_lock(&eNB->UL_INFO_mutex);
if (data_or_control == 0) // format 1
{
if(ACK_NACK == 1)
if(decode_flag == 1)
{
eNB->UL_INFO.RX_NPUSCH.number_of_pdus = 1;
} else {
eNB->UL_INFO.RX_NPUSCH.number_of_pdus = 0;
}
pdu = &eNB->UL_INFO.RX_NPUSCH.rx_pdu_list[0];
pdu->rx_ue_information.rnti = eNB->ulsch_NB_IoT[0]->rnti;
pdu->rx_indication_rel8.length = eNB->ulsch_NB_IoT[0]->harq_process->TBS; //eNB->ulsch_NB_IoT[0]->harq_process->TBS>>3;
pdu->data = eNB->ulsch_NB_IoT[0]->harq_process->b;
} else { // format 2
if(decode_flag == 1)
{
ack_ind = &eNB->UL_INFO.nb_harq_ind.nb_harq_indication_body.nb_harq_pdu_list[0];
ack_ind->nb_harq_indication_fdd_rel13.harq_tb1 = 1;
ack_ind->rx_ue_information.rnti = eNB->ulsch_NB_IoT[0]->rnti;
} else {
ack_ind = &eNB->UL_INFO.nb_harq_ind.nb_harq_indication_body.nb_harq_pdu_list[0];
ack_ind->nb_harq_indication_fdd_rel13.harq_tb1 = 2;
ack_ind->rx_ue_information.rnti = eNB->ulsch_NB_IoT[0]->rnti;
}
}
//eNB->UL_INFO.RX_NPUSCH.rx_pdu_list.rx_ue_information.tl.tag = NFAPI_RX_INDICATION_BODY_TAG; // do we need this ??
//eNB->UL_INFO.RX_NPUSCH.rx_pdu_list.rx_ue_information.rnti = rnti; // rnti should be got from eNB structure
//pdu = &eNB->UL_INFO.RX_NPUSCH.rx_pdu_list[eNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus];
pdu = &eNB->UL_INFO.RX_NPUSCH.rx_pdu_list[0];
// pdu->rx_ue_information.handle = eNB->ulsch[UE_id]->handle;
// pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
//pdu->rx_indication_rel8.tl.tag = NFAPI_RX_INDICATION_REL8_TAG;
pdu->rx_ue_information.rnti = eNB->ulsch_NB_IoT[0]->rnti;
/*if(msg3_flag == 1)
......@@ -1637,8 +1666,7 @@ void fill_rx_indication_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t d
}
} else { */
pdu->rx_indication_rel8.length = eNB->ulsch_NB_IoT[0]->harq_process->TBS; //eNB->ulsch_NB_IoT[0]->harq_process->TBS>>3;
pdu->data = eNB->ulsch_NB_IoT[0]->harq_process->b;
//}
//pdu->data = eNB->ulsch_NB_IoT[UE_id]->harq_processes[harq_pid]->b;
//eNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus++;
......
......@@ -159,6 +159,10 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
PHY_vars_eNB->UL_INFO.RX_NPUSCH.rx_pdu_list = (nfapi_rx_indication_pdu_t *)malloc16(sizeof(nfapi_rx_indication_pdu_t));
PHY_vars_eNB->UL_INFO.RX_NPUSCH.rx_pdu_list[0].data = (unsigned char*)malloc(300);
PHY_vars_eNB->UL_INFO.nb_harq_ind.nb_harq_indication_body.nb_harq_pdu_list = (nfapi_nb_harq_indication_pdu_t*)malloc16(sizeof(nfapi_nb_harq_indication_pdu_t));
//nfapi_nb_harq_indication_t nb_harq_ind
PHY_vars_eNB->ndlsch_SIB1->rnti = 0xffff;
PHY_vars_eNB->ndlsch_SIB23->rnti = 0xffff;
......
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