Skip to content
Snippets Groups Projects
defs.h 44.2 KiB
Newer Older
  /// sorted uplink component carrier for the scheduler 
knopp's avatar
 
knopp committed
  int ordered_ULCCids[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
  /// number of uplink active component carrier 
knopp's avatar
 
knopp committed
  int numactiveULCCs[NUMBER_OF_UE_MAX];
  /// number of downlink active component carrier 
  uint8_t dl_CC_bitmap[NUMBER_OF_UE_MAX];
knopp's avatar
 
knopp committed
  eNB_UE_STATS eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
  /// scheduling control info
knopp's avatar
 
knopp committed
  UE_sched_ctrl UE_sched_ctrl[NUMBER_OF_UE_MAX];
  int next[NUMBER_OF_UE_MAX];
  int next_ul[NUMBER_OF_UE_MAX];
  int head_ul;
knopp's avatar
 
knopp committed
  int avail;
  int num_UEs;
  boolean_t active[NUMBER_OF_UE_MAX];
} UE_list_t;
/*! \brief eNB common channels */ 
  int                              physCellId;
  int                              p_eNB;
  int                              Ncp;
  int                              eutra_band;
  uint32_t                         dl_CarrierFreq;
  BCCH_BCH_Message_t               *mib;
  RadioResourceConfigCommonSIB_t   *radioResourceConfigCommon;
#ifdef Rel14
  RadioResourceConfigCommonSIB_t   *radioResourceConfigCommon_BR;  
  TDD_Config_t                     *tdd_Config;
  SchedulingInfoList_t             *schedulingInfoList;
  ARFCN_ValueEUTRA_t               ul_CarrierFreq;
  long                             ul_Bandwidth;
  /// Outgoing MIB PDU for PHY
  MIB_PDU MIB_pdu;
  /// Outgoing BCCH pdu for PHY
  BCCH_PDU BCCH_pdu;
  /// Outgoing BCCH DCI allocation
  uint32_t BCCH_alloc_pdu;
  /// Outgoing CCCH pdu for PHY
  CCCH_PDU CCCH_pdu;
  /// Outgoing RAR pdu for PHY
  RAR_PDU RAR_pdu;
  /// Template for RA computations
  RA_TEMPLATE RA_template[NB_RA_PROC_MAX];
  /// VRB map for common channels
  uint8_t vrb_map[100];
  /// VRB map for common channels and retransmissions by PHICH
  uint8_t vrb_map_UL[100];
  /// MBSFN SubframeConfig
  struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[8];
  /// number of subframe allocation pattern available for MBSFN sync area
  uint8_t num_sf_allocation_pattern;
Cédric Roux's avatar
Cédric Roux committed
#if defined(Rel10) || defined(Rel14)
  uint8_t MBMS_flag;
  /// Outgoing MCCH pdu for PHY
  MCCH_PDU MCCH_pdu;
  /// MCCH active flag
  uint8_t msi_active;
  /// MCCH active flag
  uint8_t mcch_active;
  /// MTCH active flag
  uint8_t mtch_active;
  uint8_t num_active_mbsfn_area;
  /// MBSFN Area Info
  struct  MBSFN_AreaInfo_r9 *mbsfn_AreaInfo[MAX_MBSFN_AREA];
  /// PMCH Config
  struct PMCH_Config_r9 *pmch_Config[MAX_PMCH_perMBSFN];
  /// MBMS session info list
  struct MBMS_SessionInfoList_r9 *mbms_SessionList[MAX_PMCH_perMBSFN];
  /// Outgoing MCH pdu for PHY
  MCH_PDU MCH_pdu;
#endif
#ifdef Rel14
  /// Rel13 parameters from SIB1
  SystemInformationBlockType1_v1310_IEs_t *sib1_v13ext;
  /// Counter for SIB1-BR scheduling
  int SIB1_BR_cnt;
  /// Outgoing BCCH-BR pdu for PHY
  BCCH_PDU BCCH_BR_pdu[20];
