Commit 5ffb2386 authored by Nick Ho's avatar Nick Ho

Merge branch 'develop-nb-iot' of...

Merge branch 'develop-nb-iot' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot
parents 606403cf 10e7d9f2
...@@ -285,6 +285,7 @@ int ul_chest_tmp_NB_IoT(int32_t **rxdataF_ext, ...@@ -285,6 +285,7 @@ int ul_chest_tmp_NB_IoT(int32_t **rxdataF_ext,
uint8_t pilot_pos2, uint8_t pilot_pos2,
uint16_t ul_sc_start, uint16_t ul_sc_start,
uint8_t Qm, uint8_t Qm,
uint16_t N_SF_per_word,
LTE_DL_FRAME_PARMS *frame_parms) LTE_DL_FRAME_PARMS *frame_parms)
{ {
//int pilot_pos1 = 3, pilot_pos2 = 10; // holds for npusch format 1, and 15 kHz subcarrier bandwidth //int pilot_pos1 = 3, pilot_pos2 = 10; // holds for npusch format 1, and 15 kHz subcarrier bandwidth
...@@ -312,7 +313,7 @@ int ul_chest_tmp_NB_IoT(int32_t **rxdataF_ext, ...@@ -312,7 +313,7 @@ int ul_chest_tmp_NB_IoT(int32_t **rxdataF_ext,
{ {
received_data = (int16_t *)&rxdataF_ext[aa][symbol_offset]; received_data = (int16_t *)&rxdataF_ext[aa][symbol_offset];
estimated_channel = (int16_t *)&ul_ch_estimates[aa][symbol_offset]; estimated_channel = (int16_t *)&ul_ch_estimates[aa][symbol_offset];
pilot_sig = &ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU][24 + 24*((8-counter_msg3)*2+Ns)-(ul_sc_start<<1)]; // pilot values depends on the slots pilot_sig = &ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU][24 + 24*((N_SF_per_word-counter_msg3)*2+Ns)-(ul_sc_start<<1)]; // pilot values depends on the slots
for (k=0;k<12;k++) for (k=0;k<12;k++)
{ {
......
...@@ -113,10 +113,10 @@ uint16_t get_UL_N_ru_NB_IoT(uint8_t I_mcs, uint8_t I_ru, uint8_t flag_msg3) ...@@ -113,10 +113,10 @@ uint16_t get_UL_N_ru_NB_IoT(uint8_t I_mcs, uint8_t I_ru, uint8_t flag_msg3)
uint16_t get_UL_sc_index_start_NB_IoT(uint8_t subcarrier_spacing, uint16_t I_sc, uint8_t npush_format) uint16_t get_UL_sc_index_start_NB_IoT(uint8_t subcarrier_spacing, uint16_t I_sc, uint8_t npush_format)
{ {
if(npush_format == 1) if(npush_format == 0) // format 1
{ {
if(subcarrier_spacing == 0) ////////// 15 KHz if(subcarrier_spacing == 1) ////////// 15 KHz
{ {
if (0<=I_sc && I_sc<12) if (0<=I_sc && I_sc<12)
...@@ -149,7 +149,7 @@ uint16_t get_UL_sc_index_start_NB_IoT(uint8_t subcarrier_spacing, uint16_t I_sc, ...@@ -149,7 +149,7 @@ uint16_t get_UL_sc_index_start_NB_IoT(uint8_t subcarrier_spacing, uint16_t I_sc,
} else { /////////////////////////////////////// format 2 } else { /////////////////////////////////////// format 2
if(subcarrier_spacing == 0) ////////// 15 KHz if(subcarrier_spacing == 1) ////////// 15 KHz
{ {
return(tab_ack_15khz[I_sc]); return(tab_ack_15khz[I_sc]);
...@@ -167,9 +167,9 @@ uint16_t get_UL_sc_index_start_NB_IoT(uint8_t subcarrier_spacing, uint16_t I_sc, ...@@ -167,9 +167,9 @@ uint16_t get_UL_sc_index_start_NB_IoT(uint8_t subcarrier_spacing, uint16_t I_sc,
uint8_t get_numb_UL_sc_NB_IoT(uint8_t subcarrier_spacing, uint8_t I_sc, uint8_t npush_format) uint8_t get_numb_UL_sc_NB_IoT(uint8_t subcarrier_spacing, uint8_t I_sc, uint8_t npush_format)
{ {
if(npush_format == 1) if(npush_format == 0) // format 1
{ {
if(subcarrier_spacing == 0) // 15 KHz if(subcarrier_spacing == 1) // 15 KHz
{ {
if(I_sc >= 0 && I_sc < 12) if(I_sc >= 0 && I_sc < 12)
...@@ -199,9 +199,9 @@ uint8_t get_UL_slots_per_RU_NB_IoT(uint8_t subcarrier_spacing, uint8_t subcarrie ...@@ -199,9 +199,9 @@ uint8_t get_UL_slots_per_RU_NB_IoT(uint8_t subcarrier_spacing, uint8_t subcarrie
{ {
uint8_t subcarrier_number = get_numb_UL_sc_NB_IoT(subcarrier_spacing, subcarrier_indcation, UL_format); uint8_t subcarrier_number = get_numb_UL_sc_NB_IoT(subcarrier_spacing, subcarrier_indcation, UL_format);
if(UL_format == 1) // format 1 if(UL_format == 0) // format 1
{ {
if(subcarrier_spacing == 0) // 15 KHz if(subcarrier_spacing == 1) // 15 KHz
{ {
if (subcarrier_number == 1 ) if (subcarrier_number == 1 )
{ {
......
...@@ -80,7 +80,7 @@ uint8_t NPRACH_detection_NB_IoT(int16_t *input_buffer,uint32_t input_length){ ...@@ -80,7 +80,7 @@ uint8_t NPRACH_detection_NB_IoT(int16_t *input_buffer,uint32_t input_length){
} }
//printf("energies = %ld %ld\n",energy_signal,energy_noise); //printf("energies = %ld %ld\n",energy_signal,energy_noise);
if ((uint64_t)(((uint64_t) energy_signal))<(uint64_t)energy_noise>>4){ if ((uint64_t)(((uint64_t) energy_signal))<(uint64_t)energy_noise>>6){
return 1; return 1;
}else{ }else{
...@@ -480,7 +480,7 @@ uint32_t process_nprach_NB_IoT(PHY_VARS_eNB *eNB, int frame, uint8_t subframe, u ...@@ -480,7 +480,7 @@ uint32_t process_nprach_NB_IoT(PHY_VARS_eNB *eNB, int frame, uint8_t subframe, u
*preamble_index = subcarrier_estimation(Rx_sub_sampled_buffer_128); *preamble_index = subcarrier_estimation(Rx_sub_sampled_buffer_128);
*timing_advance = 0; *timing_advance = 0;
*rnti = 1 + frame/4; *rnti = 1 + frame/4;
printf("estimated subaccier = %i\n",eNB->preamble_index_NB_IoT); printf("estimated subaccier = %i\n",*preamble_index);
return 1;//estimated_TA; return 1;//estimated_TA;
}else{ }else{
......
...@@ -540,6 +540,7 @@ int ul_chest_tmp_NB_IoT(int32_t **rxdataF_ext, ...@@ -540,6 +540,7 @@ int ul_chest_tmp_NB_IoT(int32_t **rxdataF_ext,
uint8_t pilot_pos2, uint8_t pilot_pos2,
uint16_t ul_sc_start, uint16_t ul_sc_start,
uint8_t Qm, uint8_t Qm,
uint16_t N_SF_per_word,
LTE_DL_FRAME_PARMS *frame_parms); LTE_DL_FRAME_PARMS *frame_parms);
/// Channel estimation for NPUSCH format 2 /// Channel estimation for NPUSCH format 2
......
...@@ -1255,6 +1255,7 @@ uint8_t rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -1255,6 +1255,7 @@ uint8_t rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB,
pilot_pos2, pilot_pos2,
ul_sc_start, ul_sc_start,
Qm, Qm,
N_SF_per_word,
fp); fp);
} else { } else {
/// Channel Estimation (NPUSCH format 2) /// Channel Estimation (NPUSCH format 2)
...@@ -1592,6 +1593,7 @@ uint8_t rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -1592,6 +1593,7 @@ uint8_t rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB,
//fill_rx_indication_NB_IoT(eNB,i,frame,subframe); // indicate SDU to MAC //fill_rx_indication_NB_IoT(eNB,i,frame,subframe); // indicate SDU to MAC
fill_rx_indication_NB_IoT(eNB,proc,npusch_format,ulsch_NB_IoT->Msg3_flag); fill_rx_indication_NB_IoT(eNB,proc,npusch_format,ulsch_NB_IoT->Msg3_flag);
printf(" MSG3 OK"); printf(" MSG3 OK");
//return 1;
} else { } else {
...@@ -1600,7 +1602,7 @@ uint8_t rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -1600,7 +1602,7 @@ uint8_t rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB,
fill_rx_indication_NB_IoT(eNB,proc,npusch_format,ulsch_NB_IoT->Msg3_flag); fill_rx_indication_NB_IoT(eNB,proc,npusch_format,ulsch_NB_IoT->Msg3_flag);
printf(" MSG3 NOT OK"); printf(" MSG3 NOT OK");
break; //return 0;
} }
}//////////// r loop end //////////// }//////////// r loop end ////////////
...@@ -1647,14 +1649,14 @@ uint8_t rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -1647,14 +1649,14 @@ uint8_t rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB,
fill_crc_indication_NB_IoT(eNB,0,rx_frame,rx_subframe,0); // indicate ACK to MAC fill_crc_indication_NB_IoT(eNB,0,rx_frame,rx_subframe,0); // indicate ACK to MAC
//fill_rx_indication_NB_IoT(eNB,i,frame,subframe); // indicate SDU to MAC //fill_rx_indication_NB_IoT(eNB,i,frame,subframe); // indicate SDU to MAC
fill_rx_indication_NB_IoT(eNB,proc,npusch_format,ulsch_NB_IoT->Msg3_flag); fill_rx_indication_NB_IoT(eNB,proc,npusch_format,ulsch_NB_IoT->Msg3_flag);
//return 1;
} else if (counter_ack<8) { //hard decision } else if (counter_ack<8) { //hard decision
printf(" decoded msg5: NACK "); printf(" decoded msg5: NACK ");
fill_crc_indication_NB_IoT(eNB,0,rx_frame,rx_subframe,1); // indicate NAK to MAC fill_crc_indication_NB_IoT(eNB,0,rx_frame,rx_subframe,1); // indicate NAK to MAC
//fill_rx_indication_NB_IoT(eNB,i,frame,subframe); // indicate SDU to MAC //fill_rx_indication_NB_IoT(eNB,i,frame,subframe); // indicate SDU to MAC
fill_rx_indication_NB_IoT(eNB,proc,npusch_format,ulsch_NB_IoT->Msg3_flag); fill_rx_indication_NB_IoT(eNB,proc,npusch_format,ulsch_NB_IoT->Msg3_flag);
//return 0;
} else { //when equality (8 bits 0 vs 8 bits 1), soft decision } else { //when equality (8 bits 0 vs 8 bits 1), soft decision
counter_ack_soft=0; counter_ack_soft=0;
...@@ -1670,13 +1672,14 @@ uint8_t rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -1670,13 +1672,14 @@ uint8_t rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB,
fill_crc_indication_NB_IoT(eNB,0,rx_frame,rx_subframe,0); // indicate ACK to MAC fill_crc_indication_NB_IoT(eNB,0,rx_frame,rx_subframe,0); // indicate ACK to MAC
//fill_rx_indication_NB_IoT(eNB,i,frame,subframe); // indicate SDU to MAC //fill_rx_indication_NB_IoT(eNB,i,frame,subframe); // indicate SDU to MAC
fill_rx_indication_NB_IoT(eNB,proc,npusch_format,ulsch_NB_IoT->Msg3_flag); fill_rx_indication_NB_IoT(eNB,proc,npusch_format,ulsch_NB_IoT->Msg3_flag);
//return 1;
} else { } else {
printf(" decoded msg5 (soft): NACK "); printf(" decoded msg5 (soft): NACK ");
fill_crc_indication_NB_IoT(eNB,0,rx_frame,rx_subframe,1); // indicate NAK to MAC fill_crc_indication_NB_IoT(eNB,0,rx_frame,rx_subframe,1); // indicate NAK to MAC
//fill_rx_indication_NB_IoT(eNB,i,frame,subframe); // indicate SDU to MAC //fill_rx_indication_NB_IoT(eNB,i,frame,subframe); // indicate SDU to MAC
fill_rx_indication_NB_IoT(eNB,proc,npusch_format,ulsch_NB_IoT->Msg3_flag); fill_rx_indication_NB_IoT(eNB,proc,npusch_format,ulsch_NB_IoT->Msg3_flag);
//return 0;
} }
} }
printf("\n\n\n"); printf("\n\n\n");
...@@ -1705,6 +1708,7 @@ uint8_t rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -1705,6 +1708,7 @@ uint8_t rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB,
{ {
ulsch_NB_IoT->counter_sf = N_SF_per_word; ulsch_NB_IoT->counter_sf = N_SF_per_word;
} }
return 1;
/////////////////////////////////////////END///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////END/////////////////////////////////////////////////////////////////////////////////////
} else { } else {
return 0; // create void function for NPUSCH ? return 0; // create void function for NPUSCH ?
......
...@@ -3216,6 +3216,7 @@ void fill_rx_indication_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t d ...@@ -3216,6 +3216,7 @@ void fill_rx_indication_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t d
for(m=0; m<6;m++) for(m=0; m<6;m++)
{ {
pdu->data[m] = eNB->ulsch_NB_IoT[0]->harq_process->b[2+m]; pdu->data[m] = eNB->ulsch_NB_IoT[0]->harq_process->b[2+m];
printf(" pdu content = %d \n", eNB->ulsch_NB_IoT[0]->harq_process->b[2+m]);
} }
} else { } else {
......
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