\brief This is the NB-IoT rate matching algorithm for Convolutionally-coded channels (e.g. BCH,DCI,UCI). It is taken directly from 36-212 (Rel 8 8.6, 2009-03), pages 16-18 )
\param RCC R^CC_subblock from subblock interleaver (number of rows in interleaving matrix) for up to 8 segments
\param E Number of coded channel bits
\param w This is a pointer to the w-sequence (second interleaver output)
\param e This is a pointer to the e-sequence (rate matching output, channel input/output bits)
\returns \f$E\f$, the number of coded bits per segment */
\brief This is the LTE rate matching algorithm for Convolutionally-coded channels (e.g. BCH,DCI,UCI). It is taken directly from 36-212 (Rel 8 8.6, 2009-03), pages 16-18 )
\param RCC R^CC_subblock from subblock interleaver (number of rows in interleaving matrix)
\param E This the number of coded bits allocated for channel
\param w This is a pointer to the soft w-sequence (second interleaver output) with soft-combined outputs from successive HARQ rounds
\param dummy_w This is the first row of the interleaver matrix for identifying/discarding the "LTE-NULL" positions
\param soft_input This is a pointer to the soft channel output
\returns \f$E\f$, the number of coded bits per segment
\brief This function generates a dummy interleaved sequence (first row) for receiver (convolutionally-coded data), in order to identify the NULL positions used to make the matrix complete.
\param D Number of systematic bits plus 4 (plus 4 for termination)
\param w This is the dummy sequence (first row), it will contain zeros and at most 31 "LTE_NULL" values
\returns Interleaving matrix cardinality (\f$K_{\pi}\f$ from 36-212)
\brief This is the LTE rate matching algorithm for Turbo-coded channels (e.g. DLSCH,ULSCH). It is taken directly from 36-212 (Rel 8 8.6, 2009-03), pages 16-18 )
\param RTC R^TC_subblock from subblock interleaver (number of rows in interleaving matrix)
\param G This the number of coded transport bits allocated in sub-frame
\param w This is a pointer to the soft w-sequence (second interleaver output) with soft-combined outputs from successive HARQ rounds
\param dummy_w This is the first row of the interleaver matrix for identifying/discarding the "LTE-NULL" positions
\param soft_input This is a pointer to the soft channel output
\param C Number of segments (codewords) in the sub-frame
\param Nsoft Total number of soft bits (from UE capabilities in 36-306)
\param Mdlharq Number of HARQ rounds
\param Kmimo MIMO capability for this DLSCH (0 = no MIMO)
\param rvidx round index (0-3)
\param clear 1 means clear soft buffer (start of HARQ round)
//enum for distinguish the different type of ndlsch (may in the future will be not needed)
typedefenum
{
SIB1,
SI_Message,
RAR,
UE_Data
}ndlsch_flag_t;
typedefstruct{
rnti_trnti;
//array containing the pdus of DCI
uint8_t*a[2];
//Array containing encoded DCI data
uint8_t*e[2];
//UE specific parameters
uint16_tnpdcch_NumRepetitions;
uint16_trepetition_number;
//indicate the corresponding subframe within the repetition (set to 0 when a new NPDCCH pdu is received)
uint16_trepetition_idx;
// uint16_t npdcch_Offset_USS;
// uint16_t npdcch_StartSF_USS;
}NB_IoT_eNB_NPDCCH_t;
typedefstruct{
//Number of repetitions (R) for common search space (RAR and PAGING)
uint16_tnumber_repetition_RA;
uint16_tnumber_repetition_PAg;
//index of the current subframe among the repetition (set to 0 when we receive the new NPDCCH)
uint16_trepetition_idx_RA;
uint16_trepetition_idx_Pag;
}NB_IoT_eNB_COMMON_NPDCCH_t;
typedefstruct{
/// Length of DCI in bits
uint8_tdci_length;
/// Aggregation level only 1,2 in NB-IoT
uint8_tL;
/// Position of first CCE of the dci
intfirstCCE;
/// flag to indicate that this is a RA response
boolean_tra_flag;
/// rnti
rnti_trnti;
/// Format
DCI_format_NB_IoT_tformat;
/// DCI pdu
uint8_tdci_pdu[8];
}DCI_ALLOC_NB_IoT_t;
typedefstruct{
//delete the count for the DCI numbers,NUM_DCI_MAX should set to 2
uint32_tnum_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_tnpdcch_start_symbol;
uint8_tNum_dci;
DCI_ALLOC_NB_IoT_tdci_alloc[2];
}DCI_PDU_NB_IoT;
typedefstruct{
/// 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_trnti;
/// Active flag for baseband transmitter processing
uint8_tactive;
/// Indicator of TX activation per subframe. Used during PUCCH detection for ACK/NAK.
uint8_tsubframe_tx[10];
/// First CCE of last PDSCH scheduling per subframe. Again used during PUCCH detection for ACK/NAK.
uint8_tnCCE[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_tG;
/// Maximum number of HARQ rounds
uint8_tMlimit;
/// Nsoft parameter related to UE Category
uint32_tNsoft;
/// amplitude of PDSCH (compared to RS) in symbols without pilots
int16_tsqrt_rho_a;
/// amplitude of PDSCH (compared to RS) in symbols containing pilots
int16_tsqrt_rho_b;
///NB-IoT
/// may use in the npdsch_procedures
uint16_tscrambling_sequence_intialization;
/// number of cell specific TX antenna ports assumed by the UE
uint8_tnrs_antenna_ports;
//This indicate the current subframe within the subframe interval between the NPDSCH transmission (Nsf*Nrep)
uint16_tsf_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_tnpdsch_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_tsib1_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_trelative_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_tndlsch_type;
}NB_IoT_eNB_NDLSCH_t;
typedefstruct{
/// Length of CQI data under RI=1 assumption(bits)
uint8_tOr1;
/// Rank information
uint8_to_RI[2];
/// Format of CQI data
UCI_format_NB_IoT_tuci_format;
/// The value of DAI in DCI format 0
uint8_tV_UL_DAI;
/// Pointer to CQI data
uint8_to[MAX_CQI_BYTES_NB_IoT];
/// CQI CRC status
uint8_tcqi_crc_status;
/// PHICH active flag
uint8_tphich_active;
/// PHICH ACK
uint8_tphich_ACK;
/// Length of rank information (bits)
uint8_tO_RI;
/// First Allocated RB
uint16_tfirst_rb;
/// Current Number of RBs
uint16_tnb_rb;
/// Determined the subcarrier allocation for the NPUSCH.(15, 3.75 KHz)
uint8_tsubcarrier_indication;
/// Determined the number of resource unit for the NPUSCH
uint8_tresource_assignment;
/// Determined the scheduling delay for NPUSCH
uint8_tscheduling_delay;
/// The number of the repetition number for NPUSCH Transport block
uint8_trepetition_number;
/// Determined the repetition number value 0-3
uint8_tdci_subframe_repetitions;
/// Flag indicating that this ULSCH has been allocated by a DCI (otherwise it is a retransmission based on PHICH NAK)
uint8_tdci_alloc;
/// Flag indicating that this ULSCH has been allocated by a RAR (otherwise it is a retransmission based on PHICH NAK or DCI)
uint8_trar_alloc;
/// Status Flag indicating for this ULSCH (idle,active,disabled)
\brief This function performs a subset of the bit-coding functions for LTE as described in 36-212, Release 8.Support is limited to turbo-coded channels (DLSCH/ULSCH). The implemented functions are:
- CRC computation and addition
- Code block segmentation and sub-block CRC addition
- Channel coding (Turbo coding)
- Rate matching (sub-block interleaving, bit collection, selection and transmission
- Code block concatenation
@param eNB Pointer to eNB PHY context
@param input_buffer Pointer to input buffer for sub-frame
@param frame_parms Pointer to frame descriptor structure
@param num_pdcch_symbols Number of PDCCH symbols in this subframe
@param dlsch Pointer to dlsch to be encoded
@param frame Frame number
@param subframe Subframe number
@param rm_stats Time statistics for rate-matching
@param te_stats Time statistics for turbo-encoding
@param i_stats Time statistics for interleaving
@returns status
*/
int32_tdlsch_encoding_NB_IoT(unsignedchar*a,
NB_IoT_eNB_DLSCH_t*dlsch,
uint8_tNsf,// number of subframes required for npdsch pdu transmission calculated from Isf (3GPP spec table)
unsignedintG,// G (number of available RE) is implicitly multiplied by 2 (since only QPSK modulation)
unsignedcharcooperation_flag;// for cooperative communication
unsignedcharis_secondary_eNB;// primary by default
unsignedcharis_init_sync;/// Flag to tell if initial synchronization is performed. This affects how often the secondary eNB will listen to the PSS from the primary system.
unsignedcharhas_valid_precoder;/// Flag to tell if secondary eNB has channel estimates to create NULL-beams from, and this B/F vector is created.
unsignedcharPeNB_id;/// id of Primary eNB
intrx_offset;/// Timing offset (used if is_secondary_eNB)
/// hold the precoder for NULL beam to the primary user
int**dl_precoder_SeNB[3];
///
charlog2_maxp;/// holds the maximum channel/precoder coefficient
/// if ==0 enables phy only test mode
intmac_enabled;
/// For emulation only (used by UE abstraction to retrieve DCI)
uint8_tnum_common_dci[2];// num_dci in even/odd subframes
///
uint8_tnum_ue_spec_dci[2];// num_dci in even/odd subframes
///
DCI_ALLOC_NB_IoT_tdci_alloc[2][NUM_DCI_MAX_NB_IoT];// dci_alloc from even/odd subframes
* NUMBER_OF_UE_MAX_NB_IoT maybe in the future should be dynamic because could be very large and the memory may explode
* (is almost the indication of the number of UE context that we are storing at PHY layer)
*
* reasoning: the following data structure (ndlsch, nulsch ecc..) are used to store the context that should be transmitted in at least n+4 subframe later
* (the minimum interval between NPUSCH and the ACK for this)
* the problem is that in NB_IoT the ACK for the UPLINK is contained in the DCI through the NDI field (if this value change from the previous one then it means ACK)
* but may we could schedule this DCI long time later so may lots of contents shuld be stored (there is no concept of phich channel in NB-IoT)
* For the DL transmission the UE send a proper ACK/NACK message
*
* *the HARQ process should be killed when the NDI change
*
* *In the Structure for nulsch we should also store the information related to the subframe (because each time we should read it and understand what should be done
* in that subframe)
*
*/
/*
* TIMING
* the entire transmission and scheduling are done for the "subframe" concept but the subframe = proc->subframe_tx (that in reality is the subframe_rx +4)
* (see USER/lte-enb/wakeup_rxtx )
*
* Related to FAPI:
* DCI and DL_CONFIG.request (also more that 1) and MAC_PDU are transmitted in the same subframe (our assumption) so will be all contained in the schedule_response getting from the scheduler
* DCI0 and UL_CONFIG.request are transmitted in the same subframe (our assumption) so contained in the schedule_response
*
*/
//TODO: check what should be NUMBER_OF_UE_MAX_NB_IoT value
/// \brief Indicator of current run mode of UE (normal_txrx, rx_calib_ue, no_L2_connect, debug_prach)
runmode_NB_IoT_tmode;
/// \brief Indicator that UE should perform band scanning
intUE_scan;
/// \brief Indicator that UE should perform coarse scanning around carrier
intUE_scan_carrier;
/// \brief Indicator that UE is synchronized to an eNB
intis_synchronized;
/// Data structure for UE process scheduling
UE_proc_NB_IoT_tproc;
/// Flag to indicate the UE shouldn't do timing correction at all
intno_timing_correction;
/// \brief Total gain of the TX chain (16-bit baseband I/Q to antenna)
uint32_ttx_total_gain_dB;
/// \brief Total gain of the RX chain (antenna to baseband I/Q) This is a function of rx_gain_mode (and the corresponding gain) and the rx_gain of the card.
uint32_trx_total_gain_dB;
/// \brief Total gains with maximum RF gain stage (ExpressMIMO2/Lime)
uint32_trx_gain_max[4];
/// \brief Total gains with medium RF gain stage (ExpressMIMO2/Lime)
uint32_trx_gain_med[4];
/// \brief Total gains with bypassed RF gain stage (ExpressMIMO2/Lime)
uint32_trx_gain_byp[4];
/// \brief Current transmit power
int16_ttx_power_dBm[10];
/// \brief Total number of REs in current transmission
inttx_total_RE[10];
/// \brief Maximum transmit power
int8_ttx_power_max_dBm;
/// \brief Number of eNB seen by UE
uint8_tn_connected_eNB;
/// \brief indicator that Handover procedure has been initiated
uint8_tho_initiated;
/// \brief indicator that Handover procedure has been triggered
uint8_tho_triggered;
/// \brief Measurement variables.
PHY_MEASUREMENTS_NB_IoTmeasurements;
NB_IoT_DL_FRAME_PARMSframe_parms;
/// \brief Frame parame before ho used to recover if ho fails.
NB_IoT_DL_FRAME_PARMSframe_parms_before_ho;
NB_IoT_UE_COMMONcommon_vars;
NB_IoT_UE_PDSCH*pdsch_vars[2][NUMBER_OF_CONNECTED_eNB_MAX+1];// two RxTx Threads
NB_IoT_UE_DLSCH_t*dlsch[2][NUMBER_OF_CONNECTED_eNB_MAX][2];// two RxTx Threads
/// Index of N when DCI format 3 is used. See TS 36.212 (5.3.3.1.6). \vr{[1..15]}
uint8_tindexOfFormat3;
/// Index of M when DCI format 3A is used. See TS 36.212 (5.3.3.1.7). \vr{[1..31]}
uint8_tindexOfFormat3A;
}TPC_INDEX_NB_IoT_t;
/// TPC-PDCCH-Config Information Element from 36.331 RRC spec
typedefstruct{
/// RNTI for power control using DCI format 3/3A, see TS 36.212. \vr{[0..65535]}
uint16_trnti;
/// Index of N or M, see TS 36.212 (5.3.3.1.6 and 5.3.3.1.7), where N or M is dependent on the used DCI format (i.e. format 3 or 3a).
TPC_INDEX_NB_IoT_ttpc_Index;
}TPC_PDCCH_CONFIG_NB_IoT;
/// Enumeration for parameter \f$N_\text{ANRep}\f$ \ref PUCCH_CONFIG_DEDICATED::repetitionFactor.
typedefenum{
//n2=0,
n4_n,
n6_n
}ACKNAKREP_NB_IoT_t;
/// Enumeration for \ref PUCCH_CONFIG_DEDICATED::tdd_AckNackFeedbackMode.
typedefenum{
bundling_N=0,
multiplexing_N
}ANFBmode_NB_IoT_t;
/// PUCCH-ConfigDedicated from 36.331 RRC spec
typedefstruct{
/// Flag to indicate ACK NAK repetition activation, see TS 36.213 (10.1). \vr{[0..1]}
uint8_tackNackRepetition;
/// Parameter: \f$N_\text{ANRep}\f$, see TS 36.213 (10.1).
ACKNAKREP_NB_IoT_trepetitionFactor;
/// Parameter: \f$n^{(1)}_\text{PUCCH,ANRep}\f$, see TS 36.213 (10.1). \vr{[0..2047]}
uint16_tn1PUCCH_AN_Rep;
/// Feedback mode, see TS 36.213 (7.3). \details Applied to both PUCCH and PUSCH feedback. For TDD, should always be set to bundling.
ANFBmode_NB_IoT_ttdd_AckNackFeedbackMode;
}PUCCH_CONFIG_DEDICATED_NB_IoT;
// UE specific PUSCH configuration.
typedefstruct{
/// Parameter: \f$I^\text{HARQ-ACK}_\text{offset}\f$, see TS 36.213 (Table 8.6.3-1). \vr{[0..15]}
uint16_tbetaOffset_ACK_Index;
/// Parameter: \f$I^{RI}_\text{offset}\f$, see TS 36.213 (Table 8.6.3-2). \vr{[0..15]}
uint16_tbetaOffset_RI_Index;
/// Parameter: \f$I^{CQI}_\text{offset}\f$, see TS 36.213 (Table 8.6.3-3). \vr{[0..15]}
uint16_tbetaOffset_CQI_Index;
}PUSCH_CONFIG_DEDICATED_NB_IoT;
/// Enumeration for Parameter \f$P_A\f$ \ref PDSCH_CONFIG_DEDICATED::p_a.
typedefenum{
//dBm6=0, ///< (dB-6) corresponds to -6 dB
// dBm477, ///< (dB-4dot77) corresponds to -4.77 dB
// dBm3, ///< (dB-3) corresponds to -3 dB
//dBm177, ///< (dB-1dot77) corresponds to -1.77 dB
//dB0, ///< corresponds to 0 dB
// dB1, ///< corresponds to 1 dB
dB2_NB,///< corresponds to 2 dB
dB3_NB///< corresponds to 3 dB
}PA_NB_IoT_t;
/// PDSCH-ConfigDedicated from 36.331 RRC spec
typedefstruct{
/// Parameter: \f$P_A\f$, see TS 36.213 (5.2).
PA_NB_IoT_tp_a;
}PDSCH_CONFIG_DEDICATED_NB_IoT;
/// UplinkPowerControlDedicated Information Element from 36.331 RRC spec
typedefstruct{
/// Parameter: \f$P_\text{0\_UE\_PUSCH}(1)\f$, see TS 36.213 (5.1.1.1), unit dB. \vr{[-8..7]}\n This field is applicable for non-persistent scheduling, only.
int8_tp0_UE_PUSCH;
/// Parameter: Ks, see TS 36.213 (5.1.1.1). \vr{[0..1]}\n en0 corresponds to value 0 corresponding to state “disabled”. en1 corresponds to value 1.25 corresponding to “enabled”. \note the specification sais it is an enumerated value. \warning the enumeration values do not correspond to the given values in the specification (en1 should be 1.25).
uint8_tdeltaMCS_Enabled;
/// Parameter: Accumulation-enabled, see TS 36.213 (5.1.1.1). \vr{[0..1]} 1 corresponds to "enabled" whereas 0 corresponds to "disabled".
uint8_taccumulationEnabled;
/// Parameter: \f$P_\text{0\_UE\_PUCCH}(1)\f$, see TS 36.213 (5.1.2.1), unit dB. \vr{[-8..7]}
int8_tp0_UE_PUCCH;
/// Parameter: \f$P_\text{SRS\_OFFSET}\f$, see TS 36.213 (5.1.3.1). \vr{[0..15]}\n For Ks=1.25 (\ref deltaMCS_Enabled), the actual parameter value is pSRS_Offset value - 3. For Ks=0, the actual parameter value is -10.5 + 1.5*pSRS_Offset value.
int8_tpSRS_Offset;
/// Specifies the filtering coefficient for RSRP measurements used to calculate path loss, as specified in TS 36.213 (5.1.1.1).\details The same filtering mechanism applies as for quantityConfig described in 5.5.3.2. \note the specification sais it is an enumerated value.
uint8_tfilterCoefficient;
}UL_POWER_CONTROL_DEDICATED_NB_IoT;
/// Union for \ref TPC_PDCCH_CONFIG::tpc_Index.
//typedef union {
/// Index of N when DCI format 3 is used. See TS 36.212 (5.3.3.1.6). \vr{[1..15]}
// uint8_t indexOfFormat3;
/// Index of M when DCI format 3A is used. See TS 36.212 (5.3.3.1.7). \vr{[1..31]}
/// Parameter: CQI/PMI Periodicity and Offset Configuration Index \f$I_\text{CQI/PMI}\f$, see TS 36.213 (tables 7.2.2-1A and 7.2.2-1C). \vr{[0..1023]}
int16_tcqi_PMI_ConfigIndex;
/// Parameter: K, see 36.213 (4.2.2). \vr{[1..4]}
uint8_tK;
/// Parameter: RI Config Index \f$I_\text{RI}\f$, see TS 36.213 (7.2.2-1B). \vr{[0..1023]}, -1 indicates inactivity
int16_tri_ConfigIndex;
/// Parameter: Simultaneous-AN-and-CQI, see TS 36.213 (10.1). \vr{[0..1]} 1 indicates that simultaneous transmission of ACK/NACK and CQI is allowed.
uint8_tsimultaneousAckNackAndCQI;
/// parameter computed from Tables 7.2.2-1A and 7.2.2-1C
uint16_tNpd;
/// parameter computed from Tables 7.2.2-1A and 7.2.2-1C
uint16_tN_OFFSET_CQI;
}CQI_REPORTPERIODIC_NB_IoT;
/// Enumeration for parameter reporting mode \ref CQI_REPORT_CONFIG::cqi_ReportModeAperiodic.
typedefenum{
//rm12=0,
//rm20=1,
//rm22=2,
rm30_N=3,
rm31_N=4
}CQI_REPORTMODEAPERIODIC_NB_IoT;
/// CQI-ReportConfig Information Element from 36.331 RRC spec
typedefstruct{
/// Parameter: reporting mode. Value rm12 corresponds to Mode 1-2, rm20 corresponds to Mode 2-0, rm22 corresponds to Mode 2-2 etc. PUSCH reporting modes are described in TS 36.213 [23, 7.2.1].
/// Parameter: \f$\Delta_\text{offset}\f$, see TS 36.213 (7.2.3). \vr{[-1..6]}\n Actual value = IE value * 2 [dB].
int8_tnomPDSCH_RS_EPRE_Offset;
CQI_REPORTPERIODIC_NB_IoTCQI_ReportPeriodic;
}CQI_REPORT_CONFIG_NB_IoT;
/// SoundingRS-UL-ConfigDedicated Information Element from 36.331 RRC spec
typedefstruct{
/// Parameter: \f$B_\text{SRS}\f$, see TS 36.211 (table 5.5.3.2-1, 5.5.3.2-2, 5.5.3.2-3 and 5.5.3.2-4). \vr{[0..3]} \note the specification sais it is an enumerated value.
uint8_tsrs_Bandwidth;
/// Parameter: SRS hopping bandwidth \f$b_\text{hop}\in\{0,1,2,3\}\f$, see TS 36.211 (5.5.3.2) \vr{[0..3]} \note the specification sais it is an enumerated value.
uint8_tsrs_HoppingBandwidth;
/// Parameter: \f$n_\text{RRC}\f$, see TS 36.211 (5.5.3.2). \vr{[0..23]}
uint8_tfreqDomainPosition;
/// Parameter: Duration, see TS 36.213 (8.2). \vr{[0..1]} 0 corresponds to "single" and 1 to "indefinite".
uint8_tduration;
/// Parameter: \f$k_\text{TC}\in\{0,1\}\f$, see TS 36.211 (5.5.3.2). \vr{[0..1]}
uint8_ttransmissionComb;
/// Parameter: \f$I_\text{SRS}\f$, see TS 36.213 (table 8.2-1). \vr{[0..1023]}
uint16_tsrs_ConfigIndex;
/// Parameter: \f$n^\text{CS}_\text{SRS}\f$. See TS 36.211 (5.5.3.1). \vr{[0..7]} \note the specification sais it is an enumerated value.
// Parameter: cell srs subframe for internal implementation
uint8_tsrsCellSubframe;
// Parameter: ue srs subframe for internal implementation
uint8_tsrsUeSubframe;
}SOUNDINGRS_UL_CONFIG_DEDICATED_NB_IoT;
/// Enumeration for parameter SR transmission \ref SCHEDULING_REQUEST_CONFIG::dsr_TransMax.
typedefenum{
//sr_n4=0,
// sr_n8=1,
// sr_n16=2,
sr_n32_N=3,
sr_n64_N=4
}DSR_TRANSMAX_NB_IoT_t;
/// SchedulingRequestConfig Information Element from 36.331 RRC spec
typedefstruct{
/// Parameter: \f$n^{(1)}_\text{PUCCH,SRI}\f$, see TS 36.213 (10.1). \vr{[0..2047]}
uint16_tsr_PUCCH_ResourceIndex;
/// Parameter: \f$I_\text{SR}\f$, see TS 36.213 (10.1). \vr{[0..155]}
uint8_tsr_ConfigIndex;
/// Parameter for SR transmission in TS 36.321 (5.4.4). \details The value n4 corresponds to 4 transmissions, n8 corresponds to 8 transmissions and so on.
DSR_TRANSMAX_NB_IoT_tdsr_TransMax;
}SCHEDULING_REQUEST_CONFIG_NB_IoT;
typedefstruct{
/// Downlink Power offset field
uint8_tdl_pow_off;
///Subband resource allocation field
uint8_trballoc_sub[50];
///Total number of PRBs indicator
uint8_tpre_nb_available_rbs;
}MU_MIMO_mode_NB_IoT;
////////////////////////
typedefstruct{
/// \brief Holds the received data in the frequency domain.
/// - first index: rx antenna [0..nb_antennas_rx[
/// - second index: symbol [0..28*ofdm_symbol_size[
int32_t**rxdataF;
/// \brief Hold the channel estimates in frequency domain.
/// - first index: eNB id [0..6] (hard coded)
/// - second index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - third index: samples? [0..symbols_per_tti*(ofdm_symbol_size+LTE_CE_FILTER_LENGTH)[
int32_t**dl_ch_estimates[7];
/// \brief Hold the channel estimates in time domain (used for tracking).
/// - first index: eNB id [0..6] (hard coded)
/// - second index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - third index: samples? [0..2*ofdm_symbol_size[
int32_t**dl_ch_estimates_time[7];
}NB_IoT_UE_COMMON_PER_THREAD;
typedefstruct{
/// \brief Holds the transmit data in time domain.
/// For IFFT_FPGA this points to the same memory as PHY_vars->tx_vars[a].TX_DMA_BUFFER.
/// - first index: tx antenna [0..nb_antennas_tx[
/// - second index: sample [0..FRAME_LENGTH_COMPLEX_SAMPLES[
int32_t**txdata;
/// \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: tx antenna [0..nb_antennas_tx[
/// - second index: sample [0..FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX[
int32_t**txdataF;
/// \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: rx antenna [0..nb_antennas_rx[
/// - second index: sample [0..FRAME_LENGTH_COMPLEX_SAMPLES+2048[
/// estimated frequency offset (in radians) for all subcarriers
int32_tfreq_offset;
/// eNb_id user is synched to
int32_teNb_id;
}NB_IoT_UE_COMMON;
typedefstruct{
/// \brief Received frequency-domain signal after extraction.
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..168*N_RB_DL[
int32_t**rxdataF_ext;
/// \brief Received frequency-domain ue specific pilots.
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..12*N_RB_DL[
int32_t**rxdataF_uespec_pilots;
/// \brief Received frequency-domain signal after extraction and channel compensation.
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..168*N_RB_DL[
int32_t**rxdataF_comp0;
/// \brief Received frequency-domain signal after extraction and channel compensation for the second stream. For the SIC receiver we need to store the history of this for each harq process and round
/// - first index: ? [0..7] (hard coded) accessed via \c harq_pid
/// - second index: ? [0..7] (hard coded) accessed via \c round
/// - third index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - fourth index: ? [0..168*N_RB_DL[
int32_t**rxdataF_comp1[8][8];
/// \brief Downlink channel estimates extracted in PRBS.
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..168*N_RB_DL[
int32_t**dl_ch_estimates_ext;
/// \brief Downlink cross-correlation of MIMO channel estimates (unquantized PMI) extracted in PRBS. For the SIC receiver we need to store the history of this for each harq process and round
/// - first index: ? [0..7] (hard coded) accessed via \c harq_pid
/// - second index: ? [0..7] (hard coded) accessed via \c round
/// - third index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - fourth index: ? [0..168*N_RB_DL[
int32_t**dl_ch_rho_ext[8][8];
/// \brief Downlink beamforming channel estimates in frequency domain.
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: samples? [0..symbols_per_tti*(ofdm_symbol_size+LTE_CE_FILTER_LENGTH)[
///see TS 36.213 (16.2). \vr{[-60..50]}\n Provides the downlink reference-signal EPRE. The actual value in dBm.
uint16_tnrs_Power;
}NPDSCH_CONFIG_COMMON;
typedefstruct{
/// The base sequence of DMRS sequence in a cell for 3 tones transmission; see TS 36.211 [21, 10.1.4.1.2]. If absent, it is given by NB-IoT CellID mod 12. Value 12 is not used.
uint16_tthreeTone_BaseSequence;
/// Define 3 cyclic shifts for the 3-tone case, see TS 36.211 [21, 10.1.4.1.2].
uint16_tthreeTone_CyclicShift;
/// The base sequence of DMRS sequence in a cell for 6 tones transmission; see TS 36.211 [21, 10.1.4.1.2]. If absent, it is given by NB-IoT CellID mod 14. Value 14 is not used.
uint16_tsixTone_BaseSequence;
/// Define 4 cyclic shifts for the 6-tone case, see TS 36.211 [21, 10.1.4.1.2].
uint16_tsixTone_CyclicShift;
/// The base sequence of DMRS sequence in a cell for 12 tones transmission; see TS 36.211 [21, 10.1.4.1.2]. If absent, it is given by NB-IoT CellID mod 30. Value 30 is not used.
uint16_ttwelveTone_BaseSequence;
}DMRS_CONFIG_t;
/// UL-ReferenceSignalsNPUSCH from 36.331 RRC spec
typedefstruct{
/// Parameter: Group-hopping-enabled, see TS 36.211 (5.5.1.3). \vr{[0..1]}
uint8_tgroupHoppingEnabled;
/// , see TS 36.211 (5.5.1.3). \vr{[0..29]}
uint8_tgroupAssignmentNPUSCH;
/// Parameter: cyclicShift, see TS 36.211 (Table 5.5.2.1.1-2). \vr{[0..7]}
uint8_tcyclicShift;
/// nPRS for cyclic shift of DRS \note not part of offical UL-ReferenceSignalsPUSCH ASN1 specification.
uint8_tnPRS[20];
/// group hopping sequence for DMRS, 36.211, Section 10.1.4.1.3. Second index corresponds to the four possible subcarrier configurations
uint8_tgrouphop[20][4];
/// sequence hopping sequence for DRS \note not part of offical UL-ReferenceSignalsPUSCH ASN1 specification.
uint8_tseqhop[20];
}UL_REFERENCE_SIGNALS_NPUSCH_t;
/// PUSCH-ConfigCommon from 36.331 RRC spec.
typedefstruct{
/// Number of repetitions for ACK/NACK HARQ response to NPDSCH containing Msg4 per NPRACH resource, see TS 36.213 [23, 16.4.2].
uint8_tack_NACK_NumRepetitions_Msg4[3];
/// SRS SubframeConfiguration. See TS 36.211 [21, table 5.5.3.3-1]. Value sc0 corresponds to value 0, sc1 to value 1 and so on.
uint8_tsrs_SubframeConfig;
/// Parameter: \f$N^{HO}_{RB}\f$, see TS 36.211 (5.3.4). \vr{[0..98]}
/// See TS 36.213 [23, 16.2.1.1] where al0 corresponds to 0, al04 corresponds to value 0.4, al05 to 0.5, al06 to 0.6, al07 to 0.7, al08 to 0.8, al09 to 0.9 and al1 corresponds to 1.
uint8_talpha;
/// See TS 36.213 [23, 16.2.1.1]. Actual value = IE value * 2 [dB].
uint8_tdeltaPreambleMsg3;
}UplinkPowerControlCommon_NB_IoT;
/* DL-GapConfig-NB-r13 */
typedefstruct{
uint16_tdl_GapThreshold;
uint16_tdl_GapPeriodicity;
uint16_tdl_GapDurationCoeff;
}DL_GapConfig_NB_IoT;
#define NBIOT_INBAND_LTEPCI 0
#define NBIOT_INBAND_IOTPCI 1
#define NBIOT_INGUARD 2
#define NBIOT_STANDALONE 3
typedefstruct{
/// for inband, lte bandwidth
uint8_tLTE_N_RB_DL;
uint8_tLTE_N_RB_UL;
/// Cell ID
uint16_tNid_cell;
/// shift of pilot position in one RB
uint8_tnushift;
/// indicates if node is a UE (NODE=2) or eNB (PRIMARY_CH=0).
uint8_tnode_id;
/// Frequency index of CBMIMO1 card
uint8_tfreq_idx;
/// RX Frequency for ExpressMIMO/LIME
uint32_tcarrier_freq[4];
/// TX Frequency for ExpressMIMO/LIME
uint32_tcarrier_freqtx[4];
/// RX gain for ExpressMIMO/LIME
uint32_trxgain[4];
/// TX gain for ExpressMIMO/LIME
uint32_ttxgain[4];
/// RF mode for ExpressMIMO/LIME
uint32_trfmode[4];
/// RF RX DC Calibration for ExpressMIMO/LIME
uint32_trxdc[4];
/// RF TX DC Calibration for ExpressMIMO/LIME
uint32_trflocal[4];
/// RF VCO calibration for ExpressMIMO/LIME
uint32_trfvcolocal[4];
/// Turns on second TX of CBMIMO1 card
uint8_tdual_tx;
/// flag to indicate SISO transmission
uint8_tmode1_flag;
/// Indicator that 20 MHz channel uses 3/4 sampling frequency
//uint8_t threequarter_fs;
/// Size of FFT
uint16_tofdm_symbol_size;
/// Number of prefix samples in all but first symbol of slot
uint16_tnb_prefix_samples;
/// Number of prefix samples in first symbol of slot
uint16_tnb_prefix_samples0;
/// Carrier offset in FFT buffer for first RE in PRB0
uint16_tfirst_carrier_offset;
/// Number of samples in a subframe
uint32_tsamples_per_tti;
/// Number of OFDM/SC-FDMA symbols in one subframe (to be modified to account for potential different in UL/DL)
uint16_tsymbols_per_tti;
/// Number of Physical transmit antennas in node
uint8_tnb_antennas_tx;
/// Number of Receive antennas in node
uint8_tnb_antennas_rx;
/// Number of common transmit antenna ports in eNodeB (1 or 2)
uint8_tnb_antenna_ports_eNB;
/// Number of common receiving antenna ports in eNodeB (1 or 2)
(*sib1_NB_IoT)->cellSelectionInfo_r13.q_QualMin_r13=0;//FIXME new parameter for SIB1-NB, not present in SIB1 (for cell reselection but if not used the UE should apply the default value)
schedulingInfo_NB_IoT[0].si_RepetitionPattern_r13=SchedulingInfo_NB_r13__si_RepetitionPattern_r13_every2ndRF;//This Indicates the starting radio frames within the SI window used for SI message transmission.
constNB_IoT_DL_FRAME_PARMS*constframe_parms,//to be changed but not deleted
SRB_ToAddModList_NB_r13_t**SRB_configList_NB_IoT,//in order to be configured--> stanno puntando alla SRB_configlist dell ue_context
structPhysicalConfigDedicated_NB_r13**physicalConfigDedicated_NB_IoT//in order to be configured--> stanno puntando alla physicalConfigDedicated dell ue_context
);
/**
* For which SRB is used in NB-IoT??
\brief Generate an RRCConnectionReconfiguration-NB DL-DCCH-Message (eNB). This routine configures SRBToAddMod-NB (SRB1) and one DRBToAddMod-NB
(DRB3). PhysicalConfigDedicated-NB is not updated.
@param ctxt_pP Running context
@param buffer Pointer to PER-encoded ASN.1 description of DL-CCCH-Message PDU
@param Transaction_id Transaction_ID for this message
@param SRB_list_NB Pointer to SRB List to be added/modified (NULL if no additions/modifications)
@param DRB_list_NB Pointer to DRB List to be added/modified (NULL if no additions/modifications)
@param DRB_list2_NB Pointer to DRB List to be released (NULL if none to be released)
//sps not supported by NB-IoT
@param physicalConfigDedicated_NB Pointer to PhysicalConfigDedicated-NB to be modified (NULL if no modifications)
//measurement not supported by NB-IoT
@param mac_MainConfig Pointer to Mac_MainConfig(NULL if no modifications)