Commit 4d17c7a6 authored by Michele Paffetti's avatar Michele Paffetti

start modification for HARQ process and adding major strucutres to...

start modification for HARQ process and adding major strucutres to PHY_vars_eNB. Code not compile. dci_nb_iot.c to be added to CMakeList
parent d1d341ef
...@@ -287,100 +287,6 @@ typedef struct { ...@@ -287,100 +287,6 @@ typedef struct {
} LTE_eNB_DLSCH_t; } LTE_eNB_DLSCH_t;
//----------------------------------------------------------------------------------------------------
//new structure for NPDCCH
typedef struct
{
/// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding)
int32_t *txdataF[8];
/// beamforming weights for UE-spec transmission (antenna ports 5 or 7..14), for each codeword, maximum 4 layers?
int32_t **ue_spec_bf_weights[4];
/// dl channel estimates (estimated from ul channel estimates)
int32_t **calib_dl_ch_estimates;
/// Allocated RNTI (0 means DLSCH_t is not currently used)
uint16_t rnti;
/// Active flag for baseband transmitter processing
uint8_t active;
/// Indicator of TX activation per subframe. Used during PUCCH detection for ACK/NAK.
uint8_t subframe_tx[10];
/// First CCE of last PDSCH scheduling per subframe. Again used during PUCCH detection for ACK/NAK.
uint8_t nCCE[10];
/// Current HARQ process id
uint8_t current_harq_pid;
/// Process ID's per subframe. Used to associate received ACKs on PUSCH/PUCCH to DLSCH harq process ids
uint8_t harq_ids[10];
/// Window size (in outgoing transport blocks) for fine-grain rate adaptation
uint8_t ra_window_size;
/// First-round error threshold for fine-grain rate adaptation
uint8_t error_threshold;
/// Pointers to 8 HARQ processes for the DLSCH
LTE_DL_eNB_HARQ_t *harq_processes[8];
/// Number of soft channel bits
uint32_t G;
/// Codebook index for this dlsch (0,1,2,3)
uint8_t codebook_index;
/// Maximum number of HARQ processes (for definition see 36-212 V8.6 2009-03, p.17)
uint8_t Mdlharq;
/// Maximum number of HARQ rounds
uint8_t Mlimit;
/// MIMO transmission mode indicator for this sub-frame (for definition see 36-212 V8.6 2009-03, p.17)
uint8_t Kmimo;
/// Nsoft parameter related to UE Category
uint32_t Nsoft;
/// amplitude of PDSCH (compared to RS) in symbols without pilots
int16_t sqrt_rho_a;
/// amplitude of PDSCH (compared to RS) in symbols containing pilots
int16_t sqrt_rho_b;
}NB_IoT_eNB_NPDCCH_t;
typedef struct {
/// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding)
int32_t *txdataF[8];
/// beamforming weights for UE-spec transmission (antenna ports 5 or 7..14), for each codeword, maximum 4 layers?
int32_t **ue_spec_bf_weights[4];
/// dl channel estimates (estimated from ul channel estimates)
int32_t **calib_dl_ch_estimates;
/// Allocated RNTI (0 means DLSCH_t is not currently used)
uint16_t rnti;
/// Active flag for baseband transmitter processing
uint8_t active;
/// Indicator of TX activation per subframe. Used during PUCCH detection for ACK/NAK.
uint8_t subframe_tx[10];
/// First CCE of last PDSCH scheduling per subframe. Again used during PUCCH detection for ACK/NAK.
uint8_t nCCE[10];
/*in NB-IoT there is only 1 HARQ process for each UE therefore no pid is required*/
/// Current HARQ process id
//uint8_t current_harq_pid;
/// Process ID's per subframe. Used to associate received ACKs on PUSCH/PUCCH to DLSCH harq process ids
//uint8_t harq_ids[10];
/// Window size (in outgoing transport blocks) for fine-grain rate adaptation
uint8_t ra_window_size;
/// First-round error threshold for fine-grain rate adaptation
uint8_t error_threshold;
/// The only HARQ processes for the DLSCH
LTE_DL_eNB_HARQ_t harq_process;
/// Number of soft channel bits
uint32_t G;
/// Codebook index for this dlsch (0,1,2,3)
uint8_t codebook_index;
/// Maximum number of HARQ processes (for definition see 36-212 V8.6 2009-03, p.17)
uint8_t Mdlharq;
/// Maximum number of HARQ rounds
uint8_t Mlimit;
/// MIMO transmission mode indicator for this sub-frame (for definition see 36-212 V8.6 2009-03, p.17)
uint8_t Kmimo;
/// Nsoft parameter related to UE Category
uint32_t Nsoft;
/// amplitude of PDSCH (compared to RS) in symbols without pilots
int16_t sqrt_rho_a;
/// amplitude of PDSCH (compared to RS) in symbols containing pilots
int16_t sqrt_rho_b;
} NB_IoT_eNB_DLSCH_t;
//---------------------------------------------------------------------------------------
#define PUSCH_x 2 #define PUSCH_x 2
#define PUSCH_y 3 #define PUSCH_y 3
...@@ -895,5 +801,143 @@ typedef struct { ...@@ -895,5 +801,143 @@ typedef struct {
} DCI_ALLOC_t; } DCI_ALLOC_t;
//----------------------------------------------------------------------------------------------------------
// NB-IoT
//----------------------------------------------------------------------------------------------------
typedef struct
{
/// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding)
int32_t *txdataF[8];
/// beamforming weights for UE-spec transmission (antenna ports 5 or 7..14), for each codeword, maximum 4 layers?
int32_t **ue_spec_bf_weights[4];
/// dl channel estimates (estimated from ul channel estimates)
int32_t **calib_dl_ch_estimates;
/// Allocated RNTI (0 means DLSCH_t is not currently used)
uint16_t rnti;
/// Active flag for baseband transmitter processing
uint8_t active;
/// Indicator of TX activation per subframe. Used during PUCCH detection for ACK/NAK.
uint8_t subframe_tx[10];
/// First CCE of last PDSCH scheduling per subframe. Again used during PUCCH detection for ACK/NAK.
uint8_t nCCE[10];
/// Current HARQ process id
uint8_t current_harq_pid;
/// Process ID's per subframe. Used to associate received ACKs on PUSCH/PUCCH to DLSCH harq process ids
uint8_t harq_ids[10];
/// Window size (in outgoing transport blocks) for fine-grain rate adaptation
uint8_t ra_window_size;
/// First-round error threshold for fine-grain rate adaptation
uint8_t error_threshold;
/// Pointers to 8 HARQ processes for the DLSCH
LTE_DL_eNB_HARQ_t *harq_processes[8];
/// Number of soft channel bits
uint32_t G;
/// Codebook index for this dlsch (0,1,2,3)
uint8_t codebook_index;
/// Maximum number of HARQ processes (for definition see 36-212 V8.6 2009-03, p.17)
uint8_t Mdlharq;
/// Maximum number of HARQ rounds
uint8_t Mlimit;
/// MIMO transmission mode indicator for this sub-frame (for definition see 36-212 V8.6 2009-03, p.17)
uint8_t Kmimo;
/// Nsoft parameter related to UE Category
uint32_t Nsoft;
/// amplitude of PDSCH (compared to RS) in symbols without pilots
int16_t sqrt_rho_a;
/// amplitude of PDSCH (compared to RS) in symbols containing pilots
int16_t sqrt_rho_b;
}NB_IoT_eNB_NPDCCH_t;
typedef struct {
/// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding)
int32_t *txdataF[8];
/// beamforming weights for UE-spec transmission (antenna ports 5 or 7..14), for each codeword, maximum 4 layers?
int32_t **ue_spec_bf_weights[4];
/// dl channel estimates (estimated from ul channel estimates)
int32_t **calib_dl_ch_estimates;
/// Allocated RNTI (0 means DLSCH_t is not currently used)
uint16_t rnti;
/// Active flag for baseband transmitter processing
uint8_t active;
/// Indicator of TX activation per subframe. Used during PUCCH detection for ACK/NAK.
uint8_t subframe_tx[10];
/// First CCE of last PDSCH scheduling per subframe. Again used during PUCCH detection for ACK/NAK.
uint8_t nCCE[10];
/*in NB-IoT there is only 1 HARQ process for each UE therefore no pid is required*/
/// Current HARQ process id
//uint8_t current_harq_pid;
/// Process ID's per subframe. Used to associate received ACKs on PUSCH/PUCCH to DLSCH harq process ids
//uint8_t harq_ids[10];
/// Window size (in outgoing transport blocks) for fine-grain rate adaptation
uint8_t ra_window_size;
/// First-round error threshold for fine-grain rate adaptation
uint8_t error_threshold;
/// The only HARQ processes for the DLSCH
LTE_DL_eNB_HARQ_t *harq_process;
/// Number of soft channel bits
uint32_t G;
/// Codebook index for this dlsch (0,1,2,3)
uint8_t codebook_index;
/// Maximum number of HARQ processes (for definition see 36-212 V8.6 2009-03, p.17)
//uint8_t Mdlharq;
/// Maximum number of HARQ rounds
uint8_t Mlimit;
/// MIMO transmission mode indicator for this sub-frame (for definition see 36-212 V8.6 2009-03, p.17)
//uint8_t Kmimo;
/// Nsoft parameter related to UE Category
uint32_t Nsoft;
/// amplitude of PDSCH (compared to RS) in symbols without pilots
int16_t sqrt_rho_a;
/// amplitude of PDSCH (compared to RS) in symbols containing pilots
int16_t sqrt_rho_b;
} NB_IoT_eNB_NDLSCH_t;
typedef struct {
/// Pointers to 8 HARQ processes for the ULSCH
LTE_UL_eNB_HARQ_t *harq_process;
/// Maximum number of HARQ rounds
//uint8_t Mlimit;
/// Maximum number of iterations used in eNB turbo decoder
//uint8_t max_turbo_iterations;
//boundling not exist in NB-IoT since we are not using TDD and only 1 HARQ process
/// ACK/NAK Bundling flag
//uint8_t bundling;
/// beta_offset_cqi times 8
uint16_t beta_offset_cqi_times8;
/// beta_offset_ri times 8
uint16_t beta_offset_ri_times8;
/// beta_offset_harqack times 8
uint16_t beta_offset_harqack_times8;
/// Flag to indicate that eNB awaits UE Msg3
uint8_t Msg3_active;
/// Flag to indicate that eNB should decode UE Msg3
uint8_t Msg3_flag;
/// Subframe for Msg3
uint8_t Msg3_subframe;
/// Frame for Msg3
uint32_t Msg3_frame;
/// RNTI attributed to this ULSCH
uint16_t rnti;
/// cyclic shift for DM RS
uint8_t cyclicShift;
/// cooperation flag
uint8_t cooperation_flag;
/// num active cba group
//uint8_t num_active_cba_groups;
/// allocated CBA RNTI for this ulsch
//uint16_t cba_rnti[4];//NUM_MAX_CBA_GROUP];
} NB_IoT_eNB_NULSCH_t;
//---------------------------------------------------------------------------------------
/**@}*/ /**@}*/
#endif #endif
...@@ -235,6 +235,138 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_ ...@@ -235,6 +235,138 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_
} }
NB_IoT_eNB_NDLSCH_t *new_eNB_dlsch_NB(//unsigned char Kmimo,
//unsigned char Mdlharq,
uint32_t Nsoft,
//unsigned char N_RB_DL,
uint8_t abstraction_flag,
NB_DL_FRAME_PARMS* frame_parms)
{
NB_IoT_eNB_NDLSCH_t *dlsch;
unsigned char exit_flag = 0,i,j,r,aa,layer;
int re;
unsigned char bw_scaling =1;
// switch (N_RB_DL) {
// case 6:
// bw_scaling =16;
// break;
//
// case 25:
// bw_scaling =4;
// break;
//
// case 50:
// bw_scaling =2;
// break;
//
// default:
// bw_scaling =1;
// break;
// }
dlsch = (NB_IoT_eNB_NDLSCH_t *)malloc16(sizeof(NB_IoT_eNB_NDLSCH_t));
if (dlsch) {
bzero(dlsch,sizeof(NB_IoT_eNB_NDLSCH_t));
dlsch->Mlimit = 4;//max number of retransmission
dlsch->Nsoft = Nsoft;
for (layer=0; layer<4; layer++) {
dlsch->ue_spec_bf_weights[layer] = (int32_t**)malloc16(frame_parms->nb_antennas_tx*sizeof(int32_t*));
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
dlsch->ue_spec_bf_weights[layer][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t));
for (re=0;re<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; re++) {
dlsch->ue_spec_bf_weights[layer][aa][re] = 0x00007fff;
}
}
}
dlsch->calib_dl_ch_estimates = (int32_t**)malloc16(frame_parms->nb_antennas_tx*sizeof(int32_t*));
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
dlsch->calib_dl_ch_estimates[aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t));
}
//In NB-IoT we have only 1 HARQ process for each User-------------
/*
* for Nb-IoT we are using the same HARQ structure as for LTE (for the moment)
*/
dlsch->harq_process = (LTE_DL_eNB_HARQ_t *)malloc16(sizeof(LTE_DL_eNB_HARQ_t));
LOG_T(PHY, "[NB-IoT] Required mem size %d (bw scaling %d), dlsch->harq_process %p\n",
MAX_DLSCH_PAYLOAD_BYTES/bw_scaling,bw_scaling,dlsch->harq_process);
if (dlsch->harq_process) {
bzero(dlsch->harq_process,sizeof(LTE_DL_eNB_HARQ_t));
// dlsch->harq_processes[i]->first_tx=1;
dlsch->harq_process->b = (unsigned char*)malloc16(MAX_DLSCH_PAYLOAD_BYTES/bw_scaling);
if (dlsch->harq_process->b) {
bzero(dlsch->harq_process->b,MAX_DLSCH_PAYLOAD_BYTES/bw_scaling);
} else {
printf("Can't get b\n");
exit_flag=1;
}
if (abstraction_flag==0) {
//XXX MAX_NUM_DLSCH_SEGMENTS may should be changed for NB-IoT
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS/bw_scaling; r++) {
// account for filler in first segment and CRCs for multiple segment case
dlsch->harq_process->c[r] = (uint8_t*)malloc16(((r==0)?8:0) + 3+ 768);
dlsch->harq_process->d[r] = (uint8_t*)malloc16((96+12+3+(3*6144)));
if (dlsch->harq_process->c[r]) {
bzero(dlsch->harq_process->c[r],((r==0)?8:0) + 3+ 768);
} else {
printf("Can't get c\n");
exit_flag=2;
}
if (dlsch->harq_process->d[r]) {
bzero(dlsch->harq_process->d[r],(96+12+3+(3*6144)));
} else {
printf("Can't get d\n");
exit_flag=2;
}
}
}
} else {
printf("Can't get harq_p %d\n",i);
exit_flag=3;
}
//---------------------------------------------
if (exit_flag==0) {
dlsch->harq_process->round=0;
for (j=0; j<96; j++)
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS/bw_scaling; r++) {
// printf("dlsch->harq_processes[%d]->d[%d] %p\n",i,r,dlsch->harq_processes[i]->d[r]);
if (dlsch->harq_process->d[r])
dlsch->harq_process->d[r][j] = LTE_NULL;
}
return(dlsch);
}
}
// memory allocation failed for ndlsch
LOG_D(PHY,"new_eNB_ndlsch exit flag %d, size of %ld\n",
exit_flag, sizeof(LTE_eNB_DLSCH_t));
free_eNB_dlsch(dlsch);
return(NULL);
}
void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch) void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch)
{ {
......
...@@ -60,6 +60,17 @@ void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch); ...@@ -60,6 +60,17 @@ void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch);
*/ */
LTE_eNB_DLSCH_t *new_eNB_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t N_RB_DL, uint8_t abstraction_flag, LTE_DL_FRAME_PARMS* frame_parms); LTE_eNB_DLSCH_t *new_eNB_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t N_RB_DL, uint8_t abstraction_flag, LTE_DL_FRAME_PARMS* frame_parms);
//NB-IoT version
NB_IoT_eNB_NDLSCH_t *new_eNB_dlsch_NB(//unsigned char Kmimo,
//unsigned char Mdlharq,
uint32_t Nsoft,
//unsigned char N_RB_DL,
uint8_t abstraction_flag,
NB_DL_FRAME_PARMS* frame_parms);
/** \fn free_ue_dlsch(LTE_UE_DLSCH_t *dlsch) /** \fn free_ue_dlsch(LTE_UE_DLSCH_t *dlsch)
\brief This function frees memory allocated for a particular DLSCH at UE \brief This function frees memory allocated for a particular DLSCH at UE
@param dlsch Pointer to DLSCH to be removed @param dlsch Pointer to DLSCH to be removed
...@@ -84,6 +95,9 @@ void free_ue_ulsch(LTE_UE_ULSCH_t *ulsch); ...@@ -84,6 +95,9 @@ void free_ue_ulsch(LTE_UE_ULSCH_t *ulsch);
LTE_eNB_ULSCH_t *new_eNB_ulsch(uint8_t max_turbo_iterations,uint8_t N_RB_UL, uint8_t abstraction_flag); LTE_eNB_ULSCH_t *new_eNB_ulsch(uint8_t max_turbo_iterations,uint8_t N_RB_UL, uint8_t abstraction_flag);
NB_IoT_eNB_NULSCH_t *new_eNB_ulsch_NB(uint8_t abstraction_flag);
LTE_UE_ULSCH_t *new_ue_ulsch(unsigned char N_RB_UL, uint8_t abstraction_flag); LTE_UE_ULSCH_t *new_ue_ulsch(unsigned char N_RB_UL, uint8_t abstraction_flag);
/** \fn dlsch_encoding(PHY_VARS_eNB *eNB, /** \fn dlsch_encoding(PHY_VARS_eNB *eNB,
......
...@@ -164,6 +164,89 @@ LTE_eNB_ULSCH_t *new_eNB_ulsch(uint8_t max_turbo_iterations,uint8_t N_RB_UL, uin ...@@ -164,6 +164,89 @@ LTE_eNB_ULSCH_t *new_eNB_ulsch(uint8_t max_turbo_iterations,uint8_t N_RB_UL, uin
return(NULL); return(NULL);
} }
NB_IoT_eNB_NULSCH_t *new_eNB_ulsch_NB(uint8_t abstraction_flag)
{
NB_IoT_eNB_NULSCH_t *ulsch;
uint8_t exit_flag = 0,i,r;
unsigned char bw_scaling =1;
// switch (N_RB_UL) {
// case 6:
// bw_scaling =16;
// break;
//
// case 25:
// bw_scaling =4;
// break;
//
// case 50:
// bw_scaling =2;
// break;
//
// default:
// bw_scaling =1;
// break;
// }
ulsch = (NB_IoT_eNB_NULSCH_t *)malloc16(sizeof(NB_IoT_eNB_NULSCH_t));
if (ulsch) {
memset(ulsch,0,sizeof(LTE_eNB_ULSCH_t));
//MP: add some parameters in npusch structure for convolutional coding to be set
ulsch->Mlimit = 4;
/*
* In NB-IoT we have only 1 HARQ process for each UE
* we use the same HARQ process structure as LTE
*/
ulsch->harq_process = (LTE_UL_eNB_HARQ_t *)malloc16(sizeof(LTE_UL_eNB_HARQ_t));
if (ulsch->harq_process) {
memset(ulsch->harq_process,0,sizeof(LTE_UL_eNB_HARQ_t));
ulsch->harq_process->b = (uint8_t*)malloc16(MAX_ULSCH_PAYLOAD_BYTES/bw_scaling);
if (ulsch->harq_process->b)
memset(ulsch->harq_process->b,0,MAX_ULSCH_PAYLOAD_BYTES/bw_scaling);
else
exit_flag=3;
if (abstraction_flag==0) {
for (r=0; r<MAX_NUM_ULSCH_SEGMENTS/bw_scaling; r++) {
ulsch->harq_process->c[r] = (uint8_t*)malloc16(((r==0)?8:0) + 3+768);
if (ulsch->harq_process->c[r])
memset(ulsch->harq_process->c[r],0,((r==0)?8:0) + 3+768);
else
exit_flag=2;
ulsch->harq_process->d[r] = (short*)malloc16(((3*8*6144)+12+96)*sizeof(short));
if (ulsch->harq_process->d[r])
memset(ulsch->harq_process->d[r],0,((3*8*6144)+12+96)*sizeof(short));
else
exit_flag=2;
}
ulsch->harq_process->subframe_scheduling_flag = 0;
}
} else {
exit_flag=1;
}
if (exit_flag==0)
return(ulsch);
}
LOG_E(PHY,"new_ue_ulsch: exit_flag = %d\n",exit_flag);
free_eNB_ulsch(ulsch);
return(NULL);
}
void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch) void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch)
{ {
......
...@@ -469,20 +469,13 @@ typedef struct PHY_VARS_eNB_s { ...@@ -469,20 +469,13 @@ typedef struct PHY_VARS_eNB_s {
LTE_eNB_PUSCH *pusch_vars[NUMBER_OF_UE_MAX]; LTE_eNB_PUSCH *pusch_vars[NUMBER_OF_UE_MAX];
LTE_eNB_PRACH prach_vars; LTE_eNB_PRACH prach_vars;
LTE_eNB_DLSCH_t *dlsch[NUMBER_OF_UE_MAX][2]; // Nusers times two spatial streams LTE_eNB_DLSCH_t *dlsch[NUMBER_OF_UE_MAX][2]; // Nusers times two spatial streams
LTE_eNB_ULSCH_t *ulsch[NUMBER_OF_UE_MAX+1]; // Nusers + number of RA LTE_eNB_ULSCH_t *ulsch[NUMBER_OF_UE_MAX+1]; // Nusers + number of RA (the ulsch[0] contains RAR)
LTE_eNB_DLSCH_t *dlsch_SI,*dlsch_ra; LTE_eNB_DLSCH_t *dlsch_SI,*dlsch_ra;
LTE_eNB_DLSCH_t *dlsch_MCH; LTE_eNB_DLSCH_t *dlsch_MCH;
LTE_eNB_UE_stats UE_stats[NUMBER_OF_UE_MAX]; LTE_eNB_UE_stats UE_stats[NUMBER_OF_UE_MAX];
LTE_eNB_UE_stats *UE_stats_ptr[NUMBER_OF_UE_MAX]; LTE_eNB_UE_stats *UE_stats_ptr[NUMBER_OF_UE_MAX];
//NB-IoT------------------------
NB_IoT_eNB_NPBCH npbch;
NB_IoT_eNB_NPDCCH_t *npdcch[NUMBER_OF_UE_MAC_NB_IoT]; //check the max size of this array
NB_DL_FRAME_PARMS frame_parms_nb_iot;
DCI_PDU_NB DCI_pdu;
/// cell-specific reference symbols /// cell-specific reference symbols
uint32_t lte_gold_table[20][2][14]; uint32_t lte_gold_table[20][2][14];
...@@ -666,6 +659,24 @@ typedef struct PHY_VARS_eNB_s { ...@@ -666,6 +659,24 @@ typedef struct PHY_VARS_eNB_s {
/// Pointer for ifdevice buffer struct /// Pointer for ifdevice buffer struct
if_buffer_t ifbuffer; if_buffer_t ifbuffer;
//------------------------
// NB-IoT
//------------------------
NB_IoT_eNB_NPBCH npbch;
NB_IoT_eNB_NPDCCH_t *npdcch[NUMBER_OF_UE_MAX_NB_IoT]; //check the max size of this array
NB_IoT_eNB_NDLSCH_t *ndlsch[NUMBER_OF_UE_MAX_NB_IoT];
NB_IoT_eNB_NULSCH_t *nulsch[NUMBER_OF_UE_MAX_NB_IoT+1] //nulsch[0] contains the RAR
NB_IoT_eNB_NDLSCH_t *dlsch_SI_NB,*dlsch_ra_NB;
NB_DL_FRAME_PARMS frame_parms_nb_iot;
DCI_PDU_NB DCI_pdu;
} PHY_VARS_eNB; } PHY_VARS_eNB;
#define debug_msg if (((mac_xface->frame%100) == 0) || (mac_xface->frame < 50)) msg #define debug_msg if (((mac_xface->frame%100) == 0) || (mac_xface->frame < 50)) msg
......
...@@ -950,7 +950,7 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, ...@@ -950,7 +950,7 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
if(Sched_Rsp->NB_DL.NB_DLSCH.ndlsch.rnti_type == 0) if(Sched_Rsp->NB_DL.NB_DLSCH.ndlsch.rnti_type == 0)
{ {
/*TODO: NPDSCH procedures for BCCH for NB-IoT*/ /*TODO: NPDSCH procedures for BCCH for NB-IoT*/
//npdsch_procedures(); npdsch_procedures_NB();
} }
/*clear the DCI allocation maps for new subframe*/ /*clear the DCI allocation maps for new subframe*/
......
...@@ -27,4 +27,7 @@ ...@@ -27,4 +27,7 @@
# endif # endif
#endif #endif
#define NUMBER_OF_UE_MAX_NB_IoT 1
#endif /* OPENAIRINTERFACE5G_LIMITS_H_ */ #endif /* OPENAIRINTERFACE5G_LIMITS_H_ */
...@@ -1816,6 +1816,7 @@ void init_eNB_proc(int inst) { ...@@ -1816,6 +1816,7 @@ void init_eNB_proc(int inst) {
#endif #endif
if (eNB->single_thread_flag==0) { if (eNB->single_thread_flag==0) {
//the two threads that manage tw consecutive subframes
pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, &proc_rxtx[0] ); pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, &proc_rxtx[0] );
pthread_create( &proc_rxtx[1].pthread_rxtx, attr1, eNB_thread_rxtx, &proc_rxtx[1] ); pthread_create( &proc_rxtx[1].pthread_rxtx, attr1, eNB_thread_rxtx, &proc_rxtx[1] );
pthread_create( &proc->pthread_FH, attr_FH, eNB_thread_FH, &eNB->proc ); pthread_create( &proc->pthread_FH, attr_FH, eNB_thread_FH, &eNB->proc );
......
...@@ -169,7 +169,7 @@ int otg_enabled; ...@@ -169,7 +169,7 @@ int otg_enabled;
static LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]; static LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs];
//NB-IoT //NB-IoT
static NB_DL_FRAME_PARMS *frame_parms_nb_iot[MAX_NUM_CCs]; static NB_DL_FRAME_PARMS *frame_parms_nb_iot[MAX_NUM_CCs]; // this will be still inside the PHY_VARS of LTE
eNB_func_t node_function[MAX_NUM_CCs]; eNB_func_t node_function[MAX_NUM_CCs];
eNB_timing_t node_timing[MAX_NUM_CCs]; eNB_timing_t node_timing[MAX_NUM_CCs];
...@@ -1212,7 +1212,7 @@ int T_dont_fork = 0; /* default is to fork, see 'T_init' to understand */ ...@@ -1212,7 +1212,7 @@ int T_dont_fork = 0; /* default is to fork, see 'T_init' to understand */
#endif #endif
void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]); void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]);
void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) { void A(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) {
int CC_id; int CC_id;
...@@ -1258,6 +1258,52 @@ void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) { ...@@ -1258,6 +1258,52 @@ void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) {
} }
//NB_IoT-------------------------------------------------
void set_default_frame_parms_NB(NB_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]);
void set_default_frame_parms_NB(NB_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) {
int CC_id;
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
frame_parms[CC_id] = (NB_DL_FRAME_PARMS*) malloc(sizeof(NB_DL_FRAME_PARMS));
/* Set some default values that may be overwritten while reading options */
//XXX check if there are other parameters to be set
frame_parms[CC_id]->Ncp = NORMAL;
frame_parms[CC_id]->Ncp_UL = NORMAL;
frame_parms[CC_id]->Nid_cell = 0;
frame_parms[CC_id]->nb_antenna_ports_eNB = 1;
frame_parms[CC_id]->nb_antennas_tx = 1;
frame_parms[CC_id]->nb_antennas_rx = 1;
frame_parms[CC_id]->nushift = 0;
// UL RS Config
frame_parms[CC_id]->npusch_config_common.ul_ReferenceSignalsNPUSCH.groupHoppingEnabled = 0;
frame_parms[CC_id]->npusch_config_common.ul_ReferenceSignalsNPUSCH.groupAssignmentNPUSCH = 0;
frame_parms[CC_id]->nprach_config_common.nprach_CP_Length
//frame_parms[CC_id]->nprach_config_common.nprach_ParametersList.list.array[CC_id]
//frame_parms[CC_id]->nprach_config_common.rsrp_ThresholdsPrachInfoList
//already initialized in the set_default_frame_parms function for LTE
// downlink_frequency[CC_id][0] = 2680000000; // Use float to avoid issue with frequency over 2^31.
// downlink_frequency[CC_id][1] = downlink_frequency[CC_id][0];
// downlink_frequency[CC_id][2] = downlink_frequency[CC_id][0];
// downlink_frequency[CC_id][3] = downlink_frequency[CC_id][0];
// //printf("Downlink for CC_id %d frequency set to %u\n", CC_id, downlink_frequency[CC_id][0]);
}
}
void init_openair0(void); void init_openair0(void);
void init_openair0() { void init_openair0() {
...@@ -1396,6 +1442,9 @@ int main( int argc, char **argv ) { ...@@ -1396,6 +1442,9 @@ int main( int argc, char **argv ) {
// set default parameters // set default parameters
set_default_frame_parms(frame_parms); set_default_frame_parms(frame_parms);
#ifdef NB_IOT
set_default_frame_parms_NB(frame_parms_nb_iot);
#endif
// initialize logging // initialize logging
...@@ -1539,8 +1588,19 @@ int main( int argc, char **argv ) { ...@@ -1539,8 +1588,19 @@ int main( int argc, char **argv ) {
frame_parms[CC_id]->nb_antenna_ports_eNB = 1; //initial value overwritten by initial sync later frame_parms[CC_id]->nb_antenna_ports_eNB = 1; //initial value overwritten by initial sync later
LOG_I(PHY,"Set nb_rx_antenna %d , nb_tx_antenna %d \n",frame_parms[CC_id]->nb_antennas_rx, frame_parms[CC_id]->nb_antennas_tx); LOG_I(PHY,"Set nb_rx_antenna %d , nb_tx_antenna %d \n",frame_parms[CC_id]->nb_antennas_rx, frame_parms[CC_id]->nb_antennas_tx);
#ifdef NB_IoT
frame_parms_nb_iot[CC_id]->nb_antennas_tx = nb_antenna_tx;
frame_parms_nb_iot[CC_id]->nb_antennas_rx = nb_antenna_rx;
frame_parms_nb_iot[CC_id]->nb_antenna_ports_eNB = 1; //initial value overwritten by initial sync later
LOG_I(PHY,"[NB-IoT] Set nb_rx_antenna %d , nb_tx_antenna %d \n",frame_parms_nb_iot[CC_id]->nb_antennas_rx, frame_parms_nb_iot[CC_id]->nb_antennas_tx);
#endif
} }
//XXXX we need to modify it for NB-IoT????
init_ul_hopping(frame_parms[CC_id]); init_ul_hopping(frame_parms[CC_id]);
init_frame_parms(frame_parms[CC_id],1); init_frame_parms(frame_parms[CC_id],1);
// phy_init_top(frame_parms[CC_id]); // phy_init_top(frame_parms[CC_id]);
...@@ -1625,15 +1685,18 @@ int main( int argc, char **argv ) { ...@@ -1625,15 +1685,18 @@ int main( int argc, char **argv ) {
// printf("tx_max_power = %d -> amp %d\n",tx_max_power,get_tx_amp(tx_max_poHwer,tx_max_power)); // printf("tx_max_power = %d -> amp %d\n",tx_max_power,get_tx_amp(tx_max_poHwer,tx_max_power));
} else { } else {
//this is eNB //this is eNB
PHY_vars_eNB_g = malloc(sizeof(PHY_VARS_eNB**)); //global PHY Vars matrix PHY_vars_eNB_g = malloc(sizeof(PHY_VARS_eNB**)); //global PHY_vars --> is a matrix
PHY_vars_eNB_g[0] = malloc(sizeof(PHY_VARS_eNB*)); PHY_vars_eNB_g[0] = malloc(sizeof(PHY_VARS_eNB*));
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
//we initialiaze DL/UL buffer and HARQ (inside the LTE_eNB_DLSCH) //we initialiaze DL/UL buffer and HARQ (inside the LTE_eNB_DLSCH)
/*
* the LTE_DL_FRAME PARMS for NB-IoT is mantained the same for the monent
*/
PHY_vars_eNB_g[0][CC_id] = init_lte_eNB(frame_parms[CC_id],0,frame_parms[CC_id]->Nid_cell,node_function[CC_id],abstraction_flag); PHY_vars_eNB_g[0][CC_id] = init_lte_eNB(frame_parms[CC_id],0,frame_parms[CC_id]->Nid_cell,node_function[CC_id],abstraction_flag);
//this is a complementary function for just initialize manage NB_ioT stuff inside the PHY_Vars
#ifdef NB_IOT
init_lte_eNB_NB(PHY_vars_eNB_g[0][CC_id],frame_parms_nb_iot[CC_id], 0, frame_parms_nb_iot[CC_id]->Nid_cell,node_function[CC_id],abstraction_flag);
#endif
PHY_vars_eNB_g[0][CC_id]->ue_dl_rb_alloc=0x1fff; PHY_vars_eNB_g[0][CC_id]->ue_dl_rb_alloc=0x1fff;
PHY_vars_eNB_g[0][CC_id]->target_ue_dl_mcs=target_dl_mcs; PHY_vars_eNB_g[0][CC_id]->target_ue_dl_mcs=target_dl_mcs;
PHY_vars_eNB_g[0][CC_id]->ue_ul_nb_rb=6; PHY_vars_eNB_g[0][CC_id]->ue_ul_nb_rb=6;
...@@ -1665,6 +1728,7 @@ int main( int argc, char **argv ) { ...@@ -1665,6 +1728,7 @@ int main( int argc, char **argv ) {
} }
} }
//TODO: this is different for NB-IoT
compute_prach_seq(&PHY_vars_eNB_g[0][CC_id]->frame_parms.prach_config_common, compute_prach_seq(&PHY_vars_eNB_g[0][CC_id]->frame_parms.prach_config_common,
PHY_vars_eNB_g[0][CC_id]->frame_parms.frame_type, PHY_vars_eNB_g[0][CC_id]->frame_parms.frame_type,
PHY_vars_eNB_g[0][CC_id]->X_u); PHY_vars_eNB_g[0][CC_id]->X_u);
...@@ -1689,11 +1753,6 @@ int main( int argc, char **argv ) { ...@@ -1689,11 +1753,6 @@ int main( int argc, char **argv ) {
NB_eNB_INST=1; NB_eNB_INST=1;
NB_INST=1; NB_INST=1;
//#ifdef NB_IOT
// NB_eNB_INST_NB =1;
// NB_INST_NB = 1;
//#endif
} }
fill_modeled_runtime_table(runtime_phy_rx,runtime_phy_tx); fill_modeled_runtime_table(runtime_phy_rx,runtime_phy_tx);
......
...@@ -148,6 +148,98 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -148,6 +148,98 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
return (PHY_vars_eNB); return (PHY_vars_eNB);
} }
void init_lte_eNB_NB(
PHY_VARS_eNB *PHY_vars_eNB,
NB_DL_FRAME_PARMS *frame_parms,
uint8_t eNB_id,
uint8_t Nid_cell,
eNB_func_t node_function,
int8_t abstraction_flag)
{
int i,j;
memset(PHY_vars_eNB,0,sizeof(PHY_VARS_eNB));
PHY_vars_eNB->Mod_id=eNB_id;
PHY_vars_eNB->cooperation_flag=0;//cooperation_flag;
memcpy(&(PHY_vars_eNB->frame_parms_nb_iot), frame_parms, sizeof(NB_DL_FRAME_PARMS));
PHY_vars_eNB->frame_parms_nb_iot.Nid_cell = ((Nid_cell/3)*3)+((eNB_id+Nid_cell)%3); //XXX NB_IoT ????
PHY_vars_eNB->frame_parms_nb_iot.nushift = PHY_vars_eNB->frame_parms.Nid_cell%6;
phy_init_lte_eNB(PHY_vars_eNB,0,abstraction_flag);
LOG_I(PHY,"init eNB NB_IoT: Node Function %d\n",node_function);
LOG_I(PHY,"init eNB NB_IoT: Nid_cell %d\n", frame_parms->Nid_cell);
LOG_I(PHY,"init eNB NB_IoT: number of ue max %d number of enb max %d \n",
NUMBER_OF_UE_MAX, NUMBER_OF_eNB_MAX);
LOG_I(PHY,"init eNB NB_IoT: N_RB_DL %d\n", frame_parms->N_RB_DL);
//LOG_I(PHY,"init eNB NB_IoT: prach_config_index %d\n", frame_parms->nprach_config_common.prach_ConfigInfo.prach_ConfigIndex);
if (node_function >= NGFI_RRU_IF5)
// For RRU, don't allocate DLSCH/ULSCH Transport channel buffers
return;
/*
* In NB-IoT we not transmit two dlsch pdu at the same time so the dlsch dimension in PHY_vars_eNB for NB-IoT is just an array
*/
for (i=0; i<NUMBER_OF_UE_MAX_NB_IOT; i++) {
LOG_I(PHY,"[NB-IoT] Allocating Transport Channel Buffers for NDLSCH, UE %d\n",i);
PHY_vars_eNB->ndlsch[i] = new_eNB_dlsch_NB(NSOFT,abstraction_flag,frame_parms);
if (!PHY_vars_eNB->ndlsch[i]) {
LOG_E(PHY,"Can't get eNB ndlsch structures for UE %d \n", i);
exit(-1);
} else {
LOG_D(PHY,"dlsch[%d] => %p\n",i,PHY_vars_eNB->dlsch[i]);
PHY_vars_eNB->dlsch[i]->rnti=0;
}
LOG_I(PHY," [NB-IoT] Allocating Transport Channel Buffer for ULSCH, UE %d\n", i);
PHY_vars_eNB->nulsch[1+i] = new_eNB_ulsch_NB(abstraction_flag);
if (!PHY_vars_eNB->nulsch[1+i]) {
LOG_E(PHY,"Can't get eNB nulsch structures\n");
exit(-1);
}
}
// ULSCH for RA
PHY_vars_eNB->nulsch[0] = new_eNB_ulsch_NB(abstraction_flag);
if (!PHY_vars_eNB->nulsch[0]) {
LOG_E(PHY,"Can't get eNB nulsch structures\n");
exit(-1);
}
PHY_vars_eNB->dlsch_SI_NB = new_eNB_dlsch_NB(NSOFT, abstraction_flag, frame_parms);
LOG_D(PHY,"[NB-IoT] eNB %d : SI %p\n",eNB_id,PHY_vars_eNB->dlsch_SI_NB);
PHY_vars_eNB->dlsch_ra_NB = new_eNB_dlsch_NB(NSOFT, abstraction_flag, frame_parms);
LOG_D(PHY,"[NB-IoT] eNB %d : RA %p\n",eNB_id,PHY_vars_eNB->dlsch_ra_NB);
//already set in the LTE function version
//PHY_vars_eNB->rx_total_gain_dB=130;
// for(i=0; i<NUMBER_OF_UE_MAX; i++)
// PHY_vars_eNB->mu_mimo_mode[i].dl_pow_off = 2;
//
// PHY_vars_eNB->check_for_total_transmissions = 0;
//
// PHY_vars_eNB->check_for_MUMIMO_transmissions = 0;
//
// PHY_vars_eNB->FULL_MUMIMO_transmissions = 0;
//
// PHY_vars_eNB->check_for_SUMIMO_transmissions = 0;
//
// PHY_vars_eNB->frame_parms.pucch_config_common.deltaPUCCH_Shift = 1;
return;
}
PHY_VARS_UE* init_lte_UE(LTE_DL_FRAME_PARMS *frame_parms, PHY_VARS_UE* init_lte_UE(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t UE_id, uint8_t UE_id,
uint8_t abstraction_flag) uint8_t abstraction_flag)
......
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