Commit 8617782a authored by Matthieu Kanj's avatar Matthieu Kanj

bug fixe

parent 6454c61f
......@@ -384,12 +384,12 @@ void phy_config_dedicated_eNB_NB_IoT(uint8_t Mod_id,
if (eNB->npdcch[UE_id]) {
npdcch = eNB->npdcch[UE_id];
npdcch->rnti = rnti;
npdcch->npdcch_NumRepetitions = extra_parms->npdcch_NumRepetitions; //Rmax maybe is the only one needed
npdcch->rnti[0] = rnti;
npdcch->npdcch_NumRepetitions[0] = extra_parms->npdcch_NumRepetitions; //Rmax maybe is the only one needed
//npdcch->npdcch_Offset_USS = extra_parms->npdcch_Offset_USS;
//npdcch->npdcch_StartSF_USS = extra_parms->npdcch_StartSF_USS;
LOG_I(PHY,"phy_config_dedicated_eNB_NB_IoT: npdcch_NumRepetitions = %d\n",npdcch->npdcch_NumRepetitions);
LOG_I(PHY,"phy_config_dedicated_eNB_NB_IoT: npdcch_NumRepetitions = %d\n",npdcch->npdcch_NumRepetitions[0]);
} else {
LOG_E(PHY,"[eNB %d] Received NULL radioResourceConfigDedicated from eNB %d\n",Mod_id, UE_id);
......
......@@ -167,66 +167,76 @@ void npdcch_scrambling_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,
}
}
//// correction is needed to this function
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int dci_allocate_REs_in_RB_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **txdataF,
uint32_t *jj,
uint32_t symbol_offset,
uint8_t *x0[2],
uint8_t *x0,
uint8_t pilots,
uint8_t pilot_shift,
int16_t amp,
unsigned short id_offset,
uint32_t *re_allocated, // not used variable ??!!
uint8_t dci_number, // This variable should takes the 1 or 2 (1 for in case of one DCI, 2 in case of two DCI)
uint8_t ncce_index,
uint8_t agr_level)
{
MIMO_mode_NB_IoT_t mimo_mode = (frame_parms->mode1_flag==1)?SISO_NB_IoT:ALAMOUTI_NB_IoT;
MIMO_mode_t mimo_mode = (frame_parms->mode1_flag==1)? SISO:ALAMOUTI;
uint32_t tti_offset,aa;
uint8_t re;
int16_t gain_lin_QPSK;
uint8_t first_re,last_re;
int32_t tmp_sample1,tmp_sample2,tmp_sample3,tmp_sample4;
int32_t tmp_sample1,tmp_sample2;
gain_lin_QPSK = (int16_t)((amp*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
first_re=0;
last_re=12;
first_re = 0;
last_re = 12;
if(agr_level == 2 && dci_number == 1)
if(ncce_index == 1 && agr_level == 2)
{
for (re=first_re; re<last_re; re++) { // re varies between 0 and 12 sub-carriers
tti_offset = symbol_offset + re; // symbol_offset = 512 * L , re_offset = 512 - 3*12 , re
if (pilots != 1 || re%3 != id_offset) // if re is not a pilot
if (pilots != 1 || (re%6 != ((id_offset + 3*pilot_shift) % 6) ) ) // if re is not a pilot
{
// diff_re = re%3 - id_offset;
if (mimo_mode == SISO_NB_IoT) { //SISO mapping
if (mimo_mode == SISO) { //SISO mapping
*re_allocated = *re_allocated + 1; // variable incremented but never used
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
((int16_t*)&txdataF[aa][tti_offset])[0] += (x0[0][*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
((int16_t*)&txdataF[aa][tti_offset])[0] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
}
*jj = *jj + 1;
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
((int16_t*)&txdataF[aa][tti_offset])[1] += (x0[0][*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1}
((int16_t*)&txdataF[aa][tti_offset])[1] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1}
}
*jj = *jj + 1;
} else if (mimo_mode == ALAMOUTI_NB_IoT) {
} else if (mimo_mode == ALAMOUTI) {
*re_allocated = *re_allocated + 1;
((int16_t*)&tmp_sample1)[0] = (x0[0][*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
((int16_t*)&tmp_sample1)[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj=*jj+1;
((int16_t*)&tmp_sample1)[1] = (x0[0][*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
((int16_t*)&tmp_sample1)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj=*jj+1;
// second antenna position n -> -x1*
((int16_t*)&tmp_sample2)[0] = (x0[0][*jj]==1) ? (gain_lin_QPSK) : -gain_lin_QPSK;
((int16_t*)&tmp_sample2)[0] = (x0[*jj]==1) ? (gain_lin_QPSK) : -gain_lin_QPSK;
*jj=*jj+1;
((int16_t*)&tmp_sample2)[1] = (x0[0][*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
((int16_t*)&tmp_sample2)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj=*jj+1;
// normalization for 2 tx antennas
......@@ -255,41 +265,42 @@ int dci_allocate_REs_in_RB_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,
}
}
}
}else if(agr_level == 1 && dci_number == 1){
for (re=first_re; re<6; re++) { // re varies between 0 and 6 sub-carriers
} else if(agr_level == 1) {
for (re=(first_re + (ncce_index/2)*6); re<(6+((ncce_index/2)*6)); re++) { // re varies between 0 and 6 or 6 and 12 sub-carriers
tti_offset = symbol_offset + re; // symbol_offset = 512 * L , re_offset = 512 - 3*12 , re
if (pilots != 1 || re%3 != id_offset) // if re is not a pilot
if (pilots != 1 || (re%6 != ((id_offset + 3*pilot_shift) % 6) ) ) // if re is not a pilot
{
// diff_re = re%3 - id_offset;
if (mimo_mode == SISO_NB_IoT) { //SISO mapping
if (mimo_mode == SISO) { //SISO mapping
*re_allocated = *re_allocated + 1; // variable incremented but never used
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
((int16_t*)&txdataF[aa][tti_offset])[0] += (x0[0][*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
((int16_t*)&txdataF[aa][tti_offset])[0] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
}
*jj = *jj + 1;
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
((int16_t*)&txdataF[aa][tti_offset])[1] += (x0[0][*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1}
((int16_t*)&txdataF[aa][tti_offset])[1] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1}
}
*jj = *jj + 1;
} else if (mimo_mode == ALAMOUTI_NB_IoT) {
} else if (mimo_mode == ALAMOUTI) {
*re_allocated = *re_allocated + 1;
((int16_t*)&tmp_sample1)[0] = (x0[0][*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
((int16_t*)&tmp_sample1)[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj=*jj+1;
((int16_t*)&tmp_sample1)[1] = (x0[0][*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
((int16_t*)&tmp_sample1)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj=*jj+1;
// second antenna position n -> -x1*
((int16_t*)&tmp_sample2)[0] = (x0[0][*jj]==1) ? (gain_lin_QPSK) : -gain_lin_QPSK;
((int16_t*)&tmp_sample2)[0] = (x0[*jj]==1) ? (gain_lin_QPSK) : -gain_lin_QPSK;
*jj=*jj+1;
((int16_t*)&tmp_sample2)[1] = (x0[0][*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
((int16_t*)&tmp_sample2)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj=*jj+1;
// normalization for 2 tx antennas
......@@ -318,119 +329,48 @@ int dci_allocate_REs_in_RB_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,
}
}
}
} else {
// allocate first DCI
for (re=first_re; re<6; re++) { // re varies between 0 and 12 sub-carriers
tti_offset = symbol_offset + re; // symbol_offset = 512 * L , re_offset = 512 - 3*12 , re
if (pilots != 1 || re%3 != id_offset) { // if re is not a pilot
// diff_re = re%3 - id_offset;
if (mimo_mode == SISO_NB_IoT) { //SISO mapping
*re_allocated = *re_allocated + 1; // variable incremented but never used
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
((int16_t*)&txdataF[aa][tti_offset])[0] += (x0[0][*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
((int16_t*)&txdataF[aa][tti_offset+6])[0] += (x0[1][*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
}
*jj = *jj + 1;
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
((int16_t*)&txdataF[aa][tti_offset])[1] += (x0[0][*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1}
((int16_t*)&txdataF[aa][tti_offset+6])[1] += (x0[1][*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1}
}
*jj = *jj + 1;
} else if (mimo_mode == ALAMOUTI_NB_IoT) {
*re_allocated = *re_allocated + 1;
((int16_t*)&tmp_sample1)[0] = (x0[0][*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
((int16_t*)&tmp_sample3)[0] = (x0[1][*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj=*jj+1;
((int16_t*)&tmp_sample1)[1] = (x0[0][*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
((int16_t*)&tmp_sample3)[1] = (x0[1][*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj=*jj+1;
// second antenna position n -> -x1*
((int16_t*)&tmp_sample2)[0] = (x0[0][*jj]==1) ? (gain_lin_QPSK) : -gain_lin_QPSK;
((int16_t*)&tmp_sample4)[0] = (x0[1][*jj]==1) ? (gain_lin_QPSK) : -gain_lin_QPSK;
*jj=*jj+1;
((int16_t*)&tmp_sample2)[1] = (x0[0][*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
((int16_t*)&tmp_sample4)[1] = (x0[1][*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj=*jj+1;
// normalization for 2 tx antennas
((int16_t*)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
((int16_t*)&txdataF[0][tti_offset+6])[0] += (int16_t)((((int16_t*)&tmp_sample3)[0]*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
((int16_t*)&txdataF[0][tti_offset+6])[1] += (int16_t)((((int16_t*)&tmp_sample3)[1]*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
((int16_t*)&txdataF[1][tti_offset+6])[0] += (int16_t)((((int16_t*)&tmp_sample4)[0]*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
((int16_t*)&txdataF[1][tti_offset+6])[1] += (int16_t)((((int16_t*)&tmp_sample4)[1]*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
// fill in the rest of the ALAMOUTI precoding
if ( pilots != 1 || (re+1)%3 != id_offset) {
((int16_t *)&txdataF[0][tti_offset+1])[0] += -((int16_t *)&txdataF[1][tti_offset])[0]; //x1
((int16_t *)&txdataF[0][tti_offset+1])[1] += ((int16_t *)&txdataF[1][tti_offset])[1];
((int16_t *)&txdataF[1][tti_offset+1])[0] += ((int16_t *)&txdataF[0][tti_offset])[0]; //x0*
((int16_t *)&txdataF[1][tti_offset+1])[1] += -((int16_t *)&txdataF[0][tti_offset])[1];
((int16_t *)&txdataF[0][tti_offset+6+1])[0] += -((int16_t *)&txdataF[1][tti_offset+6])[0]; //x1
((int16_t *)&txdataF[0][tti_offset+6+1])[1] += ((int16_t *)&txdataF[1][tti_offset+6])[1];
((int16_t *)&txdataF[1][tti_offset+6+1])[0] += ((int16_t *)&txdataF[0][tti_offset+6])[0]; //x0*
((int16_t *)&txdataF[1][tti_offset+6+1])[1] += -((int16_t *)&txdataF[0][tti_offset+6])[1];
} else {
((int16_t *)&txdataF[0][tti_offset+2])[0] += -((int16_t *)&txdataF[1][tti_offset])[0]; //x1
((int16_t *)&txdataF[0][tti_offset+2])[1] += ((int16_t *)&txdataF[1][tti_offset])[1];
((int16_t *)&txdataF[1][tti_offset+2])[0] += ((int16_t *)&txdataF[0][tti_offset])[0]; //x0*
((int16_t *)&txdataF[1][tti_offset+2])[1] += -((int16_t *)&txdataF[0][tti_offset])[1];
((int16_t *)&txdataF[0][tti_offset+6+2])[0] += -((int16_t *)&txdataF[1][tti_offset+6])[0]; //x1
((int16_t *)&txdataF[0][tti_offset+6+2])[1] += ((int16_t *)&txdataF[1][tti_offset+6])[1];
((int16_t *)&txdataF[1][tti_offset+6+2])[0] += ((int16_t *)&txdataF[0][tti_offset+6])[0]; //x0*
((int16_t *)&txdataF[1][tti_offset+6+2])[1] += -((int16_t *)&txdataF[0][tti_offset+6])[1];
printf("Error in allocate RE of DCI NB_IoT");
re++; // skip pilots
*re_allocated = *re_allocated + 1;
}
re++; // adjacent carriers are taken care of by precoding
*re_allocated = *re_allocated + 1; // incremented variable but never used
}
}
}
}
return(0);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int dci_modulation_NB_IoT(int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t control_region_size, //XXX we pass the npdcch_start_symbol // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
uint8_t *e, // Input data
uint8_t control_region_size, // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
NB_IoT_eNB_NDLSCH_t *dlsch0, //NB_IoT_eNB_NDLSCH_t
int G, // number of bits per subframe
unsigned int npdsch_data_subframe, // subframe index of the data table of npdsch channel (G*Nsf) , values are between 0..Nsf
uint8_t dci_number, // This variable should takes the 1 or 2 (1 for in case of one DCI, 2 in case of two DCI)
uint8_t agr_level,
int RB_index,
int subframe) // Aggregation level
unsigned int subframe,
unsigned short NB_IoT_RB_ID)
{
uint32_t jj=0;
//uint8_t harq_pid = dlsch0->current_harq_pid;
//NB_IoT_DL_eNB_HARQ_t *dlsch0_harq = dlsch0->harq_processes[harq_pid];
uint32_t jj = 0;
uint32_t re_allocated,symbol_offset;
uint16_t l;
uint8_t id_offset,pilot_shift,pilots=0;
uint8_t id_offset,pilot_shift,pilots = 0;
unsigned short bandwidth_even_odd;
unsigned short NB_IoT_start, RB_IoT_ID;
re_allocated=0;
id_offset=0;
re_allocated = 0;
id_offset = 0;
pilot_shift = 0;
// testing if the total number of RBs is even or odd
bandwidth_even_odd = frame_parms->N_RB_DL % 2; // 0 even, 1 odd
//RB_IoT_ID = frame_parms->NB_IoT_RB_ID;
RB_IoT_ID = RB_index;
RB_IoT_ID = NB_IoT_RB_ID;
// step 5, 6, 7 // modulation and mapping (slot 1, symbols 0..3)
for (l=control_region_size; l<14; l++) { // loop on OFDM symbols
if((l>=4 && l<=7) || (l>=11 && l<=13))
......@@ -457,7 +397,7 @@ int dci_modulation_NB_IoT(int32_t **txdataF,
txdataF,
&jj,
symbol_offset,
&e[0],
&dlsch0->harq_process->s_e[G*npdsch_data_subframe],
pilots,
amp,
id_offset,
......@@ -469,22 +409,16 @@ int dci_modulation_NB_IoT(int32_t **txdataF,
return (re_allocated);
}
//------------------------------------------------
// BCOM code functions npdcch end
//------------------------------------------------
/*dci_allocate_REs_in_RB_NB_IoT(frame_parms,
txdataF,
&jj,
symbol_offset,
e,
pilots,
amp,
id_offset,
&re_allocated,
dci_number,
agr_level);
*/
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
uint8_t generate_dci_top_NB_IoT(NB_IoT_eNB_NPDCCH_t *npdcch,
uint8_t Num_dci,
......@@ -529,7 +463,7 @@ uint8_t generate_dci_top_NB_IoT(NB_IoT_eNB_NPDCCH_t *npdcch,
//First take all the DCI pdu and their corrispondent rnti
for(i = 0; i<Num_dci;i++)
{
npdcch->a[i]=dci_alloc[i].dci_pdu;
npdcch->pdu[i][0]=dci_alloc[i].dci_pdu;
rnti[i]=dci_alloc[i].rnti;
L = dci_alloc[i].L;
......
......@@ -546,27 +546,6 @@ typedef enum
typedef struct {
rnti_t rnti;
//array containing the pdus of DCI
uint8_t *a[2];
//Array containing encoded DCI data
uint8_t *e[2];
//UE specific parameters
uint16_t npdcch_NumRepetitions;
uint16_t repetition_number;
//indicate the corresponding subframe within the repetition (set to 0 when a new NPDCCH pdu is received)
uint16_t repetition_idx;
// uint16_t npdcch_Offset_USS;
// uint16_t npdcch_StartSF_USS;
}NB_IoT_eNB_NPDCCH_t;
typedef struct{
//Number of repetitions (R) for common search space (RAR and PAGING)
......@@ -871,18 +850,28 @@ typedef struct {
} NB_IoT_eNB_NPBCH_t;
#define NPDCCH_A 23
#define MAX_BITS_IN_SF 284 // maximum number of bits over one subframe
typedef struct {
//the 2 LSB of the hsfn (the MSB are indicated by the SIB1-NB)
rnti_t rnti[2];
//UE specific parameters
uint16_t npdcch_NumRepetitions[2];
uint16_t repetition_number[2];
//indicate the corresponding subframe within the repetition (set to 0 when a new NPDCCH pdu is received)
uint16_t repetition_idx[2];
uint16_t h_sfn_lsb;
uint8_t npdcch_d[2][96+(3*(16+NPDCCH_A))];
uint8_t npdcch_w[2][3*3*(16+NPDCCH_A)];
uint8_t npdcch_e[2][236];
uint8_t npdcch_e[2][MAX_BITS_IN_SF];
///pdu of the npbch message
uint8_t pdu[2][3];
} NB_IoT_eNB_NPDCCH_temp_t;
} NB_IoT_eNB_NPDCCH_t;
#endif
......@@ -125,7 +125,7 @@ void ccode_encode_npdsch_NB_IoT (int32_t numbits,
///////////////////////////////////////////////////////////////////////////////
int dlsch_encoding_NB_IoT(unsigned char *a,
NB_IoT_DL_eNB_HARQ_t *dlsch, //NB_IoT_eNB_NDLSCH_t
NB_IoT_eNB_NDLSCH_t *dlsch, //NB_IoT_eNB_NDLSCH_t
uint8_t Nsf, // number of subframes required for npdsch pdu transmission calculated from Isf (3GPP spec table)
unsigned int G,
uint8_t option) // G (number of available RE) is implicitly multiplied by 2 (since only QPSK modulation)
......@@ -134,7 +134,7 @@ int dlsch_encoding_NB_IoT(unsigned char *a,
//unsigned char harq_pid = dlsch->current_harq_pid; // to check during implementation if harq_pid is required in the NB_IoT_eNB_DLSCH_t structure in defs_NB_IoT.h
//uint8_t option1,option2,option3,option4;
unsigned int A=0;
A = dlsch->TBS / 8;
A = dlsch->harq_process->TBS / 8;
uint8_t RCC;
......@@ -143,7 +143,7 @@ int dlsch_encoding_NB_IoT(unsigned char *a,
bzero(npbch_a,A);
bzero(npbch_a_crc,A+3);
dlsch->length_e = G*Nsf; // G*Nsf (number_of_subframes) = total number of bits to transmit G=236
dlsch->harq_process->length_e = G*Nsf; // G*Nsf (number_of_subframes) = total number of bits to transmit G=236
for (int i=0; i<A; i++)
......@@ -165,13 +165,12 @@ int dlsch_encoding_NB_IoT(unsigned char *a,
npbch_a_crc[A+1] = ((uint8_t*)&crc)[1];
npbch_a_crc[A+2] = ((uint8_t*)&crc)[0];
dlsch->B = numbits; // The length of table b in bits
dlsch->harq_process->B = numbits; // The length of table b in bits
//memcpy(dlsch->b,a,numbits/8); // comment if option 2
memset(dlsch->d,LTE_NULL_NB_IoT,96);
ccode_encode_npdsch_NB_IoT(numbits,npbch_a_crc,dlsch->d+96,crc);
RCC = sub_block_interleaving_cc_NB_IoT(numbits,dlsch->d+96,dlsch->w); // step 2 interleaving
lte_rate_matching_cc_NB_IoT(RCC,dlsch->length_e,dlsch->w,dlsch->e); // step 3 Rate Matching
memset(dlsch->harq_process->d,LTE_NULL_NB_IoT,96);
ccode_encode_npdsch_NB_IoT(numbits,npbch_a_crc,dlsch->harq_process->d+96,crc);
RCC = sub_block_interleaving_cc_NB_IoT(numbits,dlsch->harq_process->d+96,dlsch->harq_process->w); // step 2 interleaving
lte_rate_matching_cc_NB_IoT(RCC,dlsch->harq_process->length_e,dlsch->harq_process->w,dlsch->harq_process->e); // step 3 Rate Matching
return(0);
......
......@@ -137,7 +137,7 @@ int dlsch_modulation_NB_IoT(int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t control_region_size, // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
NB_IoT_DL_eNB_HARQ_t *dlsch0, //NB_IoT_eNB_NDLSCH_t
NB_IoT_eNB_NDLSCH_t *dlsch0, //NB_IoT_eNB_NDLSCH_t
int G, // number of bits per subframe
unsigned int npdsch_data_subframe, // subframe index of the data table of npdsch channel (G*Nsf) , values are between 0..Nsf
unsigned int subframe,
......@@ -184,7 +184,7 @@ int dlsch_modulation_NB_IoT(int32_t **txdataF,
txdataF,
&jj,
symbol_offset,
&dlsch0->s_e[G*npdsch_data_subframe],
&dlsch0->harq_process->s_e[G*npdsch_data_subframe],
pilots,
amp,
id_offset,
......
......@@ -258,23 +258,27 @@ unsigned char get_Qm_ul_NB_IoT(unsigned char I_MCS, uint8_t N_sc_RU);
int dci_modulation_NB_IoT(int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t control_region_size, //XXX we pass the npdcch_start_symbol // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
uint8_t *e, // Input data
uint8_t control_region_size, // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
NB_IoT_eNB_NDLSCH_t *dlsch0, //NB_IoT_eNB_NDLSCH_t
int G, // number of bits per subframe
unsigned int npdsch_data_subframe, // subframe index of the data table of npdsch channel (G*Nsf) , values are between 0..Nsf
uint8_t dci_number, // This variable should takes the 1 or 2 (1 for in case of one DCI, 2 in case of two DCI)
uint8_t agr_level,
int RB_index,
int subframe);
unsigned int subframe,
unsigned short NB_IoT_RB_ID);
int dci_allocate_REs_in_RB_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **txdataF,
uint32_t *jj,
uint32_t symbol_offset,
uint8_t *x0[2],
uint8_t *x0,
uint8_t pilots,
uint8_t pilot_shift,
int16_t amp,
unsigned short id_offset,
uint32_t *re_allocated, // not used variable ??!!
uint8_t dci_number, // This variable should takes the 1 or 2 (1 for in case of one DCI, 2 in case of two DCI)
uint8_t ncce_index,
uint8_t agr_level);
void npdcch_scrambling_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,
......@@ -289,7 +293,7 @@ int dlsch_modulation_NB_IoT(int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t control_region_size, // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
NB_IoT_DL_eNB_HARQ_t *dlsch0, //NB_IoT_eNB_NDLSCH_t
NB_IoT_eNB_NDLSCH_t *dlsch0, //NB_IoT_eNB_NDLSCH_t
int G, // number of bits per subframe
unsigned int npdsch_data_subframe, // subframe index of the data table of npdsch channel (G*Nsf) , values are between 0..Nsf
unsigned int subframe,
......@@ -307,7 +311,7 @@ int dlsch_modulation_rar_NB_IoT(int32_t **txdataF,
uint8_t option);
*/
int32_t dlsch_encoding_NB_IoT(unsigned char *a,
NB_IoT_DL_eNB_HARQ_t *dlsch, // NB_IoT_eNB_NDLSCH_t
NB_IoT_eNB_NDLSCH_t *dlsch, // NB_IoT_eNB_NDLSCH_t
uint8_t Nsf, // number of subframes required for npdsch pdu transmission calculated from Isf (3GPP spec table)
unsigned int G,
uint8_t option); // G (number of available RE) is implicitly multiplied by 2 (since only QPSK modulation)
......
......@@ -516,7 +516,7 @@ NB_IoT_eNB_NDLSCH_t *ndlsch_SIB1;
NB_IoT_eNB_NDLSCH_t *ndlsch_SIB23;
NB_IoT_eNB_NDLSCH_t *ndlsch_RAR;
//NB_IoT_eNB_NDLSCH_t ndlsch_rar;
NB_IoT_eNB_NPDCCH_temp_t npdcch_tmp;
NB_IoT_eNB_NPDCCH_t npdcch_DCI;
NB_IoT_eNB_NULSCH_t *ulsch_NB_IoT[NUMBER_OF_UE_MAX+1];
////////////// For IF Module /////////////////////////////
......
......@@ -519,28 +519,6 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
int subframerx = proc->subframe_rx;
/////////////////////////////////////////////////ACK ///////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////
//int With_NSSS=0;
//printf("\n in eNB_fep_full in frame_tx = %d \n",frame);
/*if (proc->flag_msg3==1 && framerx==proc->frame_msg3 && subframerx==9)
{
printf("\n\n\n\n in writing in frame %d \n\n\n\n",frame);
int16_t *Rx_buffer;
FILE *fich = fopen("xyzabc.txt","w");
Rx_buffer = &eNB->common_vars.rxdata[0][0][0]; // get the whole frame
memcpy(&buffer_npusch[0],&Rx_buffer[0],307200);
int pp;
for (pp=0;pp<153600;pp++)
{
fprintf(fich," %d ",buffer_npusch[pp]);
}
fclose(fich);
exit(0);
}*/
NB_IoT_eNB_NULSCH_t **ulsch_NB_IoT = &eNB->ulsch_NB_IoT[0];//[0][0];
////////////////////////////////////////////////////////////////////////////////////////
......@@ -548,16 +526,7 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
////////////////////////////////////////////////////////////////////////////////////////
if(subframe==proc->subframe_msg5 && frame==proc->frame_msg5 && proc->flag_msg5==1 && proc->counter_msg5>0)
{
//LTE_eNB_PUSCH *pusch_vars = eNB->pusch_vars[0];
//NB_IoT_eNB_NULSCH_t **ulsch_NB_IoT = &eNB->ulsch_NB_IoT;//[0][0];
//int l,ii=0; //i;
//uint8_t nb_rb=1; //ulsch_NB_IoT[0]->harq_process->nb_rb, //////////////// high level parameter
//int16_t *llrp, *llrp2;
//uint32_t rnti_tmp= 65522; // true rnti should be used
//uint32_t x1_msg5, x2_msg5, s_msg5=0;
//uint8_t reset;
//uint8_t counter_ack; // ack counter for decision ack/nack
//int32_t counter_ack_soft;
printf("\n\n msg5 received in frame %d subframe %d \n\n",framerx,subframerx);
if (proc->counter_msg5 ==2)
......@@ -591,7 +560,7 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
proc->subframe_msg5++;
proc->counter_msg5--;
///if (proc->counter_msg5==0) exit(0);
}
////////////////////////////////////////////////////////////////////////////////////
......@@ -647,7 +616,7 @@ if(proc->flag_msg4 == 1 && proc->counter_msg4 > 0)
if(frame == proc->frame_msg4 && subframe == proc->subframe_msg4)
{
NB_IoT_DL_eNB_HARQ_t *rar = eNB->ndlsch_RAR->harq_process;
NB_IoT_eNB_NDLSCH_t *rar = eNB->ndlsch_RAR;
//uint8_t tab_rar[15];
//uint8_t tab_rar[18];
uint8_t tab_rar[7];
......@@ -780,582 +749,15 @@ if(proc->flag_msg4 == 1 && proc->counter_msg4 > 0)
}
////////////////////////////////////////////////////////////////////////////////////////////////////
if(proc->flag_DCI_msg4 ==1 && proc->counter_DCI_msg4>0)
{
if(proc->guard>0)
{
proc->guard--;
}
NB_IoT_eNB_NPDCCH_temp_t *npdcch_struct_x = &eNB->npdcch_tmp;
if(proc->SP2 == 1)
{
if(proc->subframe_DCI_msg4==subframe && frame == proc->frame_DCI_msg4)
{
if(subframe==9)
{
proc->subframe_DCI_msg4 =1;
proc->frame_DCI_msg4=frame+1;
} else {
printf("\n xxxxxxxxxxxxxxxx DCI 2 for msg4 xxxxxxxxxxxxx frame %d, subframe %d", frame, subframe);
dci_modulation_NB_IoT(txdataF,AMP,fp,3,npdcch_struct_x->npdcch_e[0],1,2,22,subframe);
proc->counter_DCI_msg4--;
if(subframe==9) /// tester le cas ou subframe==4 && 5
{
proc->subframe_DCI_msg4 =1;
proc->frame_DCI_msg4=frame+1;
} else {
proc->subframe_DCI_msg4 =subframe+1;
}
if(proc->counter_DCI_msg4 == 0)
{
proc->flag_msg4=1;
proc->counter_msg4=4;
if(subframe+5>9)
{
proc->subframe_msg4 = (subframe+5)-10;
proc->frame_msg4= frame+1;
} else {
proc->subframe_msg4= subframe+5;
proc->frame_msg4= frame;
}
}
}
}
}
if(((10*frame +subframe) % 8)==2 && subframe != 0 && subframe != 5 && proc->SP2 !=1 && proc->guard==0)
{
printf("\n xxxxxxxxxxxxxxxx DCI 1 for msg4 xxxxxxxxxxxxx frame %d, subframe %d", frame, subframe);
proc->SP2 =1;
proc->flag_scrambling =0; /// for msg4 PDU
int32_t numbits = 23;
uint8_t RCC;
uint16_t npdcch_D = 16 + 23;
uint16_t npdcch_E = 236;
uint8_t agr_level = 2;
// uint8_t dci_number=1;
uint8_t tab_a[3];
tab_a[0]= 128;
tab_a[1]= 66;
tab_a[2]= 4;
// TBS =120
/* tab_a[0]= 129;
tab_a[1]= 130;
tab_a[2]= 2;
*/
/* // TBS =144
tab_a[0]= 128;
tab_a[1]= 130;
tab_a[2]= 4;
*/
// int RB_ID_IoT=22 ;
bzero(npdcch_struct_x->npdcch_e[0],npdcch_E);
memset(npdcch_struct_x->npdcch_d[0],LTE_NULL_NB_IoT,96);
ccode_encode_NB_IoT(numbits,2,tab_a,npdcch_struct_x->npdcch_d[0]+96,65522);
RCC = sub_block_interleaving_cc_NB_IoT(npdcch_D,npdcch_struct_x->npdcch_d[0]+96,npdcch_struct_x->npdcch_w[0]);
lte_rate_matching_cc_NB_IoT(RCC,npdcch_E,npdcch_struct_x->npdcch_w[0],npdcch_struct_x->npdcch_e[0]);
npdcch_scrambling_NB_IoT(fp,npdcch_struct_x->npdcch_e[0],npdcch_E,(uint8_t)subframe*2,1,agr_level);
dci_modulation_NB_IoT(txdataF,AMP,fp,3,npdcch_struct_x->npdcch_e[0],1,2,22,subframe);
proc->counter_DCI_msg4--;
////////////////////////////////////////////if (subframe ==9 )
proc->subframe_DCI_msg4 = subframe+1;
proc->frame_DCI_msg4 = frame;
}
}
///////////////////////////////////////////////////////////////////////////////
common_signal_procedures_NB_IoT(eNB,proc);
/////////////////// NB-IoT broadcast channel //////////////////////////
//RA_template[i].RA_active=TRUE;
///if( frame%2 ==0 && subframe ==1)
if(subframe ==7)
{
if( RA_template[0].generate_rar == 1 && proc->sheduling_info_rar != 1)
{
proc->ra_rnti_computed = RA_template[0].RA_rnti;
proc->dci_to_transmit =1;
proc->remaining_dci =4;
proc->sheduling_info_rar =1;
proc->rar_to_transmit =0;
proc->SP =0;
proc->SP2 =0;
proc->flag_msg3=0;
proc->frame_msg3=0;
proc->counter_msg3=0;
proc->flag_scrambling =0;
proc->subframe_real=-1;
proc->subframe_delay=-1;
proc->flag_msg5 =0;
proc->flag_msg4 =0;
proc->subframe_SP2 =0;
proc->subframe_SP =0;
proc->flag_DCI_msg4=0;
proc->flag_msg4=0;
proc->counter_DCI_msg4=0;
proc->counter_msg4=0;
proc->frame_DCI_msg4=0;
proc->frame_msg4=0;
proc->guard=5;
proc->subframe_DCI_msg4=0;
proc->subframe_msg4=0;
proc->counter_msg5 =0;
proc->frame_msg5=0;
proc->subframe_msg5=0;
//printf("detection ok in TX !!!!!!!!!!!!!!!!!");
//RA_template[0].generate_rar = 0;
//RA_template[0].RA_active = FALSE;
eNB->npdcch_tmp.pdu[0][0]=128; //90
eNB->npdcch_tmp.pdu[0][1]=66; //42
eNB->npdcch_tmp.pdu[0][2]=4; //4
}
}
//if(frame%4==0 && proc->dci_to_transmit ==1 && proc->remaining_dci >0)
if(proc->dci_to_transmit ==1 && proc->remaining_dci >0)
{
if(((10*frame +subframe) % 8)==2 && subframe != 0 && subframe != 4 && subframe != 6 && proc->SP !=1)
{
printf("\n xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxframe %d, subframe %dxxxxxxxxxxxxxxxxxxxxxxxxxxxx", frame, subframe);
proc->SP =1;
NB_IoT_eNB_NPDCCH_temp_t *npdcch_struct = &eNB->npdcch_tmp;
if(subframe ==2)
{ proc->subframe_SP =0;
printf("\n DCI 2 sentttttt frame %d, subframe %d", frame, subframe);
printf("\n xxxxxxxxx RA-RNTI = %d xxxxxxxxxxxxxxx", RA_template[0].RA_rnti);
int32_t numbits = 23;
uint8_t RCC;
uint16_t npdcch_D = 16 + 23;
uint16_t npdcch_E = 236;
uint8_t agr_level = 2;
// uint8_t dci_number=1;
uint8_t tab_a[3];
tab_a[0]= 128;
tab_a[1]= 66;
tab_a[2]= 4;
// int RB_ID_IoT=22 ;
bzero(npdcch_struct->npdcch_e[0],npdcch_E);
memset(npdcch_struct->npdcch_d[0],LTE_NULL_NB_IoT,96);
ccode_encode_NB_IoT(numbits,2,tab_a,npdcch_struct->npdcch_d[0]+96,RA_template[0].RA_rnti);
RCC = sub_block_interleaving_cc_NB_IoT(npdcch_D,npdcch_struct->npdcch_d[0]+96,npdcch_struct->npdcch_w[0]);
lte_rate_matching_cc_NB_IoT(RCC,npdcch_E,npdcch_struct->npdcch_w[0],npdcch_struct->npdcch_e[0]);
npdcch_scrambling_NB_IoT(fp,npdcch_struct->npdcch_e[0],npdcch_E,(uint8_t)subframe*2,1,agr_level);
dci_modulation_NB_IoT(txdataF,AMP,fp,3,npdcch_struct->npdcch_e[0],1,2,22,subframe);
proc->remaining_dci--;
} else {
proc->subframe_SP =1;
if( ((frame)%2==1) && ((frame)%64<16))
{
proc->there_is_sib23 =8;
} else {
printf("\n DCI 8 sentttttt frame %d, subframe %d", frame, subframe);
printf("\n xxxxxxxxx RA-RNTI = %d xxxxxxxxxxxxxxx", RA_template[0].RA_rnti);
int32_t numbits = 23;
uint8_t RCC;
uint16_t npdcch_D = 16 + 23;
uint16_t npdcch_E = 236;
uint8_t agr_level = 2;
//uint8_t dci_number=1;
uint8_t tab_a[3];
tab_a[0]= 128;
tab_a[1]= 66;
tab_a[2]= 4;
// int RB_ID_IoT=22 ;
bzero(npdcch_struct->npdcch_e[0],npdcch_E);
memset(npdcch_struct->npdcch_d[0],LTE_NULL_NB_IoT,96);
ccode_encode_NB_IoT(numbits,2,tab_a,npdcch_struct->npdcch_d[0]+96,RA_template[0].RA_rnti);
RCC = sub_block_interleaving_cc_NB_IoT(npdcch_D,npdcch_struct->npdcch_d[0]+96,npdcch_struct->npdcch_w[0]);
lte_rate_matching_cc_NB_IoT(RCC,npdcch_E,npdcch_struct->npdcch_w[0],npdcch_struct->npdcch_e[0]);
npdcch_scrambling_NB_IoT(fp,npdcch_struct->npdcch_e[0],npdcch_E,(uint8_t)subframe*2,1,agr_level);
dci_modulation_NB_IoT(txdataF,AMP,fp,3,npdcch_struct->npdcch_e[0],1,2,22,subframe);
proc->remaining_dci--;
}
}
}
if(proc->subframe_SP ==0 && proc->SP ==1)
{
NB_IoT_eNB_NPDCCH_temp_t *npdcch_struct = &eNB->npdcch_tmp;
if(subframe ==3)
{
printf("\n DCI 3 sentttttt frame %d, subframe %d", frame, subframe);
dci_modulation_NB_IoT(txdataF,AMP,fp,3,npdcch_struct->npdcch_e[0],1,2,22,subframe);
proc->remaining_dci--;
}
if((subframe == 4) && (frame%2==0) && (frame%32>=16) )
{
printf("\n DCI 4 sentttttt frame %d, subframe %d", frame, subframe);
dci_modulation_NB_IoT(txdataF,AMP,fp,3,npdcch_struct->npdcch_e[0],1,2,22,subframe);
proc->remaining_dci--;
}
if(subframe ==6)
{
printf("\n DCI 6 sentttttt frame %d, subframe %d", frame, subframe);
dci_modulation_NB_IoT(txdataF,AMP,fp,3,npdcch_struct->npdcch_e[0],1,2,22,subframe);
proc->remaining_dci--;
if(proc->remaining_dci == 0)
{
proc->dci_to_transmit =0;
proc->rar_to_transmit =1;
proc->remaining_rar =4;
printf("xxxxx ERROR %d XXXXXX",proc->remaining_dci);
// proc->next_frame_tx=frame+2;
// proc->next_subframe_tx=1;
if(((frame+1)%2==1) && ((frame+1)%64<16))
{
proc->next_frame_tx=frame+2;
proc->next_subframe_tx=1;
}else {
proc->next_frame_tx=frame+1;
proc->next_subframe_tx=2;
}
}
}
if(subframe ==7)
{
printf("\n DCI 7 sentttttt frame %d, subframe %d", frame, subframe);
dci_modulation_NB_IoT(txdataF,AMP,fp,3,npdcch_struct->npdcch_e[0],1,2,22,subframe);
proc->remaining_dci--;
if(proc->remaining_dci == 0)
{
proc->dci_to_transmit =0;
proc->rar_to_transmit =1;
proc->remaining_rar =4;
// proc->next_frame_tx=frame+2;
// proc->next_subframe_tx=1;
if(((frame+1)%2==1) && ((frame+1)%64<16))
{
proc->next_frame_tx=frame+2;
proc->next_subframe_tx=1;
}else {
proc->next_frame_tx=frame+1;
proc->next_subframe_tx=3;
}
}
}
}
if(proc->subframe_SP ==1 && proc->SP ==1)
{
if(proc->there_is_sib23==8)
{
NB_IoT_eNB_NPDCCH_temp_t *npdcch_struct = &eNB->npdcch_tmp;
if(subframe ==1)
{ printf("\n DCI 1 sentttttt frame %d, subframe %d", frame, subframe);
printf("\n xxxxxxxxx RA-RNTI = %d xxxxxxxxxxxxxxx", RA_template[0].RA_rnti);
int32_t numbits = 23;
uint8_t RCC;
uint16_t npdcch_D = 16 + 23;
uint16_t npdcch_E = 236;
uint8_t agr_level = 2;
// uint8_t dci_number=1;
uint8_t tab_a[3];
tab_a[0]= 128;
tab_a[1]= 66;
tab_a[2]= 4;
// int RB_ID_IoT=22 ;
bzero(npdcch_struct->npdcch_e[0],npdcch_E);
memset(npdcch_struct->npdcch_d[0],LTE_NULL_NB_IoT,96);
ccode_encode_NB_IoT(numbits,2,tab_a,npdcch_struct->npdcch_d[0]+96,RA_template[0].RA_rnti);
RCC = sub_block_interleaving_cc_NB_IoT(npdcch_D,npdcch_struct->npdcch_d[0]+96,npdcch_struct->npdcch_w[0]);
lte_rate_matching_cc_NB_IoT(RCC,npdcch_E,npdcch_struct->npdcch_w[0],npdcch_struct->npdcch_e[0]);
npdcch_scrambling_NB_IoT(fp,npdcch_struct->npdcch_e[0],npdcch_E,(uint8_t)subframe*2,1,agr_level);
dci_modulation_NB_IoT(txdataF,AMP,fp,3,npdcch_struct->npdcch_e[0],1,2,22,subframe);
proc->remaining_dci--;
}
if(subframe ==2)
{
printf("\n DCI 2 sentttttt frame %d, subframe %d", frame, subframe);
dci_modulation_NB_IoT(txdataF,AMP,fp,3,npdcch_struct->npdcch_e[0],1,2,22,subframe);
proc->remaining_dci--;
}
if(subframe ==3)
{
printf("\n DCI 3 sentttttt frame %d, subframe %d", frame, subframe);
dci_modulation_NB_IoT(txdataF,AMP,fp,3,npdcch_struct->npdcch_e[0],1,2,22,subframe);
proc->remaining_dci--;
}
if((subframe == 4) && (frame%2==0) && (frame%32>=16) )
{
printf("\n DCI 4 sentttttt frame %d, subframe %d", frame, subframe);
dci_modulation_NB_IoT(txdataF,AMP,fp,3,npdcch_struct->npdcch_e[0],1,2,22,subframe);
proc->remaining_dci--;
if(proc->remaining_dci == 0)
{
proc->dci_to_transmit =0;
proc->rar_to_transmit =1;
proc->remaining_rar =4;
printf("xxxxx ERROR %d XXXXXX",proc->remaining_dci);
//proc->next_frame_tx=frame+1;
// proc->next_subframe_tx=8;
if(((frame+1)%2==1) && ((frame+1)%64<16))
{
proc->next_frame_tx=frame+2;
proc->next_subframe_tx=1;
} else {
proc->next_frame_tx=frame+1;
proc->next_subframe_tx=1;
}
}
}
if((subframe == 6))
{
printf("\n DCI 6 sentttttt frame %d, subframe %d", frame, subframe);
dci_modulation_NB_IoT(txdataF,AMP,fp,3,npdcch_struct->npdcch_e[0],1,2,22,subframe);
proc->remaining_dci--;
if(proc->remaining_dci == 0)
{
proc->dci_to_transmit =0;
proc->rar_to_transmit =1;
proc->remaining_rar =4;
printf("xxxxx ERROR %d XXXXXX",proc->remaining_dci);
// proc->next_frame_tx=frame+2;
// proc->next_subframe_tx=1;
if(((frame+1)%2==1) && ((frame+1)%64<16))
{
proc->next_frame_tx=frame+2;
proc->next_subframe_tx=1;
} else {
proc->next_frame_tx=frame+1;
proc->next_subframe_tx=2;
}
}
}
} else {
NB_IoT_eNB_NPDCCH_temp_t *npdcch_struct = &eNB->npdcch_tmp;
if(subframe ==9)
{
printf("\n DCI 9 sentttttt frame %d, subframe %d", frame, subframe);
dci_modulation_NB_IoT(txdataF,AMP,fp,3,npdcch_struct->npdcch_e[0],1,2,22,subframe);
proc->remaining_dci--;
}
if(subframe == 1 )
{
printf("\n DCI 1 sentttttt frame %d, subframe %d", frame, subframe);
dci_modulation_NB_IoT(txdataF,AMP,fp,3,npdcch_struct->npdcch_e[0],1,2,22,subframe);
proc->remaining_dci--;
}
if(subframe ==2)
{
printf("\n DCI 2 sentttttt frame %d, subframe %d", frame, subframe);
dci_modulation_NB_IoT(txdataF,AMP,fp,3,npdcch_struct->npdcch_e[0],1,2,22,subframe);
proc->remaining_dci--;
if(proc->remaining_dci == 0)
{
proc->dci_to_transmit =0;
proc->rar_to_transmit =1;
proc->remaining_rar =4;
printf("xxxxx ERROR %d XXXXXX",proc->remaining_dci);
proc->next_frame_tx=frame;
proc->next_subframe_tx=7;
}
}
}
}
}
if(subframe !=5 && subframe !=0)
{
if(proc->rar_to_transmit ==1 && proc->remaining_rar >0)
{
NB_IoT_DL_eNB_HARQ_t *rar = &eNB->ndlsch_RAR->harq_process;
uint8_t tab_rar[7];
// printf("xxxxx index verif %d XXXXXX",RA_template[0].preamble_index);
tab_rar[0]=64 + RA_template[0].preamble_index;
tab_rar[1]=0;
tab_rar[2]=9;
tab_rar[3]=96;
tab_rar[4]=64;
tab_rar[5]=255; // 16
tab_rar[6]=242; // 5*/
if(frame == proc->next_frame_tx && subframe == proc->next_subframe_tx)
{
if(subframe == 4)
{
uint8_t sib1_exist =0;
if( ((frame)%2==0) && ((frame)%32<16))
{
sib1_exist =1;
}
if(sib1_exist == 1)
{
proc->next_subframe_tx =subframe+2;
} else {
if(proc->flag_scrambling ==0)
{
dlsch_encoding_NB_IoT(tab_rar,
rar,
8, ///// number_of_subframes_required
236,
1); //////////// G*2
dlsch_scrambling_Gen_NB_IoT(fp,
rar,
236,
frame,
subframe*2,
RA_template[0].RA_rnti);
}
proc->flag_scrambling =1;
printf("\n RAR sentttttt frame %d, subframe %d", frame, subframe);
dlsch_modulation_NB_IoT(txdataF,
AMP,
fp,
3, // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
rar,
236, // number of bits per subframe
frame, // unrequired
subframe,
22);
proc->remaining_rar--;
proc->next_subframe_tx =subframe+2;
if(proc->remaining_rar == 0)
{
proc->flag_msg3 =1;
proc->frame_msg3=frame+1;
proc->counter_msg3 = 8;
proc->subframe_real=9;
proc->subframe_delay=5;
}
}
} else {
if( ((frame)%2==0) && (subframe ==9))
{
proc->next_subframe_tx =1;
proc->next_frame_tx = proc->next_frame_tx+1;
} else {
if(proc->flag_scrambling ==0)
{
dlsch_encoding_NB_IoT(tab_rar,
rar,
8, ///// number_of_subframes_required
236,
1); //////////// G*2
dlsch_scrambling_Gen_NB_IoT(fp,
rar,
236,
frame,
subframe*2,
RA_template[0].RA_rnti);
}
proc->flag_scrambling =1;
printf("\n RAR sentttttt frame %d, subframe %d", frame, subframe);
dlsch_modulation_NB_IoT(txdataF,
AMP,
fp,
3, // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
rar,
236, // number of bits per subframe
frame, // unrequired
subframe,
22);
proc->remaining_rar--;
proc->next_subframe_tx =subframe+1;
if(proc->remaining_rar == 0)
{
proc->flag_msg3 =1;
proc->frame_msg3=frame+1;
proc->counter_msg3 = 8;
proc->subframe_delay=5;
proc->subframe_real=9;
}
}
}
}
}
}
/////////////////////////// END ///////////////////////////////////////
......
......@@ -878,10 +878,10 @@ void generate_eNB_dlsch_params_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_t *
//set the NPDCCH UE-specific structure (calculate R)
npdcch=eNB->npdcch[(uint8_t)UE_id];
AssertFatal(npdcch != NULL, "NPDCCH structure for UE specific is not exist\n");
npdcch->repetition_idx = 0; //this is used for the encoding mechanism to understand that is the first transmission
npdcch->repetition_idx[(uint8_t)UE_id] = 0; //this is used for the encoding mechanism to understand that is the first transmission
if(dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.aggregation_level) //whenever aggregation level is =1 we have only 1 repetition for USS
npdcch->repetition_number = 1;
npdcch->repetition_number[(uint8_t)UE_id] = 1;
else
{
//see TS 36.213 Table 16.1-1
......@@ -1532,7 +1532,7 @@ void phy_procedures_eNB_TX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
for(UE_id = 0 ; UE_id < NUMBER_OF_UE_MAX_NB_IoT; UE_id++)
{
if(eNB->npdcch[(uint8_t)UE_id] != NULL && eNB->npdcch[(uint8_t)UE_id]->rnti == dci_pdu->dci_alloc->rnti && (eNB->ndlsch_SIB1->harq_process->status != ACTIVE_NB_IoT || subframe != 4))
if(eNB->npdcch[(uint8_t)UE_id] != NULL && eNB->npdcch[(uint8_t)UE_id]->rnti[(uint8_t)UE_id] == dci_pdu->dci_alloc->rnti && (eNB->ndlsch_SIB1->harq_process->status != ACTIVE_NB_IoT || subframe != 4))
{
if(frame%2 == 0)//condition on NSSS (subframe 9 not available)
{
......@@ -1547,7 +1547,7 @@ void phy_procedures_eNB_TX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
eNB->common_vars.txdataF[0],
subframe,
dci_pdu->npdcch_start_symbol); //this parameter depends by eutraControlRegionSize (see TS36.213 16.6.1)
eNB->npdcch[(uint8_t)UE_id]->repetition_idx++; //can do also inside also the management
eNB->npdcch[(uint8_t)UE_id]->repetition_idx[(uint8_t)UE_id]++; //can do also inside also the management
break;
}
......@@ -1565,7 +1565,7 @@ void phy_procedures_eNB_TX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
subframe,
dci_pdu->npdcch_start_symbol); //this parameter depends by eutraControlRegionSize (see TS36.213 16.6.1)
eNB->npdcch[(uint8_t)UE_id]->repetition_idx++; //can do also inside also the management
eNB->npdcch[(uint8_t)UE_id]->repetition_idx[(uint8_t)UE_id]++; //can do also inside also the management
break;
}
......
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