#endif
/*! \brief top level eNB MAC structure */ 
typedef struct eNB_MAC_INST_s {
  /// Ethernet parameters for northbound midhaul interface
  eth_params_t         eth_params_n;
  /// Ethernet parameters for fronthaul interface
  eth_params_t         eth_params_s;
knopp's avatar
 
knopp committed
  /// frame counter
  frame_t frame;
  /// subframe counter
  sub_frame_t subframe;
  /// Pointer to IF module instance for PHY
  IF_Module_t *if_inst;
knopp's avatar
 
knopp committed
  /// Common cell resources
  COMMON_channels_t common_channels[MAX_NUM_CCs];
  /// current PDU index (BCH,MCH,DLSCH)
  uint16_t pdu_index[MAX_NUM_CCs];

  /// NFAPI Config Request Structure
  nfapi_config_request_t config[MAX_NUM_CCs];
  /// Preallocated DL pdu list
  nfapi_dl_config_request_pdu_t dl_config_pdu_list[MAX_NUM_CCs][MAX_NUM_DL_PDU];
  /// NFAPI DL Config Request Structure
  nfapi_dl_config_request_t DL_req[MAX_NUM_CCs];
  /// Preallocated UL pdu list
  nfapi_ul_config_request_pdu_t ul_config_pdu_list[MAX_NUM_CCs][MAX_NUM_UL_PDU];
  /// Preallocated UL pdu list for ULSCH (n+k delay)
  nfapi_ul_config_request_pdu_t ul_config_pdu_list_tmp[MAX_NUM_CCs][10][MAX_NUM_UL_PDU];
  /// NFAPI UL Config Request Structure, send to L1 4 subframes before processing takes place
  nfapi_ul_config_request_t UL_req[MAX_NUM_CCs];
  /// NFAPI "Temporary" UL Config Request Structure, holds future UL_config requests
  nfapi_ul_config_request_t UL_req_tmp[MAX_NUM_CCs][10];
  /// Preallocated HI_DCI0 pdu list 
  nfapi_hi_dci0_request_pdu_t hi_dci0_pdu_list[MAX_NUM_CCs][MAX_NUM_HI_DCI0_PDU];
  /// NFAPI HI/DCI0 Config Request Structure
  nfapi_hi_dci0_request_t HI_DCI0_req[MAX_NUM_CCs];
  /// Prealocated TX pdu list
  nfapi_tx_request_pdu_t tx_request_pdu[MAX_NUM_CCs][MAX_NUM_TX_REQUEST_PDU];
  /// NFAPI DL PDU structure
  nfapi_tx_request_t TX_req[MAX_NUM_CCs];
  /// UL handle
  uint32_t ul_handle;
knopp's avatar
 
knopp committed
  UE_list_t UE_list;
  ///subband bitmap configuration
  SBMAP_CONF sbmap_conf;
  /// CCE table used to build DCI scheduling information
  int CCE_table[MAX_NUM_CCs][800];
  /// eNB stats
  eNB_STATS eNB_stats[MAX_NUM_CCs];
  // MAC function execution peformance profiler
  /// processing time of eNB scheduler 
  time_stats_t eNB_scheduler;
  /// processing time of eNB scheduler for SI 
  time_stats_t schedule_si;
  /// processing time of eNB scheduler for Random access
  time_stats_t schedule_ra;
  /// processing time of eNB ULSCH scheduler 
  time_stats_t schedule_ulsch;
  /// processing time of eNB DCI generation
  time_stats_t fill_DLSCH_dci;
  /// processing time of eNB MAC preprocessor
  time_stats_t schedule_dlsch_preprocessor;
  /// processing time of eNB DLSCH scheduler 
  time_stats_t schedule_dlsch; // include rlc_data_req + MAC header + preprocessor
  /// processing time of eNB MCH scheduler 
  time_stats_t schedule_mch;
  /// processing time of eNB ULSCH reception
  time_stats_t rx_ulsch_sdu; // include rlc_data_ind
typedef enum {
  TYPE0,
  TYPE1,
  TYPE1A,
  TYPE2,
  TYPE2A,
  TYPEUESPEC
} MPDCCH_TYPES_t;

/*!\brief UE layer 2 status */
typedef enum {
  CONNECTION_OK=0,
  CONNECTION_LOST,
  PHY_RESYNCH,
  PHY_HO_PRACH
} UE_L2_STATE_t;

/*!\brief UE scheduling info */
typedef struct {
  /// buffer status for each lcgid
  uint8_t  BSR[MAX_NUM_LCGID]; // should be more for mesh topology
fnabet's avatar
fnabet committed
  /// keep the number of bytes in rlc buffer for each lcgid
Gabriel's avatar
Gabriel committed
  int32_t  BSR_bytes[MAX_NUM_LCGID];
fnabet's avatar
fnabet committed
  /// after multiplexing buffer remain for each lcid
Gabriel's avatar
Gabriel committed
  int32_t  LCID_buffer_remain[MAX_NUM_LCID];
calvin wang's avatar
calvin wang committed
  /// sum of all lcid buffer size
  uint16_t  All_lcid_buffer_size_lastTTI;
  uint8_t  LCID_status[MAX_NUM_LCID];
  /// SR pending as defined in 36.321
  uint8_t  SR_pending;
  /// SR_COUNTER as defined in 36.321
  uint16_t SR_COUNTER;
  /// logical channel group ide for each LCID
  uint8_t  LCGID[MAX_NUM_LCID];
  /// retxBSR-Timer, default value is sf2560
  uint16_t retxBSR_Timer;
  /// retxBSR_SF, number of subframe before triggering a regular BSR
Bilel's avatar
Bilel committed
  uint16_t retxBSR_SF;
  /// periodicBSR-Timer, default to infinity
  uint16_t periodicBSR_Timer;
  /// periodicBSR_SF, number of subframe before triggering a periodic BSR
Bilel's avatar
Bilel committed
  uint16_t periodicBSR_SF;
  /// default value is 0: not configured
  uint16_t sr_ProhibitTimer;
  uint8_t sr_ProhibitTimer_Running;
  uint16_t maxHARQ_Tx;
  uint16_t ttiBundling;
  struct DRX_Config *drx_config;
  /// default value is release
  struct MAC_MainConfig__phr_Config *phr_config;
  ///timer before triggering a periodic PHR
  uint16_t periodicPHR_Timer;
  ///timer before triggering a prohibit PHR
  uint16_t prohibitPHR_Timer;
  uint16_t PathlossChange;
  ///number of subframe before triggering a periodic PHR
  int16_t periodicPHR_SF;
  ///number of subframe before triggering a prohibit PHR
  int16_t prohibitPHR_SF;
  uint16_t PathlossChange_db;
fnabet's avatar
fnabet committed

  /// default value is false
  uint16_t extendedBSR_Sizes_r10;
  /// default value is false
  uint16_t extendedPHR_r10;

  int16_t Bj[MAX_NUM_LCID];
  int16_t bucket_size[MAX_NUM_LCID];
/*!\brief Top level UE MAC structure */
  uint16_t Node_id;
  /// RX frame counter
  frame_t     rxFrame;
  /// RX subframe counter
  sub_frame_t rxSubframe;
  /// TX frame counter
  frame_t     txFrame;
  /// TX subframe counter
  sub_frame_t txSubframe;
  uint16_t crnti;
  rnti_t crnti_before_ho; ///user id (rnti) of connected UEs
  /// uplink active flag
  uint8_t ul_active;
  /// pointer to RRC PHY configuration
  RadioResourceConfigCommonSIB_t *radioResourceConfigCommon;
  /// pointer to RACH_ConfigDedicated (NULL when not active, i.e. upon HO completion or T304 expiry)
  struct RACH_ConfigDedicated *rach_ConfigDedicated;
  /// pointer to RRC PHY configuration
  struct PhysicalConfigDedicated *physicalConfigDedicated;
Cédric Roux's avatar
Cédric Roux committed
#if defined(Rel10) || defined(Rel14)
  /// pointer to RRC PHY configuration SCEll
  struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10;
#endif
  /// pointer to TDD Configuration (NULL for FDD)
  TDD_Config_t *tdd_Config;
  /// Number of adjacent cells to measure
  uint8_t  n_adj_cells;
  /// Array of adjacent physical cell ids
  uint32_t adj_cell_id[6];
  /// Pointer to RRC MAC configuration
  MAC_MainConfig_t *macConfig;
  /// Pointer to RRC Measurement gap configuration
  MeasGapConfig_t  *measGapConfig;
  /// Pointers to LogicalChannelConfig indexed by LogicalChannelIdentity. Note NULL means LCHAN is inactive.
  LogicalChannelConfig_t *logicalChannelConfig[MAX_NUM_LCID];
  /*/// Panos: Pointer to IF_Module_UE instance of the UE
  IF_Module_UE_t *if_inst_ue;
  /// Panos: UE_MAC interface: Config request structure.
  UE_PHY_Config_t UE_config;
  /// Panos: UE_MAC interface: UL Config Request Structure
  UE_MAC_ul_config_request_t UL_req_ue[MAX_NUM_CCs];
  /// Panos: UE_MAC interface: UL Transmission request structure.
  UE_MAC_tx_request_t UL_TX_req[MAX_NUM_CCs];*/
  UE_SCHEDULING_INFO scheduling_info;
  /// Outgoing CCCH pdu for PHY
  CCCH_PDU CCCH_pdu;
  /// Outgoing RAR pdu for PHY
  RAR_PDU RAR_pdu;
  DLSCH_PDU DLSCH_pdu[NUMBER_OF_UE_MAX][2];
  uint8_t RA_attempt_number;
  uint8_t RA_active;
  int8_t RA_window_cnt;
  /// Random-access Msg3 size in bytes
  uint8_t RA_Msg3_size;
  uint8_t RA_prachMaskIndex;
  /// Flag indicating Preamble set (A,B) used for first Msg3 transmission
  uint8_t RA_usedGroupA;
  /// Random-access Resources
  PRACH_RESOURCES_t RA_prach_resources;
  /// Random-access PREAMBLE_TRANSMISSION_COUNTER
  uint8_t RA_PREAMBLE_TRANSMISSION_COUNTER;
  /// Random-access backoff counter
  int16_t RA_backoff_cnt;
  /// Random-access variable for window calculation (frame of last change in window counter)
  uint32_t RA_tx_frame;
  /// Random-access variable for window calculation (subframe of last change in window counter)
  uint8_t RA_tx_subframe;
  /// Random-access Group B maximum path-loss
  /// Random-access variable for backoff (frame of last change in backoff counter)
  uint32_t RA_backoff_frame;
  /// Random-access variable for backoff (subframe of last change in backoff counter)
  uint8_t RA_backoff_subframe;
  /// Random-access Group B maximum path-loss
  uint16_t RA_maxPL;
  /// Random-access Contention Resolution Timer active flag
  uint8_t RA_contention_resolution_timer_active;
  /// Random-access Contention Resolution Timer count value
  uint8_t RA_contention_resolution_cnt;
  /// power headroom reporitng reconfigured
  uint8_t PHR_reconfigured;
  /// power headroom state as configured by the higher layers
  uint8_t PHR_state;
  /// power backoff due to power management (as allowed by P-MPRc) for this cell
  uint8_t PHR_reporting_active;
  /// power backoff due to power management (as allowed by P-MPRc) for this cell
  uint8_t power_backoff_db[NUMBER_OF_eNB_MAX];
fnabet's avatar
fnabet committed
  /// BSR report falg management
  uint8_t BSR_reporting_active;
  /// retxBSR-Timer expires flag
  uint8_t retxBSRTimer_expires_flag;
  /// periodBSR-Timer expires flag
  uint8_t periodBSRTimer_expires_flag;

  struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[8]; // FIXME replace 8 by MAX_MBSFN_AREA?
  /// number of subframe allocation pattern available for MBSFN sync area
  uint8_t num_sf_allocation_pattern;
Cédric Roux's avatar
Cédric Roux committed
#if defined(Rel10) || defined(Rel14)
  uint8_t num_active_mbsfn_area;
  /// MBSFN Area Info
  struct  MBSFN_AreaInfo_r9 *mbsfn_AreaInfo[MAX_MBSFN_AREA];
  /// PMCH Config
  struct PMCH_Config_r9 *pmch_Config[MAX_PMCH_perMBSFN];
  /// MCCH status
  uint8_t mcch_status;
  uint8_t msi_status;// could be an array if there are >1 MCH in one MBSFN area
  /// CBA RNTI for each group 
  uint16_t cba_rnti[NUM_MAX_CBA_GROUP];
  /// last SFN for CBA channel access 
  uint8_t cba_last_access[NUM_MAX_CBA_GROUP];
  /// total UE scheduler processing time 
  time_stats_t ue_scheduler; // total
  /// UE ULSCH tx  processing time inlcuding RLC interface (rlc_data_req) and mac header generation 
  time_stats_t tx_ulsch_sdu;  
  /// UE DLSCH rx  processing time inlcuding RLC interface (mac_rrc_data_ind or mac_rlc_status_ind+mac_rlc_data_ind) and mac header parser
  time_stats_t rx_dlsch_sdu ; 
  /// UE query for MCH subframe processing time 
  /// UE MCH rx processing time 
  /// UE BCCH rx processing time including RLC interface (mac_rrc_data_ind) 
  time_stats_t rx_si; 
  /// UE PCCH rx processing time including RLC interface (mac_rrc_data_ind) 
  time_stats_t rx_p;
  /// Panos: Mutex for nfapi UL_INFO
  pthread_mutex_t      UL_INFO_mutex;
  /// Panos: UE_Mode variable should be used in the case of Phy_stub operation since we won't have access to PHY_VARS_UE
  /// where the UE_mode originally is for the full stack operation mode. The transitions between the states of the UE_Mode
  /// will be triggered within phy_stub_ue.c in this case
  UE_MODE_t        UE_mode[NUMBER_OF_CONNECTED_eNB_MAX];
  /// Panos: Phy_stub mode: Boolean variable to distinguish whether a Msg3 or a regular ULSCH data pdu should be generated
  /// after the reception of NFAPI_UL_CONFIG_ULSCH_PDU_TYPE.
  uint8_t first_ULSCH_Tx;

  /// Panos: Pointers to config_request types. Used from nfapi callback functions.
  nfapi_dl_config_request_t* dl_config_req;
  nfapi_ul_config_request_t* ul_config_req;
  nfapi_hi_dci0_request_t* hi_dci0_req;
  nfapi_tx_request_t* tx_req;

/*! \brief ID of the neighboring cells used for HO*/
  uint16_t cell_ids[6];
  uint8_t n_adj_cells;
#include "proto.h"