Commit e7f6906b authored by Matthieu Kanj's avatar Matthieu Kanj

scrambling update for release 13.5.0

parent efa4401e
......@@ -47,7 +47,8 @@ int generate_SIB1(NB_IoT_eNB_NDLSCH_t *sib1_struct,
uint32_t frame,
uint32_t subframe,
int RB_IoT_ID,
uint8_t operation_mode)
uint8_t operation_mode,
uint8_t release_v13_5_0)
{
int done=0;
uint8_t *sib1_pdu = sib1_struct->harq_process->pdu;
......@@ -97,7 +98,7 @@ int generate_SIB1(NB_IoT_eNB_NDLSCH_t *sib1_struct,
if((subframe == 4) && (frame%2 == var) && (born_inf<= frame % rep_val) && (frame % rep_val < born_sup ))
{
LOG_D(PHY,"[%3d][%2d] Generating SIB1\n",frame,subframe);
int G = get_G_SIB1_NB_IoT(frame_parms,operation_mode);
int G = get_G_SIB1_NB_IoT(frame_parms,operation_mode);
if( frame % rep_val == var )
{
......@@ -111,7 +112,9 @@ int generate_SIB1(NB_IoT_eNB_NDLSCH_t *sib1_struct,
8*G,
frame,
subframe*2,
sib1_struct->rnti);
sib1_struct->rnti,
release_v13_5_0,
1);
}
dlsch_modulation_NB_IoT(txdataF,
......@@ -137,13 +140,14 @@ int generate_SIB1(NB_IoT_eNB_NDLSCH_t *sib1_struct,
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
int generate_SIB23(NB_IoT_eNB_NDLSCH_t *SIB23,
int32_t **txdataF,
int16_t amp,
int generate_SIB23(NB_IoT_eNB_NDLSCH_t *SIB23,
int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint32_t frame,
uint32_t subframe,
int RB_IoT_ID)
uint32_t frame,
uint32_t subframe,
int RB_IoT_ID,
uint8_t release_v13_5_0)
{
int done=0;
......@@ -152,8 +156,8 @@ int generate_SIB23(NB_IoT_eNB_NDLSCH_t *SIB23,
//LOG_I(PHY,"[Frame: %d][Subframe: %d]sent SIB23\n",frame,subframe);
uint8_t *SIB23_pdu = SIB23->harq_process->pdu;
uint32_t rep = SIB23->resource_assignment;
uint8_t eutra_control_region = 3;
uint32_t rep = SIB23->resource_assignment;
uint8_t eutra_control_region = 3;
uint32_t counter_rep = SIB23->counter_repetition_number;
uint32_t pointer_to_sf = SIB23->pointer_to_subframe; /// to identify wich encoded subframe to transmit
......@@ -173,7 +177,9 @@ int generate_SIB23(NB_IoT_eNB_NDLSCH_t *SIB23,
Nsf*G,
frame,
subframe*2,
SIB23->rnti);
SIB23->rnti,
release_v13_5_0,
1);
}
dlsch_modulation_NB_IoT(txdataF,
......@@ -208,30 +214,29 @@ int generate_SIB23(NB_IoT_eNB_NDLSCH_t *SIB23,
int generate_NDLSCH_NB_IoT(PHY_VARS_eNB *eNB,
NB_IoT_eNB_NDLSCH_t *RAR,
int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint32_t frame,
uint32_t subframe,
int RB_IoT_ID)
int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint32_t frame,
uint32_t subframe,
int RB_IoT_ID,
uint8_t release_v13_5_0)
{
int done = 0;
if( RAR->active == 1 )
{
uint8_t *RAR_pdu = RAR->harq_process->pdu;
// TODO: process the RAR PDU to get the subcarrier indication for NPUSCH , Then set value in NPUSCH
if(RAR->active_msg2 == 1 && RAR_pdu!=NULL)
{
//printf("RAR PDU = %p\n",RAR_pdu);
uint8_t one_byte = RAR_pdu[2]>>3;
uint8_t subcarrier_spacing = one_byte & 0x01;
eNB->ulsch_NB_IoT[0]->harq_process->subcarrier_spacing = subcarrier_spacing;
}
// to be added at the end of NPDSCH process
// make different between RAR data and NPDSCH data // add a flag in NPDSCH to switch between RA and normal data transmission
uint32_t rep = RAR->repetition_number;
uint8_t eutra_control_region = 3;
if(RAR->active_msg2 == 1 && RAR_pdu!=NULL)
{
uint8_t one_byte = RAR_pdu[2]>>3;
uint8_t subcarrier_spacing = one_byte & 0x01;
eNB->ulsch_NB_IoT[0]->harq_process->subcarrier_spacing = subcarrier_spacing;
}
// make different between RAR data and NPDSCH data // add a flag in NPDSCH to switch between RA and normal data transmission
uint32_t rep = RAR->repetition_number;
uint8_t eutra_control_region = 3;
uint32_t counter_rep = RAR->counter_repetition_number;
uint32_t counter_sf_rep = RAR->counter_current_sf_repetition; /// for identifiying when to trigger new scrambling
......@@ -242,8 +247,8 @@ int generate_NDLSCH_NB_IoT(PHY_VARS_eNB *eNB,
//LOG_I(PHY,"[Frame: %d][Subframe: %d]sent RAR, rep : %d, counter_rep:%d, Num_res:%d\n",frame,subframe,rep,counter_rep,Nsf);
if( (counter_rep == rep) && (counter_sf_rep == 0) && (pointer_to_sf == 0) )
{
if( (counter_rep == rep) && (counter_sf_rep == 0) && (pointer_to_sf == 0) )
{
dlsch_encoding_NB_IoT(RAR_pdu,
RAR,
......@@ -255,18 +260,22 @@ int generate_NDLSCH_NB_IoT(PHY_VARS_eNB *eNB,
Nsf*G,
frame,
subframe*2,
RAR->rnti);
}
if( (counter_rep != rep) && (counter_sf_rep == 0) && (pointer_to_sf == 0) )
{
dlsch_scrambling_Gen_NB_IoT(frame_parms,
RAR->rnti,
release_v13_5_0,
0);
}
if( (counter_rep != rep) && (counter_sf_rep == 0) && (pointer_to_sf == 0) )
{
dlsch_scrambling_Gen_NB_IoT(frame_parms,
RAR,
Nsf*G,
frame,
subframe*2,
RAR->rnti);
}
RAR->rnti,
release_v13_5_0,
0);
}
if( rep > 4)
{
......
......@@ -53,16 +53,20 @@ void dlsch_scrambling_Gen_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,
int tot_bits, // total number of bits to transmit
uint16_t Nf, // Nf is the frame number (0..9)
uint8_t Ns,
uint32_t rnti)
uint32_t rnti,
uint8_t release_v13_5_0,
uint8_t SIB)
{
int i,j,k=0;
uint32_t x1,x2, s=0;
uint8_t *e = dlsch->harq_process->e; //uint8_t *e=dlsch->harq_processes[dlsch->current_harq_pid]->e;
//x2 = (dlsch->si_rnti<<15) + (frame_parms->Nid_cell + 1) * ( (Nf % 61) + 1 ) ;
x2 = (rnti<<14) + ((Nf%2)<<13) + ((Ns>>1)<<9) + frame_parms->Nid_cell;
// for NPDSCH not carriying SIBs
//x2 = (dlsch->harq_process_sib1.rnti<<14) + ((Nf%2)<<13) + ((Ns>>1)<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 10.2.3.1
if(release_v13_5_0 == 1 && SIB == 1) /// for SIBs from release 13.5.0 and above
{
x2 = (rnti<<15) + (frame_parms->Nid_cell + 1) * ( (Nf % 61) + 1 ) ;
} else {
x2 = (rnti<<14) + ((Nf%2)<<13) + ((Ns>>1)<<9) + frame_parms->Nid_cell;
}
s = lte_gold_generic_NB_IoT(&x1, &x2, 1);
......
......@@ -20,11 +20,11 @@
/*! \file PHY/LTE_TRANSPORT/npbch_NB_IoT.c
* \Fucntions for the generation of broadcast channel (NPBCH) for NB_IoT, TS 36-212, V13.4.0 2017-02
* \author M. KANJ
* \author M. KANJ, V. Savaux
* \date 2017
* \version 0.0
* \company bcom
* \email: matthieu.kanj@b-com.com
* \email: matthieu.kanj@b-com.com , vincent.savaux@b-com.com
* \note
* \warning
*/
......@@ -53,18 +53,19 @@
#define NPBCH_A 34 // 34 for NB-IoT and 24 for LTE
/*
int scrambling_npbch_REs_rel_14(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **txdataF,
uint32_t *jj,
int l,
uint32_t symbol_offset,
uint8_t pilots,
unsigned short id_offset,
uint8_t *reset,
uint32_t *x1,
uint32_t *x2,
uint32_t *s)
int scrambling_npbch_REs_rel_13_5_0(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **txdataF,
uint32_t *jj,
int l,
uint32_t symbol_offset,
uint8_t pilots,
unsigned short id_offset,
uint8_t *reset,
uint32_t *x1,
uint32_t *x2,
uint32_t *s,
uint8_t *flag_32)
{
uint32_t tti_offset,aa;
uint8_t re;
......@@ -72,22 +73,23 @@ int scrambling_npbch_REs_rel_14(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t c_even,c_odd;
int16_t theta_re,theta_im;
int16_t data_re[frame_parms->nb_antennas_tx],data_im[frame_parms->nb_antennas_tx];
uint32_t mem_jj;
first_re = 0;
last_re = 12;
for (re=first_re; re<last_re; re++) { // re varies between 0 and 12 sub-carriers
if (((l-3)*12+re)%16 == 0){
if ((*jj)%32 == 0 && *flag_32 == 0){
*s = lte_gold_generic_NB_IoT(x1, x2, *reset);
*reset = 0;
*jj = 0;
mem_jj = *jj;
}
c_even = (*s>>*jj)&1;
c_odd = (*s>>(*jj+1))&1;
if (c_even == c_odd){
if(c_even){
theta_re = 0;
theta_im = -32768;
theta_im = -32767;
}else{
theta_re = 32767;
theta_im = 0;
......@@ -97,7 +99,7 @@ int scrambling_npbch_REs_rel_14(LTE_DL_FRAME_PARMS *frame_parms,
theta_re = 0;
theta_im = 32767;
}else{
theta_re = -32768;
theta_re = -32767;
theta_im = 0;
}
}
......@@ -117,14 +119,21 @@ int scrambling_npbch_REs_rel_14(LTE_DL_FRAME_PARMS *frame_parms,
((int16_t*)&txdataF[aa][tti_offset])[1] = (int16_t) (((int32_t) data_im[aa] * (int32_t) theta_re +
(int32_t) data_re[aa] * (int32_t) theta_im)>>15); //Q //b_{i+1}
}
*jj = *jj + 2;
}
}
if (mem_jj == *jj) // avoid to shift lte_gold_generic_NB_IoT 2 times
{*flag_32 = 1;
}else
{*flag_32 = 0;
}
}
return(0);
}
*/
int allocate_npbch_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **txdataF,
......@@ -217,7 +226,8 @@ int generate_npbch(NB_IoT_eNB_NPBCH_t *eNB_npbch,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t *npbch_pdu,
uint8_t frame_mod64,
unsigned short NB_IoT_RB_ID)
unsigned short NB_IoT_RB_ID,
uint8_t release_v13_5_0)
{
int i, l;
int id_offset;
......@@ -231,19 +241,14 @@ int generate_npbch(NB_IoT_eNB_NPBCH_t *eNB_npbch,
uint32_t re_allocated=0;
uint32_t symbol_offset;
uint16_t amask=0;
///////////////////////////// for release 13.5.0 and above ////////////////////////
//uint32_t ii=0;
//uint8_t reset=1,flag_32=0;
//uint32_t x1_v13_5_0, x2_v13_5_0, s_v13_5_0 =0;
//////////////////////////////////////////////////////////////////////////////////
frame_parms->flag_free_sf =1;
/*
uint32_t ii=0;
uint8_t reset=1;
uint32_t x1_r14, x2_r14, s_r14=0;
x2_r14 = ((frame_parms->Nid_cell+1) * (frame_mod64%8 + 1)
* (frame_mod64%8 + 1) * (frame_mod64%8 + 1) <<9)
+ frame_parms->Nid_cell; // specific to Rel 14
*/
npbch_D = 16 + NPBCH_A;
npbch_E = 1600;
......@@ -313,19 +318,30 @@ int generate_npbch(NB_IoT_eNB_NPBCH_t *eNB_npbch,
amp,
id_offset,
&re_allocated);
/*
scrambling_npbch_REs_rel_14(frame_parms,
txdataF,
&ii,
l,
symbol_offset,
pilots,
id_offset,
&reset,
&x1_r14,
&x2_r14,
&s_r14);
*/
if(release_v13_5_0 == 1)
{
uint32_t ii=0;
uint8_t reset=1,flag_32=0;
uint32_t x1_v13_5_0, x2_v13_5_0, s_v13_5_0 =0;
x2_v13_5_0 = (((frame_parms->Nid_cell+1) * (frame_mod64%8 + 1) * (frame_mod64%8 + 1) * (frame_mod64%8 + 1)) <<9) + frame_parms->Nid_cell;
scrambling_npbch_REs_rel_13_5_0(frame_parms,
txdataF,
&ii,
l,
symbol_offset,
pilots,
id_offset,
&reset,
&x1_v13_5_0,
&x2_v13_5_0,
&s_v13_5_0,
&flag_32);
}
}
return(0);
}
......
......@@ -107,14 +107,15 @@ int allocate_REs_in_RB_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t pilot_shift,
uint32_t *re_allocated);
int generate_NDLSCH_NB_IoT(PHY_VARS_eNB *eNB,
NB_IoT_eNB_NDLSCH_t *RAR,
int generate_NDLSCH_NB_IoT(PHY_VARS_eNB *eNB,
NB_IoT_eNB_NDLSCH_t *RAR,
int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint32_t frame,
uint32_t subframe,
int RB_IoT_ID);
int RB_IoT_ID,
uint8_t release_v13_5_0);
int generate_NPDCCH_NB_IoT(NB_IoT_eNB_NPDCCH_t *DCI,
int32_t **txdataF,
......@@ -130,7 +131,8 @@ int generate_SIB23(NB_IoT_eNB_NDLSCH_t *SIB23,
LTE_DL_FRAME_PARMS *frame_parms,
uint32_t frame,
uint32_t subframe,
int RB_IoT_ID);
int RB_IoT_ID,
uint8_t release_v13_5_0);
int generate_SIB1(NB_IoT_eNB_NDLSCH_t *sib1_struct,
int32_t **txdataF,
......@@ -139,15 +141,17 @@ int generate_SIB1(NB_IoT_eNB_NDLSCH_t *sib1_struct,
uint32_t frame,
uint32_t subframe,
int RB_IoT_ID,
uint8_t operation_mode);
uint8_t operation_mode,
uint8_t release_v13_5_0);
int generate_npbch(NB_IoT_eNB_NPBCH_t *eNB_npbch,
int32_t **txdataF,
int amp,
LTE_DL_FRAME_PARMS *frame_parms,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t *npbch_pdu,
uint8_t frame_mod64,
unsigned short NB_IoT_RB_ID);
unsigned short NB_IoT_RB_ID,
uint8_t release_v13_5_0);
void npbch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
......@@ -160,7 +164,9 @@ void dlsch_scrambling_Gen_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,
int tot_bits, // total number of bits to transmit
uint16_t Nf, // Nf is the frame number (0..9)
uint8_t Ns,
uint32_t rnti);
uint32_t rnti,
uint8_t release_v13_5_0,
uint8_t SIB);
NB_IoT_eNB_NDLSCH_t *new_eNB_dlsch_NB_IoT(uint8_t length, LTE_DL_FRAME_PARMS* frame_parms);
......
......@@ -231,6 +231,7 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
//uint16_t Ntti = 10; //ntti = 10
int RB_IoT_ID=22; // XXX should be initialized (RB reserved for NB-IoT, PRB index)
int With_NSSS=0; // With_NSSS = 1; if the frame include a sub-Frame with NSSS signal
uint8_t release_v13_5_0 = 0;
uint32_t hyper_frame=proc->HFN;
......@@ -300,7 +301,8 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
fp,
npbch_pdu,
frame%64,
RB_IoT_ID);
RB_IoT_ID,
release_v13_5_0);
}
/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////// SIB1 ////////////////////////////////////
......@@ -309,13 +311,14 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
if(subframe == 4)
{
sib1_state = generate_SIB1(sib1,
txdataF,
AMP,
fp,
frame,
subframe,
RB_IoT_ID,
0);
txdataF,
AMP,
fp,
frame,
subframe,
RB_IoT_ID,
0,
release_v13_5_0);
}
/////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////// SIB23 ////////////////////////////////////
......@@ -328,7 +331,8 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
fp,
frame,
subframe,
RB_IoT_ID);
RB_IoT_ID,
release_v13_5_0);
}
if( (subframe != 0) && (subframe != 5) && (nsss_state != 1) && (fp->flag_free_sf == 0) )
......@@ -358,7 +362,8 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
fp,
frame,
subframe,
RB_IoT_ID);
RB_IoT_ID,
release_v13_5_0);
} else if(eNB->ndlsch[0] != NULL) {
generate_NDLSCH_NB_IoT(eNB,
......@@ -368,7 +373,8 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
fp,
frame,
subframe,
RB_IoT_ID);
RB_IoT_ID,
release_v13_5_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