Commit 34edb293 authored by Matthieu Kanj's avatar Matthieu Kanj

separation between files in openair1/PHY/LTE_TRANSPORT/

+ creation of 2 new files openair1/PHY/LTE_TRANSPORT/uci_NB_IoT.h openair2/COMMON/platform_types_NB_IoT.h
parent 0fdd3c8e
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#include "UTIL/LISTS/list.h" #include "UTIL/LISTS/list.h"
#endif #endif
#include "dci_nb_iot.h" ////////////////////////////////////////////////#include "dci_nb_iot.h"
#define MOD_TABLE_QPSK_OFFSET 1 #define MOD_TABLE_QPSK_OFFSET 1
#define MOD_TABLE_16QAM_OFFSET 5 #define MOD_TABLE_16QAM_OFFSET 5
...@@ -802,301 +802,7 @@ typedef struct { ...@@ -802,301 +802,7 @@ typedef struct {
uint8_t dci_pdu[8]; uint8_t dci_pdu[8];
} DCI_ALLOC_t; } DCI_ALLOC_t;
//----------------------------------------------------------------------------------------------------------
// NB-IoT
//----------------------------------------------------------------------------------------------------
//enum for distinguish the different type of ndlsch (may in the future will be not needed)
typedef enum
{
SIB1,
SI_Message,
RAR,
UE_Data
}ndlsch_flag_t;
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)
uint16_t number_repetition_RA;
uint16_t number_repetition_PAg;
//index of the current subframe among the repetition (set to 0 when we receive the new NPDCCH)
uint16_t repetition_idx_RA;
uint16_t repetition_idx_Pag;
}NB_IoT_eNB_COMMON_NPDCCH_t;
typedef struct {
/// Length of DCI in bits
uint8_t dci_length;
/// Aggregation level only 1,2 in NB-IoT
uint8_t L;
/// Position of first CCE of the dci
int firstCCE;
/// flag to indicate that this is a RA response
boolean_t ra_flag;
/// rnti
rnti_t rnti;
/// Format
DCI_format_NB_IoT_t format;
/// DCI pdu
uint8_t dci_pdu[8];
} DCI_ALLOC_NB_IoT_t;
typedef struct {
//delete the count for the DCI numbers,NUM_DCI_MAX should set to 2
uint32_t num_npdcch_symbols;
///indicates the starting OFDM symbol in the first slot of a subframe k for the NPDCCH transmission
/// see FAPI/NFAPI specs Table 4-45
uint8_t npdcch_start_symbol;
uint8_t Num_dci;
DCI_ALLOC_NB_IoT_t dci_alloc[2] ;
} DCI_PDU_NB_IoT;
typedef struct {
/// NB-IoT
/// The scheduling the NPDCCH and the NPDSCH transmission TS 36.213 Table 16.4.1-1
uint8_t scheduling_delay;
/// The number of the subframe to transmit the NPDSCH Table TS 36.213 Table 16.4.1.3-1 (Nsf) (NB. in this case is not the index Isf)
uint8_t resource_assignment;
/// is the index that determined the repeat number of NPDSCH through table TS 36.213 Table 16.4.1.3-2 / for SIB1-NB Table 16.4.1.3-3
uint8_t repetition_number;
/// Determined the ACK/NACK delay and the subcarrier allocation TS 36.213 Table 16.4.2
uint8_t HARQ_ACK_resource;
/// Determined the repetition number value 0-3 (2 biut carried by the FAPI NPDCCH)
uint8_t dci_subframe_repetitions;
/// modulation always QPSK Qm = 2
uint8_t modulation;
/// Status Flag indicating for this DLSCH (idle,active,disabled)
SCH_status_t status;
/// Transport block size
uint32_t TBS;
/// The payload + CRC size in bits, "B" from 36-212
uint32_t B;
/// Pointer to the payload
uint8_t *b;
///pdu of the ndlsch message
uint8_t*pdu;
/// Frame where current HARQ round was sent
uint32_t frame;
/// Subframe where current HARQ round was sent
uint32_t subframe;
/// Index of current HARQ round for this DLSCH
uint8_t round;
/// MCS format for this NDLSCH , TS 36.213 Table 16.4.1.5
uint8_t mcs;
// we don't have code block segmentation / crc attachment / concatenation in NB-IoT R13 36.212 6.4.2
// we don't have beamforming in NB-IoT
//this index will be used mainly for SI message buffer
uint8_t pdu_buffer_index;
} NB_IoT_DL_eNB_HARQ_t;
typedef struct {
/// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding)
int32_t *txdataF[8];
/// 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*/
/// The only HARQ process for the DLSCH
NB_IoT_DL_eNB_HARQ_t *harq_process;
/// Number of soft channel bits
uint32_t G;
/// Maximum number of HARQ rounds
uint8_t Mlimit;
/// 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
/// may use in the npdsch_procedures
uint16_t scrambling_sequence_intialization;
/// number of cell specific TX antenna ports assumed by the UE
uint8_t nrs_antenna_ports;
//This indicate the current subframe within the subframe interval between the NPDSCH transmission (Nsf*Nrep)
uint16_t sf_index;
///indicates the starting OFDM symbol in the first slot of a subframe k for the NPDSCH transmission
/// see FAPI/NFAPI specs Table 4-47
uint8_t npdsch_start_symbol;
/*SIB1-NB related parameters*/
///flag for indicate if the current frame is the start of a new SIB1-NB repetition within the SIB1-NB period (0 = FALSE, 1 = TRUE)
uint8_t sib1_rep_start;
///the number of the frame within the 16 continuous frame in which sib1-NB is transmitted (1-8 = 1st, 2nd ecc..) (0 = not foresees a transmission)
uint8_t relative_sib1_frame;
//Flag used to discern among different NDLSCH structures (SIB1,SI,RA,UE-spec)
//(used inside the ndlsch procedure for distinguish the different type of data to manage also in term of repetitions and transmission over more subframes
ndlsch_flag_t ndlsch_type;
} NB_IoT_eNB_NDLSCH_t;
typedef struct {
/// Determined the subcarrier allocation for the NPUSCH.(15, 3.75 KHz)
uint8_t subcarrier_indication;
/// Determined the number of resource unit for the NPUSCH
uint8_t resource_assignment;
/// Determined the scheduling delay for NPUSCH
uint8_t scheduling_delay;
/// The number of the repetition number for NPUSCH Transport block
uint8_t repetition_number;
/// Determined the repetition number value 0-3
uint8_t dci_subframe_repetitions;
/// Flag indicating that this ULSCH has been allocated by a DCI (otherwise it is a retransmission based on PHICH NAK)
uint8_t dci_alloc;
/// Flag indicating that this ULSCH has been allocated by a RAR (otherwise it is a retransmission based on PHICH NAK or DCI)
uint8_t rar_alloc;
/// Status Flag indicating for this ULSCH (idle,active,disabled)
SCH_status_t status;
/// Subframe scheduling indicator (i.e. Transmission opportunity indicator)
uint8_t subframe_scheduling_flag;
/// Transport block size
uint32_t TBS;
/// The payload + CRC size in bits
uint32_t B;
/// Number of soft channel bits
uint32_t G;
/// Pointer to ACK
uint8_t o_ACK[4];
/// Length of ACK information (bits)
uint8_t O_ACK;
/// Temporary h sequence to flag PUSCH_x/PUSCH_y symbols which are not scrambled
uint8_t h[MAX_NUM_CHANNEL_BITS];
/// Pointer to the payload
uint8_t *b;
/// Current Number of Symbols
uint8_t Nsymb_pusch;
/// Index of current HARQ round for this ULSCH
uint8_t round;
/// MCS format for this ULSCH
uint8_t mcs;
/// Redundancy-version of the current sub-frame (value 0->RV0,value 1 ->RV2)
uint8_t rvidx;
/// Msc_initial, Initial number of subcarriers for ULSCH (36-212, v8.6 2009-03, p.26-27)
uint16_t Msc_initial;
/// Nsymb_initial, Initial number of symbols for ULSCH (36-212, v8.6 2009-03, p.26-27)
uint8_t Nsymb_initial;
/// n_DMRS for cyclic shift of DMRS (36.213 Table 9.1.2-2)
uint8_t n_DMRS;
/// n_DMRS for cyclic shift of DMRS (36.213 Table 9.1.2-2) - previous scheduling
/// This is needed for PHICH generation which
/// is done after a new scheduling
uint8_t previous_n_DMRS;
/// n_DMRS 2 for cyclic shift of DMRS (36.211 Table 5.5.1.1.-1)
uint8_t n_DMRS2;
/// Flag to indicate that this ULSCH is for calibration information sent from UE (i.e. no MAC SDU to pass up)
// int calibration_flag;
/// delta_TF for power control
int32_t delta_TF;
} NB_IoT_UL_eNB_HARQ_t;
typedef struct {
/// Pointers to 8 HARQ processes for the ULSCH
NB_IoT_UL_eNB_HARQ_t *harq_process;
/// Maximum number of HARQ rounds
uint8_t Mlimit;
/// Value 0 = npush format 1 (data) value 1 = npusch format 2 (ACK/NAK)
uint8_t npusch_format;
/// 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;
/// (only in-band mode), indicate the resource block overlap the SRS configuration of LTE
uint8_t N_srs;
uint8_t scrambling_re_intialization_batch_index;
/// number of cell specific TX antenna ports assumed by the UE
uint8_t nrs_antenna_ports;
uint16_t scrambling_sequence_intialization;
uint16_t sf_index;
/// Determined the ACK/NACK delay and the subcarrier allocation TS 36.213 Table 16.4.2
uint8_t HARQ_ACK_resource;
} NB_IoT_eNB_NULSCH_t;
#define NPBCH_A 34
typedef struct {
//the 2 LSB of the hsfn (the MSB are indicated by the SIB1-NB)
uint16_t h_sfn_lsb;
uint8_t npbch_d[96+(3*(16+NPBCH_A))];
uint8_t npbch_w[3*3*(16+NPBCH_A)];
uint8_t npbch_e[1600];
///pdu of the npbch message
uint8_t*pdu;
} NB_IoT_eNB_NPBCH_t;
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
......
...@@ -15,13 +15,19 @@ ...@@ -15,13 +15,19 @@
#define __LTE_TRANSPORT_DEFS_NB_IOT__H__ #define __LTE_TRANSPORT_DEFS_NB_IOT__H__
////#include "PHY/defs.h" ////#include "PHY/defs.h"
//#include "PHY/defs_nb_iot.h" //#include "PHY/defs_nb_iot.h"
//#include "dci_nb_iot.h" #include "dci_nb_iot.h"
#include "PHY/impl_defs_lte_nb_iot.h"
#include "openair2/COMMON/platform_types_NB_IoT.h"
//#include "dci.h"
#include "uci_NB_IoT.h"
//#include "dci.h" //#include "dci.h"
//#include "uci.h" //#include "uci.h"
//#ifndef STANDALONE_COMPILE //#ifndef STANDALONE_COMPILE
//#include "UTIL/LISTS/list.h" //#include "UTIL/LISTS/list.h"
//#endif //#endif
//
//#include "dci_nb_iot.h"
//#define MOD_TABLE_QPSK_OFFSET 1 //#define MOD_TABLE_QPSK_OFFSET 1
//#define MOD_TABLE_16QAM_OFFSET 5 //#define MOD_TABLE_16QAM_OFFSET 5
//#define MOD_TABLE_64QAM_OFFSET 21 //#define MOD_TABLE_64QAM_OFFSET 21
...@@ -34,12 +40,12 @@ ...@@ -34,12 +40,12 @@
// //
//// maximum of 3 segments before each coding block if data length exceeds 6144 bits. //// maximum of 3 segments before each coding block if data length exceeds 6144 bits.
// //
//#define MAX_NUM_DLSCH_SEGMENTS 16 #define MAX_NUM_DLSCH_SEGMENTS_NB_IoT 16
//#define MAX_NUM_ULSCH_SEGMENTS MAX_NUM_DLSCH_SEGMENTS //#define MAX_NUM_ULSCH_SEGMENTS MAX_NUM_DLSCH_SEGMENTS
//#define MAX_DLSCH_PAYLOAD_BYTES (MAX_NUM_DLSCH_SEGMENTS*768) //#define MAX_DLSCH_PAYLOAD_BYTES (MAX_NUM_DLSCH_SEGMENTS*768)
//#define MAX_ULSCH_PAYLOAD_BYTES (MAX_NUM_ULSCH_SEGMENTS*768) //#define MAX_ULSCH_PAYLOAD_BYTES (MAX_NUM_ULSCH_SEGMENTS*768)
// //
//#define MAX_NUM_CHANNEL_BITS (14*1200*6) // 14 symbols, 1200 REs, 12 bits/RE //#define MAX_NUM_CHANNEL_BITS_NB_IOT (14*1200*6) // 14 symbols, 1200 REs, 12 bits/RE
//#define MAX_NUM_RE (14*1200) //#define MAX_NUM_RE (14*1200)
// //
//#if !defined(SI_RNTI) //#if !defined(SI_RNTI)
...@@ -64,13 +70,13 @@ ...@@ -64,13 +70,13 @@
//#define PMI_2A_1mj 3 //#define PMI_2A_1mj 3
// //
//// for NB-IoT //// for NB-IoT
//#define MAX_NUM_CHANNEL_BITS_NB_IOT 3360 //14 symbols * 12 sub-carriers * 10 SF * 2bits/RE // to check during real tests #define MAX_NUM_CHANNEL_BITS_NB_IoT 3360 //14 symbols * 12 sub-carriers * 10 SF * 2bits/RE // to check during real tests
//#define MAX_DL_SIZE_BITS_NB_IOT 680 // in release 13 // in release 14 = 2048 // ??? **** not sure #define MAX_DL_SIZE_BITS_NB_IoT 680 // in release 13 // in release 14 = 2048 // ??? **** not sure
////#define MAX_NUM_CHANNEL_BITS_NB_IOT 3*680 /// ??? ****not sure ////#define MAX_NUM_CHANNEL_BITS_NB_IOT 3*680 /// ??? ****not sure
// //
//// to be created LTE_eNB_DLSCH_t --> is duplicated for each number of UE and then indexed in the table //// to be created LTE_eNB_DLSCH_t --> is duplicated for each number of UE and then indexed in the table
// //
//typedef struct { // LTE_eNB_DLSCH_t // typedef struct { // LTE_eNB_DLSCH_t
// /// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding) // /// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding)
// uint32_t *txdataF[8]; // uint32_t *txdataF[8];
// /// Allocated RNTI (0 means DLSCH_t is not currently used) // /// Allocated RNTI (0 means DLSCH_t is not currently used)
...@@ -114,8 +120,8 @@ ...@@ -114,8 +120,8 @@
// int16_t sqrt_rho_a; // int16_t sqrt_rho_a;
// /// amplitude of PDSCH (compared to RS) in symbols containing pilots // /// amplitude of PDSCH (compared to RS) in symbols containing pilots
// int16_t sqrt_rho_b; // int16_t sqrt_rho_b;
//
//} NB_IoT_eNB_DLSCH_t; // } NB_IoT_eNB_DLSCH_t;
// //
// //
// //
...@@ -179,6 +185,604 @@ ...@@ -179,6 +185,604 @@
//} NB_IoT_DL_eNB_HARQ_t; //} NB_IoT_DL_eNB_HARQ_t;
typedef enum {
SCH_IDLE_NB_IoT,
ACTIVE_NB_IoT,
CBA_ACTIVE_NB_IoT,
DISABLED_NB_IoT
} SCH_status_NB_IoT_t;
typedef struct {
/// HARQ process id
uint8_t harq_id;
/// ACK bits (after decoding) 0:NACK / 1:ACK / 2:DTX
uint8_t ack;
/// send status (for PUCCH)
uint8_t send_harq_status;
/// nCCE (for PUCCH)
uint8_t nCCE;
/// DAI value detected from DCI1/1a/1b/1d/2/2a/2b/2c. 0xff indicates not touched
uint8_t vDAI_DL;
/// DAI value detected from DCI0/4. 0xff indicates not touched
uint8_t vDAI_UL;
} harq_status_NB_IoT_t;
typedef struct {
/// UL RSSI per receive antenna
int32_t UL_rssi[NB_ANTENNAS_RX];
/// PUCCH1a/b power (digital linear)
uint32_t Po_PUCCH;
/// PUCCH1a/b power (dBm)
int32_t Po_PUCCH_dBm;
/// PUCCH1 power (digital linear), conditioned on below threshold
uint32_t Po_PUCCH1_below;
/// PUCCH1 power (digital linear), conditioned on above threshold
uint32_t Po_PUCCH1_above;
/// Indicator that Po_PUCCH has been updated by PHY
int32_t Po_PUCCH_update;
/// DL Wideband CQI index (2 TBs)
uint8_t DL_cqi[2];
/// DL Subband CQI index (from HLC feedback)
uint8_t DL_subband_cqi[2][13];
/// DL PMI Single Stream
uint16_t DL_pmi_single;
/// DL PMI Dual Stream
uint16_t DL_pmi_dual;
/// Current RI
uint8_t rank;
/// CRNTI of UE
uint16_t crnti; ///user id (rnti) of connected UEs
/// Initial timing offset estimate from PRACH for RAR
int32_t UE_timing_offset;
/// Timing advance estimate from PUSCH for MAC timing advance signalling
int32_t timing_advance_update;
/// Current mode of UE (NOT SYCHED, RAR, PUSCH)
UE_MODE_NB_IoT_t mode;
/// Current sector where UE is attached
uint8_t sector;
/// dlsch l2 errors
uint32_t dlsch_l2_errors[8];
/// dlsch trials per harq and round
uint32_t dlsch_trials[8][8];
/// dlsch ACK/NACK per hard_pid and round
uint32_t dlsch_ACK[8][8];
uint32_t dlsch_NAK[8][8];
/// ulsch l2 errors per harq_pid
uint32_t ulsch_errors[8];
/// ulsch l2 consecutive errors per harq_pid
uint32_t ulsch_consecutive_errors; //[8];
/// ulsch trials/errors/fer per harq and round
uint32_t nulsch_decoding_attempts[8][8];
uint32_t ulsch_round_errors[8][8];
uint32_t ulsch_decoding_attempts_last[8][8];
uint32_t ulsch_round_errors_last[8][8];
uint32_t ulsch_round_fer[8][8];
uint32_t sr_received;
uint32_t sr_total;
/// dlsch sliding count and total errors in round 0 are used to compute the dlsch_mcs_offset
uint32_t dlsch_sliding_cnt;
uint32_t dlsch_NAK_round0;
int8_t dlsch_mcs_offset;
/// Target mcs1 after rate-adaptation (used by MAC layer scheduler)
uint8_t dlsch_mcs1;
/// Target mcs2 after rate-adaptation (used by MAC layer scheduler)
uint8_t dlsch_mcs2;
/// Total bits received from MAC on PDSCH
int total_TBS_MAC;
/// Total bits acknowledged on PDSCH
int total_TBS;
/// Total bits acknowledged on PDSCH (last interval)
int total_TBS_last;
/// Bitrate on the PDSCH [bps]
unsigned int dlsch_bitrate;
// unsigned int total_transmitted_bits;
} NB_IoT_eNB_UE_stats;
typedef struct {
/// Indicator of first transmission
uint8_t first_tx;
/// Last Ndi received for this process on DCI (used for C-RNTI only)
uint8_t DCINdi;
/// DLSCH status flag indicating
//SCH_status_t status;
/// Transport block size
uint32_t TBS;
/// The payload + CRC size in bits
uint32_t B;
/// Pointer to the payload
uint8_t *b;
/// Pointers to transport block segments
uint8_t *c[MAX_NUM_DLSCH_SEGMENTS_NB_IoT];
/// RTC values for each segment (for definition see 36-212 V8.6 2009-03, p.15)
uint32_t RTC[MAX_NUM_DLSCH_SEGMENTS_NB_IoT];
/// Index of current HARQ round for this DLSCH
uint8_t round;
/// MCS format for this DLSCH
uint8_t mcs;
/// Qm (modulation order) for this DLSCH
uint8_t Qm;
/// Redundancy-version of the current sub-frame
uint8_t rvidx;
/// MIMO mode for this DLSCH
// MIMO_mode_t mimo_mode;
/// soft bits for each received segment ("w"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
int16_t w[MAX_NUM_DLSCH_SEGMENTS_NB_IoT][3*(6144+64)];
/// for abstraction soft bits for each received segment ("w"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
double w_abs[MAX_NUM_DLSCH_SEGMENTS_NB_IoT][3*(6144+64)];
/// soft bits for each received segment ("d"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
int16_t *d[MAX_NUM_DLSCH_SEGMENTS_NB_IoT];
/// Number of code segments (for definition see 36-212 V8.6 2009-03, p.9)
uint32_t C;
/// Number of "small" code segments (for definition see 36-212 V8.6 2009-03, p.10)
uint32_t Cminus;
/// Number of "large" code segments (for definition see 36-212 V8.6 2009-03, p.10)
uint32_t Cplus;
/// Number of bits in "small" code segments (<6144) (for definition see 36-212 V8.6 2009-03, p.10)
uint32_t Kminus;
/// Number of bits in "large" code segments (<6144) (for definition see 36-212 V8.6 2009-03, p.10)
uint32_t Kplus;
/// Number of "Filler" bits (for definition see 36-212 V8.6 2009-03, p.10)
uint32_t F;
/// Number of MIMO layers (streams) (for definition see 36-212 V8.6 2009-03, p.17)
uint8_t Nl;
/// current delta_pucch
int8_t delta_PUCCH;
/// Number of soft channel bits
uint32_t G;
/// Current Number of RBs
uint16_t nb_rb;
/// Current subband PMI allocation
uint16_t pmi_alloc;
/// Current RB allocation (even slots)
uint32_t rb_alloc_even[4];
/// Current RB allocation (odd slots)
uint32_t rb_alloc_odd[4];
/// distributed/localized flag
//vrb_t vrb_type;
/// downlink power offset field
uint8_t dl_power_off;
/// trials per round statistics
uint32_t trials[8];
/// error statistics per round
uint32_t errors[8];
/// codeword this transport block is mapped to
uint8_t codeword;
} NB_IoT_DL_UE_HARQ_t;
typedef struct {
/// RNTI
uint16_t rnti;
/// Active flag for DLSCH demodulation
uint8_t active;
/// Transmission mode
uint8_t mode1_flag;
/// 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;
/// Current HARQ process id threadRx Odd and threadRx Even
uint8_t current_harq_pid;
/// Current subband antenna selection
uint32_t antenna_alloc;
/// Current subband RI allocation
uint32_t ri_alloc;
/// Current subband CQI1 allocation
uint32_t cqi_alloc1;
/// Current subband CQI2 allocation
uint32_t cqi_alloc2;
/// saved subband PMI allocation from last PUSCH/PUCCH report
uint16_t pmi_alloc;
/// HARQ-ACKs
harq_status_NB_IoT_t harq_ack[10];
/// Pointers to up to 8 HARQ processes
NB_IoT_DL_UE_HARQ_t *harq_processes[8];
/// Maximum number of HARQ processes(for definition see 36-212 V8.6 2009-03, p.17
uint8_t Mdlharq;
/// 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;
/// Maximum number of Turbo iterations
uint8_t max_turbo_iterations;
/// number of iterations used in last turbo decoding
uint8_t last_iteration_cnt;
/// accumulated tx power adjustment for PUCCH
int8_t g_pucch;
} NB_IoT_UE_DLSCH_t;
//----------------------------------------------------------------------------------------------------------
// NB-IoT
//----------------------------------------------------------------------------------------------------
//enum for distinguish the different type of ndlsch (may in the future will be not needed)
typedef enum
{
SIB1,
SI_Message,
RAR,
UE_Data
}ndlsch_flag_t;
typedef struct {
rnti_NB_IoT_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)
uint16_t number_repetition_RA;
uint16_t number_repetition_PAg;
//index of the current subframe among the repetition (set to 0 when we receive the new NPDCCH)
uint16_t repetition_idx_RA;
uint16_t repetition_idx_Pag;
}NB_IoT_eNB_COMMON_NPDCCH_t;
typedef struct {
/// Length of DCI in bits
uint8_t dci_length;
/// Aggregation level only 1,2 in NB-IoT
uint8_t L;
/// Position of first CCE of the dci
int firstCCE;
/// flag to indicate that this is a RA response
boolean_NB_IoT_t ra_flag;
/// rnti
rnti_NB_IoT_t rnti;
/// Format
DCI_format_NB_IoT_t format;
/// DCI pdu
uint8_t dci_pdu[8];
} DCI_ALLOC_NB_IoT_t;
typedef struct {
//delete the count for the DCI numbers,NUM_DCI_MAX should set to 2
uint32_t num_npdcch_symbols;
///indicates the starting OFDM symbol in the first slot of a subframe k for the NPDCCH transmission
/// see FAPI/NFAPI specs Table 4-45
uint8_t npdcch_start_symbol;
uint8_t Num_dci;
DCI_ALLOC_NB_IoT_t dci_alloc[2] ;
} DCI_PDU_NB_IoT;
typedef struct {
/// NB-IoT
SCH_status_NB_IoT_t status;
/// The scheduling the NPDCCH and the NPDSCH transmission TS 36.213 Table 16.4.1-1
uint8_t scheduling_delay;
/// The number of the subframe to transmit the NPDSCH Table TS 36.213 Table 16.4.1.3-1 (Nsf) (NB. in this case is not the index Isf)
uint8_t resource_assignment;
/// is the index that determined the repeat number of NPDSCH through table TS 36.213 Table 16.4.1.3-2 / for SIB1-NB Table 16.4.1.3-3
uint8_t repetition_number;
/// Determined the ACK/NACK delay and the subcarrier allocation TS 36.213 Table 16.4.2
uint8_t HARQ_ACK_resource;
/// Determined the repetition number value 0-3 (2 biut carried by the FAPI NPDCCH)
uint8_t dci_subframe_repetitions;
/// modulation always QPSK Qm = 2
uint8_t modulation;
/// Status Flag indicating for this DLSCH (idle,active,disabled)
//SCH_status_t status;
/// Transport block size
uint32_t TBS;
/// The payload + CRC size in bits, "B" from 36-212
uint32_t B;
/// Pointer to the payload
uint8_t *b;
///pdu of the ndlsch message
uint8_t*pdu;
/// Frame where current HARQ round was sent
uint32_t frame;
/// Subframe where current HARQ round was sent
uint32_t subframe;
/// Index of current HARQ round for this DLSCH
uint8_t round;
/// MCS format for this NDLSCH , TS 36.213 Table 16.4.1.5
uint8_t mcs;
// we don't have code block segmentation / crc attachment / concatenation in NB-IoT R13 36.212 6.4.2
// we don't have beamforming in NB-IoT
//this index will be used mainly for SI message buffer
uint8_t pdu_buffer_index;
} NB_IoT_DL_eNB_HARQ_t;
typedef struct {
/// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding)
int32_t *txdataF[8];
/// 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*/
/// The only HARQ process for the DLSCH
NB_IoT_DL_eNB_HARQ_t *harq_process;
/// Number of soft channel bits
uint32_t G;
/// Maximum number of HARQ rounds
uint8_t Mlimit;
/// 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
/// may use in the npdsch_procedures
uint16_t scrambling_sequence_intialization;
/// number of cell specific TX antenna ports assumed by the UE
uint8_t nrs_antenna_ports;
//This indicate the current subframe within the subframe interval between the NPDSCH transmission (Nsf*Nrep)
uint16_t sf_index;
///indicates the starting OFDM symbol in the first slot of a subframe k for the NPDSCH transmission
/// see FAPI/NFAPI specs Table 4-47
uint8_t npdsch_start_symbol;
/*SIB1-NB related parameters*/
///flag for indicate if the current frame is the start of a new SIB1-NB repetition within the SIB1-NB period (0 = FALSE, 1 = TRUE)
uint8_t sib1_rep_start;
///the number of the frame within the 16 continuous frame in which sib1-NB is transmitted (1-8 = 1st, 2nd ecc..) (0 = not foresees a transmission)
uint8_t relative_sib1_frame;
//Flag used to discern among different NDLSCH structures (SIB1,SI,RA,UE-spec)
//(used inside the ndlsch procedure for distinguish the different type of data to manage also in term of repetitions and transmission over more subframes
ndlsch_flag_t ndlsch_type;
} NB_IoT_eNB_NDLSCH_t;
typedef struct {
/// Length of CQI data under RI=1 assumption(bits)
uint8_t Or1;
/// Rank information
uint8_t o_RI[2];
/// Format of CQI data
UCI_format_NB_IoT_t uci_format;
/// The value of DAI in DCI format 0
uint8_t V_UL_DAI;
/// Pointer to CQI data
uint8_t o[MAX_CQI_BYTES_NB_IoT];
/// CQI CRC status
uint8_t cqi_crc_status;
/// PHICH active flag
uint8_t phich_active;
/// PHICH ACK
uint8_t phich_ACK;
/// Length of rank information (bits)
uint8_t O_RI;
/// First Allocated RB
uint16_t first_rb;
/// Current Number of RBs
uint16_t nb_rb;
/// Determined the subcarrier allocation for the NPUSCH.(15, 3.75 KHz)
uint8_t subcarrier_indication;
/// Determined the number of resource unit for the NPUSCH
uint8_t resource_assignment;
/// Determined the scheduling delay for NPUSCH
uint8_t scheduling_delay;
/// The number of the repetition number for NPUSCH Transport block
uint8_t repetition_number;
/// Determined the repetition number value 0-3
uint8_t dci_subframe_repetitions;
/// Flag indicating that this ULSCH has been allocated by a DCI (otherwise it is a retransmission based on PHICH NAK)
uint8_t dci_alloc;
/// Flag indicating that this ULSCH has been allocated by a RAR (otherwise it is a retransmission based on PHICH NAK or DCI)
uint8_t rar_alloc;
/// Status Flag indicating for this ULSCH (idle,active,disabled)
SCH_status_NB_IoT_t status;
/// Subframe scheduling indicator (i.e. Transmission opportunity indicator)
uint8_t subframe_scheduling_flag;
/// Transport block size
uint32_t TBS;
/// The payload + CRC size in bits
uint32_t B;
/// Number of soft channel bits
uint32_t G;
/// Pointer to ACK
uint8_t o_ACK[4];
/// Length of ACK information (bits)
uint8_t O_ACK;
/// coded ACK bits
int16_t q_ACK[MAX_ACK_PAYLOAD_NB_IoT];
/// Number of code segments (for definition see 36-212 V8.6 2009-03, p.9)
/// Concatenated "e"-sequences (for definition see 36-212 V8.6 2009-03, p.17-18)
int16_t e[MAX_NUM_CHANNEL_BITS_NB_IoT] __attribute__((aligned(32)));
/// coded RI bits
int16_t q_RI[MAX_RI_PAYLOAD_NB_IoT];
/// "q" sequences for CQI/PMI (for definition see 36-212 V8.6 2009-03, p.27)
int8_t q[MAX_CQI_PAYLOAD_NB_IoT];
/// number of coded CQI bits after interleaving
uint8_t o_RCC;
/// coded and interleaved CQI bits
int8_t o_w[(MAX_CQI_BITS_NB_IoT+8)*3];
/// coded CQI bits
int8_t o_d[96+((MAX_CQI_BITS_NB_IoT+8)*3)];
uint32_t C;
/// Number of "small" code segments (for definition see 36-212 V8.6 2009-03, p.10)
uint32_t Cminus;
/// Number of "large" code segments (for definition see 36-212 V8.6 2009-03, p.10)
uint32_t Cplus;
/// Number of bits in "small" code segments (<6144) (for definition see 36-212 V8.6 2009-03, p.10)
uint32_t Kminus;
/// Number of bits in "large" code segments (<6144) (for definition see 36-212 V8.6 2009-03, p.10)
uint32_t Kplus;
/// Number of "Filler" bits (for definition see 36-212 V8.6 2009-03, p.10)
uint32_t F;
/// Temporary h sequence to flag PUSCH_x/PUSCH_y symbols which are not scrambled
//uint8_t h[MAX_NUM_CHANNEL_BITS];
/// Pointer to the payload
uint8_t *b;
/// Current Number of Symbols
uint8_t Nsymb_pusch;
/// Index of current HARQ round for this ULSCH
uint8_t round;
/// MCS format for this ULSCH
uint8_t mcs;
/// Redundancy-version of the current sub-frame (value 0->RV0,value 1 ->RV2)
uint8_t rvidx;
/// Msc_initial, Initial number of subcarriers for ULSCH (36-212, v8.6 2009-03, p.26-27)
uint16_t Msc_initial;
/// Nsymb_initial, Initial number of symbols for ULSCH (36-212, v8.6 2009-03, p.26-27)
uint8_t Nsymb_initial;
/// n_DMRS for cyclic shift of DMRS (36.213 Table 9.1.2-2)
uint8_t n_DMRS;
/// n_DMRS for cyclic shift of DMRS (36.213 Table 9.1.2-2) - previous scheduling
/// This is needed for PHICH generation which
/// is done after a new scheduling
uint8_t previous_n_DMRS;
/// n_DMRS 2 for cyclic shift of DMRS (36.211 Table 5.5.1.1.-1)
uint8_t n_DMRS2;
/// Flag to indicate that this ULSCH is for calibration information sent from UE (i.e. no MAC SDU to pass up)
// int calibration_flag;
/// delta_TF for power control
int32_t delta_TF;
} NB_IoT_UL_eNB_HARQ_t;
typedef struct {
/// Pointers to 8 HARQ processes for the ULSCH
NB_IoT_UL_eNB_HARQ_t *harq_process;
/// Maximum number of HARQ rounds
uint8_t Mlimit;
/// Value 0 = npush format 1 (data) value 1 = npusch format 2 (ACK/NAK)
uint8_t npusch_format;
/// 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;
/// (only in-band mode), indicate the resource block overlap the SRS configuration of LTE
uint8_t N_srs;
uint8_t scrambling_re_intialization_batch_index;
/// number of cell specific TX antenna ports assumed by the UE
uint8_t nrs_antenna_ports;
uint16_t scrambling_sequence_intialization;
uint16_t sf_index;
/// Determined the ACK/NACK delay and the subcarrier allocation TS 36.213 Table 16.4.2
uint8_t HARQ_ACK_resource;
} NB_IoT_eNB_NULSCH_t;
typedef struct {
/// Pointers to 8 HARQ processes for the ULSCH
NB_IoT_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;
/// 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];
#ifdef LOCALIZATION
/// epoch timestamp in millisecond
int32_t reference_timestamp_ms;
/// aggregate physical states every n millisecond
int32_t aggregation_period_ms;
/// a set of lists used for localization
struct list loc_rss_list[10], loc_rssi_list[10], loc_subcarrier_rss_list[10], loc_timing_advance_list[10], loc_timing_update_list[10];
struct list tot_loc_rss_list, tot_loc_rssi_list, tot_loc_subcarrier_rss_list, tot_loc_timing_advance_list, tot_loc_timing_update_list;
#endif
} NB_IoT_eNB_ULSCH_t;
#define NPBCH_A 34
typedef struct {
//the 2 LSB of the hsfn (the MSB are indicated by the SIB1-NB)
uint16_t h_sfn_lsb;
uint8_t npbch_d[96+(3*(16+NPBCH_A))];
uint8_t npbch_w[3*3*(16+NPBCH_A)];
uint8_t npbch_e[1600];
///pdu of the npbch message
uint8_t*pdu;
} NB_IoT_eNB_NPBCH_t;
......
...@@ -15,16 +15,14 @@ ...@@ -15,16 +15,14 @@
//#include "PHY/defs.h" //#include "PHY/defs.h"
#include "PHY/defs_nb_iot.h" #include "PHY/defs_nb_iot.h"
#include "PHY/extern.h" #include "PHY/extern.h"
#include "PHY/CODING/defs.h" #include "PHY/CODING/defs_nb_iot.h"
#include "PHY/CODING/extern.h" //#include "PHY/CODING/extern.h"
#include "PHY/CODING/lte_interleaver_inline.h" //#include "PHY/CODING/lte_interleaver_inline.h"
#include "PHY/LTE_TRANSPORT/defs.h" #include "PHY/LTE_TRANSPORT/defs.h"
#include "PHY/LTE_TRANSPORT/proto.h" #include "PHY/LTE_TRANSPORT/proto.h"
#include "SCHED/defs.h" #include "SCHED/defs_nb_iot.h"
#include "defs.h" #include "defs_nb_iot.h"
#include "UTIL/LOG/vcd_signal_dumper.h" //#include "UTIL/LOG/vcd_signal_dumper.h"
#define is_not_pilot(pilots,first_pilot,re) (1)
#include "PHY/LTE_TRANSPORT/defs_NB_IoT.h" // newly added for NB_IoT #include "PHY/LTE_TRANSPORT/defs_NB_IoT.h" // newly added for NB_IoT
......
...@@ -61,16 +61,6 @@ void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch); ...@@ -61,16 +61,6 @@ 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_IoT(//unsigned char Kmimo,
//unsigned char Mdlharq,
uint32_t Nsoft,
//unsigned char N_RB_DL,
uint8_t abstraction_flag,
NB_IoT_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
...@@ -95,8 +85,6 @@ void free_ue_ulsch(LTE_UE_ULSCH_t *ulsch); ...@@ -95,8 +85,6 @@ 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);
......
...@@ -149,7 +149,14 @@ unsigned int ulsch_decoding_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB, ...@@ -149,7 +149,14 @@ unsigned int ulsch_decoding_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB,
uint8_t Nbundled, uint8_t Nbundled,
uint8_t llr8_flag); uint8_t llr8_flag);
//NB-IoT version
NB_IoT_eNB_NDLSCH_t *new_eNB_dlsch_NB_IoT(//unsigned char Kmimo,
//unsigned char Mdlharq,
uint32_t Nsoft,
//unsigned char N_RB_DL,
uint8_t abstraction_flag,
NB_IoT_DL_FRAME_PARMS* frame_parms);
NB_IoT_eNB_NULSCH_t *new_eNB_ulsch_NB(uint8_t abstraction_flag);
#endif #endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.0 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "PHY/types.h"
typedef enum {
ue_selected_NB_IoT,
wideband_cqi_rank1_2A_NB_IoT, //wideband_cqi_rank1_2A,
wideband_cqi_rank2_2A_NB_IoT, //wideband_cqi_rank2_2A,
HLC_subband_cqi_nopmi_NB_IoT, //HLC_subband_cqi_nopmi,
HLC_subband_cqi_rank1_2A_NB_IoT, //HLC_subband_cqi_rank1_2A,
HLC_subband_cqi_rank2_2A_NB_IoT, //HLC_subband_cqi_rank2_2A,
HLC_subband_cqi_modes123_NB_IoT, //HLC_subband_cqi_modes123
HLC_subband_cqi_mcs_CBA_NB_IoT, // MCS and RNTI, for contention-based acces
unknown_cqi_NB_IoT//
} UCI_format_NB_IoT_t;
typedef struct __attribute__((packed))
{
uint64_t padding:3;
uint64_t pmi:1;
uint64_t diffcqi2:26;
uint64_t cqi2:4;
uint64_t diffcqi1:26;
uint64_t cqi1:4;
}
HLC_subband_cqi_rank2_2A_20MHz_NB_IoT;
#define MAX_CQI_PAYLOAD_NB_IoT (sizeof(HLC_subband_cqi_rank2_2A_20MHz_NB_IoT)*8*20)
#define MAX_CQI_BITS_NB_IoT (sizeof(HLC_subband_cqi_rank2_2A_20MHz_NB_IoT)*8)
#define MAX_CQI_BYTES_NB_IoT (sizeof(HLC_subband_cqi_rank2_2A_20MHz_NB_IoT))
#define MAX_ACK_PAYLOAD_NB_IoT 18
#define MAX_RI_PAYLOAD_NB_IoT 6
/*
// **********************************************1.5 MHz***************************************************************************
typedef struct __attribute__((packed))
{
uint32_t padding:16;
uint32_t pmi:12;
uint32_t cqi1:4;
}
wideband_cqi_rank1_2A_1_5MHz ;
#define sizeof_wideband_cqi_rank1_2A_1_5MHz 16
typedef struct __attribute__((packed))
{
uint16_t padding:2;
uint16_t pmi:6;
uint16_t cqi2:4;
uint16_t cqi1:4;
}
wideband_cqi_rank2_2A_1_5MHz ;
#define sizeof_wideband_cqi_rank2_2A_1_5MHz 14
typedef struct __attribute__((packed))
{
uint32_t padding:16;
uint32_t diffcqi1:12;
uint32_t cqi1:4;
}
HLC_subband_cqi_nopmi_1_5MHz;
#define sizeof_HLC_subband_cqi_nopmi_1_5MHz 16
typedef struct __attribute__((packed))
{
uint32_t padding:14;
uint32_t pmi:2;
uint32_t diffcqi1:12;
uint32_t cqi1:4;
}
HLC_subband_cqi_rank1_2A_1_5MHz;
#define sizeof_HLC_subband_cqi_rank1_2A_1_5MHz 18
typedef struct __attribute__((packed))
{
uint64_t padding:31;
uint64_t pmi:1;
uint64_t diffcqi2:12;
uint64_t cqi2:4;
uint64_t diffcqi1:12;
uint64_t cqi1:4;
}
HLC_subband_cqi_rank2_2A_1_5MHz;
#define sizeof_HLC_subband_cqi_rank2_2A_1_5MHz 33
typedef struct __attribute__((packed))
{
uint32_t padding:16;
uint32_t diffcqi1:12;
uint32_t cqi1:4;
}
HLC_subband_cqi_modes123_1_5MHz;
#define sizeof_HLC_subband_cqi_modes123_1_5MHz 16
typedef struct __attribute__((packed))
{
uint32_t padding:11;
uint32_t crnti:16;
uint32_t mcs:5;
}
HLC_subband_cqi_mcs_CBA_1_5MHz;
#define sizeof_HLC_subband_cqi_mcs_CBA_1_5MHz 21
// **********************************************5 MHz***************************************************************************
typedef struct __attribute__((packed))
{
uint32_t padding:14;
uint32_t pmi:14;
uint32_t cqi1:4;
}
wideband_cqi_rank1_2A_5MHz ;
#define sizeof_wideband_cqi_rank1_2A_5MHz 18
typedef struct __attribute__((packed))
{
uint16_t padding:1;
uint16_t pmi:7;
uint16_t cqi2:4;
uint16_t cqi1:4;
}
wideband_cqi_rank2_2A_5MHz ;
#define sizeof_wideband_cqi_rank2_2A_5MHz 15
typedef struct __attribute__((packed))
{
uint32_t padding:14;
uint32_t diffcqi1:14;
uint32_t cqi1:4;
}
HLC_subband_cqi_nopmi_5MHz;
#define sizeof_HLC_subband_cqi_nopmi_5MHz 18
typedef struct __attribute__((packed))
{
uint32_t padding:12;
uint32_t pmi:2;
uint32_t diffcqi1:14;
uint32_t cqi1:4;
}
HLC_subband_cqi_rank1_2A_5MHz;
#define sizeof_HLC_subband_cqi_rank1_2A_5MHz 20
typedef struct __attribute__((packed))
{
uint64_t padding:27;
uint64_t pmi:1;
uint64_t diffcqi2:14;
uint64_t cqi2:4;
uint64_t diffcqi1:14;
uint64_t cqi1:4;
}
HLC_subband_cqi_rank2_2A_5MHz;
#define sizeof_HLC_subband_cqi_rank2_2A_5MHz 37
typedef struct __attribute__((packed))
{
uint32_t padding:14;
uint32_t diffcqi1:14;
uint32_t cqi1:4;
}
HLC_subband_cqi_modes123_5MHz;
#define sizeof_HLC_subband_cqi_modes123_5MHz 18
typedef struct __attribute__((packed))
{
uint32_t padding:11;
uint32_t crnti:16;
uint32_t mcs:5;
}
HLC_subband_cqi_mcs_CBA_5MHz;
#define sizeof_HLC_subband_cqi_mcs_CBA_5MHz 21
// **********************************************10 MHz***************************************************************************
typedef struct __attribute__((packed))
{
uint32_t padding:10;
uint32_t pmi:18;
uint32_t cqi1:4;
}
wideband_cqi_rank1_2A_10MHz ;
#define sizeof_wideband_cqi_rank1_2A_10MHz 22
typedef struct __attribute__((packed))
{
uint32_t padding:15;
uint32_t pmi:9;
uint32_t cqi2:4;
uint32_t cqi1:4;
}
wideband_cqi_rank2_2A_10MHz ;
#define sizeof_wideband_cqi_rank2_2A_10MHz 17
typedef struct __attribute__((packed))
{
uint32_t padding:10;
uint32_t diffcqi1:18;
uint32_t cqi1:4;
}
HLC_subband_cqi_nopmi_10MHz;
#define sizeof_HLC_subband_cqi_nopmi_10MHz 22
typedef struct __attribute__((packed))
{
uint32_t padding:8;
uint32_t pmi:2;
uint32_t diffcqi1:18;
uint32_t cqi1:4;
}
HLC_subband_cqi_rank1_2A_10MHz;
#define sizeof_HLC_subband_cqi_rank1_2A_10MHz 24
typedef struct __attribute__((packed))
{
uint64_t padding:19;
uint64_t pmi:1;
uint64_t diffcqi2:18;
uint64_t cqi2:4;
uint64_t diffcqi1:18;
uint64_t cqi1:4;
}
HLC_subband_cqi_rank2_2A_10MHz;
#define sizeof_HLC_subband_cqi_rank2_2A_10MHz 45
typedef struct __attribute__((packed))
{
uint32_t padding:10;
uint32_t diffcqi1:18;
uint32_t cqi1:4;
}
HLC_subband_cqi_modes123_10MHz;
#define sizeof_HLC_subband_cqi_modes123_10MHz 22
typedef struct __attribute__((packed))
{
uint32_t padding:11;
uint32_t crnti:16;
uint32_t mcs:5;
}
HLC_subband_cqi_mcs_CBA_10MHz;
#define sizeof_HLC_subband_cqi_mcs_CBA_10MHz 21
// **********************************************20 MHz***************************************************************************
typedef struct __attribute__((packed))
{
uint32_t padding:2;
uint32_t pmi:26;
uint32_t cqi1:4;
}
wideband_cqi_rank1_2A_20MHz ;
#define sizeof_wideband_cqi_rank1_2A_20MHz 20
typedef struct __attribute__((packed))
{
uint32_t padding:11;
uint32_t pmi:13;
uint32_t cqi2:4;
uint32_t cqi1:4;
}
wideband_cqi_rank2_2A_20MHz ;
#define sizeof_wideband_cqi_rank2_2A_20MHz 21
typedef struct __attribute__((packed))
{
uint32_t padding:2;
uint32_t diffcqi1:26;
uint32_t cqi1:4;
}
HLC_subband_cqi_nopmi_20MHz;
#define sizeof_HLC_subband_cqi_nopmi_20MHz 30
typedef struct __attribute__((packed))
{
// uint32_t padding:12;
uint32_t pmi:2;
uint32_t diffcqi1:26;
uint32_t cqi1:4;
}
HLC_subband_cqi_rank1_2A_20MHz;
#define sizeof_HLC_subband_cqi_rank1_2A_20MHz 32
typedef struct __attribute__((packed))
{
uint64_t padding:3;
uint64_t pmi:1;
uint64_t diffcqi2:26;
uint64_t cqi2:4;
uint64_t diffcqi1:26;
uint64_t cqi1:4;
}
HLC_subband_cqi_rank2_2A_20MHz;
#define sizeof_HLC_subband_cqi_rank2_2A_20MHz 61
typedef struct __attribute__((packed))
{
uint32_t padding:2;
uint32_t diffcqi1:26;
uint32_t cqi1:4;
}
HLC_subband_cqi_modes123_20MHz;
#define sizeof_HLC_subband_cqi_modes123_20MHz 30
typedef struct __attribute__((packed))
{
uint32_t padding:11;
uint32_t crnti:16;
uint32_t mcs:5;
}
HLC_subband_cqi_mcs_CBA_20MHz;
#define sizeof_HLC_subband_cqi_mcs_CBA_20MHz 21
#define MAX_CQI_PAYLOAD (sizeof(HLC_subband_cqi_rank2_2A_20MHz)*8*20)
#define MAX_CQI_BITS (sizeof(HLC_subband_cqi_rank2_2A_20MHz)*8)
#define MAX_CQI_BYTES (sizeof(HLC_subband_cqi_rank2_2A_20MHz))
#define MAX_ACK_PAYLOAD 18
#define MAX_RI_PAYLOAD 6
*/
\ No newline at end of file
...@@ -934,7 +934,7 @@ unsigned int ulsch_decoding_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, ...@@ -934,7 +934,7 @@ unsigned int ulsch_decoding_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
int16_t *ulsch_llr = eNB->pusch_vars[UE_id]->llr; int16_t *ulsch_llr = eNB->pusch_vars[UE_id]->llr;
NB_IoT_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms; NB_IoT_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
LTE_eNB_ULSCH_t *ulsch = eNB->ulsch[UE_id]; NB_IoT_eNB_ULSCH_t *ulsch = eNB->ulsch[UE_id];
uint8_t harq_pid; uint8_t harq_pid;
unsigned short nb_rb; unsigned short nb_rb;
unsigned int A; unsigned int A;
...@@ -964,7 +964,7 @@ unsigned int ulsch_decoding_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, ...@@ -964,7 +964,7 @@ unsigned int ulsch_decoding_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
int off; int off;
int subframe = proc->subframe_rx; int subframe = proc->subframe_rx;
LTE_UL_eNB_HARQ_t *ulsch_harq; NB_IoT_UL_eNB_HARQ_t *ulsch_harq;
...@@ -974,7 +974,7 @@ unsigned int ulsch_decoding_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, ...@@ -974,7 +974,7 @@ unsigned int ulsch_decoding_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
// x1 is set in lte_gold_generic // x1 is set in lte_gold_generic
x2 = ((uint32_t)ulsch->rnti<<14) + ((uint32_t)subframe<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.3.1 x2 = ((uint32_t)ulsch->rnti<<14) + ((uint32_t)subframe<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.3.1
ulsch_harq = ulsch->harq_processes[harq_pid]; ulsch_harq = ulsch->harq_process;
if (harq_pid==255) { if (harq_pid==255) {
LOG_E(PHY, "FATAL ERROR: illegal harq_pid, returning\n"); LOG_E(PHY, "FATAL ERROR: illegal harq_pid, returning\n");
...@@ -1657,7 +1657,7 @@ unsigned int ulsch_decoding_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, ...@@ -1657,7 +1657,7 @@ unsigned int ulsch_decoding_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
if (extract_cqi_crc_NB_IoT(o_flip,ulsch_harq->Or1) == (crc8(o_flip,ulsch_harq->Or1)>>24)) if (extract_cqi_crc_NB_IoT(o_flip,ulsch_harq->Or1) == (crc8(o_flip,ulsch_harq->Or1)>>24))
ulsch_harq->cqi_crc_status = 1; ulsch_harq->cqi_crc_status = 1;
if (ulsch->harq_processes[harq_pid]->Or1<=32) { if (ulsch->harq_process->Or1<=32) {
ulsch_harq->o[3] = o_flip[0] ; ulsch_harq->o[3] = o_flip[0] ;
ulsch_harq->o[2] = o_flip[1] ; ulsch_harq->o[2] = o_flip[1] ;
ulsch_harq->o[1] = o_flip[2] ; ulsch_harq->o[1] = o_flip[2] ;
......
...@@ -99,41 +99,41 @@ static inline void* malloc16_clear( size_t size ) ...@@ -99,41 +99,41 @@ static inline void* malloc16_clear( size_t size )
*/ */
#define PAGE_MASK 0xfffff000 // #define PAGE_MASK 0xfffff000
#define virt_to_phys(x) (x) // #define virt_to_phys(x) (x)
#define openair_sched_exit() exit(-1) // #define openair_sched_exit() exit(-1)
#define max(a,b) ((a)>(b) ? (a) : (b)) // #define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b)) // #define min(a,b) ((a)<(b) ? (a) : (b))
#define bzero(s,n) (memset((s),0,(n))) // #define bzero(s,n) (memset((s),0,(n)))
#define cmax(a,b) ((a>b) ? (a) : (b)) // #define cmax(a,b) ((a>b) ? (a) : (b))
#define cmin(a,b) ((a<b) ? (a) : (b)) // #define cmin(a,b) ((a<b) ? (a) : (b))
#define cmax3(a,b,c) ((cmax(a,b)>c) ? (cmax(a,b)) : (c)) // #define cmax3(a,b,c) ((cmax(a,b)>c) ? (cmax(a,b)) : (c))
/// suppress compiler warning for unused arguments // /// suppress compiler warning for unused arguments
#define UNUSED(x) (void)x; // #define UNUSED(x) (void)x;
#include "impl_defs_top_NB_IoT.h" #include "impl_defs_top_NB_IoT.h"
#include "impl_defs_top.h" #include "impl_defs_top.h"
#include "impl_defs_lte.h" #include "impl_defs_lte.h"
#include "impl_defs_lte_nb_iot.h" #include "PHY/impl_defs_lte_nb_iot.h"
#include "PHY/TOOLS/time_meas.h" #include "PHY/TOOLS/time_meas.h"
#include "PHY/CODING/defs.h" #include "PHY/CODING/defs.h"
#include "PHY/CODING/defs_nb_iot.h" #include "PHY/CODING/defs_nb_iot.h"
#include "PHY/TOOLS/defs.h" #include "PHY/TOOLS/defs.h"
#include "platform_types.h" #include "platform_types.h"
///#include "openair1/PHY/LTE_TRANSPORT/defs_nb_iot.h"
#ifdef OPENAIR_LTE #ifdef OPENAIR_LTE
#include "PHY/LTE_TRANSPORT/defs.h" //#include "PHY/LTE_TRANSPORT/defs.h"
#include "PHY/LTE_TRANSPORT/defs_nb_iot.h" #include "PHY/LTE_TRANSPORT/defs_nb_iot.h"
#include <pthread.h> #include <pthread.h>
...@@ -179,7 +179,7 @@ typedef struct UE_SCAN_INFO_s { ...@@ -179,7 +179,7 @@ typedef struct UE_SCAN_INFO_s {
/// 10 frequency offsets (kHz) corresponding to best amplitudes, with respect do minimum DL frequency in the band /// 10 frequency offsets (kHz) corresponding to best amplitudes, with respect do minimum DL frequency in the band
int32_t freq_offset_Hz[3][10]; int32_t freq_offset_Hz[3][10];
} UE_SCAN_INFO_t; } UE_SCAN_INFO_t;
*/
/// Top-level PHY Data Structure for RN /// Top-level PHY Data Structure for RN
typedef struct { typedef struct {
/// Module ID indicator for this instance /// Module ID indicator for this instance
...@@ -190,10 +190,55 @@ typedef struct { ...@@ -190,10 +190,55 @@ typedef struct {
// cuurently only used to store and forward the PMCH // cuurently only used to store and forward the PMCH
uint8_t mch_avtive[10]; uint8_t mch_avtive[10];
uint8_t sync_area[10]; // num SF uint8_t sync_area[10]; // num SF
LTE_UE_DLSCH_t *dlsch_rn_MCH[10]; NB_IoT_UE_DLSCH_t *dlsch_rn_MCH[10];
} PHY_VARS_RN_NB_IoT;
#ifdef OCP_FRAMEWORK
#include <enums.h>
#else
//typedef enum {normal_txrx=0,rx_calib_ue=1,rx_calib_ue_med=2,rx_calib_ue_byp=3,debug_prach=4,no_L2_connect=5,calib_prach_tx=6,rx_dump_frame=7,loop_through_memory=8} runmode_t;
// enum transmission_access_mode {
// NO_ACCESS=0,
// POSTPONED_ACCESS,
// CANCELED_ACCESS,
// UNKNOWN_ACCESS,
// SCHEDULED_ACCESS,
// CBA_ACCESS};
// typedef enum {
// eNodeB_3GPP=0, // classical eNodeB function
// eNodeB_3GPP_BBU, // eNodeB with NGFI IF5
// NGFI_RCC_IF4p5, // NGFI_RCC (NGFI radio cloud center)
// NGFI_RAU_IF4p5,
// NGFI_RRU_IF5, // NGFI_RRU (NGFI remote radio-unit,IF5)
// NGFI_RRU_IF4p5 // NGFI_RRU (NGFI remote radio-unit,IF4p5)
// } eNB_func_NB_IoT_t;
typedef enum {
synch_to_ext_device_NB_IoT=0, // synch to RF or Ethernet device
synch_to_other_NB_IoT // synch to another source (timer, other CC_id)
} eNB_timing_NB_IoT_t;
#endif
typedef struct {
struct PHY_VARS_eNB_NB_IoT_s *eNB;
NB_IoT_eNB_NDLSCH_t *dlsch;
int G;
} te_params_NB_IoT;
typedef struct {
struct PHY_VARS_eNB_NB_IoT_s *eNB;
int UE_id;
int harq_pid;
int llr8_flag;
int ret;
} td_params_NB_IoT;
} PHY_VARS_RN;
*/
/// Context data structure for RX/TX portion of subframe processing /// Context data structure for RX/TX portion of subframe processing
typedef struct { typedef struct {
/// Component Carrier index /// Component Carrier index
...@@ -366,13 +411,13 @@ typedef struct eNB_proc_NB_IoT_t_s { ...@@ -366,13 +411,13 @@ typedef struct eNB_proc_NB_IoT_t_s {
/// mutex for asynch RX/TX thread /// mutex for asynch RX/TX thread
pthread_mutex_t mutex_asynch_rxtx; pthread_mutex_t mutex_asynch_rxtx;
/// parameters for turbo-decoding worker thread /// parameters for turbo-decoding worker thread
td_params tdp; td_params_NB_IoT tdp;
/// parameters for turbo-encoding worker thread /// parameters for turbo-encoding worker thread
te_params tep; te_params_NB_IoT tep;
/// number of slave threads /// number of slave threads
int num_slaves; int num_slaves;
/// array of pointers to slaves /// array of pointers to slaves
struct eNB_proc_t_s **slave_proc; struct eNB_proc_NB_IoT_t_s **slave_proc;
/// set of scheduling variables RXn-TXnp4 threads /// set of scheduling variables RXn-TXnp4 threads
// newly added for NB_IoT // newly added for NB_IoT
eNB_rxtx_proc_NB_IoT_t proc_rxtx[2]; eNB_rxtx_proc_NB_IoT_t proc_rxtx[2];
...@@ -450,9 +495,9 @@ typedef struct PHY_VARS_eNB_NB_IoT_s { ...@@ -450,9 +495,9 @@ typedef struct PHY_VARS_eNB_NB_IoT_s {
/// Module ID indicator for this instance /// Module ID indicator for this instance
module_id_t Mod_id; module_id_t Mod_id;
uint8_t CC_id; uint8_t CC_id;
eNB_proc_t proc; eNB_proc_NB_IoT_t proc;
eNB_func_t node_function; //eNB_func_NB_IoT_t node_function;
eNB_timing_t node_timing; eNB_timing_NB_IoT_t node_timing;
eth_params_t *eth_params; eth_params_t *eth_params;
int single_thread_flag; int single_thread_flag;
openair0_rf_map rf_map; openair0_rf_map rf_map;
...@@ -469,7 +514,7 @@ typedef struct PHY_VARS_eNB_NB_IoT_s { ...@@ -469,7 +514,7 @@ typedef struct PHY_VARS_eNB_NB_IoT_s {
int (*td)(struct PHY_VARS_eNB_NB_IoT_s *eNB,int UE_id,int harq_pid,int llr8_flag); int (*td)(struct PHY_VARS_eNB_NB_IoT_s *eNB,int UE_id,int harq_pid,int llr8_flag);
int (*te)(struct PHY_VARS_eNB_NB_IoT_s *,uint8_t *,uint8_t,LTE_eNB_DLSCH_t *,int,uint8_t,time_stats_t *,time_stats_t *,time_stats_t *); int (*te)(struct PHY_VARS_eNB_NB_IoT_s *,uint8_t *,uint8_t,LTE_eNB_DLSCH_t *,int,uint8_t,time_stats_t *,time_stats_t *,time_stats_t *);
void (*proc_uespec_rx)(struct PHY_VARS_eNB_NB_IoT_s *eNB,eNB_rxtx_proc_NB_IoT_t *proc,const relaying_type_t r_type); void (*proc_uespec_rx)(struct PHY_VARS_eNB_NB_IoT_s *eNB,eNB_rxtx_proc_NB_IoT_t *proc,const relaying_type_t r_type);
void (*proc_tx)(struct PHY_VARS_eNB_NB_IoT_s *eNB,eNB_rxtx_proc_NB_IoT_t *proc,relaying_type_t r_type,PHY_VARS_RN *rn); void (*proc_tx)(struct PHY_VARS_eNB_NB_IoT_s *eNB,eNB_rxtx_proc_NB_IoT_t *proc,relaying_type_t r_type,PHY_VARS_RN_NB_IoT *rn);
void (*tx_fh)(struct PHY_VARS_eNB_NB_IoT_s *eNB,eNB_rxtx_proc_NB_IoT_t *proc); void (*tx_fh)(struct PHY_VARS_eNB_NB_IoT_s *eNB,eNB_rxtx_proc_NB_IoT_t *proc);
void (*rx_fh)(struct PHY_VARS_eNB_NB_IoT_s *eNB,int *frame, int *subframe); void (*rx_fh)(struct PHY_VARS_eNB_NB_IoT_s *eNB,int *frame, int *subframe);
int (*start_rf)(struct PHY_VARS_eNB_NB_IoT_s *eNB); int (*start_rf)(struct PHY_VARS_eNB_NB_IoT_s *eNB);
...@@ -478,18 +523,18 @@ typedef struct PHY_VARS_eNB_NB_IoT_s { ...@@ -478,18 +523,18 @@ typedef struct PHY_VARS_eNB_NB_IoT_s {
uint8_t local_flag; uint8_t local_flag;
uint32_t rx_total_gain_dB; uint32_t rx_total_gain_dB;
NB_IoT_DL_FRAME_PARMS frame_parms; NB_IoT_DL_FRAME_PARMS frame_parms;
PHY_MEASUREMENTS_eNB measurements[NUMBER_OF_eNB_SECTORS_MAX_NB_IoT]; /// Measurement variables PHY_MEASUREMENTS_eNB_NB_IoT measurements[NUMBER_OF_eNB_SECTORS_MAX_NB_IoT]; /// Measurement variables
LTE_eNB_COMMON common_vars; NB_IoT_eNB_COMMON common_vars;
LTE_eNB_SRS srs_vars[NUMBER_OF_UE_MAX_NB_IoT]; NB_IoT_eNB_SRS srs_vars[NUMBER_OF_UE_MAX_NB_IoT];
LTE_eNB_PBCH pbch; NB_IoT_eNB_PBCH pbch;
LTE_eNB_PUSCH *pusch_vars[NUMBER_OF_UE_MAX_NB_IoT]; NB_IoT_eNB_PUSCH *pusch_vars[NUMBER_OF_UE_MAX_NB_IoT];
LTE_eNB_PRACH prach_vars; NB_IoT_eNB_PRACH prach_vars;
LTE_eNB_DLSCH_t *dlsch[NUMBER_OF_UE_MAX_NB_IoT][2]; // Nusers times two spatial streams //LTE_eNB_DLSCH_t *dlsch[NUMBER_OF_UE_MAX_NB_IoT][2]; // Nusers times two spatial streams
LTE_eNB_ULSCH_t *ulsch[NUMBER_OF_UE_MAX_NB_IoT+1]; // Nusers + number of RA (the ulsch[0] contains RAR) NB_IoT_eNB_ULSCH_t *ulsch[NUMBER_OF_UE_MAX_NB_IoT+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_NB_IoT]; NB_IoT_eNB_UE_stats UE_stats[NUMBER_OF_UE_MAX_NB_IoT];
LTE_eNB_UE_stats *UE_stats_ptr[NUMBER_OF_UE_MAX_NB_IoT]; //LTE_eNB_UE_stats *UE_stats_ptr[NUMBER_OF_UE_MAX_NB_IoT];
/// cell-specific reference symbols /// cell-specific reference symbols
...@@ -1069,10 +1114,10 @@ static inline int release_thread(pthread_mutex_t *mutex,int *instance_cnt,char * ...@@ -1069,10 +1114,10 @@ static inline int release_thread(pthread_mutex_t *mutex,int *instance_cnt,char *
*/ */
#include "PHY/INIT/defs.h" #include "PHY/INIT/defs_nb_iot.h"
#include "PHY/LTE_REFSIG/defs.h" #include "PHY/LTE_REFSIG/defs_NB_IoT.h"
#include "PHY/MODULATION/defs.h" //#include "PHY/MODULATION/defs.h"
#include "PHY/LTE_TRANSPORT/proto.h" //#include "PHY/LTE_TRANSPORT/proto.h"
#include "PHY/LTE_TRANSPORT/proto_nb_iot.h" #include "PHY/LTE_TRANSPORT/proto_nb_iot.h"
#include "PHY/LTE_ESTIMATION/defs.h" #include "PHY/LTE_ESTIMATION/defs.h"
......
...@@ -36,6 +36,9 @@ ...@@ -36,6 +36,9 @@
#include "types.h" #include "types.h"
//#include "defs.h" //#include "defs.h"
typedef enum {TDD_NB_IoT=1,FDD_NB_IoT=0} NB_IoT_frame_type_t;
typedef enum {EXTENDED_NB_IoT=1,NORMAL_NB_IoT=0} NB_IoT_prefix_type_t;
#define A_SEQUENCE_OF(type) A_SET_OF(type) #define A_SEQUENCE_OF(type) A_SET_OF(type)
#define A_SET_OF(type) \ #define A_SET_OF(type) \
...@@ -155,7 +158,7 @@ typedef struct { ...@@ -155,7 +158,7 @@ typedef struct {
typedef struct { typedef struct {
/// Frame type (0 FDD, 1 TDD) /// Frame type (0 FDD, 1 TDD)
lte_frame_type_t frame_type; NB_IoT_frame_type_t frame_type;
/// Number of resource blocks (RB) in DL of the LTE (for knowing the bandwidth) /// Number of resource blocks (RB) in DL of the LTE (for knowing the bandwidth)
uint8_t N_RB_DL; uint8_t N_RB_DL;
/// Number of resource blocks (RB) in UL of the LTE ((for knowing the bandwidth) /// Number of resource blocks (RB) in UL of the LTE ((for knowing the bandwidth)
...@@ -164,9 +167,9 @@ typedef struct { ...@@ -164,9 +167,9 @@ typedef struct {
/// Cell ID /// Cell ID
uint16_t Nid_cell; uint16_t Nid_cell;
/// Cyclic Prefix for DL (0=Normal CP, 1=Extended CP) /// Cyclic Prefix for DL (0=Normal CP, 1=Extended CP)
lte_prefix_type_t Ncp; NB_IoT_prefix_type_t Ncp;
/// Cyclic Prefix for UL (0=Normal CP, 1=Extended CP) /// Cyclic Prefix for UL (0=Normal CP, 1=Extended CP)
lte_prefix_type_t Ncp_UL; NB_IoT_prefix_type_t Ncp_UL;
/// shift of pilot position in one RB /// shift of pilot position in one RB
uint8_t nushift; uint8_t nushift;
/// indicates if node is a UE (NODE=2) or eNB (PRIMARY_CH=0). /// indicates if node is a UE (NODE=2) or eNB (PRIMARY_CH=0).
...@@ -268,6 +271,177 @@ typedef struct { ...@@ -268,6 +271,177 @@ typedef struct {
} NB_IoT_DL_FRAME_PARMS; } NB_IoT_DL_FRAME_PARMS;
typedef struct {
/// \brief Holds the transmit data in time domain.
/// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER.
/// - first index: eNB id [0..2] (hard coded)
/// - second index: tx antenna [0..nb_antennas_tx[
/// - third index:
int32_t **txdata[3];
/// \brief holds the transmit data in the frequency domain.
/// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER. //?
/// - first index: eNB id [0..2] (hard coded)
/// - second index: tx antenna [0..14[ where 14 is the total supported antenna ports.
/// - third index: sample [0..]
int32_t **txdataF[3];
/// \brief holds the transmit data after beamforming in the frequency domain.
/// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER. //?
/// - first index: eNB id [0..2] (hard coded)
/// - second index: tx antenna [0..nb_antennas_tx[
/// - third index: sample [0..]
int32_t **txdataF_BF[3];
/// \brief Holds the received data in time domain.
/// Should point to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER.
/// - first index: sector id [0..2] (hard coded)
/// - second index: rx antenna [0..nb_antennas_rx[
/// - third index: sample [0..]
int32_t **rxdata[3];
/// \brief Holds the last subframe of received data in time domain after removal of 7.5kHz frequency offset.
/// - first index: secotr id [0..2] (hard coded)
/// - second index: rx antenna [0..nb_antennas_rx[
/// - third index: sample [0..samples_per_tti[
int32_t **rxdata_7_5kHz[3];
/// \brief Holds the received data in the frequency domain.
/// - first index: sector id [0..2] (hard coded)
/// - second index: rx antenna [0..nb_antennas_rx[
/// - third index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[
int32_t **rxdataF[3];
/// \brief Holds output of the sync correlator.
/// - first index: sector id [0..2] (hard coded)
/// - second index: sample [0..samples_per_tti*10[
uint32_t *sync_corr[3];
/// \brief Holds the beamforming weights
/// - first index: eNB id [0..2] (hard coded)
/// - second index: eNB antenna port index (hard coded)
/// - third index: tx antenna [0..nb_antennas_tx[
/// - fourth index: sample [0..]
int32_t **beam_weights[3][15];
/// \brief Holds the tdd reciprocity calibration coefficients
/// - first index: eNB id [0..2] (hard coded)
/// - second index: tx antenna [0..nb_antennas_tx[
/// - third index: frequency [0..]
int32_t **tdd_calib_coeffs[3];
} NB_IoT_eNB_COMMON;
typedef struct {
/// \brief Hold the channel estimates in frequency domain based on SRS.
/// - first index: sector id [0..2] (hard coded)
/// - second index: rx antenna id [0..nb_antennas_rx[
/// - third index: ? [0..ofdm_symbol_size[
int32_t **srs_ch_estimates[3];
/// \brief Hold the channel estimates in time domain based on SRS.
/// - first index: sector id [0..2] (hard coded)
/// - second index: rx antenna id [0..nb_antennas_rx[
/// - third index: ? [0..2*ofdm_symbol_size[
int32_t **srs_ch_estimates_time[3];
/// \brief Holds the SRS for channel estimation at the RX.
/// - first index: ? [0..ofdm_symbol_size[
int32_t *srs;
} NB_IoT_eNB_SRS;
typedef struct {
/// \brief Holds the received data in the frequency domain for the allocated RBs in repeated format.
/// - first index: sector id [0..2] (hard coded)
/// - second index: rx antenna id [0..nb_antennas_rx[
/// - third index: ? [0..2*ofdm_symbol_size[
/// - third index (definition from phy_init_lte_eNB()): ? [0..24*N_RB_UL*frame_parms->symbols_per_tti[
/// \warning inconsistent third index definition
int32_t **rxdataF_ext[3];
/// \brief Holds the received data in the frequency domain for the allocated RBs in normal format.
/// - first index: sector id [0..2] (hard coded)
/// - second index: rx antenna id [0..nb_antennas_rx[
/// - third index (definition from phy_init_lte_eNB()): ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
int32_t **rxdataF_ext2[3];
/// \brief Hold the channel estimates in time domain based on DRS.
/// - first index: sector id [0..2] (hard coded)
/// - second index: rx antenna id [0..nb_antennas_rx[
/// - third index: ? [0..4*ofdm_symbol_size[
int32_t **drs_ch_estimates_time[3];
/// \brief Hold the channel estimates in frequency domain based on DRS.
/// - first index: sector id [0..2] (hard coded)
/// - second index: rx antenna id [0..nb_antennas_rx[
/// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
int32_t **drs_ch_estimates[3];
/// \brief Hold the channel estimates for UE0 in case of Distributed Alamouti Scheme.
/// - first index: sector id [0..2] (hard coded)
/// - second index: rx antenna id [0..nb_antennas_rx[
/// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
int32_t **drs_ch_estimates_0[3];
/// \brief Hold the channel estimates for UE1 in case of Distributed Almouti Scheme.
/// - first index: sector id [0..2] (hard coded)
/// - second index: rx antenna id [0..nb_antennas_rx[
/// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
int32_t **drs_ch_estimates_1[3];
/// \brief Holds the compensated signal.
/// - first index: sector id [0..2] (hard coded)
/// - second index: rx antenna id [0..nb_antennas_rx[
/// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
int32_t **rxdataF_comp[3];
/// \brief Hold the compensated data (y)*(h0*) in case of Distributed Alamouti Scheme.
/// - first index: sector id [0..2] (hard coded)
/// - second index: rx antenna id [0..nb_antennas_rx[
/// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
int32_t **rxdataF_comp_0[3];
/// \brief Hold the compensated data (y*)*(h1) in case of Distributed Alamouti Scheme.
/// - first index: sector id [0..2] (hard coded)
/// - second index: rx antenna id [0..nb_antennas_rx[
/// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
int32_t **rxdataF_comp_1[3];
/// \brief ?.
/// - first index: sector id [0..2] (hard coded)
/// - second index: rx antenna id [0..nb_antennas_rx[
/// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
int32_t **ul_ch_mag[3];
/// \brief ?.
/// - first index: eNB id [0..2] (hard coded)
/// - second index: rx antenna id [0..nb_antennas_rx[
/// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
int32_t **ul_ch_magb[3];
/// \brief Hold the channel mag for UE0 in case of Distributed Alamouti Scheme.
/// - first index: eNB id [0..2] (hard coded)
/// - second index: rx antenna id [0..nb_antennas_rx[
/// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
int32_t **ul_ch_mag_0[3];
/// \brief Hold the channel magb for UE0 in case of Distributed Alamouti Scheme.
/// - first index: eNB id [0..2] (hard coded)
/// - second index: rx antenna id [0..nb_antennas_rx[
/// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
int32_t **ul_ch_magb_0[3];
/// \brief Hold the channel mag for UE1 in case of Distributed Alamouti Scheme.
/// - first index: eNB id [0..2] (hard coded)
/// - second index: rx antenna id [0..nb_antennas_rx[
/// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
int32_t **ul_ch_mag_1[3];
/// \brief Hold the channel magb for UE1 in case of Distributed Alamouti Scheme.
/// - first index: eNB id [0..2] (hard coded)
/// - second index: rx antenna id [0..nb_antennas_rx[
/// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
int32_t **ul_ch_magb_1[3];
/// measured RX power based on DRS
int ulsch_power[2];
/// measured RX power based on DRS for UE0 in case of Distributed Alamouti Scheme
int ulsch_power_0[2];
/// measured RX power based on DRS for UE0 in case of Distributed Alamouti Scheme
int ulsch_power_1[2];
/// \brief llr values.
/// - first index: ? [0..1179743] (hard coded)
int16_t *llr;
#ifdef LOCALIZATION
/// number of active subcarrier for a specific UE
int32_t active_subcarrier;
/// subcarrier power in dBm
int32_t *subcarrier_power;
#endif
} NB_IoT_eNB_PUSCH;
#define PBCH_A_NB_IoT 24
typedef struct {
uint8_t pbch_d[96+(3*(16+PBCH_A_NB_IoT))];
uint8_t pbch_w[3*3*(16+PBCH_A_NB_IoT)];
uint8_t pbch_e[1920];
} NB_IoT_eNB_PBCH;
typedef enum { typedef enum {
/// TM1 /// TM1
SISO_NB_IoT=0, SISO_NB_IoT=0,
...@@ -291,4 +465,27 @@ typedef enum { ...@@ -291,4 +465,27 @@ typedef enum {
TM9_10_NB_IoT=14 TM9_10_NB_IoT=14
} MIMO_mode_NB_IoT_t; } MIMO_mode_NB_IoT_t;
typedef struct {
/// \brief ?.
/// first index: ? [0..1023] (hard coded)
int16_t *prachF;
/// \brief ?.
/// first index: rx antenna [0..63] (hard coded) \note Hard coded array size indexed by \c nb_antennas_rx.
/// second index: ? [0..ofdm_symbol_size*12[
int16_t *rxsigF[64];
/// \brief local buffer to compute prach_ifft (necessary in case of multiple CCs)
/// first index: rx antenna [0..63] (hard coded) \note Hard coded array size indexed by \c nb_antennas_rx.
/// second index: ? [0..2047] (hard coded)
int16_t *prach_ifft[64];
} NB_IoT_eNB_PRACH;
typedef enum {
NOT_SYNCHED_NB_IoT=0,
PRACH_NB_IoT=1,
RA_RESPONSE_NB_IoT=2,
PUSCH_NB_IoT=3,
RESYNCH_NB_IoT=4
} UE_MODE_NB_IoT_t;
#endif #endif
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
#ifndef __PHY_IMPLEMENTATION_DEFS_NB_IOT_H__ #ifndef __PHY_IMPLEMENTATION_DEFS_NB_IOT_H__
#define __PHY_IMPLEMENTATION_DEFS_NB_IOT_H__ #define __PHY_IMPLEMENTATION_DEFS_NB_IOT_H__
#include "openairinterface5g_limits.h"
/** @defgroup _ref_implementation_ OpenAirInterface LTE Implementation /** @defgroup _ref_implementation_ OpenAirInterface LTE Implementation
* @{ * @{
...@@ -381,7 +383,7 @@ typedef struct { ...@@ -381,7 +383,7 @@ typedef struct {
// short dlsch_errors; // short dlsch_errors;
} PHY_MEASUREMENTS; } PHY_MEASUREMENTS;
*/
typedef struct { typedef struct {
//unsigned int rx_power[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX]; //! estimated received signal power (linear) //unsigned int rx_power[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX]; //! estimated received signal power (linear)
//unsigned short rx_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX]; //! estimated received signal power (dB) //unsigned short rx_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX]; //! estimated received signal power (dB)
...@@ -408,33 +410,33 @@ typedef struct { ...@@ -408,33 +410,33 @@ typedef struct {
short n0_subband_power_tot_dBm[100]; short n0_subband_power_tot_dBm[100];
// eNB measurements (per user) // eNB measurements (per user)
//! estimated received spatial signal power (linear) //! estimated received spatial signal power (linear)
unsigned int rx_spatial_power[NUMBER_OF_UE_MAX][2][2]; unsigned int rx_spatial_power[NUMBER_OF_UE_MAX_NB_IoT][2][2];
//! estimated received spatial signal power (dB) //! estimated received spatial signal power (dB)
unsigned short rx_spatial_power_dB[NUMBER_OF_UE_MAX][2][2]; unsigned short rx_spatial_power_dB[NUMBER_OF_UE_MAX_NB_IoT][2][2];
//! estimated rssi (dBm) //! estimated rssi (dBm)
short rx_rssi_dBm[NUMBER_OF_UE_MAX]; short rx_rssi_dBm[NUMBER_OF_UE_MAX_NB_IoT];
//! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation) //! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation)
int rx_correlation[NUMBER_OF_UE_MAX][2]; int rx_correlation[NUMBER_OF_UE_MAX_NB_IoT][2];
//! estimated correlation (wideband dB) between spatial channels (computed in dlsch_demodulation) //! estimated correlation (wideband dB) between spatial channels (computed in dlsch_demodulation)
int rx_correlation_dB[NUMBER_OF_UE_MAX][2]; int rx_correlation_dB[NUMBER_OF_UE_MAX_NB_IoT][2];
/// Wideband CQI (= SINR) /// Wideband CQI (= SINR)
int wideband_cqi[NUMBER_OF_UE_MAX][NB_ANTENNAS_RX]; int wideband_cqi[NUMBER_OF_UE_MAX_NB_IoT][NB_ANTENNAS_RX];
/// Wideband CQI in dB (= SINR dB) /// Wideband CQI in dB (= SINR dB)
int wideband_cqi_dB[NUMBER_OF_UE_MAX][NB_ANTENNAS_RX]; int wideband_cqi_dB[NUMBER_OF_UE_MAX_NB_IoT][NB_ANTENNAS_RX];
/// Wideband CQI (sum of all RX antennas, in dB) /// Wideband CQI (sum of all RX antennas, in dB)
char wideband_cqi_tot[NUMBER_OF_UE_MAX]; char wideband_cqi_tot[NUMBER_OF_UE_MAX_NB_IoT];
/// Subband CQI per RX antenna and RB (= SINR) /// Subband CQI per RX antenna and RB (= SINR)
int subband_cqi[NUMBER_OF_UE_MAX][NB_ANTENNAS_RX][100]; int subband_cqi[NUMBER_OF_UE_MAX_NB_IoT][NB_ANTENNAS_RX][100];
/// Total Subband CQI and RB (= SINR) /// Total Subband CQI and RB (= SINR)
int subband_cqi_tot[NUMBER_OF_UE_MAX][100]; int subband_cqi_tot[NUMBER_OF_UE_MAX_NB_IoT][100];
/// Subband CQI in dB and RB (= SINR dB) /// Subband CQI in dB and RB (= SINR dB)
int subband_cqi_dB[NUMBER_OF_UE_MAX][NB_ANTENNAS_RX][100]; int subband_cqi_dB[NUMBER_OF_UE_MAX_NB_IoT][NB_ANTENNAS_RX][100];
/// Total Subband CQI and RB /// Total Subband CQI and RB
int subband_cqi_tot_dB[NUMBER_OF_UE_MAX][100]; int subband_cqi_tot_dB[NUMBER_OF_UE_MAX_NB_IoT][100];
} PHY_MEASUREMENTS_eNB;
} PHY_MEASUREMENTS_eNB_NB_IoT;
/*
#define MCS_COUNT 28 #define MCS_COUNT 28
#define MCS_TABLE_LENGTH_MAX 64 #define MCS_TABLE_LENGTH_MAX 64
*/ */
......
...@@ -214,7 +214,7 @@ void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_ ...@@ -214,7 +214,7 @@ void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_
// check for Msg3 // check for Msg3
if (eNB->mac_enabled==1) if (eNB->mac_enabled==1)
{ {
if (eNB->UE_stats[i].mode == RA_RESPONSE) if (eNB->UE_stats[i].mode == RA_RESPONSE_NB_IoT)
{ {
/*Process Msg3 TODO*/ /*Process Msg3 TODO*/
//process_Msg3(eNB,proc,i,harq_pid); //process_Msg3(eNB,proc,i,harq_pid);
...@@ -226,16 +226,16 @@ void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_ ...@@ -226,16 +226,16 @@ void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_
eNB->pusch_stats_mcs[i][(frame*10)+subframe] = -63; eNB->pusch_stats_mcs[i][(frame*10)+subframe] = -63;
/*Check if this UE is has ULSCH scheduling*/ /*Check if this UE is has ULSCH scheduling*/
if ((eNB->ulsch[i]) && if ((eNB->nulsch[i]) &&
(eNB->ulsch[i]->rnti>0) && (eNB->nulsch[i]->rnti>0) &&
(eNB->ulsch[i]->harq_processes[harq_pid]->subframe_scheduling_flag==1)) (eNB->nulsch[i]->harq_process->subframe_scheduling_flag==1))
{ {
// UE is has ULSCH scheduling // UE is has ULSCH scheduling
round = eNB->ulsch[i]->harq_processes[harq_pid]->round; round = eNB->nulsch[i]->harq_process->round;
/*NB-IoT The nb_rb always set to 1 */ /*NB-IoT The nb_rb always set to 1 */
for (int rb=0;rb<=eNB->ulsch[i]->harq_processes[harq_pid]->nb_rb;rb++) for (int rb=0;rb<=eNB->nulsch[i]->harq_process->nb_rb;rb++)
{ {
int rb2 = rb+eNB->ulsch[i]->harq_processes[harq_pid]->first_rb; int rb2 = rb+eNB->nulsch[i]->harq_process->first_rb;
eNB->rb_mask_ul[rb2>>5] |= (1<<(rb2&31)); eNB->rb_mask_ul[rb2>>5] |= (1<<(rb2&31));
} }
...@@ -246,84 +246,84 @@ void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_ ...@@ -246,84 +246,84 @@ void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_
//eNB->ulsch[i]->cyclicShift = (eNB->ulsch[i]->harq_processes[harq_pid]->n_DMRS2 + fp->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift +nPRS)%12; //eNB->ulsch[i]->cyclicShift = (eNB->ulsch[i]->harq_processes[harq_pid]->n_DMRS2 + fp->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift +nPRS)%12;
if (fp->frame_type == FDD ) if (fp->frame_type == FDD_NB_IoT )
{ {
int sf = (subframe<4) ? (subframe+6) : (subframe-4); int sf = (subframe<4) ? (subframe+6) : (subframe-4);
/*After Downlink Data transmission, simply have a notice to received ACK from PUCCH, I think it's not use for now */ /*After Downlink Data transmission, simply have a notice to received ACK from PUCCH, I think it's not use for now */
if (eNB->dlsch[i][0]->subframe_tx[sf]>0) // we have downlink transmission if (eNB->ndlsch[i]->subframe_tx[sf]>0) // we have downlink transmission
{ {
eNB->ulsch[i]->harq_processes[harq_pid]->O_ACK = 1; eNB->nulsch[i]->harq_process->O_ACK = 1;
} }
else else
{ {
eNB->ulsch[i]->harq_processes[harq_pid]->O_ACK = 0; eNB->nulsch[i]->harq_process->O_ACK = 0;
} }
} }
eNB->pusch_stats_rb[i][(frame*10)+subframe] = eNB->ulsch[i]->harq_processes[harq_pid]->nb_rb; eNB->pusch_stats_rb[i][(frame*10)+subframe] = eNB->nulsch[i]->harq_process->nb_rb;
eNB->pusch_stats_round[i][(frame*10)+subframe] = eNB->ulsch[i]->harq_processes[harq_pid]->round; eNB->pusch_stats_round[i][(frame*10)+subframe] = eNB->nulsch[i]->harq_process->round;
eNB->pusch_stats_mcs[i][(frame*10)+subframe] = eNB->ulsch[i]->harq_processes[harq_pid]->mcs; eNB->pusch_stats_mcs[i][(frame*10)+subframe] = eNB->nulsch[i]->harq_process->mcs;
rx_ulsch(eNB,proc, rx_ulsch(eNB,proc,
eNB->UE_stats[i].sector, // this is the effective sector id eNB->UE_stats[i].sector, // this is the effective sector id
i, i,
eNB->ulsch, eNB->nulsch,
0); 0);
ret = ulsch_decoding_NB_IoT(eNB,proc, ret = ulsch_decoding_NB_IoT(eNB,proc,
i, i,
0, // control_only_flag 0, // control_only_flag
eNB->ulsch[i]->harq_processes[harq_pid]->V_UL_DAI, eNB->nulsch[i]->harq_process->V_UL_DAI,
eNB->ulsch[i]->harq_processes[harq_pid]->nb_rb>20 ? 1 : 0); eNB->nulsch[i]->harq_process->nb_rb>20 ? 1 : 0);
//compute the expected ULSCH RX power (for the stats) //compute the expected ULSCH RX power (for the stats)
eNB->ulsch[(uint32_t)i]->harq_processes[harq_pid]->delta_TF = get_hundred_times_delta_IF_eNB_NB_IoT(eNB,i,harq_pid, 0); // 0 means bw_factor is not considered eNB->nulsch[(uint32_t)i]->harq_process->delta_TF = get_hundred_times_delta_IF_eNB_NB_IoT(eNB,i,harq_pid, 0); // 0 means bw_factor is not considered
eNB->UE_stats[i].ulsch_decoding_attempts[harq_pid][eNB->ulsch[i]->harq_processes[harq_pid]->round]++; eNB->UE_stats[i].nulsch_decoding_attempts[harq_pid][eNB->nulsch[i]->harq_process->round]++;
eNB->ulsch[i]->harq_processes[harq_pid]->subframe_scheduling_flag=0; eNB->nulsch[i]->harq_process->subframe_scheduling_flag=0;
if (eNB->ulsch[i]->harq_processes[harq_pid]->cqi_crc_status == 1) if (eNB->nulsch[i]->harq_process->cqi_crc_status == 1)
{ {
extract_CQI(eNB->ulsch[i]->harq_processes[harq_pid]->o, extract_CQI(eNB->nulsch[i]->harq_process->o,
eNB->ulsch[i]->harq_processes[harq_pid]->uci_format, eNB->nulsch[i]->harq_process->uci_format,
&eNB->UE_stats[i], &eNB->UE_stats[i],
fp->N_RB_DL, fp->N_RB_DL,
&rnti, &access_mode); &rnti, &access_mode);
eNB->UE_stats[i].rank = eNB->ulsch[i]->harq_processes[harq_pid]->o_RI[0]; eNB->UE_stats[i].rank = eNB->nulsch[i]->harq_process->o_RI[0];
} }
if (ret == (1+MAX_TURBO_ITERATIONS)) if (ret == (1+MAX_TURBO_ITERATIONS))
{ {
T(T_ENB_PHY_ULSCH_UE_NACK, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe), T_INT(i), T_INT(eNB->ulsch[i]->rnti), T(T_ENB_PHY_ULSCH_UE_NACK, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe), T_INT(i), T_INT(eNB->nulsch[i]->rnti),
T_INT(harq_pid)); T_INT(harq_pid));
eNB->UE_stats[i].ulsch_round_errors[harq_pid][eNB->ulsch[i]->harq_processes[harq_pid]->round]++; eNB->UE_stats[i].ulsch_round_errors[harq_pid][eNB->nulsch[i]->harq_process->round]++;
eNB->ulsch[i]->harq_processes[harq_pid]->phich_active = 1; eNB->nulsch[i]->harq_process->phich_active = 1;
eNB->ulsch[i]->harq_processes[harq_pid]->phich_ACK = 0; eNB->nulsch[i]->harq_process->phich_ACK = 0;
eNB->ulsch[i]->harq_processes[harq_pid]->round++; eNB->nulsch[i]->harq_process->round++;
LOG_D(PHY,"[eNB][PUSCH %d] Increasing to round %d\n",harq_pid,eNB->ulsch[i]->harq_processes[harq_pid]->round); LOG_D(PHY,"[eNB][PUSCH %d] Increasing to round %d\n",harq_pid,eNB->nulsch[i]->harq_process->round);
if (eNB->ulsch[i]->Msg3_flag == 1) if (eNB->nulsch[i]->Msg3_flag == 1)
{ {
/*dump_ulsch(eNB,proc,i); /*dump_ulsch(eNB,proc,i);
exit(-1);*/ exit(-1);*/
/*In NB-IoT MSG3 */ /*In NB-IoT MSG3 */
// activate retransmission for Msg3 (signalled to UE PHY by DCI // activate retransmission for Msg3 (signalled to UE PHY by DCI
eNB->ulsch[(uint32_t)i]->Msg3_active = 1; eNB->nulsch[(uint32_t)i]->Msg3_active = 1;
/* Need to check the procedure for NB-IoT (MSG3) retransmission /* Need to check the procedure for NB-IoT (MSG3) retransmission
get_Msg3_alloc_ret(fp,subframe,frame,&eNB->ulsch[i]->Msg3_frame,&eNB->ulsch[i]->Msg3_subframe); get_Msg3_alloc_ret(fp,subframe,frame,&eNB->ulsch[i]->Msg3_frame,&eNB->ulsch[i]->Msg3_subframe);
mac_xface->set_msg3_subframe(eNB->Mod_id, eNB->CC_id, frame, subframe, eNB->ulsch[i]->rnti,eNB->ulsch[i]->Msg3_frame, eNB->ulsch[i]->Msg3_subframe); mac_xface->set_msg3_subframe(eNB->Mod_id, eNB->CC_id, frame, subframe, eNB->ulsch[i]->rnti,eNB->ulsch[i]->Msg3_frame, eNB->ulsch[i]->Msg3_subframe);
*/ */
T(T_ENB_PHY_MSG3_ALLOCATION, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe), T(T_ENB_PHY_MSG3_ALLOCATION, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe),
T_INT(i), T_INT(eNB->ulsch[i]->rnti), T_INT(0 /* 0 is for retransmission*/), T_INT(i), T_INT(eNB->nulsch[i]->rnti), T_INT(0 /* 0 is for retransmission*/),
T_INT(eNB->ulsch[i]->Msg3_frame), T_INT(eNB->ulsch[i]->Msg3_subframe)); T_INT(eNB->nulsch[i]->Msg3_frame), T_INT(eNB->nulsch[i]->Msg3_subframe));
} // This is Msg3 error } // This is Msg3 error
else else
{ //normal ULSCH { //normal ULSCH
if (eNB->ulsch[i]->harq_processes[harq_pid]->round== eNB->ulsch[i]->Mlimit) if (eNB->nulsch[i]->harq_process->round== eNB->nulsch[i]->Mlimit)
{ {
eNB->ulsch[i]->harq_processes[harq_pid]->round=0; eNB->nulsch[i]->harq_process->round=0;
eNB->ulsch[i]->harq_processes[harq_pid]->phich_active=0; eNB->nulsch[i]->harq_process->phich_active=0;
eNB->UE_stats[i].ulsch_errors[harq_pid]++; eNB->UE_stats[i].ulsch_errors[harq_pid]++;
eNB->UE_stats[i].ulsch_consecutive_errors++; eNB->UE_stats[i].ulsch_consecutive_errors++;
/*if (eNB->ulsch[i]->harq_processes[harq_pid]->nb_rb > 20) { /*if (eNB->ulsch[i]->harq_processes[harq_pid]->nb_rb > 20) {
...@@ -336,7 +336,7 @@ void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_ ...@@ -336,7 +336,7 @@ void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_
//instead rx_sdu to report The Uplink data not received successfully to MAC //instead rx_sdu to report The Uplink data not received successfully to MAC
(UL_INFO->crc_ind.crc_pdu_list+i)->crc_indication_rel8.crc_flag= 1; (UL_INFO->crc_ind.crc_pdu_list+i)->crc_indication_rel8.crc_flag= 1;
UL_INFO->crc_ind.number_of_crcs++; UL_INFO->crc_ind.number_of_crcs++;
(UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.rnti= eNB->ulsch[i]->rnti; (UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.rnti= eNB->nulsch[i]->rnti;
(UL_INFO->RX_NPUSCH.rx_pdu_list+i)->data= NULL; (UL_INFO->RX_NPUSCH.rx_pdu_list+i)->data= NULL;
(UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_indication_rel8.length = 0; (UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_indication_rel8.length = 0;
(UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.harq_pid = harq_pid; (UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.harq_pid = harq_pid;
...@@ -347,7 +347,7 @@ void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_ ...@@ -347,7 +347,7 @@ void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_
} // ulsch in error } // ulsch in error
else else
{ {
T(T_ENB_PHY_ULSCH_UE_ACK, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe), T_INT(i), T_INT(eNB->ulsch[i]->rnti), T(T_ENB_PHY_ULSCH_UE_ACK, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe), T_INT(i), T_INT(eNB->nulsch[i]->rnti),
T_INT(harq_pid)); T_INT(harq_pid));
// Delete MSG3 log for the PHICH // Delete MSG3 log for the PHICH
...@@ -356,18 +356,18 @@ void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_ ...@@ -356,18 +356,18 @@ void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_
//this is the RSSI per RB //this is the RSSI per RB
eNB->UE_stats[i].UL_rssi[j] = eNB->UE_stats[i].UL_rssi[j] =
dB_fixed(eNB->pusch_vars[i]->ulsch_power[j]* dB_fixed(eNB->pusch_vars[i]->ulsch_power[j]*
(eNB->ulsch[i]->harq_processes[harq_pid]->nb_rb*12)/ (eNB->nulsch[i]->harq_process->nb_rb*12)/
fp->ofdm_symbol_size) - fp->ofdm_symbol_size) -
eNB->rx_total_gain_dB - eNB->rx_total_gain_dB -
hundred_times_log10_NPRB[eNB->ulsch[i]->harq_processes[harq_pid]->nb_rb-1]/100 - hundred_times_log10_NPRB[eNB->nulsch[i]->harq_process->nb_rb-1]/100 -
get_hundred_times_delta_IF_eNB_NB_IoT(eNB,i,harq_pid, 0)/100; get_hundred_times_delta_IF_eNB_NB_IoT(eNB,i,harq_pid, 0)/100;
//for NB-IoT PHICH not work //for NB-IoT PHICH not work
/*eNB->ulsch[i]->harq_processes[harq_pid]->phich_active = 1; /*eNB->ulsch[i]->harq_processes[harq_pid]->phich_active = 1;
eNB->ulsch[i]->harq_processes[harq_pid]->phich_ACK = 1;*/ eNB->ulsch[i]->harq_processes[harq_pid]->phich_ACK = 1;*/
eNB->ulsch[i]->harq_processes[harq_pid]->round = 0; eNB->nulsch[i]->harq_process->round = 0;
eNB->UE_stats[i].ulsch_consecutive_errors = 0; eNB->UE_stats[i].ulsch_consecutive_errors = 0;
if (eNB->ulsch[i]->Msg3_flag == 1) if (eNB->nulsch[i]->Msg3_flag == 1)
{ {
if (eNB->mac_enabled==1) if (eNB->mac_enabled==1)
{ {
...@@ -378,9 +378,9 @@ void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_ ...@@ -378,9 +378,9 @@ void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_
// store successful MSG3 in UL_Info instead rx_sdu // store successful MSG3 in UL_Info instead rx_sdu
(UL_INFO->crc_ind.crc_pdu_list+i)->crc_indication_rel8.crc_flag= 0; (UL_INFO->crc_ind.crc_pdu_list+i)->crc_indication_rel8.crc_flag= 0;
UL_INFO->crc_ind.number_of_crcs++; UL_INFO->crc_ind.number_of_crcs++;
(UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.rnti= eNB->ulsch[i]->rnti; (UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.rnti= eNB->nulsch[i]->rnti;
(UL_INFO->RX_NPUSCH.rx_pdu_list+i)->data = eNB->ulsch[i]->harq_processes[harq_pid]->b; (UL_INFO->RX_NPUSCH.rx_pdu_list+i)->data = eNB->nulsch[i]->harq_process->b;
(UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_indication_rel8.length = eNB->ulsch[i]->harq_processes[harq_pid]->TBS>>3; (UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_indication_rel8.length = eNB->nulsch[i]->harq_process->TBS>>3;
(UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.harq_pid = harq_pid; (UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.harq_pid = harq_pid;
UL_INFO->RX_NPUSCH.number_of_pdus++; UL_INFO->RX_NPUSCH.number_of_pdus++;
} }
...@@ -400,14 +400,14 @@ void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_ ...@@ -400,14 +400,14 @@ void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_
} // mac_enabled==1 } // mac_enabled==1
eNB->UE_stats[i].mode = PUSCH; eNB->UE_stats[i].mode = PUSCH;
eNB->ulsch[i]->Msg3_flag = 0; eNB->nulsch[i]->Msg3_flag = 0;
LOG_D(PHY,"[eNB %d][RAPROC] Frame %d : RX Subframe %d Setting UE %d mode to PUSCH\n",eNB->Mod_id,frame,subframe,i); LOG_D(PHY,"[eNB %d][RAPROC] Frame %d : RX Subframe %d Setting UE %d mode to PUSCH\n",eNB->Mod_id,frame,subframe,i);
/*Init HARQ parameters, need to check*/ /*Init HARQ parameters, need to check*/
for (k=0; k<8; k++) for (k=0; k<8; k++)
{ //harq_processes { //harq_processes
for (j=0; j<eNB->dlsch[i][0]->Mlimit; j++) for (j=0; j<eNB->ndlsch[i]->Mlimit; j++)
{ {
eNB->UE_stats[i].dlsch_NAK[k][j]=0; eNB->UE_stats[i].dlsch_NAK[k][j]=0;
eNB->UE_stats[i].dlsch_ACK[k][j]=0; eNB->UE_stats[i].dlsch_ACK[k][j]=0;
...@@ -418,9 +418,9 @@ void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_ ...@@ -418,9 +418,9 @@ void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_
eNB->UE_stats[i].ulsch_errors[k]=0; eNB->UE_stats[i].ulsch_errors[k]=0;
eNB->UE_stats[i].ulsch_consecutive_errors=0; eNB->UE_stats[i].ulsch_consecutive_errors=0;
for (j=0; j<eNB->ulsch[i]->Mlimit; j++) for (j=0; j<eNB->nulsch[i]->Mlimit; j++)
{ {
eNB->UE_stats[i].ulsch_decoding_attempts[k][j]=0; eNB->UE_stats[i].nulsch_decoding_attempts[k][j]=0;
eNB->UE_stats[i].ulsch_decoding_attempts_last[k][j]=0; eNB->UE_stats[i].ulsch_decoding_attempts_last[k][j]=0;
eNB->UE_stats[i].ulsch_round_errors[k][j]=0; eNB->UE_stats[i].ulsch_round_errors[k][j]=0;
eNB->UE_stats[i].ulsch_round_fer[k][j]=0; eNB->UE_stats[i].ulsch_round_fer[k][j]=0;
...@@ -438,9 +438,9 @@ void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_ ...@@ -438,9 +438,9 @@ void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_
// store successful Uplink data in UL_Info instead rx_sdu // store successful Uplink data in UL_Info instead rx_sdu
(UL_INFO->crc_ind.crc_pdu_list+i)->crc_indication_rel8.crc_flag= 0; (UL_INFO->crc_ind.crc_pdu_list+i)->crc_indication_rel8.crc_flag= 0;
UL_INFO->crc_ind.number_of_crcs++; UL_INFO->crc_ind.number_of_crcs++;
(UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.rnti= eNB->ulsch[i]->rnti; (UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.rnti= eNB->nulsch[i]->rnti;
(UL_INFO->RX_NPUSCH.rx_pdu_list+i)->data = eNB->ulsch[i]->harq_processes[harq_pid]->b; (UL_INFO->RX_NPUSCH.rx_pdu_list+i)->data = eNB->nulsch[i]->harq_process->b;
(UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_indication_rel8.length = eNB->ulsch[i]->harq_processes[harq_pid]->TBS>>3; (UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_indication_rel8.length = eNB->nulsch[i]->harq_process->TBS>>3;
(UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.harq_pid = harq_pid; (UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.harq_pid = harq_pid;
UL_INFO->RX_NPUSCH.number_of_pdus++; UL_INFO->RX_NPUSCH.number_of_pdus++;
...@@ -1016,7 +1016,7 @@ void phy_procedures_eNB_TX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, ...@@ -1016,7 +1016,7 @@ void phy_procedures_eNB_TX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
* consider that if at the start of the new SIB1-NB period the MAC will not send an NPDSCH for the SIB1-NB transmission then SIB1-NB will be not transmitted (pdu = NULL) * consider that if at the start of the new SIB1-NB period the MAC will not send an NPDSCH for the SIB1-NB transmission then SIB1-NB will be not transmitted (pdu = NULL)
* *
*/ */
if(subframe == 4 && eNB->ndlsch_SIB1 != NULL && eNB->ndlsch_SIB1->harq_process->status == ACTIVE) if(subframe == 4 && eNB->ndlsch_SIB1 != NULL && eNB->ndlsch_SIB1->harq_process->status == ACTIVE_NB_IoT)
{ {
//check if current frame is for SIB1-NB transmission (if yes get the starting frame of SIB1-NB) and set the flag for the encoding //check if current frame is for SIB1-NB transmission (if yes get the starting frame of SIB1-NB) and set the flag for the encoding
sib1_startFrame = is_SIB1_NB_IoT(frame, sib1_startFrame = is_SIB1_NB_IoT(frame,
...@@ -1070,7 +1070,7 @@ void phy_procedures_eNB_TX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, ...@@ -1070,7 +1070,7 @@ void phy_procedures_eNB_TX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
* *
*/ */
if(eNB->ndlsch_SI->harq_process->status == ACTIVE && (eNB->ndlsch_SIB1->harq_process->status != ACTIVE || subframe != 4)) //condition on SIB1-NB if(eNB->ndlsch_SI->harq_process->status == ACTIVE_NB_IoT && (eNB->ndlsch_SIB1->harq_process->status != ACTIVE_NB_IoT || subframe != 4)) //condition on SIB1-NB
{ {
if(frame%2 == 0)//condition on NSSS (subframe 9 not available) if(frame%2 == 0)//condition on NSSS (subframe 9 not available)
{ {
...@@ -1082,7 +1082,7 @@ void phy_procedures_eNB_TX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, ...@@ -1082,7 +1082,7 @@ void phy_procedures_eNB_TX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
eNB->ndlsch_SI, //since we have no DCI for system information, this is filled directly when we receive the DL_CONFIG.request message eNB->ndlsch_SI, //since we have no DCI for system information, this is filled directly when we receive the DL_CONFIG.request message
eNB->ndlsch_SI->harq_process->pdu); eNB->ndlsch_SI->harq_process->pdu);
eNB->ndlsch_SI->harq_process->status = DISABLED; eNB->ndlsch_SI->harq_process->status = DISABLED_NB_IoT;
} }
} else {//this frame not foresee the transmission of NSSS (subframe 9 is available) } else {//this frame not foresee the transmission of NSSS (subframe 9 is available)
...@@ -1094,7 +1094,7 @@ void phy_procedures_eNB_TX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, ...@@ -1094,7 +1094,7 @@ void phy_procedures_eNB_TX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
eNB->ndlsch_SI, //since we have no DCI for system information, this is filled directly when we receive the DL_CONFIG.request message eNB->ndlsch_SI, //since we have no DCI for system information, this is filled directly when we receive the DL_CONFIG.request message
eNB->ndlsch_SI->harq_process->pdu); eNB->ndlsch_SI->harq_process->pdu);
eNB->ndlsch_SI->harq_process->status = DISABLED; eNB->ndlsch_SI->harq_process->status = DISABLED_NB_IoT;
} }
} }
...@@ -1102,7 +1102,7 @@ void phy_procedures_eNB_TX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, ...@@ -1102,7 +1102,7 @@ void phy_procedures_eNB_TX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
} }
///check for RAR transmission ///check for RAR transmission
if(eNB->ndlsch_ra != NULL && eNB->ndlsch_ra->active == 1 && (eNB->ndlsch_SIB1->harq_process->status != ACTIVE || subframe != 4)) //condition on SIB1-NB if(eNB->ndlsch_ra != NULL && eNB->ndlsch_ra->active == 1 && (eNB->ndlsch_SIB1->harq_process->status != ACTIVE_NB_IoT || subframe != 4)) //condition on SIB1-NB
{ {
if(frame%2 == 0)//condition on NSSS (subframe 9 not available) if(frame%2 == 0)//condition on NSSS (subframe 9 not available)
{ {
...@@ -1158,7 +1158,7 @@ void phy_procedures_eNB_TX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, ...@@ -1158,7 +1158,7 @@ void phy_procedures_eNB_TX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
//this should give only 1 result (since only 1 ndlsch procedure is activated at once) so we brak after the transmission //this should give only 1 result (since only 1 ndlsch procedure is activated at once) so we brak after the transmission
for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX_NB_IoT; UE_id++) for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX_NB_IoT; UE_id++)
{ {
if(eNB->ndlsch[(uint8_t)UE_id] != NULL && eNB->ndlsch[(uint8_t)UE_id]->active == 1 && (eNB->ndlsch_SIB1->harq_process->status != ACTIVE || subframe != 4)) //condition on sib1-NB if(eNB->ndlsch[(uint8_t)UE_id] != NULL && eNB->ndlsch[(uint8_t)UE_id]->active == 1 && (eNB->ndlsch_SIB1->harq_process->status != ACTIVE_NB_IoT || subframe != 4)) //condition on sib1-NB
{ {
if(frame%2 == 0)//condition on NSSS (subframe 9 not available) if(frame%2 == 0)//condition on NSSS (subframe 9 not available)
{ {
......
...@@ -48,16 +48,16 @@ int16_t get_hundred_times_delta_IF_eNB_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,uint8_t U ...@@ -48,16 +48,16 @@ int16_t get_hundred_times_delta_IF_eNB_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,uint8_t U
DevAssert( UE_id < NUMBER_OF_UE_MAX_NB_IoT+1 ); DevAssert( UE_id < NUMBER_OF_UE_MAX_NB_IoT+1 );
DevAssert( harq_pid < 8 ); DevAssert( harq_pid < 8 );
Nre = eNB->ulsch[UE_id]->harq_processes[harq_pid]->Nsymb_initial * Nre = eNB->nulsch[UE_id]->harq_process->Nsymb_initial *
eNB->ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12; eNB->nulsch[UE_id]->harq_process->nb_rb*12;
sumKr = 0; sumKr = 0;
for (r=0; r<eNB->ulsch[UE_id]->harq_processes[harq_pid]->C; r++) { for (r=0; r<eNB->nulsch[UE_id]->harq_process->C; r++) {
if (r<eNB->ulsch[UE_id]->harq_processes[harq_pid]->Cminus) if (r<eNB->nulsch[UE_id]->harq_process->Cminus)
Kr = eNB->ulsch[UE_id]->harq_processes[harq_pid]->Kminus; Kr = eNB->nulsch[UE_id]->harq_process->Kminus;
else else
Kr = eNB->ulsch[UE_id]->harq_processes[harq_pid]->Kplus; Kr = eNB->nulsch[UE_id]->harq_process->Kplus;
sumKr += Kr; sumKr += Kr;
} }
...@@ -79,7 +79,7 @@ int16_t get_hundred_times_delta_IF_eNB_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,uint8_t U ...@@ -79,7 +79,7 @@ int16_t get_hundred_times_delta_IF_eNB_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,uint8_t U
if (eNB->ul_power_control_dedicated[UE_id].deltaMCS_Enabled == 1) { if (eNB->ul_power_control_dedicated[UE_id].deltaMCS_Enabled == 1) {
// This is the formula from Section 5.1.1.1 in 36.213 10*log10(deltaIF_PUSCH = (2^(MPR*Ks)-1)*beta_offset_pusch) // This is the formula from Section 5.1.1.1 in 36.213 10*log10(deltaIF_PUSCH = (2^(MPR*Ks)-1)*beta_offset_pusch)
if (bw_factor == 1) { if (bw_factor == 1) {
uint8_t nb_rb = eNB->ulsch[UE_id]->harq_processes[harq_pid]->nb_rb; uint8_t nb_rb = eNB->nulsch[UE_id]->harq_process->nb_rb;
return(hundred_times_delta_TF_NB_IoT[MPR_x100/6]+10*dB_fixed_times10((beta_offset_pusch)>>3)) + hundred_times_log10_NPRB_NB_IoT[nb_rb-1]; return(hundred_times_delta_TF_NB_IoT[MPR_x100/6]+10*dB_fixed_times10((beta_offset_pusch)>>3)) + hundred_times_log10_NPRB_NB_IoT[nb_rb-1];
} else } else
return(hundred_times_delta_TF_NB_IoT[MPR_x100/6]+10*dB_fixed_times10((beta_offset_pusch)>>3)); return(hundred_times_delta_TF_NB_IoT[MPR_x100/6]+10*dB_fixed_times10((beta_offset_pusch)>>3));
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.0 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*
platform_types.h
-------------------
AUTHOR : Lionel GAUTHIER
COMPANY : EURECOM
EMAIL : Lionel.Gauthier@eurecom.fr
***************************************************************************/
#ifndef __PLATFORM_TYPES_NB_IoT_H__
# define __PLATFORM_TYPES_NB_IoT_H__
#ifdef USER_MODE
#include <stdint.h>
#endif
#if defined(ENABLE_ITTI)
#include "itti_types.h"
#endif
//-----------------------------------------------------------------------------
// GENERIC TYPES
//-----------------------------------------------------------------------------
typedef uint16_t rnti_NB_IoT_t;
/* boolean_t is also defined in openair2/COMMON/commonDef.h,
* let's protect potential redefinition
*/
#ifndef _BOOLEAN_T_DEFINED_NB_IoT_
#define _BOOLEAN_T_DEFINED_NB_IoT_
typedef signed char boolean_NB_IoT_t;
#if !defined(TRUE)
#define TRUE (boolean_NB_IoT_t)0x01
#endif
#if !defined(FALSE)
#define FALSE (boolean_NB_IoT_t)0x00
#endif
#define BOOL_NOT(b) (b^TRUE)
#endif /* _BOOLEAN_T_DEFINED_ */
/*
//-----------------------------------------------------------------------------
// GENERIC ACCESS STRATUM TYPES
//-----------------------------------------------------------------------------
typedef int32_t sdu_size_t;
typedef uint32_t frame_t;
typedef int32_t sframe_t;
typedef uint32_t sub_frame_t;
typedef uint8_t module_id_t;
typedef uint8_t eNB_index_t;
typedef uint16_t ue_id_t;
typedef int16_t smodule_id_t;
typedef uint16_t rb_id_t;
typedef uint16_t srb_id_t;
typedef boolean_t MBMS_flag_t;
#define MBMS_FLAG_NO FALSE
#define MBMS_FLAG_YES TRUE
typedef boolean_t eNB_flag_t;
#define ENB_FLAG_NO FALSE
#define ENB_FLAG_YES TRUE
typedef boolean_t srb_flag_t;
#define SRB_FLAG_NO FALSE
#define SRB_FLAG_YES TRUE
///NB-IoT
typedef boolean_t srb1bis_flag_t;
#define SRB1BIS_FLAG_NO FALSE
#define SRB1BIS_FLAG_YES TRUE
typedef boolean_t mib_flag_t;
#define MIB_FLAG_YES TRUE
#define MIB_FLAG_NO FALSE
typedef enum link_direction_e {
UNKNOWN_DIR = 0,
DIR_UPLINK = 1,
DIR_DOWNLINK = 2
} link_direction_t;
typedef enum rb_type_e {
UNKNOWN_RADIO_BEARER = 0,
SIGNALLING_RADIO_BEARER = 1,
RADIO_ACCESS_BEARER = 2
} rb_type_t;
//-----------------------------------------------------------------------------
// PHY TYPES
//-----------------------------------------------------------------------------
typedef uint8_t crc8_t;
typedef uint16_t crc16_t;
typedef uint32_t crc32_t;
typedef unsigned int crc_t;
//-----------------------------------------------------------------------------
// MAC TYPES
//-----------------------------------------------------------------------------
typedef sdu_size_t tbs_size_t;
typedef sdu_size_t tb_size_t;
typedef unsigned int logical_chan_id_t;
typedef unsigned int num_tb_t;
typedef uint8_t mac_enb_index_t;
//-----------------------------------------------------------------------------
// RLC TYPES
//-----------------------------------------------------------------------------
typedef unsigned int mui_t;
typedef unsigned int confirm_t;
typedef unsigned int rlc_tx_status_t;
typedef int16_t rlc_sn_t;
typedef uint16_t rlc_usn_t;
typedef int32_t rlc_buffer_occupancy_t;
typedef signed int rlc_op_status_t;
#define SDU_CONFIRM_NO FALSE
#define SDU_CONFIRM_YES TRUE
//-----------------------------------------------------------------------------
// PDCP TYPES
//-----------------------------------------------------------------------------
typedef uint16_t pdcp_sn_t;
typedef uint32_t pdcp_hfn_t;
typedef int16_t pdcp_hfn_offset_t;
typedef enum pdcp_transmission_mode_e {
PDCP_TRANSMISSION_MODE_UNKNOWN = 0,
PDCP_TRANSMISSION_MODE_CONTROL = 1,
PDCP_TRANSMISSION_MODE_DATA = 2,
PDCP_TRANSMISSION_MODE_TRANSPARENT = 3
} pdcp_transmission_mode_t;
//-----------------------------------------------------------------------------
// IP DRIVER / PDCP TYPES
//-----------------------------------------------------------------------------
typedef uint16_t tcp_udp_port_t;
typedef enum ip_traffic_type_e {
TRAFFIC_IPVX_TYPE_UNKNOWN = 0,
TRAFFIC_IPV6_TYPE_UNICAST = 1,
TRAFFIC_IPV6_TYPE_MULTICAST = 2,
TRAFFIC_IPV6_TYPE_UNKNOWN = 3,
TRAFFIC_IPV4_TYPE_UNICAST = 5,
TRAFFIC_IPV4_TYPE_MULTICAST = 6,
TRAFFIC_IPV4_TYPE_BROADCAST = 7,
TRAFFIC_IPV4_TYPE_UNKNOWN = 8
} ip_traffic_type_t;
*/
//-----------------------------------------------------------------------------
// RRC TYPES
//-----------------------------------------------------------------------------
//typedef uint32_t mbms_session_id_t;
//typedef uint16_t mbms_service_id_t;
//typedef uint8_t rrc_enb_index_t;
//typedef uint8_t mme_code_t;
//typedef uint32_t m_tmsi_t;
/*
//Random UE identity length = 40 bits
#if ! defined(NOT_A_RANDOM_UE_IDENTITY)
#define NOT_A_RANDOM_UE_IDENTITY (uint64_t)0xFFFFFFFF
#endif
#if ! defined(NOT_A_RNTI)
#define NOT_A_RNTI (rnti_t)0
#endif
#if ! defined(M_RNTI)
#define M_RNTI (rnti_t)0xFFFD
#endif
#if ! defined(P_RNTI)
#define P_RNTI (rnti_t)0xFFFE
#endif
#if ! defined(SI_RNTI)
#define SI_RNTI (rnti_t)0xFFFF
#endif
typedef enum config_action_e {
CONFIG_ACTION_NULL = 0,
CONFIG_ACTION_ADD = 1,
CONFIG_ACTION_REMOVE = 2,
CONFIG_ACTION_MODIFY = 3,
CONFIG_ACTION_SET_SECURITY_MODE = 4,
CONFIG_ACTION_MBMS_ADD = 10,
CONFIG_ACTION_MBMS_MODIFY = 11
} config_action_t;
//-----------------------------------------------------------------------------
// GTPV1U TYPES
//-----------------------------------------------------------------------------
typedef uint32_t teid_t; // tunnel endpoint identifier
typedef uint8_t ebi_t; // eps bearer id
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
// may be ITTI not enabled, but type instance is useful also for OTG,
#if !defined(instance_t)
typedef uint16_t instance_t;
#endif
typedef struct protocol_ctxt_s {
module_id_t module_id; /!< \brief Virtualized module identifier /
eNB_flag_t enb_flag; /!< \brief Flag to indicate eNB (1) or UE (0) /
instance_t instance; /!< \brief ITTI or OTG module identifier /
rnti_t rnti;
frame_t frame; /!< \brief LTE frame number./
sub_frame_t subframe; /!< \brief LTE sub frame number./
eNB_index_t eNB_index; /!< \brief valid for UE indicating the index of connected eNB(s) /
boolean_t configured; /!< \brief flag indicating whether the instance is configured or not /
} protocol_ctxt_t;
// warning time hardcoded
#define PROTOCOL_CTXT_TIME_MILLI_SECONDS(CtXt_h) ((CtXt_h)->frame*10+(CtXt_h)->subframe)
#define UE_MODULE_ID_TO_INSTANCE( mODULE_iD ) mODULE_iD + NB_eNB_INST
#define ENB_MODULE_ID_TO_INSTANCE( mODULE_iD ) mODULE_iD
#define UE_INSTANCE_TO_MODULE_ID( iNSTANCE ) iNSTANCE - NB_eNB_INST
#define ENB_INSTANCE_TO_MODULE_ID( iNSTANCE )iNSTANCE
#define MODULE_ID_TO_INSTANCE(mODULE_iD, iNSTANCE, eNB_fLAG) \
if(eNB_fLAG == ENB_FLAG_YES) \
iNSTANCE = ENB_MODULE_ID_TO_INSTANCE(mODULE_iD); \
else \
iNSTANCE = UE_MODULE_ID_TO_INSTANCE(mODULE_iD)
#define INSTANCE_TO_MODULE_ID(iNSTANCE, mODULE_iD, eNB_fLAG) \
if(eNB_fLAG == ENB_FLAG_YES) \
mODULE_iD = ENB_INSTANCE_TO_MODULE_ID(iNSTANCE); \
else \
mODULE_iD = UE_INSTANCE_TO_MODULE_ID(iNSTANCE)
#define PROTOCOL_CTXT_COMPUTE_MODULE_ID(CtXt_h) \
INSTANCE_TO_MODULE_ID( (CtXt_h)->instance , (CtXt_h)->module_id , (CtXt_h)->enb_flag )
#define PROTOCOL_CTXT_COMPUTE_INSTANCE(CtXt_h) \
MODULE_ID_TO_INSTANCE( (CtXt_h)->module_id , (CtXt_h)->instance , (CtXt_h)->enb_flag )
#define PROTOCOL_CTXT_SET_BY_MODULE_ID(Ctxt_Pp, mODULE_iD, eNB_fLAG, rNTI, fRAME, sUBfRAME, eNB_iNDEX) \
(Ctxt_Pp)->module_id = mODULE_iD; \
(Ctxt_Pp)->enb_flag = eNB_fLAG; \
(Ctxt_Pp)->rnti = rNTI; \
(Ctxt_Pp)->frame = fRAME; \
(Ctxt_Pp)->subframe = sUBfRAME; \
(Ctxt_Pp)->eNB_index = eNB_iNDEX; \
PROTOCOL_CTXT_COMPUTE_INSTANCE(Ctxt_Pp)
#define PROTOCOL_CTXT_SET_BY_INSTANCE(Ctxt_Pp, iNSTANCE, eNB_fLAG, rNTI, fRAME, sUBfRAME) \
(Ctxt_Pp)->instance = iNSTANCE; \
(Ctxt_Pp)->enb_flag = eNB_fLAG; \
(Ctxt_Pp)->rnti = rNTI; \
(Ctxt_Pp)->frame = fRAME; \
(Ctxt_Pp)->subframe = sUBfRAME; \
PROTOCOL_CTXT_COMPUTE_MODULE_ID(Ctxt_Pp)
#define PROTOCOL_CTXT_FMT "[FRAME %05u][%s][MOD %02u][RNTI %" PRIx16 "]"
#define PROTOCOL_CTXT_ARGS(CTXT_Pp) \
(CTXT_Pp)->frame, \
((CTXT_Pp)->enb_flag == ENB_FLAG_YES) ? "eNB":" UE", \
(CTXT_Pp)->module_id, \
(CTXT_Pp)->rnti
#ifdef OAI_EMU
#define CHECK_CTXT_ARGS(CTXT_Pp) \
if ((CTXT_Pp)->enb_flag) {\
AssertFatal (((CTXT_Pp)->module_id >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0),\
"eNB module id is too low (%u/%d/%d)!\n",\
(CTXT_Pp)->module_id,\
oai_emulation.info.first_enb_local,\
oai_emulation.info.nb_enb_local);\
AssertFatal (((CTXT_Pp)->module_id < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.nb_enb_local > 0),\
"eNB module id is too high (%u/%d)!\n",\
(CTXT_Pp)->module_id,\
oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local);\
} else {\
AssertFatal ((CTXT_Pp)->module_id < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local),\
"UE module id is too high (%u/%d)!\n",\
(CTXT_Pp)->module_id,\
oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local);\
AssertFatal ((CTXT_Pp)->module_id >= oai_emulation.info.first_ue_local,\
"UE module id is too low (%u/%d)!\n",\
(CTXT_Pp)->module_id,\
oai_emulation.info.first_ue_local);\
}
#else
#define CHECK_CTXT_ARGS(CTXT_Pp)
#endif
*/
#endif
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