Commit 807e160b authored by Michele Paffetti's avatar Michele Paffetti

adding PHY_Config structure for FAPI-like PHY configuration, still to finish...

adding PHY_Config structure for FAPI-like PHY configuration, still to finish the function call. The code compile
parent bd903cfe
......@@ -20,10 +20,10 @@
*/
#ifndef __INIT_DEFS_NB_IoT__H__
#define __INIT_DEFSJ_NB_IoT__H__
#define __INIT_DEFS_NB_IoT__H__
#include "PHY/defs.h"
#include "openair2/PHY_INTERFACE/IF_Module_nb_iot.h"
#include "SystemInformationBlockType2.h"
//#include "RadioResourceConfigCommonSIB.h"
......@@ -34,301 +34,6 @@
#if defined(Rel10) || defined(Rel14)
#include "SCellToAddMod-r10.h"
#endif
/** @addtogroup _PHY_STRUCTURES_
* @{
*/
/*!
\fn int phy_init_top(LTE_DL_FRAME_PARMS *frame_parms)
\brief Allocate and Initialize the PHY variables after receiving static configuration
@param frame_parms Pointer to LTE_DL_FRAME_PARMS (common configuration)
@returns 0 on success
*/
int phy_init_top(LTE_DL_FRAME_PARMS *frame_parms);
/*!
\brief Allocate and Initialize the PHY variables relevant to the LTE implementation.
\details Only a subset of phy_vars_ue is initialized.
@param[out] phy_vars_ue Pointer to UE Variables
@param nb_connected_eNB Number of eNB that UE can process in one PDSCH demodulation subframe
@param abstraction_flag 1 indicates memory should be allocated for abstracted MODEM
@returns 0 on success
@returns -1 if any memory allocation failed
@note The current implementation will never return -1, but segfault.
*/
int phy_init_lte_ue(PHY_VARS_UE *phy_vars_ue,
int nb_connected_eNB,
uint8_t abstraction_flag);
/*!
\brief Allocate and initialize the PHY variables relevant to the LTE implementation (eNB).
\details Only a subset of phy_vars_eNb is initialized.
@param[out] phy_vars_eNb Pointer to eNB Variables
@param is_secondary_eNb Flag to indicate this eNB gets synch from another
@param abstraction_flag 1 indicates memory should be allocated for abstracted MODEM
@returns 0 on success
@returns -1 if any memory allocation failed
@note The current implementation will never return -1, but segfault.
*/
int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNb,
unsigned char is_secondary_eNb,
unsigned char abstraction_flag);
/** \brief Configure LTE_DL_FRAME_PARMS with components derived after initial synchronization (MIB decoding + primary/secondary synch).
\details The basically allows configuration of \f$N_{\mathrm{RB}}^{\mathrm{DL}}\f$, the cell id \f$N_{\mathrm{ID}}^{\mathrm{cell}}\f$, the normal/extended prefix mode, the frame type (FDD/TDD), \f$N_{\mathrm{cp}}\f$, the number of TX antennas at eNB (\f$p\f$) and the number of PHICH groups, \f$N_{\mathrm{group}}^{\mathrm{PHICH}}\f$
@param lte_frame_parms pointer to LTE parameter structure
@param N_RB_DL Number of DL resource blocks
@param Nid_cell Cell ID
@param Ncp Normal/Extended Prefix flag
@param frame_type FDD/TDD framing
@param p_eNB Number of eNB TX antennas
@param phich_config Pointer to PHICH_CONFIG_COMMON
*/
void phy_config_mib(LTE_DL_FRAME_PARMS *lte_frame_parms,
uint8_t N_RB_DL,
uint8_t Nid_cell,
uint8_t Ncp,
uint8_t frame_type,
uint8_t p_eNB,
PHICH_CONFIG_COMMON *phich_config);
/** \brief Configure LTE_DL_FRAME_PARMS with components derived after reception of SIB1.
\details From a PHY perspective this allows configuration of TDD framing parameters and SI reception.
@param Mod_id Instance ID of eNB
@param CC_id Component Carrier index
@param tdd_Config TDD UL/DL and S-subframe configurations
@param SIwindowsize Size of a SI window in frames where repetitions of a unique System Information message block is repeated
@param SIperiod Periodicity of System Information Messages (in multiples of a frame)*/
void phy_config_sib1_eNB(module_id_t Mod_id,
int CC_id,
TDD_Config_t *tdd_Config,
uint8_t SIwindowsize,
uint16_t SIperiod);
/** \brief Configure LTE_DL_FRAME_PARMS with components derived after reception of SIB1.
\details From a PHY perspective this allows configuration of TDD framing parameters and SI reception.
@param Mod_id Instance ID of UE
@param CC_id Component Carrier index
@param CH_index Index of eNB for this configuration
@param tdd_Config TDD UL/DL and S-subframe configurations
@param SIwindowsize Size of a SI window in frames where repetitions of a unique System Information message block is repeated
@param SIperiod Periodicity of System Information Messages (in multiples of a frame)*/
void phy_config_sib1_ue(module_id_t Mod_id,
int CC_id,
uint8_t CH_index,
TDD_Config_t *tdd_Config,
uint8_t SIwindowsize,
uint16_t SIperiod);
/*!
\fn void phy_config_sib2_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t CH_index,
RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
ARFCN_ValueEUTRA_t *ul_CArrierFreq,
long *ul_Bandwidth,
AdditionalSpectrumEmission_t additionalSpectrumEmission,
struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList)
\brief Configure LTE_DL_FRAME_PARMS with components derived after reception of SIB2 (at UE).
@param Mod_id Instance id
@param CC_id
@param CH_index Index of CH to which UE is connected
@param CC_id Component Carrier Index
@param radioResourceConfigCommon Radio Configuration from SIB2
@param ul_CarrierFreq UL carrier ARFCN, null if optional (i.e. implicit from DL)
@param ul_Bandwidth UL bandwidth, null if optional (i.e. same as DL)
@param additionalSpectrumEmission UL parameter (see 36.101)
@param mbsfn_SubframeConfigList MBSFN subframe configuration
*/
void phy_config_sib2_ue(module_id_t Mod_id,
int CC_id,
uint8_t CH_index,
RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
ARFCN_ValueEUTRA_t *ul_CArrierFreq,
long *ul_Bandwidth,
AdditionalSpectrumEmission_t *additionalSpectrumEmission,
struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList);
/*!
\fn phy_config_afterHO_ue
\brief Configure Common PHY parameters from mobilityControlInfo
@param Mod_id
@param CC_id
@param eNB_index
@param mobilityControlInfo pointer to the mobility control information for handover
@param ho_failed flag to indicated whether the ho was successful or not
*/
void phy_config_afterHO_ue(module_id_t Mod_id,
uint8_t CC_id,
uint8_t eNB_index,
MobilityControlInfo_t *mobilityControlInfo,
uint8_t ho_failed);
/*!
\fn void phy_config_sib2_eNB(module_id_t Mod_id,
RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
ARFCN_ValueEUTRA_t *ul_CArrierFreq,
long *ul_Bandwidth,
AdditionalSpectrumEmission_t additionalSpectrumEmission,
struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList)
\brief Configure LTE_DL_FRAME_PARMS with components of SIB2 (at eNB).
@param Mod_id Instance id
@param Mod_id Component Carrier index
@param radioResourceConfigCommon Radio Configuration from SIB2
@param ul_CarrierFreq UL carrier ARFCN, null if optional (i.e. implicit from DL)
@param ul_Bandwidth UL bandwidth, null if optional (i.e. same as DL)
@param additionalSpectrumEmission UL parameter (see 36.101)
@param mbsfn_SubframeConfigList MBSFN subframe configuration
*/
void phy_config_sib2_eNB(module_id_t Mod_id,
int CC_id,
RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
ARFCN_ValueEUTRA_t *ul_CArrierFreq,
long *ul_Bandwidth,
AdditionalSpectrumEmission_t *additionalSpectrumEmission,
struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList);
/*!
\fn void phy_config_dedicated_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t CH_index,
struct PhysicalConfigDedicated *physicalConfigDedicated)
\brief Configure UE dedicated parameters.
\details Invoked upon reception of RRCConnectionSetup or RRCConnectionReconfiguration from eNB.
@param Mod_id Instance ID for eNB
@param CC_id Component Carrier index
@param CH_index Index of eNB for this configuration
@param physicalConfigDedicated PHY Configuration information
*/
void phy_config_dedicated_ue(module_id_t Mod_id,
int CC_id,
uint8_t CH_index,
struct PhysicalConfigDedicated *physicalConfigDedicated);
/*!
\fn void phy_config_harq_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t CH_index,
uint16_t max_harq_tx)
\brief Configure UE UL max harq Tx.
\details Invoked upon reception of RRCConnectionSetup or RRCConnectionReconfiguration from eNB.
@param Mod_id Instance ID for eNB
@param CC_id Component Carrier index
@param CH_index Index of eNB for this configuration
@param max_harq_tx max harq tx information
*/
void phy_config_harq_ue(module_id_t Mod_id,int CC_id,uint8_t CH_index,
uint16_t max_harq_tx);
/**
\brief Configure UE MBSFN common parameters.
\details Invoked upon reception of SIB13 from eNB.
@param Mod_id Instance ID for UE
@param CC_id Component Carrier Index
@param CH_index eNB id (for multiple eNB reception)
@param mbsfn_Area_idx Index of MBSFN-Area for which this command operates
@param mbsfn_AreaId_r9 MBSFN-Area Id
*/
void phy_config_sib13_ue(module_id_t Mod_id,
int CC_id,uint8_t CH_index,int mbsfn_Area_idx,
long mbsfn_AreaId_r9);
/**
\brief Configure eNB MBSFN common parameters.
\details Invoked upon transmission of SIB13 from eNB.
@param Mod_id Instance ID for eNB
@param CC_id Component Carrier index
@param mbsfn_Area_idx Index of MBSFN-Area for which this command operates
@param mbsfn_AreaId_r9 MBSFN-Area Id
*/
void phy_config_sib13_eNB(module_id_t Mod_id,
int CC_id,
int mbsfn_Area_idx,
long mbsfn_AreaId_r9);
/**
\brief Configure cba rnti for .
@param Mod_id Instance ID for eNB
@param CC_id Component Carrier Index
@param eNB_flag flag indicating whether the nodeis eNB (1) or UE (0)
@param index index of the node
@param cba_rnti rnti for the cba transmission
@param num_active_cba_groups num active cba group
*/
void phy_config_cba_rnti (module_id_t Mod_id,int CC_id,eNB_flag_t eNB_flag, uint8_t index, rnti_t cba_rnti, uint8_t cba_group_id, uint8_t num_active_cba_groups);
/** \brief Configure RRC inter-cell measurements procedures
@param Mod_id Index of UE
@param CC_id
@param eNB_index Index of corresponding eNB
@param n_adj_cells Number of adjacent cells on which to perform the measuremnts
@param adj_cell_id Array of cell ids of adjacent cells
*/
void phy_config_meas_ue(module_id_t Mod_id,
uint8_t CC_id,
uint8_t eNB_index,
uint8_t n_adj_cells,
uint32_t *adj_cell_id);
/*!
\fn void phy_config_dedicated_eNB(module_id_t Mod_id,uint16_t rnti,
struct PhysicalConfigDedicated *physicalConfigDedicated)
\brief Prepare for configuration of PHY with dedicated parameters.
\details Invoked just prior to transmission of RRCConnectionSetup or RRCConnectionReconfiguration at eNB.
@param Mod_id Instance ID for eNB
@param CC_id Component Carrier index
@param rnti rnti for UE context
@param physicalConfigDedicated PHY Configuration information
*/
void phy_config_dedicated_eNB(module_id_t Mod_id,
int CC_id,
rnti_t rnti,
struct PhysicalConfigDedicated *physicalConfigDedicated);
/*!
\fn void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *phy_vars_eNB)
\brief Configure PHY with dedicated parameters between configuration of DLSCH (n) and ULSCH (n+4) in current subframe (n).
@param phy_vars_eNB Pointer to PHY_VARS_eNB structure
*/
void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *phy_vars_eNB);
/*
\fn int phy_init_secsys_eNB(PHY_VARS_eNB *phy_vars_eNb)
\brief Allocate and Initialize the PHY variables relevant to the LTE implementation.
@param phy_vars_eNb pointer to LTE parameter structure for the eNb
*/
int phy_init_secsys_eNB(PHY_VARS_eNB *phy_vars_eNb);
void phy_init_lte_top(LTE_DL_FRAME_PARMS *lte_frame_parms);
//void copy_lte_parms_to_phy_framing(LTE_DL_FRAME_PARMS *frame_parm, PHY_FRAMING *phy_framing);
void lte_param_init(unsigned char N_tx_port_eNB,
unsigned char N_tx,
unsigned char N_rx,
unsigned char transmission_mode,
uint8_t extended_prefix_flag,
frame_t frame_type,
uint16_t Nid_cell,
uint8_t tdd_config,
uint8_t N_RB_DL,
uint8_t threequarter_fs,
uint8_t osf,
uint32_t perfect_ce);
#if defined(Rel10) || defined(Rel14)
void phy_config_dedicated_scell_ue(uint8_t Mod_id,
uint8_t eNB_index,
SCellToAddMod_r10_t *sCellToAddMod_r10,
int CC_id);
void phy_config_dedicated_scell_eNB(uint8_t Mod_id,
uint16_t rnti,
SCellToAddMod_r10_t *sCellToAddMod_r10,
int CC_id);
#endif
/*brief Configure LTE_DL_FRAME_PARMS with components derived after initial synchronization (MIB-NB decoding + primary/secondary synch).*/
void NB_phy_config_mib_eNB(int Mod_id,
......@@ -345,10 +50,15 @@ void NB_phy_config_mib_eNB(int Mod_id,
/*NB_phy_config_sib1_eNB is not needed since NB-IoT use only FDD mode*/
/*brief Configure LTE_DL_FRAME_PARMS with components of SIB2-NB (at eNB).*/
void NB_phy_config_sib2_eNB(module_id_t Mod_id,
//void NB_phy_config_sib2_eNB(module_id_t Mod_id,
// int CC_id,
// RadioResourceConfigCommonSIB_NB_r13_t *radioResourceConfigCommon
// );
void NB_phy_config_sib2_eNB(uint8_t Mod_id,
int CC_id,
RadioResourceConfigCommonSIB_NB_r13_t *radioResourceConfigCommon,
ARFCN_ValueEUTRA_r9_t *ul_CArrierFreq
nb_iot_config_t *config,
rf_config_t *rf_config
);
void NB_phy_config_dedicated_eNB(module_id_t Mod_id,
......@@ -358,28 +68,5 @@ void NB_phy_config_dedicated_eNB(module_id_t Mod_id,
/*! !\fn void phy_cleanup(void)
\brief Cleanup the PHY variables*/
void phy_cleanup(void);
int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf);
void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms);
void lte_param_init(unsigned char N_tx_port_eNB,
unsigned char N_tx_phy,
unsigned char N_rx,
unsigned char transmission_mode,
uint8_t extended_prefix_flag,
frame_t frame_type,
uint16_t Nid_cell,
uint8_t tdd_config,
uint8_t N_RB_DL,
uint8_t threequarter_fs,
uint8_t osf,
uint32_t perfect_ce);
/** @} */
#endif
......@@ -37,6 +37,7 @@
#include "defs_nb_iot.h"
#include "RadioResourceConfigCommonSIB-NB-r13.h"
#include "RadioResourceConfigDedicated-NB-r13.h"
#include "openair2/PHY_INTERFACE/IF_Module_nb_iot.h"
extern uint16_t prach_root_sequence_map0_3[838];
extern uint16_t prach_root_sequence_map4[138];
......@@ -94,109 +95,259 @@ void NB_phy_config_mib_eNB(int Mod_id,
}
//void NB_phy_config_sib2_eNB(uint8_t Mod_id,
// int CC_id,
// RadioResourceConfigCommonSIB_NB_r13_t *radioResourceConfigCommon
// )
//{
// NB_DL_FRAME_PARMS *fp = &PHY_vars_eNB_g[Mod_id][CC_id]->frame_parms;
// //LTE_eNB_UE_stats *eNB_UE_stats = PHY_vars_eNB_g[Mod_id][CC_id]->eNB_UE_stats;
// //int32_t rx_total_gain_eNB_dB = PHY_vars_eNB_g[Mod_id][CC_id]->rx_total_gain_eNB_dB;
// uint8_t MAX_NPRACH = 4;
// NPRACH_Parameters_NB_r13_t *np;
//
// LOG_D(PHY,"[eNB%d] CCid %d: Applying radioResourceConfigCommon_NB\n",Mod_id,CC_id);
//
// /*NPRACH configCommon*/
// fp->nprach_config_common.nprach_CP_Length =radioResourceConfigCommon->nprach_Config_r13.nprach_CP_Length_r13;
// //LOG_D(PHY,"nprach_config_common.nprach_CP_Length = %d\n",fp->nprach_config_common.nprach_CP_Length);
// //fp->nprach_config_common.rsrp_ThresholdsPrachInfoList.list =radioResourceConfigCommon->nprach_Config_r13.rsrp_ThresholdsPrachInfoList_r13.list;
// //LOG_D(PHY,"nprach_config_common.rsrp_ThresholdsPrachInfoList = %d\n",fp->nprach_config_common.rsrp_ThresholdsPrachInfoList);
//
// /*Loop over the configuration according to the maxNPRACH_Resources*/
// for (fp->CE=1; fp->CE <= MAX_NPRACH;fp->CE++){
// np = radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[fp->CE];
// /*fp->nprach_config_common.nprach_ParametersList.list.array[fp->CE]->maxNumPreambleAttemptCE =np->maxNumPreambleAttemptCE_r13;
// //LOG_D(PHY,"nprach_config_common.nprach_ParametersList.list.maxNumPreambleAttemptCE = %d\n",fp->nprach_config_common.nprach_ParametersList.list.maxNumPreambleAttemptCE);
// fp->nprach_config_common.nprach_ParametersList.list.array[fp->CE]->npdcch_NumRepetitions_RA =np->npdcch_NumRepetitions_RA_r13;
// //LOG_D(PHY,"nprach_config_common.nprach_ParametersList.list.npdcch_NumRepetitions_RA = %d\n",fp->nprach_config_common.nprach_ParametersList.list.npdcch_NumRepetitions_RA);
// fp->nprach_config_common.nprach_ParametersList.list.array[fp->CE]->nprach_Periodicity =np->nprach_Periodicity_r13;
// //LOG_D(PHY,"nprach_config_common.nprach_ParametersList.list.nprach_Periodicity = %d\n",fp->nprach_config_common.nprach_ParametersList.list.nprach_Periodicity);
// fp->nprach_config_common.nprach_ParametersList.list.array[fp->CE]->nprach_StartTime =np->nprach_StartTime_r13;
// //LOG_D(PHY,"nprach_config_common.nprach_ParametersList.list.nprach_StartTime = %d\n",fp->nprach_config_common.nprach_ParametersList.list.nprach_StartTime);
// fp->nprach_config_common.nprach_ParametersList.list.array[fp->CE]->nprach_SubcarrierOffset =np->nprach_SubcarrierOffset_r13;
// //LOG_D(PHY,"nprach_config_common.nprach_ParametersList.list.nprach_SubcarrierOffset = %d\n",fp->nprach_config_common.nprach_ParametersList.list.nprach_SubcarrierOffset);
// fp->nprach_config_common.nprach_ParametersList.list.array[fp->CE]->nprach_SubcarrierMSG3_RangeStart =np->nprach_SubcarrierMSG3_RangeStart_r13;
// //LOG_D(PHY,"nprach_config_common.nprach_ParametersList.list.nprach_SubcarrierMSG3_RangeStart = %d\n",fp->nprach_config_common.nprach_ParametersList.list.nprach_SubcarrierMSG3_RangeStart);
// fp->nprach_config_common.nprach_ParametersList.list.array[fp->CE]->npdcch_Offset_RA =np->npdcch_Offset_RA_r13;
// //LOG_D(PHY,"nprach_config_common.nprach_ParametersList.list.npdcch_Offset_RA = %d\n",fp->nprach_config_common.nprach_ParametersList.list.npdcch_Offset_RA);
// fp->nprach_config_common.nprach_ParametersList.list.array[fp->CE]->npdcch_StartSF_CSS_RA =np->npdcch_StartSF_CSS_RA_r13;
// //LOG_D(PHY,"nprach_config_common.nprach_ParametersList.list.npdcch_StartSF_CSS_RA = %d\n",fp->nprach_config_common.nprach_ParametersList.list.array[fp->CE]->npdcch_StartSF_CSS_RA);
// */
// }
//
// /*Should modify to compute_nprach_seq*/
// //compute_prach_seq(&fp->prach_config_common,fp->frame_type,PHY_vars_eNB_g[Mod_id][CC_id]->X_u);
//
// /*NPDSCH ConfigCommon*/
// fp->npdsch_config_common.nrs_Power = radioResourceConfigCommon->npdsch_ConfigCommon_r13.nrs_Power_r13;
//
// /*NPUSCH ConfigCommon*/
// /*A list (1-3) should be loop for ack_NACK_NumRepetitions_Msg4*/
// for (fp->CE=1; fp->CE <= MAX_NPRACH;fp->CE++){
// fp->npusch_config_common.ack_NACK_NumRepetitions_Msg4[fp->CE] = radioResourceConfigCommon->npusch_ConfigCommon_r13.ack_NACK_NumRepetitions_Msg4_r13.list.array[fp->CE];
// //LOG_D(PHY,"npusch_config_common.ack_NACK_NumRepetitions_Msg4 = %d]n",fp->npusch_config_common.ack_NACK_NumRepetitions_Msg4);
// }
// fp->npusch_config_common.srs_SubframeConfig = radioResourceConfigCommon->npusch_ConfigCommon_r13.srs_SubframeConfig_r13;
// LOG_D(PHY,"npusch_config_common.srs_SubframeConfig = %d]n",fp->npusch_config_common.srs_SubframeConfig);
// fp->npusch_config_common.dmrs_Config.threeTone_BaseSequence = radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13->threeTone_BaseSequence_r13;
// LOG_D(PHY,"npusch_config_common.dmrs_Config.threeTone_BaseSequence = %d]n",fp->npusch_config_common.dmrs_Config.threeTone_BaseSequence);
// fp->npusch_config_common.dmrs_Config.sixTone_BaseSequence = radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13->sixTone_BaseSequence_r13;
// LOG_D(PHY,"npusch_config_common.dmrs_Config.sixTone_BaseSequence = %d]n",fp->npusch_config_common.dmrs_Config.sixTone_BaseSequence);
// fp->npusch_config_common.dmrs_Config.threeTone_CyclicShift = radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13->threeTone_CyclicShift_r13;
// LOG_D(PHY,"npusch_config_common.dmrs_Config.threeTone_CyclicShift = %d]n",fp->npusch_config_common.dmrs_Config.threeTone_CyclicShift);
// fp->npusch_config_common.dmrs_Config.sixTone_CyclicShift = radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13->sixTone_CyclicShift_r13;
// LOG_D(PHY,"npusch_config_common.dmrs_Config.sixTone_CyclicShift = %d]n",fp->npusch_config_common.dmrs_Config.sixTone_CyclicShift);
// fp->npusch_config_common.dmrs_Config.twelveTone_BaseSequence = radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13->twelveTone_BaseSequence_r13;
// LOG_D(PHY,"npusch_config_common.dmrs_Config.twelveTone_BaseSequence = %d]n",fp->npusch_config_common.dmrs_Config.twelveTone_BaseSequence);
//
// fp->npusch_config_common.ul_ReferenceSignalsNPUSCH.groupAssignmentNPUSCH = radioResourceConfigCommon->npusch_ConfigCommon_r13.ul_ReferenceSignalsNPUSCH_r13.groupAssignmentNPUSCH_r13;
// LOG_D(PHY,"npusch_config_common.ul_ReferenceSignalsNPUSCH.groupAssignmentNPUSCH = %d]n",fp->npusch_config_common.ul_ReferenceSignalsNPUSCH.groupAssignmentNPUSCH);
// fp->npusch_config_common.ul_ReferenceSignalsNPUSCH.groupHoppingEnabled = radioResourceConfigCommon->npusch_ConfigCommon_r13.ul_ReferenceSignalsNPUSCH_r13.groupHoppingEnabled_r13;
// LOG_D(PHY,"npusch_config_common.ul_ReferenceSignalsNPUSCH.groupHoppingEnabled = %d]n",fp->npusch_config_common.ul_ReferenceSignalsNPUSCH.groupHoppingEnabled);
//
// /*should change the part that implement the ul hopping in NB-IoT*/
// //init_ul_hopping(fp);
//
// /*UL Power Control Config Common*/
//
// fp->ul_power_control_config_common.p0_NominalNPUSCH = radioResourceConfigCommon->uplinkPowerControlCommon_r13.p0_NominalNPUSCH_r13;
// fp->ul_power_control_config_common.alpha = radioResourceConfigCommon->uplinkPowerControlCommon_r13.alpha_r13;
// fp->ul_power_control_config_common.deltaPreambleMsg3 = radioResourceConfigCommon->uplinkPowerControlCommon_r13.deltaPreambleMsg3_r13;
//
// /*DL gap*/
//
// fp->DL_gap_config.dl_GapDurationCoeff = radioResourceConfigCommon->dl_Gap_r13->dl_GapDurationCoeff_r13;
// fp->DL_gap_config.dl_GapPeriodicity = radioResourceConfigCommon->dl_Gap_r13->dl_GapPeriodicity_r13;
// fp->DL_gap_config.dl_GapThreshold = radioResourceConfigCommon->dl_Gap_r13->dl_GapThreshold_r13;
//
// /*PUCCH stuff in LTE*/
// //init_ncs_cell(fp,PHY_vars_eNB_g[Mod_id][CC_id]->ncs_cell);
//
// //init_ul_hopping(fp);
//
//
//
//}
void NB_phy_config_sib2_eNB(uint8_t Mod_id,
int CC_id,
RadioResourceConfigCommonSIB_NB_r13_t *radioResourceConfigCommon,
ARFCN_ValueEUTRA_r9_t *ul_CArrierFreq
nb_iot_config_t *config,
rf_config_t *rf_config
)
{
NB_DL_FRAME_PARMS *fp = &PHY_vars_eNB_g[Mod_id][CC_id]->frame_parms;
//LTE_eNB_UE_stats *eNB_UE_stats = PHY_vars_eNB_g[Mod_id][CC_id]->eNB_UE_stats;
//int32_t rx_total_gain_eNB_dB = PHY_vars_eNB_g[Mod_id][CC_id]->rx_total_gain_eNB_dB;
uint8_t MAX_NPRACH = 4;
NPRACH_Parameters_NB_r13_t *np;
LOG_D(PHY,"[eNB%d] CCid %d: Applying radioResourceConfigCommon_NB\n",Mod_id,CC_id);
/*NPRACH configCommon*/
fp->nprach_config_common.nprach_CP_Length =radioResourceConfigCommon->nprach_Config_r13.nprach_CP_Length_r13;
//LOG_D(PHY,"nprach_config_common.nprach_CP_Length = %d\n",fp->nprach_config_common.nprach_CP_Length);
//fp->nprach_config_common.rsrp_ThresholdsPrachInfoList.list =radioResourceConfigCommon->nprach_Config_r13.rsrp_ThresholdsPrachInfoList_r13.list;
//LOG_D(PHY,"nprach_config_common.rsrp_ThresholdsPrachInfoList = %d\n",fp->nprach_config_common.rsrp_ThresholdsPrachInfoList);
/*Loop over the configuration according to the maxNPRACH_Resources*/
for (fp->CE=1; fp->CE <= MAX_NPRACH;fp->CE++){
np = radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[fp->CE];
/*fp->nprach_config_common.nprach_ParametersList.list.array[fp->CE]->maxNumPreambleAttemptCE =np->maxNumPreambleAttemptCE_r13;
//LOG_D(PHY,"nprach_config_common.nprach_ParametersList.list.maxNumPreambleAttemptCE = %d\n",fp->nprach_config_common.nprach_ParametersList.list.maxNumPreambleAttemptCE);
fp->nprach_config_common.nprach_ParametersList.list.array[fp->CE]->npdcch_NumRepetitions_RA =np->npdcch_NumRepetitions_RA_r13;
//LOG_D(PHY,"nprach_config_common.nprach_ParametersList.list.npdcch_NumRepetitions_RA = %d\n",fp->nprach_config_common.nprach_ParametersList.list.npdcch_NumRepetitions_RA);
fp->nprach_config_common.nprach_ParametersList.list.array[fp->CE]->nprach_Periodicity =np->nprach_Periodicity_r13;
//LOG_D(PHY,"nprach_config_common.nprach_ParametersList.list.nprach_Periodicity = %d\n",fp->nprach_config_common.nprach_ParametersList.list.nprach_Periodicity);
fp->nprach_config_common.nprach_ParametersList.list.array[fp->CE]->nprach_StartTime =np->nprach_StartTime_r13;
//LOG_D(PHY,"nprach_config_common.nprach_ParametersList.list.nprach_StartTime = %d\n",fp->nprach_config_common.nprach_ParametersList.list.nprach_StartTime);
fp->nprach_config_common.nprach_ParametersList.list.array[fp->CE]->nprach_SubcarrierOffset =np->nprach_SubcarrierOffset_r13;
//LOG_D(PHY,"nprach_config_common.nprach_ParametersList.list.nprach_SubcarrierOffset = %d\n",fp->nprach_config_common.nprach_ParametersList.list.nprach_SubcarrierOffset);
fp->nprach_config_common.nprach_ParametersList.list.array[fp->CE]->nprach_SubcarrierMSG3_RangeStart =np->nprach_SubcarrierMSG3_RangeStart_r13;
//LOG_D(PHY,"nprach_config_common.nprach_ParametersList.list.nprach_SubcarrierMSG3_RangeStart = %d\n",fp->nprach_config_common.nprach_ParametersList.list.nprach_SubcarrierMSG3_RangeStart);
fp->nprach_config_common.nprach_ParametersList.list.array[fp->CE]->npdcch_Offset_RA =np->npdcch_Offset_RA_r13;
//LOG_D(PHY,"nprach_config_common.nprach_ParametersList.list.npdcch_Offset_RA = %d\n",fp->nprach_config_common.nprach_ParametersList.list.npdcch_Offset_RA);
fp->nprach_config_common.nprach_ParametersList.list.array[fp->CE]->npdcch_StartSF_CSS_RA =np->npdcch_StartSF_CSS_RA_r13;
//LOG_D(PHY,"nprach_config_common.nprach_ParametersList.list.npdcch_StartSF_CSS_RA = %d\n",fp->nprach_config_common.nprach_ParametersList.list.array[fp->CE]->npdcch_StartSF_CSS_RA);
*/
LOG_D(PHY,"[eNB%d] CCid %d: Applying nb_iot_config from sib2_NB\n",Mod_id,CC_id);
/*NPRACH_ConfigSIB_NB_r13----------------------------------------------------------*/
//NPRACH_ConfigSIB_NB_r13_t a;
//MP: FAPI style approach: instead of a list they consider the 3 possible configuration separately
if(config->nprach_config_0_enabled == 1){
LOG_D(PHY, "NPRACH Config #0 enabled\n");
fp->nprach_config_common.nprach_CP_Length = config->nprach_config_0_cp_length; //NPRACH_ConfigSIB_NB_r13__nprach_CP_Length_r13_us66dot7
LOG_D(PHY," config#0: nprach_CP_Length = %d\n",fp->nprach_config_common.nprach_CP_Length);
//FIXME: MP: memory for the list should be allocated? initialization??
fp->nprach_config_common.nprach_ParametersList.list.array[0]->nprach_Periodicity = config->nprach_config_0_sf_periodicity;
LOG_D(PHY,"config#0: nprach_Periodicity = %d\n", fp->nprach_config_common.nprach_ParametersList.list.array[0]->nprach_Periodicity);
fp->nprach_config_common.nprach_ParametersList.list.array[0]->nprach_StartTime = config->nprach_config_0_start_time;
LOG_D(PHY,"config#0: nprach_StartTime = %d\n",fp->nprach_config_common.nprach_ParametersList.list.array[0]->nprach_StartTime);
fp->nprach_config_common.nprach_ParametersList.list.array[0]->nprach_SubcarrierOffset = config->nprach_config_0_subcarrier_offset;
LOG_D(PHY,"config#0: nprach_SubcarrierOffset= %d\n", fp->nprach_config_common.nprach_ParametersList.list.array[0]->nprach_SubcarrierOffset);
fp->nprach_config_common.nprach_ParametersList.list.array[0]->nprach_NumSubcarriers = config->nprach_config_0_number_of_subcarriers;
LOG_D(PHY,"config#0: nprach_NumSubcarriers= %d\n",fp->nprach_config_common.nprach_ParametersList.list.array[0]->nprach_NumSubcarriers);
fp->nprach_config_common.nprach_ParametersList.list.array[0]->numRepetitionsPerPreambleAttempt = config->nprach_config_0_number_of_repetitions_per_attempts;
LOG_D(PHY,"config#0: numRepetitionsPerPreambleAttempt= %d\n",fp->nprach_config_common.nprach_ParametersList.list.array[0]->numRepetitionsPerPreambleAttempt);
///FIXME: missed configuration in FAPI config_request (TS 36.331 pag 610)
// fp->nprach_config_common.rsrp_ThresholdsPrachInfoList.list /*OPTIONAL*/
// fp->nprach_config_common.nprach_ParametersList.list.array[0]->nprach_SubcarrierMSG3_RangeStart
// fp->nprach_config_common.nprach_ParametersList.list.array[0]->npdcch_StartSF_CSS_RA
// fp->nprach_config_common.nprach_ParametersList.list.array[0]->npdcch_NumRepetitions_RA
// fp->nprach_config_common.nprach_ParametersList.list.array[0]->npdcch_Offset_RA
}
/*Should modify to compute_nprach_seq*/
//compute_prach_seq(&fp->prach_config_common,fp->frame_type,PHY_vars_eNB_g[Mod_id][CC_id]->X_u);
if(config->nprach_config_1_enabled == 1){
LOG_D(PHY, "NPRACH Config #1 enabled\n");
fp->nprach_config_common.nprach_CP_Length = config->nprach_config_1_cp_length; //NPRACH_ConfigSIB_NB_r13__nprach_CP_Length_r13_us66dot7
LOG_D(PHY," config#1: nprach_CP_Length = %d\n",fp->nprach_config_common.nprach_CP_Length);
//FIXME: MP: memory for the list should be allocated? initialization??
fp->nprach_config_common.nprach_ParametersList.list.array[1]->nprach_Periodicity = config->nprach_config_1_sf_periodicity;
LOG_D(PHY,"config#1: nprach_Periodicity = %d\n", fp->nprach_config_common.nprach_ParametersList.list.array[1]->nprach_Periodicity);
fp->nprach_config_common.nprach_ParametersList.list.array[1]->nprach_StartTime = config->nprach_config_1_start_time;
LOG_D(PHY,"config#1: nprach_StartTime = %d\n",fp->nprach_config_common.nprach_ParametersList.list.array[1]->nprach_StartTime);
fp->nprach_config_common.nprach_ParametersList.list.array[1]->nprach_SubcarrierOffset = config->nprach_config_1_subcarrier_offset;
LOG_D(PHY,"config#1: nprach_SubcarrierOffset= %d\n", fp->nprach_config_common.nprach_ParametersList.list.array[1]->nprach_SubcarrierOffset);
fp->nprach_config_common.nprach_ParametersList.list.array[1]->nprach_NumSubcarriers = config->nprach_config_1_number_of_subcarriers;
LOG_D(PHY,"config#1: nprach_NumSubcarriers= %d\n",fp->nprach_config_common.nprach_ParametersList.list.array[1]->nprach_NumSubcarriers);
fp->nprach_config_common.nprach_ParametersList.list.array[1]->numRepetitionsPerPreambleAttempt = config->nprach_config_1_number_of_repetitions_per_attempts;
LOG_D(PHY,"config#1: numRepetitionsPerPreambleAttempt= %d\n",fp->nprach_config_common.nprach_ParametersList.list.array[1]->numRepetitionsPerPreambleAttempt);
///FIXME: missed configuration in FAPI config_request (TS 36.331 pag 610)
// fp->nprach_config_common.rsrp_ThresholdsPrachInfoList.list /*OPTIONAL*/
// fp->nprach_config_common.nprach_ParametersList.list.array[1]->nprach_SubcarrierMSG3_RangeStart
// fp->nprach_config_common.nprach_ParametersList.list.array[1]->npdcch_StartSF_CSS_RA
// fp->nprach_config_common.nprach_ParametersList.list.array[1]->npdcch_NumRepetitions_RA
// fp->nprach_config_common.nprach_ParametersList.list.array[1]->npdcch_Offset_RA
}
/*NPDSCH ConfigCommon*/
fp->npdsch_config_common.nrs_Power = radioResourceConfigCommon->npdsch_ConfigCommon_r13.nrs_Power_r13;
if(config->nprach_config_2_enabled == 1){
LOG_D(PHY, "NPRACH Config #2 enabled\n");
fp->nprach_config_common.nprach_CP_Length = config->nprach_config_2_cp_length; //NPRACH_ConfigSIB_NB_r13__nprach_CP_Length_r13_us66dot7
LOG_D(PHY," config#2: nprach_CP_Length = %d\n",fp->nprach_config_common.nprach_CP_Length);
//FIXME: MP: memory for the list should be allocated? initialization??
fp->nprach_config_common.nprach_ParametersList.list.array[2]->nprach_Periodicity = config->nprach_config_2_sf_periodicity;
LOG_D(PHY,"config#2: nprach_Periodicity = %d\n", fp->nprach_config_common.nprach_ParametersList.list.array[2]->nprach_Periodicity);
fp->nprach_config_common.nprach_ParametersList.list.array[2]->nprach_StartTime = config->nprach_config_2_start_time;
LOG_D(PHY,"config#2: nprach_StartTime = %d\n",fp->nprach_config_common.nprach_ParametersList.list.array[2]->nprach_StartTime);
fp->nprach_config_common.nprach_ParametersList.list.array[2]->nprach_SubcarrierOffset = config->nprach_config_2_subcarrier_offset;
LOG_D(PHY,"config#2: nprach_SubcarrierOffset= %d\n", fp->nprach_config_common.nprach_ParametersList.list.array[2]->nprach_SubcarrierOffset);
fp->nprach_config_common.nprach_ParametersList.list.array[2]->nprach_NumSubcarriers = config->nprach_config_2_number_of_subcarriers;
LOG_D(PHY,"config#2: nprach_NumSubcarriers= %d\n",fp->nprach_config_common.nprach_ParametersList.list.array[2]->nprach_NumSubcarriers);
fp->nprach_config_common.nprach_ParametersList.list.array[2]->numRepetitionsPerPreambleAttempt = config->nprach_config_2_number_of_repetitions_per_attempts;
LOG_D(PHY,"config#2: numRepetitionsPerPreambleAttempt= %d\n",fp->nprach_config_common.nprach_ParametersList.list.array[2]->numRepetitionsPerPreambleAttempt);
///FIXME: missed configuration in FAPI config_request (TS 36.331 pag 610)
// fp->nprach_config_common.rsrp_ThresholdsPrachInfoList.list /*OPTIONAL*/
// fp->nprach_config_common.nprach_ParametersList.list.array[2]->nprach_SubcarrierMSG3_RangeStart
// fp->nprach_config_common.nprach_ParametersList.list.array[2]->npdcch_StartSF_CSS_RA
// fp->nprach_config_common.nprach_ParametersList.list.array[2]->npdcch_NumRepetitions_RA
// fp->nprach_config_common.nprach_ParametersList.list.array[2]->npdcch_Offset_RA
/*NPUSCH ConfigCommon*/
/*A list (1-3) should be loop for ack_NACK_NumRepetitions_Msg4*/
for (fp->CE=1; fp->CE <= MAX_NPRACH;fp->CE++){
fp->npusch_config_common.ack_NACK_NumRepetitions_Msg4[fp->CE] = radioResourceConfigCommon->npusch_ConfigCommon_r13.ack_NACK_NumRepetitions_Msg4_r13.list.array[fp->CE];
//LOG_D(PHY,"npusch_config_common.ack_NACK_NumRepetitions_Msg4 = %d]n",fp->npusch_config_common.ack_NACK_NumRepetitions_Msg4);
}
fp->npusch_config_common.srs_SubframeConfig = radioResourceConfigCommon->npusch_ConfigCommon_r13.srs_SubframeConfig_r13;
LOG_D(PHY,"npusch_config_common.srs_SubframeConfig = %d]n",fp->npusch_config_common.srs_SubframeConfig);
fp->npusch_config_common.dmrs_Config.threeTone_BaseSequence = radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13->threeTone_BaseSequence_r13;
LOG_D(PHY,"npusch_config_common.dmrs_Config.threeTone_BaseSequence = %d]n",fp->npusch_config_common.dmrs_Config.threeTone_BaseSequence);
fp->npusch_config_common.dmrs_Config.sixTone_BaseSequence = radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13->sixTone_BaseSequence_r13;
LOG_D(PHY,"npusch_config_common.dmrs_Config.sixTone_BaseSequence = %d]n",fp->npusch_config_common.dmrs_Config.sixTone_BaseSequence);
fp->npusch_config_common.dmrs_Config.threeTone_CyclicShift = radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13->threeTone_CyclicShift_r13;
LOG_D(PHY,"npusch_config_common.dmrs_Config.threeTone_CyclicShift = %d]n",fp->npusch_config_common.dmrs_Config.threeTone_CyclicShift);
fp->npusch_config_common.dmrs_Config.sixTone_CyclicShift = radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13->sixTone_CyclicShift_r13;
LOG_D(PHY,"npusch_config_common.dmrs_Config.sixTone_CyclicShift = %d]n",fp->npusch_config_common.dmrs_Config.sixTone_CyclicShift);
fp->npusch_config_common.dmrs_Config.twelveTone_BaseSequence = radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13->twelveTone_BaseSequence_r13;
LOG_D(PHY,"npusch_config_common.dmrs_Config.twelveTone_BaseSequence = %d]n",fp->npusch_config_common.dmrs_Config.twelveTone_BaseSequence);
fp->npusch_config_common.ul_ReferenceSignalsNPUSCH.groupAssignmentNPUSCH = radioResourceConfigCommon->npusch_ConfigCommon_r13.ul_ReferenceSignalsNPUSCH_r13.groupAssignmentNPUSCH_r13;
LOG_D(PHY,"npusch_config_common.ul_ReferenceSignalsNPUSCH.groupAssignmentNPUSCH = %d]n",fp->npusch_config_common.ul_ReferenceSignalsNPUSCH.groupAssignmentNPUSCH);
fp->npusch_config_common.ul_ReferenceSignalsNPUSCH.groupHoppingEnabled = radioResourceConfigCommon->npusch_ConfigCommon_r13.ul_ReferenceSignalsNPUSCH_r13.groupHoppingEnabled_r13;
LOG_D(PHY,"npusch_config_common.ul_ReferenceSignalsNPUSCH.groupHoppingEnabled = %d]n",fp->npusch_config_common.ul_ReferenceSignalsNPUSCH.groupHoppingEnabled);
/*should change the part that implement the ul hopping in NB-IoT*/
//init_ul_hopping(fp);
/*UL Power Control Config Common*/
//TODO: Should modify to compute_nprach_seq --> nprach.
//compute_prach_seq(&fp->prach_config_common,fp->frame_type,PHY_vars_eNB_g[Mod_id][CC_id]->X_u);
fp->ul_power_control_config_common.p0_NominalNPUSCH = radioResourceConfigCommon->uplinkPowerControlCommon_r13.p0_NominalNPUSCH_r13;
fp->ul_power_control_config_common.alpha = radioResourceConfigCommon->uplinkPowerControlCommon_r13.alpha_r13;
fp->ul_power_control_config_common.deltaPreambleMsg3 = radioResourceConfigCommon->uplinkPowerControlCommon_r13.deltaPreambleMsg3_r13;
/*DL gap*/
/*NPDSCH ConfigCommon-------------------------------------------------------------------*/
//NPDSCH_ConfigCommon_NB_r13_t b;
fp->DL_gap_config.dl_GapDurationCoeff = radioResourceConfigCommon->dl_Gap_r13->dl_GapDurationCoeff_r13;
fp->DL_gap_config.dl_GapPeriodicity = radioResourceConfigCommon->dl_Gap_r13->dl_GapPeriodicity_r13;
fp->DL_gap_config.dl_GapThreshold = radioResourceConfigCommon->dl_Gap_r13->dl_GapThreshold_r13;
//FIXME: the FAPI specs pag 140 fix a range of value (0->255) but i don't find any similar correspondence in the 3GPP specs (TS 36.331 pag 608 and TS 36.213 ch 16.2.2)
fp->npdsch_config_common.nrs_Power = rf_config->reference_signal_power;
/*PUCCH stuff in LTE*/
//init_ncs_cell(fp,PHY_vars_eNB_g[Mod_id][CC_id]->ncs_cell);
/*NPUSCH ConfigCommon-------------------------------------------------------------------*/
//NPUSCH_ConfigCommon_NB_r13_t c;
fp->npusch_config_common.dmrs_Config.threeTone_BaseSequence = config->three_tone_base_sequence;
LOG_D(PHY,"npusch_config_common.dmrs_Config.threeTone_BaseSequence = %d\n",fp->npusch_config_common.dmrs_Config.threeTone_BaseSequence);
fp->npusch_config_common.dmrs_Config.sixTone_BaseSequence = config->six_tone_base_sequence;
LOG_D(PHY,"npusch_config_common.dmrs_Config.sixTone_BaseSequence = %d\n",fp->npusch_config_common.dmrs_Config.sixTone_BaseSequence);
fp->npusch_config_common.dmrs_Config.threeTone_CyclicShift = config->three_tone_cyclic_shift;
LOG_D(PHY,"npusch_config_common.dmrs_Config.threeTone_CyclicShift = %d\n",fp->npusch_config_common.dmrs_Config.threeTone_CyclicShift);
fp->npusch_config_common.dmrs_Config.sixTone_CyclicShift = config->six_tone_cyclic_shift;
LOG_D(PHY,"npusch_config_common.dmrs_Config.sixTone_CyclicShift = %d\n",fp->npusch_config_common.dmrs_Config.sixTone_CyclicShift);
fp->npusch_config_common.dmrs_Config.twelveTone_BaseSequence= config->twelve_tone_base_sequence;
LOG_D(PHY,"npusch_config_common.dmrs_Config.twelveTone_BaseSequence = %d\n",fp->npusch_config_common.dmrs_Config.twelveTone_BaseSequence);
//MP: FAPI missed parameters
// fp->npusch_config_common.ack_NACK_NumRepetitions_Msg4 --> list of size maxNPRACH_Resources_NB_r13 (3 elements)
// fp->npusch_config_common.srs_SubframeConfig /*OPTIONAL*/
// fp->npusch_config_common.ul_ReferenceSignalsNPUSCH.groupAssignmentNPUSCH
// LOG_D(PHY,"npusch_config_common.ul_ReferenceSignalsNPUSCH.groupAssignmentNPUSCH = %d]n",fp->npusch_config_common.ul_ReferenceSignalsNPUSCH.groupAssignmentNPUSCH);
// fp->npusch_config_common.ul_ReferenceSignalsNPUSCH.groupHoppingEnabled
// LOG_D(PHY,"npusch_config_common.ul_ReferenceSignalsNPUSCH.groupHoppingEnabled = %d]n",fp->npusch_config_common.ul_ReferenceSignalsNPUSCH.groupHoppingEnabled);
//TODO:should change the part that implement the ul hopping in NB-IoT
//init_ul_hopping(fp);
/*UL Power Control Config Common---------------------------------------------------------*/
//FIXME: nothing has been defined in FAPI specs for this
// fp->ul_power_control_config_common.p0_NominalNPUSCH
// fp->ul_power_control_config_common.alpha
// fp->ul_power_control_config_common.deltaPreambleMsg3
/*DL gap Config - OPTIONAL----------------------------------------------------------------*/
//DL_GapConfig_NB_r13_t a;
if(config->dl_gap_config_enable == 1){
fp->DL_gap_config.dl_GapDurationCoeff= config->dl_gap_duration_coefficent;
fp->DL_gap_config.dl_GapPeriodicity = config->dl_gap_periodicity;
fp->DL_gap_config.dl_GapThreshold = config->dl_gap_threshold;
}
//TODO
//init_ncs_cell(fp,PHY_vars_eNB_g[Mod_id][CC_id]->ncs_cell);
//init_ul_hopping(fp);
}
void NB_phy_config_dedicated_eNB(uint8_t Mod_id,
int CC_id,
uint16_t rnti,
struct PhysicalConfigDedicated_NB_r13 *physicalConfigDedicated)
{
PHY_VARS_eNB *eNB = PHY_vars_eNB_g[Mod_id][CC_id];
int8_t UE_id = find_ue(rnti,eNB);
uint8_t UE_id = find_ue(rnti,eNB);
if (UE_id == -1) {
LOG_E( PHY, "[eNB %"PRIu8"] find_ue() returns -1\n", Mod_id);
......@@ -205,8 +356,8 @@ void NB_phy_config_dedicated_eNB(uint8_t Mod_id,
/*physicalconfigDedicated is defined in PHY_VARS_eNB in defs.h in PHY layer*/
if (physicalConfigDedicated) {
eNB->physicalConfigDedicated[UE_id] = physicalConfigDedicated;
LOG_I(PHY,"phy_config_dedicated_eNB: physicalConfigDedicated=%p\n",physicalConfigDedicated);
eNB->phy_config_dedicated_NB[UE_id] = physicalConfigDedicated;
LOG_I(PHY,"NB_phy_config_dedicated_eNB: physicalConfigDedicated=%p\n",physicalConfigDedicated);
} else {
LOG_E(PHY,"[eNB %d] Received NULL radioResourceConfigDedicated from eNB %d\n",Mod_id, UE_id);
......
......@@ -565,6 +565,9 @@ typedef struct PHY_VARS_eNB_s {
// Pointers for active physicalConfigDedicated to be applied in current subframe
struct PhysicalConfigDedicated *physicalConfigDedicated[NUMBER_OF_UE_MAX];
//Pointers for actve physicalConfigDedicated for NB-IoT to be applied in current subframe
struct PhysicalConfigDedicated_NB_r13 *phy_config_dedicated_NB[NUMBER_OF_UE_MAX];
uint32_t rb_mask_ul[4];
......
......@@ -48,27 +48,31 @@
/// NPRACH-ParametersList-NB-r13 from 36.331 RRC spec
typedef struct {
typedef struct NPRACH_Parameters_NB{
/// the period time for nprach
uint8_t nprach_Periodicity;
uint16_t nprach_Periodicity;
/// for the start time for the NPRACH resource from 40ms-2560ms
uint8_t nprach_StartTime;
uint16_t nprach_StartTime;
/// for the subcarrier of set to the NPRACH preamble from n0 - n34
uint8_t nprach_SubcarrierOffset;
uint16_t nprach_SubcarrierOffset;
///number of subcarriers in a NPRACH resource allowed values (n12,n24,n36,n48)
uint16_t nprach_NumSubcarriers;
/// where is the region that in NPRACH resource to indicate if this UE support MSG3 for multi-tone or not. from 0 - 1
uint8_t nprach_SubcarrierMSG3_RangeStart;
uint16_t nprach_SubcarrierMSG3_RangeStart;
/// The max preamble transmission attempt for the CE level from 1 - 128
uint8_t maxNumPreambleAttemptCE;
uint16_t maxNumPreambleAttemptCE;
/// Number of NPRACH repetitions per attempt for each NPRACH resource
uint16_t numRepetitionsPerPreambleAttempt;
/// The number of the repetition for DCI use in RAR/MSG3/MSG4 from 1 - 2048
uint8_t npdcch_NumRepetitions_RA;
uint16_t npdcch_NumRepetitions_RA;
/// Starting subframe for NPDCCH Common searching space for (RAR/MSG3/MSG4)
uint8_t npdcch_StartSF_CSS_RA;
uint16_t npdcch_StartSF_CSS_RA;
/// Fractional period offset of starting subframe for NPDCCH common search space
uint8_t npdcch_Offset_RA;
uint16_t npdcch_Offset_RA;
} nprach_parameters_NB_t;
typedef struct{
A_SEQUENCE_OF(struct NPRACH_Parameters_NB) list;
A_SEQUENCE_OF(nprach_parameters_NB_t) list;
}NPRACH_List_NB_t;
typedef long RSRP_Range_t;
......@@ -81,7 +85,7 @@ typedef struct {
/// NPRACH_ConfigSIB-NB from 36.331 RRC spec
typedef struct {
/// nprach_CP_Length_r13, for the CP length(unit us) only 66.7 and 266.7 is implemented
uint8_t nprach_CP_Length;
uint16_t nprach_CP_Length;
/// The criterion for UEs to select a NPRACH resource. Up to 2 RSRP threshold values can be signalled. \vr{[1..2]}
struct rsrp_ThresholdsNPrachInfoList *rsrp_ThresholdsPrachInfoList;
/// NPRACH Parameters List
......@@ -91,20 +95,20 @@ typedef struct {
/// NPDSCH-ConfigCommon from 36.331 RRC spec
typedef struct {
///see TS 36.213 (16.2). \vr{[-60..50]}\n Provides the downlink reference-signal EPRE. The actual value in dBm.
int8_t nrs_Power;
uint16_t nrs_Power;
} NPDSCH_CONFIG_COMMON;
typedef struct{
/// 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.
uint8_t threeTone_BaseSequence;
uint16_t threeTone_BaseSequence;
/// Define 3 cyclic shifts for the 3-tone case, see TS 36.211 [21, 10.1.4.1.2].
uint8_t threeTone_CyclicShift;
uint16_t threeTone_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.
uint8_t sixTone_BaseSequence;
uint16_t sixTone_BaseSequence;
/// Define 4 cyclic shifts for the 6-tone case, see TS 36.211 [21, 10.1.4.1.2].
uint8_t sixTone_CyclicShift;
uint16_t sixTone_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.
uint8_t twelveTone_BaseSequence;
uint16_t twelveTone_BaseSequence;
}DMRS_CONFIG_t;
......@@ -142,9 +146,9 @@ typedef struct{
/* DL-GapConfig-NB-r13 */
typedef struct {
uint8_t dl_GapThreshold;
uint8_t dl_GapPeriodicity;
uint8_t dl_GapDurationCoeff;
uint16_t dl_GapThreshold;
uint16_t dl_GapPeriodicity;
uint16_t dl_GapDurationCoeff;
} DL_GapConfig_NB;
typedef struct {
......@@ -217,7 +221,8 @@ typedef struct {
int eutra_band;
uint32_t dl_CarrierFreq;
uint32_t ul_CarrierFreq;
uint8_t CE;// CE level to determine the NPRACH Configuration
// CE level to determine the NPRACH Configuration (one CE for each NPRACH config.)
uint8_t CE;
} NB_DL_FRAME_PARMS;
......
......@@ -150,4 +150,7 @@ int16_t unscrambling_lut[65536*16] __attribute__((aligned(32)));
uint8_t scrambling_lut[65536*16] __attribute__((aligned(32)));
#endif /*__PHY_VARS_H__ */
......@@ -49,10 +49,45 @@ void Schedule_Response(Sched_Rsp_t Sched_INFO){
//todo
}
void PHY_config_req(PHY_Config_t config_INFO){
if(config_INFO.get_MIB != 0){
NB_phy_config_mib_eNB(config_INFO.mod_id,
config_INFO.CC_id,
config_INFO.frequency_band_indicator,
config_INFO.sch_config.physical_cell_id,
config_INFO.subframe_config.dl_cyclic_prefix_type,
config_INFO.rf_config.tx_antenna_ports,
config_INFO.dl_CarrierFreq,
config_INFO.ul_CarrierFreq);
}
//Common Configuration included in SIB2-NB
NB_phy_config_sib2_eNB(config_INFO.mod_id,
config_INFO.CC_id,
&config_INFO.nb_iot_config, // FIXME to be evaluated is should be passed a pointer
&config_INFO.rf_config); // FIXME to be evaluated is should be passed a pointer
//Dedicated Configuration
if(config_INFO.phy_config_dedicated != NULL){
NB_phy_config_dedicated_eNB(config_INFO.mod_id,
config_INFO.CC_id,
config_INFO.rnti,
config_INFO.phy_config_dedicated //not defined by fapi specs
);
}
}
int IF_Module_init(IF_Module_t *if_inst){
if_inst->UL_indication = UL_indication;
if_inst->Schedule_Response = Schedule_Response;
if_inst->PHY_config_req = PHY_config_req;
return 0;
}
/*This is the interface module between PHY
*Provided the FAPI style interface structures for P7.
*
*
*Provide the semi-FAPI style interface for P5 (configuration)
*
*/
#ifndef __IF_MODULE_NB_IoT__H__
#define __IF_MODULE_NB_IoT__H__
#include "openair1/PHY/LTE_TRANSPORT/defs_nb_iot.h"
#include "PhysicalConfigDedicated-NB-r13.h"
#define SCH_PAYLOAD_SIZE_MAX 4096
#define BCCH_PAYLOAD_SIZE_MAX 128
#define NUMBER_OF_UE_MAX 20
// P5 FAPI-like configuration structures
typedef struct{
uint16_t duplex_mode;
uint16_t pcfich_power_offset;
uint16_t p_b; //refers to DL power allocation (see TS 36.213 ch 5.2
uint16_t dl_cyclic_prefix_type;
uint16_t ul_cyclic_prefix_type;
}subframe_config_t;
typedef struct{
uint16_t dl_channel_bandwidth;
uint16_t ul_channel_bandwidth;
uint16_t reference_signal_power;
uint16_t tx_antenna_ports;
uint16_t rx_antenna_ports;
}rf_config_t;
typedef struct{
uint16_t primary_sinchronization_signal_epre_eprers;
uint16_t secondary_sinchronization_signal_epre_eprers;
uint16_t physical_cell_id; //aka Ncell_id
}sch_config_t;
typedef struct{
uint16_t operating_mode;
uint16_t anchor;
uint16_t prb_index;
uint16_t control_region_size;
uint16_t assumed_crs_aps;
//enable or disable configuration #0 (value: 0 = Disable, 1 = Enable)
uint16_t nprach_config_0_enabled;
//periodicity of NPRACH resource (value 0,1,2,3,4,5,6,7 correspond to 40,80,160,240,320,640,1280,2560ms)
uint16_t nprach_config_0_sf_periodicity;
//NPRACH resource starting time after period (value 0,1,2,3,4,5,6,7 correspond to 8,16,32,64,128,256,512,1024ms)
uint16_t nprach_config_0_start_time;
//Frequency location of an NPRACH resource within a PRB (value 0,1,2,3,4,5,6 correspond to 0,12,24,36,2,18,34
uint16_t nprach_config_0_subcarrier_offset;
//Number of Subcarriers in NPRACH resource (value 0,1,2,3 correspond to 12,24,36,48)
uint16_t nprach_config_0_number_of_subcarriers;
//Cyclic prefix length for NPRACH transmission (value: 0 = 66.7usec, 1 = 266.7usec)
uint16_t nprach_config_0_cp_length;
//Number of repetitions for NPRACH transmission (value: 0,1,2,3,4,5,6,7 correspond to 1,2,4,8,16,32,64,128)
uint16_t nprach_config_0_number_of_repetitions_per_attempts;
uint16_t nprach_config_1_enabled;
uint16_t nprach_config_1_sf_periodicity;
uint16_t nprach_config_1_start_time;
uint16_t nprach_config_1_subcarrier_offset;
uint16_t nprach_config_1_number_of_subcarriers;
uint16_t nprach_config_1_cp_length;
uint16_t nprach_config_1_number_of_repetitions_per_attempts;
uint16_t nprach_config_2_enabled;
uint16_t nprach_config_2_sf_periodicity;
uint16_t nprach_config_2_start_time;
uint16_t nprach_config_2_subcarrier_offset;
uint16_t nprach_config_2_number_of_subcarriers;
uint16_t nprach_config_2_cp_length;
uint16_t nprach_config_2_number_of_repetitions_per_attempts;
//4 bits
uint16_t three_tone_base_sequence;/*OPTIONAL*/
//2bits
uint16_t six_tone_base_sequence; /*OPTIONAL*/
//5 bits
uint16_t twelve_tone_base_sequence; /*OPTIONAL*/
uint16_t three_tone_cyclic_shift;
uint16_t six_tone_cyclic_shift;
//Enable/disable the DL gap
uint16_t dl_gap_config_enable;
//Threshold on the maximum number of repetitions configured for NPDCCH before application of DL transmission gap config.
//value 0,1,2,3 correspond to 32,64,128,256
uint16_t dl_gap_threshold;
//Periodicity of a DL tranmission gap (value 0,1,2,3 correspond to 64,128,256,512sf)
uint16_t dl_gap_periodicity;
//Coefficent to calculate the gap duration of a DL transmission (value 0,1,2,3 correspond to oneEight, oneFourth, threeEight, oneHalf)
uint16_t dl_gap_duration_coefficent;
}nb_iot_config_t;
typedef struct{
uint16_t data_report_mode;
uint16_t sfn_sf;
}l23_config_t;
typedef struct{
/*OAI config. parameters*/
module_id_t mod_id;
int CC_id;
int rnti;
int get_MIB; //should be different from 0 only when the mib!= null (NB_rrc_mac_config_req_eNB)
//In FAPI specs --> is inside the nb_iot_rssi_request (P4 Network Monitor Mode procedure)
//In OAI is called eutra_band
uint8_t frequency_band_indicator; //parameter carried by the SIB1-NB, is and index of the Table 5.5-1 TS 36.101
//In 3GPP specs (TS 36.101 Table 5.7.3-1 and ch 5.7.3F) see also SIB2-NB freqInfo.ul-carrierFreq
//this parameters should be evaluated based of the EUTRA Absolute Radio Frequency Channel Number (EARFCN)
//in FAPI this value is given inside th BROADCAST DETECT request (P4 Network Monito Mode procedure)
//in OAI we set the dl_CarrierFrequenci at configuration time (see COMMON/rrc_messages_types.h)
//then adding an offset for the ul_CarrierFreq ( see RU-RAU split approach - init_SI)
uint32_t dl_CarrierFreq;
uint32_t ul_CarrierFreq;
/*FAPI style config. parameters*/
subframe_config_t subframe_config;
rf_config_t rf_config;
sch_config_t sch_config;
nb_iot_config_t nb_iot_config;
l23_config_t l23_config;
/*Dedicated configuration --> not supported by FAPI?*/
PhysicalConfigDedicated_NB_r13_t *phy_config_dedicated;
}PHY_Config_t;
// uplink subframe P7
typedef struct{
......@@ -192,6 +321,7 @@ typedef struct{
typedef struct IF_Module_s{
void (*UL_indication)(UL_IND_t UL_INFO);
void (*Schedule_Response)(Sched_Rsp_t Sched_INFO);
void (*PHY_config_req)(PHY_Config_t config_INFO);
}IF_Module_t;
/*Initial */
......@@ -206,5 +336,10 @@ void UL_indication(UL_IND_t UL_INFO);
/*Interface for Downlink, transmitting the DLSCH SDU, DCI SDU*/
void Schedule_Response(Sched_Rsp_t Sched_INFO);
/*Interface for Configuration*/
//void Config_Request();
/*Interface for PHY Configuration
* Trigger the phy_config_xxx functions using parameters from the shared PHY_Config structure
* */
void PHY_config_req(PHY_Config_t config_INFO);
#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