Commit 6b77528d authored by Matthieu Kanj's avatar Matthieu Kanj

NPUSCH functions

parent 58c39dcc
No related merge requests found
......@@ -627,12 +627,14 @@ typedef struct {
uint8_t scrambling_re_intialization_batch_index;
/// number of cell specific TX antenna ports assumed by the UE
uint8_t nrs_antenna_ports;
///
//////// nfapi param //////////////////////////////////////////
uint16_t C_init;
///
//////// nfapi param //////////////////////////////////////////////////
uint16_t SF_idx;
/// Determined the ACK/NACK delay and the subcarrier allocation TS 36.213 Table 16.4.2
uint8_t HARQ_ACK_resource;
/// Flag to trigger the storage of frame & subframe values for scrambling
uint8_t flag_scramble;
///////////// kept from LTE ///////////////////////////////////////////////////
......
......@@ -21,7 +21,7 @@
/*! \file PHY/LTE_TRANSPORT/lte_mcs_NB_IoT.c
* \brief Some support routines for subcarrier start into UL RB for ULSCH
* \author V. Savaux, M. KANJ
* \author M. KANJ
* \date 2017
* \version 0.1
* \company b<>com
......@@ -34,6 +34,11 @@
//#include "PHY/extern.h"
#include "PHY/LTE_TRANSPORT/proto_NB_IoT.h"
uint8_t tab_ack_15khz[16]= {0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3};
uint8_t tab_ack_3_75khz[16]= {38,39,40,41,42,43,44,45,38,39,40,41,42,43,44,45};
uint8_t tab_I_ru_N_ru_UL[8]= {1,2,3,4,5,6,8,10};
uint8_t tab_I_rep_N_rep_UL[8]={1,2,4,8,16,32,64,128};
// Section 16.5.1.1 in 36.213
uint16_t get_UL_sc_start_NB_IoT(uint16_t I_sc)
{
......@@ -65,3 +70,164 @@ uint16_t get_UL_sc_start_NB_IoT(uint16_t I_sc)
}
uint16_t get_UL_N_rep_NB_IoT(uint8_t I_rep)
{
return tab_I_rep_N_rep_UL[I_rep];
}
uint16_t get_UL_N_ru_NB_IoT(uint8_t I_mcs, uint8_t I_ru, uint8_t flag_msg3)
{
if(flag_msg3 ==1) // msg3
{
if(I_mcs == 0)
{
return 4;
} else if(I_mcs == 1) {
return 3;
} else if(I_mcs == 2) {
return 1;
} else {
printf("error in I_mcs value from nfapi");
return 0;
}
} else { // other NPUSCH
return tab_I_ru_N_ru_UL[I_ru];
}
}
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(subcarrier_spacing == 0) ////////// 15 KHz
{
if (0<=I_sc && I_sc<12)
{
return I_sc;
} else if (12<=I_sc && I_sc<16) {
return 3*(I_sc-12);
} else if (16<=I_sc && I_sc<18) {
return 6*(I_sc-16);
} else if (I_sc==18){
return 0;
} else {
return -1;
printf("Error in passed nfapi parameters (I_sc)");
}
} else { //////////// 3.75 KHz
return I_sc; /// values 0-47
}
} else { /////////////////////////////////////// format 2
if(subcarrier_spacing == 0) ////////// 15 KHz
{
return(tab_ack_15khz[I_sc]);
} else { //////////// 3.75 KHz
return(tab_ack_3_75khz[I_sc]);
}
}
}
///////////////////////////////////////////////
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(subcarrier_spacing == 0) // 15 KHz
{
if(I_sc >= 0 && I_sc < 12)
{
return 1;
} else if (I_sc >= 12 && I_sc < 16) {
return 3;
} else if (I_sc >= 16 && I_sc < 18) {
return 6;
} else if (I_sc == 18) {
return 12;
} else {
return 0;
}
} else {
return 1;
}
} else {
return 1;
}
}
////////////////////////////////////////////////////
uint8_t get_UL_slots_per_RU_NB_IoT(uint8_t subcarrier_spacing, uint8_t subcarrier_indcation, uint8_t 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(subcarrier_spacing == 0) // 15 KHz
{
if (subcarrier_number == 1 )
{
return 16;
} else if (subcarrier_number == 3) {
return 8;
} else if (subcarrier_number == 6) {
return 4;
} else {
return 2;
}
} else { // 3.75 KHz
return 16;
}
} else { // format 2
return 4;
}
}
......@@ -378,8 +378,7 @@ uint8_t rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB,
unsigned int A,
uint16_t counter_msg,
uint8_t subframerx,
uint8_t rvdx,
uint8_t option);
uint8_t rvdx);
void ulsch_extract_rbs_single_NB_IoT(int32_t **rxdataF,
int32_t **rxdataF_ext,
......@@ -429,6 +428,16 @@ void filtering_signal(int16_t *input_buffer, int16_t *filtered_buffer, uint32_t
//************************************************************//
uint16_t get_UL_sc_start_NB_IoT(uint16_t I_sc);
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_N_ru_NB_IoT(uint8_t I_mcs, uint8_t I_ru, uint8_t flag_msg3);
uint16_t get_UL_N_rep_NB_IoT(uint8_t I_rep);
uint8_t get_numb_UL_sc_NB_IoT(uint8_t subcarrier_spacing, uint8_t I_sc, uint8_t npush_format);
uint8_t get_UL_slots_per_RU_NB_IoT(uint8_t subcarrier_spacing, uint8_t subcarrier_indcation, uint8_t UL_format);
void generate_grouphop_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms);
void init_ul_hopping_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms);
......
......@@ -2071,8 +2071,8 @@ uint8_t rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB,
unsigned int A, // A = TBS
uint16_t counter_msg,
uint8_t subframerx,
uint8_t rvdx,
uint8_t option) // data (0) or control (1)
uint8_t rvdx)
//uint8_t option) // data (0) or control (1)
{
//LTE_eNB_PUSCH *pusch_vars = eNB->pusch_vars[UE_id];
LTE_eNB_PUSCH *pusch_vars = eNB->pusch_vars[UE_id];
......@@ -2149,7 +2149,7 @@ uint8_t rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB,
l%(fp->symbols_per_tti/2), // (0..13)
l/(fp->symbols_per_tti/2), // (0,1)
fp);
if(option ==0)
if(npusch_format == 1)
{
ul_chest_tmp_NB_IoT(pusch_vars->rxdataF_ext[eNB_id],
pusch_vars->drs_ch_estimates[eNB_id],
......@@ -2188,7 +2188,7 @@ uint8_t rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB,
fp);
}
if(option ==0)
if(npusch_format == 1)
{
for (l=0; l<fp->symbols_per_tti; l++)
{
......@@ -2224,7 +2224,7 @@ uint8_t rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB,
if(option ==0)
if(npusch_format == 1)
{
llrp = (int16_t*)&pusch_vars->llr[0+ (8-counter_msg)*24];
......@@ -2237,7 +2237,7 @@ uint8_t rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB,
{
if (l==pilot_pos1 || l==pilot_pos2) // skip pilots // option 0 pilots = x,y, for option 1 pilots = 2,9 (subcarrier_spacing=1, npush_format=1)
{
if(option==0)
if(npusch_format == 1)
{
l++;
} else {
......@@ -2281,7 +2281,7 @@ uint8_t rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB,
uint8_t counter_ack; // ack counter for decision ack/nack
int32_t counter_ack_soft;
if (option==0)
if (npusch_format == 1)
{
// NB-IoT ///////////////////////////////////////////////
// x1 is set in lte_gold_generic
......@@ -2519,13 +2519,13 @@ uint8_t rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB,
fill_crc_indication_NB_IoT(eNB,0,frame,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,proc,option);
fill_rx_indication_NB_IoT(eNB,proc,npusch_format);
} else {
fill_crc_indication_NB_IoT(eNB,0,frame,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,proc,option);
fill_rx_indication_NB_IoT(eNB,proc,npusch_format);
break;
}
} // r loop end
......@@ -2575,14 +2575,14 @@ uint8_t rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB,
printf(" decoded msg5: ACK ");
fill_crc_indication_NB_IoT(eNB,0,frame,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,proc,option);
fill_rx_indication_NB_IoT(eNB,proc,npusch_format);
} else if (counter_ack<8) { //hard decision
printf(" decoded msg5: NACK ");
fill_crc_indication_NB_IoT(eNB,0,frame,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,proc,option);
fill_rx_indication_NB_IoT(eNB,proc,npusch_format);
} else { //when equality (8 bits 0 vs 8 bits 1), soft decision
......@@ -2598,14 +2598,14 @@ uint8_t rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB,
printf(" decoded msg5 (soft): ACK ");
fill_crc_indication_NB_IoT(eNB,0,frame,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,proc,option);
fill_rx_indication_NB_IoT(eNB,proc,npusch_format);
} else {
printf(" decoded msg5 (soft): NACK ");
fill_crc_indication_NB_IoT(eNB,0,frame,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,proc,option);
fill_rx_indication_NB_IoT(eNB,proc,npusch_format);
}
}
printf("\n\n\n");
......
......@@ -458,6 +458,7 @@ void schedule_response_NB_IoT(Sched_Rsp_NB_IoT_t *Sched_INFO)
nulsch->Msg3_active = 1;
nulsch->Msg3_flag = 1;
nulsch->flag_scramble = 1;
nulsch->rnti = nfapi_parameters_rel13->rnti;
nulsch->npusch_format = nfapi_parameters_rel13->nulsch_format;
nulsch->N_srs = nfapi_parameters_rel13->n_srs;
......
......@@ -553,8 +553,7 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
88, // A = TBS
proc->counter_msg5,
subframerx, //current_rx_subframe,
0,
1); // data (0) or control (1)
0); // data (0) or control (1)
......@@ -601,7 +600,6 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
88, // A = TBS
proc->counter_msg3,
subframerx,
0,
0); // data (0) or control (1)
proc->counter_msg3--;
......
......@@ -1585,22 +1585,38 @@ void npusch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t data_or_c
uint32_t i;
LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
NB_IoT_eNB_NULSCH_t *ulsch_NB_IoT;
NB_IoT_UL_eNB_HARQ_t *ulsch_harq;
NB_IoT_eNB_NULSCH_t *nulsch;
NB_IoT_UL_eNB_HARQ_t *nulsch_harq;
nulsch = eNB->ulsch_NB_IoT[0];
nulsch_harq = nulsch->harq_process;
const int subframerx = proc->subframe_rx;
const int framerx = proc->frame_rx;
for (i=0; i<NUMBER_OF_UE_MAX; i++)
//for (i=0; i<NUMBER_OF_UE_MAX; i++)
for (i=0; i<1; i++)
{
ulsch_NB_IoT = eNB->ulsch_NB_IoT[i];
ulsch_harq = ulsch_NB_IoT->harq_process;
//ulsch_NB_IoT = eNB->ulsch_NB_IoT[i];
//ulsch_harq = ulsch_NB_IoT->harq_process;
nulsch->Msg3_active = 1;
nulsch->Msg3_flag = 1;
// if eNB is ready to receive UL data
// define a flag to trigger on or off the decoding process
//if ((ulsch) && (ulsch->rnti>0) && (ulsch_harq->status == ACTIVE) && (ulsch_harq->frame == frame) && (ulsch_harq->subframe == subframe) && (ulsch_harq->handled == 0))
if ((ulsch_NB_IoT) && (ulsch_NB_IoT->rnti>0)) // && (ulsch_harq->frame == framerx) && (ulsch_harq->subframe == subframerx))
if ((nulsch->Msg3_active == 1) && (nulsch->Msg3_flag == 1)) // && (ulsch_harq->frame == framerx) && (ulsch_harq->subframe == subframerx))
{
if(nulsch->flag_scramble == 1)
{
nulsch->Msg3_frame = framerx;
nulsch->Msg3_subframe = subframerx;
nulsch->flag_scramble = 0;
}
/*
// UE has ULSCH scheduling
for (int rb=0; rb<=ulsch_harq->nb_rb; rb++)
......@@ -1616,48 +1632,25 @@ void npusch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t data_or_c
ulsch_harq->V_UL_DAI,
ulsch_harq->nb_rb>20 ? 1 : 0);*/
// fill_ulsch_cqi_indication(eNB,frame,subframe,ulsch_harq,ulsch->rnti);
////// nulsch_config should be provided before calling the rx_ulsch function
/*typedef struct {
nfapi_tl_t tl;
uint8_t nulsch_format; --> this parameter is needed
uint32_t handle;
uint16_t size;
uint16_t rnti; --> this parameter is needed
uint8_t subcarrier_indication; --> this parameter is needed
uint8_t resource_assignment;
uint8_t mcs; --> this parameter is needed
uint8_t redudancy_version;
uint8_t repetition_number; --> this parameter is needed
uint8_t new_data_indication;
uint8_t n_srs;
uint16_t scrambling_sequence_initialization_cinit; --> this parameter is needed
uint16_t sf_idx;
nfapi_ul_config_ue_information ue_information;
nfapi_ul_config_nb_harq_information nb_harq_information;
} nfapi_ul_config_nulsch_pdu_rel13_t;
#define NFAPI_UL_CONFIG_REQUEST_NULSCH_PDU_REL13_TAG 0x205F
*/
rx_ulsch_Gen_NB_IoT(eNB,
proc,
0, // this is the effective sector id
0,
ulsch_NB_IoT,
1, //npusch_format, // 1, 2
nulsch,
nulsch->npusch_format, //npusch_format, // 1, 2
22, // 22 , to be included in // to be replaced by NB_IoT_start ??
1, // 0 (3.75 KHz) or 1 (15 KHz)
65522, //= 65522
proc->subframe_dscr_msg3, // first received subframe
proc->frame_dscr_msg3, // first received frame
16, // total number of occupied slots
11,
nulsch->rnti, //= 65522
nulsch->Msg3_subframe, // first received subframe
nulsch->Msg3_frame, // first received frame
get_UL_slots_per_RU_NB_IoT(nulsch_harq->subcarrier_spacing, nulsch_harq->subcarrier_indication, nulsch->npusch_format)*get_UL_N_ru_NB_IoT(nulsch_harq->mcs,nulsch_harq->resource_assignment,nulsch->Msg3_flag), // total number of occupied slots = get_nb_slot_per_RU * NB_of_RU
get_UL_sc_index_start_NB_IoT(nulsch_harq->subcarrier_spacing,nulsch_harq->subcarrier_indication,nulsch->npusch_format),
1,
2,
88, // A = TBS
proc->counter_msg3, // proc->counter_msg3
nulsch_harq->TBS, // A = TBS
proc->counter_msg3, // this represents the number of Subframe after encoding the msg3 // proc->counter_msg3
subframerx,
0,
data_or_control); // data (0) or control (1)
0);
}
......
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