Commit fffc6b02 authored by Ting-An Lin's avatar Ting-An Lin

Add frame_parms_NB_IoT (remain error)

parent 5b93cd38
......@@ -111,7 +111,7 @@
typedef enum {normal_txrx_NB_IoT=0,rx_calib_ue_NB_IoT=1,rx_calib_ue_med_NB_IoT=2,rx_calib_ue_byp_NB_IoT=3,debug_prach_NB_IoT=4,no_L2_connect_NB_IoT=5,calib_prach_tx_NB_IoT=6,rx_dump_frame_NB_IoT=7,loop_through_memory_NB_IoT=8} runmode_NB_IoT_t;
#endif
/*
enum transmission_access_mode {
enum transmission_access_mode_NB_IoT {
NO_ACCESS=0,
POSTPONED_ACCESS,
CANCELED_ACCESS,
......
......@@ -631,6 +631,8 @@ typedef struct {
uint8_t srsX;
/// indicates if node is a UE (NODE=2) or eNB (PRIMARY_CH=0).
uint8_t node_id;
/// flag to indicate SISO transmission
uint8_t mode1_flag;
/// Indicator that 20 MHz channel uses 3/4 sampling frequency
uint8_t threequarter_fs;
/// Size of FFT
......
......@@ -604,6 +604,12 @@ typedef struct {
/// - first index: tx antenna [0..14[ where 14 is the total supported antenna ports.
/// - second index: sample [0..]
int32_t **txdataF;
/// \brief Holds the beamforming weights
/// - first index: eNB id [0..2] (hard coded)
/// - second index: eNB antenna port index (hard coded)
/// - third index: tx antenna [0..nb_antennas_tx[
/// - fourth index: sample [0..]
int32_t **beam_weights[3][15];
} LTE_eNB_COMMON;
typedef struct {
......@@ -1109,7 +1115,7 @@ typedef struct PHY_VARS_eNB_s {
uint32_t max_peak_val;
int max_eNB_id, max_sync_pos;
int N_TA_offset; ///timing offset used in TDD
/// \brief sinr for all subcarriers of the current link (used only for abstraction).
/// first index: ? [0..N_RB_DL*12[
double *sinr_dB;
......@@ -1120,6 +1126,7 @@ typedef struct PHY_VARS_eNB_s {
unsigned char first_run_timing_advance[NUMBER_OF_UE_MAX];
unsigned char first_run_I0_measurements;
unsigned char cooperation_flag; // for cooperative communication
unsigned char is_secondary_eNB; // primary by default
unsigned char is_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.
......
......@@ -47,8 +47,8 @@ PHY_VARS_UE ***PHY_vars_UE_g;
RAN_CONTEXT_t RC;
UL_RCC_IND_t UL_RCC_INFO;
//PHY_VARS_eNB ***PHY_vars_eNB_g;
//PHY_VARS_RN **PHY_vars_RN_g;
PHY_VARS_eNB ***PHY_vars_eNB_g;
PHY_VARS_RN **PHY_vars_RN_g;
LTE_DL_FRAME_PARMS *lte_frame_parms_g;
#else
PHY_VARS_UE * PHY_vars_UE_g[MAX_UE][MAX_NUM_CCs]={NULL};
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.0 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file vars.h
* \brief mac vars
* \author Navid Nikaein and Raymond Knopp
* \date 2010 - 2014
* \version 1.0
* \email navid.nikaein@eurecom.fr
* @ingroup _mac
*/
#ifndef __MAC_VARS_H__
#define __MAC_VARS_H__
#ifdef USER_MODE
//#include "stdio.h"
#endif //USER_MODE
#include "PHY/defs_L1_NB_IoT.h"
#include "defs.h"
#include "defs_NB_IoT.h"
#include "PHY_INTERFACE/defs.h"
#include "COMMON/mac_rrc_primitives.h"
const uint32_t BSR_TABLE[BSR_TABLE_SIZE]= {0,10,12,14,17,19,22,26,31,36,42,49,57,67,78,91,
105,125,146,171,200,234,274,321,376,440,515,603,706,826,967,1132,
1326,1552,1817,2127,2490,2915,3413,3995,4677,5467,6411,7505,8787,10287,12043,14099,
16507,19325,22624,26487,31009,36304,42502,49759,58255,68201,79846,93479,109439, 128125,150000, 300000
};
// extended bsr table--currently not used
const uint32_t Extended_BSR_TABLE[BSR_TABLE_SIZE] = {0,10,13,16,19,23,29,35,43,53,65,80,98,120,147,
181,223,274,337,414,509,625,769,945,1162,1429,
1757,2161,2657,3267,4017,4940,6074,7469,9185,
11294,13888,17077,20999,25822,31752,39045,48012,
59039,72598,89272,109774,134986,165989,204111,
250990,308634,379519,466683,573866,705666,867737,
1067031,1312097,1613447,1984009,2439678,3000000,
6000000};
//#define MAX_SIZE_OF_AGG3 576
//#define MAX_SIZE_OF_AGG2 288
//#define MAX_SIZE_OF_AGG1 144
//#define MAX_SIZE_OF_AGG0 72
/*
* If the CQI is low, then scheduler will use a higher aggregation level and lower aggregation level otherwise
* this is also dependent to transmission mode, where an offset could be defined
*/
// the follwoing three tables are calibrated for TXMODE 1 and 2
const uint8_t cqi2fmt0_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE]= {
{3, 3, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0}, // 1.4_DCI0_CRC_Size= 37 bits
//{3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0}, // 5_DCI0_CRC_SIZE = 41
{3, 3, 3, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0}, // 5_DCI0_CRC_SIZE = 41
{3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0}, // 10_DCI0_CRC_SIZE = 43
{3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0} // 20_DCI0_CRC_SIZE = 44
};
const uint8_t cqi2fmt1x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE]= {
{3, 3, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0}, // 1.4_DCI0_CRC_Size < 38 bits
{3, 3, 3, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0}, // 5_DCI0_CRC_SIZE < 43
{3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0}, // 10_DCI0_CRC_SIZE < 47
{3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0} // 20_DCI0_CRC_SIZE < 55
};
const uint8_t cqi2fmt2x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE]= {
{3, 3, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0}, // 1.4_DCI0_CRC_Size= 47 bits
{3, 3, 3, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0}, // 5_DCI0_CRC_SIZE = 55
{3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0}, // 10_DCI0_CRC_SIZE = 59
{3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0} // 20_DCI0_CRC_SIZE = 64
};
//uint32_t EBSR_Level[63]={0,10,13,16,19,23,29,35,43,53,65,80,98,120,147,181};
MAC_xface *mac_xface;
uint32_t RRC_CONNECTION_FLAG;
UE_MAC_INST *UE_mac_inst; //[NB_MODULE_MAX];
eNB_MAC_INST *eNB_mac_inst; //[NB_MODULE_MAX];
MAC_RLC_XFACE *Mac_rlc_xface;
/// Primary component carrier index of eNB
int pCC_id[NUMBER_OF_eNB_MAX];
eNB_ULSCH_INFO eNB_ulsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][NUMBER_OF_UE_MAX]; // eNBxUE = 8x8
eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][NUMBER_OF_UE_MAX]; // eNBxUE = 8x8
/*
#ifndef USER_MODE
RRC_XFACE *Rrc_xface;
MAC_xface *mac_xface;
#else
#include "PHY_INTERFACE/extern.h"
#include "RRC/LITE/extern.h"
#endif
*/
uint8_t Is_rrc_registered;
#ifdef OPENAIR2
unsigned char NB_eNB_INST=0;
unsigned char NB_UE_INST=0;
unsigned char NB_RN_INST=0;
unsigned char NB_INST=0;
#endif
DCI0_5MHz_TDD_1_6_t UL_alloc_pdu;
DCI1A_5MHz_TDD_1_6_t DLSCH_alloc_pdu1A;
DCI1A_5MHz_TDD_1_6_t RA_alloc_pdu;
DCI1A_5MHz_TDD_1_6_t BCCH_alloc_pdu;
DCI1A_5MHz_TDD_1_6_t CCCH_alloc_pdu;
DCI1_5MHz_TDD_t DLSCH_alloc_pdu;
#if defined(Rel10) || defined(Rel14)
DCI1C_5MHz_t MCCH_alloc_pdu;
#endif
DCI0_5MHz_FDD_t UL_alloc_pdu_fdd;
DCI1A_5MHz_FDD_t DLSCH_alloc_pdu1A_fdd;
DCI1A_5MHz_FDD_t RA_alloc_pdu_fdd;
DCI1A_5MHz_FDD_t BCCH_alloc_pdu_fdd;
DCI1A_5MHz_FDD_t CCCH_alloc_pdu_fdd;
DCI1_5MHz_FDD_t DLSCH_alloc_pdu_fdd;
DCI2_5MHz_2A_TDD_t DLSCH_alloc_pdu1;
DCI2_5MHz_2A_TDD_t DLSCH_alloc_pdu2;
DCI1E_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu1E;
#endif
......@@ -112,7 +112,6 @@ void RCconfig_L1(void) {
if (RC.eNB == NULL) {
RC.eNB = (PHY_VARS_eNB ** *)malloc((1+NUMBER_OF_eNB_MAX)*sizeof(PHY_VARS_eNB **));
RC.L1_NB_IoT = (PHY_VARS_eNB_NB_IoT **)malloc((1+NUMBER_OF_eNB_MAX)*sizeof(PHY_VARS_eNB_NB_IoT *));//Ann
LOG_I(PHY,"RC.eNB = %p\n",RC.eNB);
memset(RC.eNB,0,(1+NUMBER_OF_eNB_MAX)*sizeof(PHY_VARS_eNB **));
RC.nb_L1_CC = malloc((1+RC.nb_L1_inst)*sizeof(int));
......@@ -121,13 +120,6 @@ void RCconfig_L1(void) {
config_getlist( &L1_ParamList,L1_Params,sizeof(L1_Params)/sizeof(paramdef_t), NULL);
if (L1_ParamList.numelt > 0) {
for (j = 0; j < RC.nb_nb_iot_L1_inst; j++) {//Ann
if (RC.L1_NB_IoT[j] == NULL) {
RC.L1_NB_IoT[j] = (PHY_VARS_eNB_NB_IoT *)malloc((1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB_NB_IoT ));
LOG_I(PHY,"RC.L1_NB_IoT[%d] = %p\n",j,RC.L1_NB_IoT[j]);
memset(RC.L1_NB_IoT[j],0,(1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB_NB_IoT));
}
}
for (j = 0; j < RC.nb_L1_inst; j++) {
RC.nb_L1_CC[j] = *(L1_ParamList.paramarray[j][L1_CC_IDX].uptr);
......@@ -2949,6 +2941,7 @@ void read_config_and_init(void) {
RC.nb_macrlc_inst, RC.nb_inst);
RCconfig_L1();
RCconfig_NbIoTL1();
LOG_I(PHY, "%s() RC.nb_L1_inst: %d\n", __FUNCTION__, RC.nb_L1_inst);
RCconfig_macrlc(macrlc_has_f1);
LOG_I(MAC, "%s() RC.nb_macrlc_inst: %d\n", __FUNCTION__, RC.nb_macrlc_inst);
......
......@@ -261,7 +261,14 @@ typedef struct {
uint8_t PH:6;
uint8_t R:2;
} __attribute__((__packed__))POWER_HEADROOM_CMD;
/*!\brief DCI PDU filled by MAC for the PHY */
typedef struct {
uint8_t Num_ue_spec_dci ;
uint8_t Num_common_dci ;
// uint32_t nCCE;
uint32_t num_pdcch_symbols;
DCI_ALLOC_t dci_alloc[NUM_DCI_MAX] ;
} DCI_PDU;
/*! \brief MIB payload */
typedef struct {
uint8_t payload[3] ;
......@@ -305,7 +312,6 @@ typedef struct {
uint8_t lcid:5; // octet 2 MSB
uint8_t stop_sf_LSB:8;
} __attribute__((__packed__))MSI_ELEMENT;
#endif
/*! \brief Values of CCCH LCID for DLSCH */
#define CCCH_LCHANID 0
/*!\brief Values of BCCH logical channel (fake)*/
......@@ -1343,3 +1349,4 @@ typedef struct {
#include "proto.h"
/*@}*/
#endif /*__LAYER2_MAC_DEFS_H__ */
#endif
\ No newline at end of file
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.0 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file PHY_INTERFACE/defs.h
* \brief mac phy interface primitives
* \author Raymond Knopp and Navid Nikaein
* \date 2011
* \version 0.5
* \mail navid.nikaein@eurecom.fr or openair_tech@eurecom.fr
*/
#ifndef __MAC_PHY_PRIMITIVES_H__
# define __MAC_PHY_PRIMITIVES_H__
#include "LAYER2/MAC/defs.h"
#define MAX_NUMBER_OF_MAC_INSTANCES 16
#define NULL_PDU 255
#define DCI 0
#define DLSCH 1
#define ULSCH 2
#define mac_exit_wrapper(sTRING) \
do { \
char temp[300]; \
snprintf(temp, sizeof(temp), "%s in file "__FILE__" at line %d\n", sTRING, __LINE__); \
mac_xface->macphy_exit(temp); \
} while(0)
/** @defgroup _phy_if MAC-PHY interface
* @ingroup _oai2
* @{
*/
/*! \brief MACPHY Interface */
typedef struct {
/// Pointer function that initializes L2
int (*macphy_init)(int eMBMS_active, char *uecap_xer, uint8_t CBA_active,uint8_t HO_active);
/// Pointer function that stops the low-level scheduler due an exit condition
void (*macphy_exit)(const char *);
// eNB functions
/// Invoke dlsch/ulsch scheduling procedure for new subframe
void (*eNB_dlsch_ulsch_scheduler)(module_id_t Mod_id,uint8_t cooperation_flag, frame_t frameP, sub_frame_t subframeP);//, int calibration_flag);
/// Fill random access response sdu, passing timing advance
uint16_t (*fill_rar)(module_id_t Mod_id,int CC_id,frame_t frameP,uint8_t *dlsch_buffer,uint16_t N_RB_UL, uint8_t input_buffer_length);
/// Initiate the RA procedure upon reception (hypothetical) of a valid preamble
void (*initiate_ra_proc)(module_id_t Mod_id,int CC_id,frame_t frameP,uint16_t preamble,int16_t timing_offset,uint8_t sect_id,sub_frame_t subframe,uint8_t f_id);
/// cancel an ongoing RA procedure
void (*cancel_ra_proc)(module_id_t Mod_id,int CC_id,frame_t frameP,uint16_t preamble);
/// Inform MAC layer that an uplink is scheduled for Msg3 in given subframe.
/// This is used so that the MAC scheduler marks as busy the RBs used by the Msg3.
void (*set_msg3_subframe)(module_id_t Mod_id,
int CC_id,
int frame,
int subframe,
int rnti,
int Msg3_frame,
int Msg3_subframe);
/// Get DCI for current subframe from MAC
DCI_PDU* (*get_dci_sdu)(module_id_t Mod_id,int CC_id,frame_t frameP,sub_frame_t subframe);
/// Get DLSCH sdu for particular RNTI and Transport block index
uint8_t* (*get_dlsch_sdu)(module_id_t Mod_id,int CC_id,frame_t frameP,rnti_t rnti,uint8_t TB_index);
/// Send ULSCH sdu to MAC for given rnti
void (*rx_sdu)(module_id_t Mod_id,int CC_id,frame_t frameP, sub_frame_t sub_frameP,rnti_t rnti, uint8_t *sdu,uint16_t sdu_len, int harq_pid,uint8_t *msg3_flag);
/// Indicate failure to synch to external source
void (*mrbch_phy_sync_failure) (module_id_t Mod_id,frame_t frameP, uint8_t free_eNB_index);
/// Indicate Scheduling Request from UE
void (*SR_indication)(module_id_t Mod_id,int CC_id,frame_t frameP,rnti_t rnti,sub_frame_t subframe);
/// Indicate UL Failure to eNodeB MAC
void (*UL_failure_indication)(module_id_t Mod_id,int CC_id,frame_t frameP,rnti_t rnti,sub_frame_t subframe);
/// Configure Common PHY parameters from SIB1
void (*phy_config_sib1_eNB)(module_id_t Mod_id,int CC_id,
TDD_Config_t *tdd_config,
uint8_t SIwindowsize,
uint16_t SIperiod);
/// Configure Common PHY parameters from SIB2
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);
#if defined(Rel10) || defined(Rel14)
/// Configure Common PHY parameters from SIB13
void (*phy_config_sib13_eNB)(module_id_t Mod_id,int CC_id, int mbsfn_Area_idx,
long mbsfn_AreaId_r9);
void (*phy_config_dedicated_scell_eNB)(uint8_t Mod_id,
uint16_t rnti,
SCellToAddMod_r10_t *sCellToAddMod_r10,
int CC_id);
#endif
/// PHY-Config-Dedicated eNB
void (*phy_config_dedicated_eNB)(module_id_t Mod_id,int CC_id,rnti_t rnti,
struct PhysicalConfigDedicated *physicalConfigDedicated);
#if defined(Rel10) || defined(Rel14)
/// Get MCH sdu and corresponding MCS for particular MBSFN subframe
MCH_PDU* (*get_mch_sdu)(module_id_t Mod_id, int CC_id, frame_t frameP,sub_frame_t subframe);
#endif
// configure the cba rnti at the physical layer
void (*phy_config_cba_rnti)(module_id_t Mod_id,int CC_id,eNB_flag_t eNB_flag, uint8_t index, uint16_t cba_rnti, uint8_t cba_group_id, uint8_t num_active_cba_groups);
/// get delta mcs for fast UL AMC
int16_t (*estimate_ue_tx_power)(uint32_t tbs, uint32_t nb_rb, uint8_t control_only, lte_prefix_type_t ncp, uint8_t use_srs);
int (*mac_phy_remove_ue)(module_id_t Mod_idP,rnti_t rntiP);
/// UE functions
/// reset the ue phy
void (*phy_reset_ue)(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
/// Indicate loss of synchronization of PBCH for this eNB to MAC layer
void (*out_of_sync_ind)(module_id_t Mod_id,frame_t frameP,uint16_t eNB_index);
/// Send a received SI sdu
void (*ue_decode_si)(module_id_t Mod_id,int CC_id,frame_t frameP, uint8_t CH_index, void *pdu, uint16_t len);
/// Send a received Paging sdu
void (*ue_decode_p)(module_id_t Mod_id,int CC_id,frame_t frameP, uint8_t CH_index, void *pdu, uint16_t len);
/// Send a received DLSCH sdu to MAC
void (*ue_send_sdu)(module_id_t Mod_id,uint8_t CC_id,frame_t frameP,sub_frame_t subframe,uint8_t *sdu,uint16_t sdu_len,uint8_t CH_index);
#if defined(Rel10) || defined(Rel14)
/// Send a received MCH sdu to MAC
void (*ue_send_mch_sdu)(module_id_t Mod_id,uint8_t CC_id, frame_t frameP,uint8_t *sdu,uint16_t sdu_len,uint8_t eNB_index,uint8_t sync_area);
/// Function to check if UE PHY needs to decode MCH for MAC
/// get the sync area id, and return MCS value if need to decode, otherwise -1
int (*ue_query_mch)(module_id_t Mod_id, uint8_t CC_id,frame_t frameP,sub_frame_t subframe,uint8_t eNB_index,uint8_t *sync_area, uint8_t *mcch_active);
#endif
/// Retrieve ULSCH sdu from MAC
void (*ue_get_sdu)(module_id_t Mod_id,int CC_id,frame_t frameP,sub_frame_t subframe, uint8_t CH_index,uint8_t *ulsch_buffer,uint16_t buflen,uint8_t *access_mode);
/// Retrieve RRCConnectionReq from MAC
PRACH_RESOURCES_t* (*ue_get_rach)(module_id_t Mod_id,int CC_id,frame_t frameP,uint8_t Msg3_flag,sub_frame_t subframe);
/// Process Random-Access Response
uint16_t (*ue_process_rar)(module_id_t Mod_id,int CC_id,frame_t frameP, uint16_t ra_rnti, uint8_t *dlsch_buffer, uint16_t *t_crnti,uint8_t preamble_index, uint8_t* selected_rar_buffer);
/// Get SR payload (0,1) from UE MAC
uint32_t (*ue_get_SR)(module_id_t Mod_id,int CC_id,frame_t frameP,uint8_t eNB_id,rnti_t rnti,sub_frame_t subframe);
/// Indicate synchronization with valid PBCH
void (*dl_phy_sync_success) (module_id_t Mod_id,frame_t frameP, uint8_t CH_index,uint8_t first_sync);
/// Only calls the PDCP for now
UE_L2_STATE_t (*ue_scheduler)(module_id_t Mod_id, frame_t rxFrameP,sub_frame_t rxSubframe, frame_t txFrameP,sub_frame_t txSubframe, lte_subframe_t direction, uint8_t eNB_id, int CC_id);
/// PHY-Config-Dedicated UE
void (*phy_config_dedicated_ue)(module_id_t Mod_id,int CC_id,uint8_t CH_index,
struct PhysicalConfigDedicated *physicalConfigDedicated);
/// PHY-Config-harq UE
void (*phy_config_harq_ue)(module_id_t Mod_id,int CC_id,uint8_t CH_index,
uint16_t max_harq_tx);
/// Configure Common PHY parameters from SIB1
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);
/// Configure Common PHY parameters from SIB2
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);
#if defined(Rel10) || defined(Rel14)
/// Configure Common PHY parameters from SIB13
void (*phy_config_sib13_ue)(uint8_t Mod_id,int CC_id, uint8_t eNB_index,int mbsfn_Area_idx,
long mbsfn_AreaId_r9);
void (*phy_config_dedicated_scell_ue)(uint8_t Mod_id,
uint8_t eNB_index,
SCellToAddMod_r10_t *sCellToAddMod_r10,
int CC_id);
#endif
/// Configure Common PHY parameters from mobilityControlInfo
void (*phy_config_afterHO_ue)(module_id_t Mod_id,uint8_t CC_id,uint8_t CH_index,
MobilityControlInfo_t *mobilityControlInfo,
uint8_t ho_failed);
/// Function to indicate failure of contention resolution or RA procedure
void (*ra_failed)(module_id_t Mod_id, uint8_t CC_id,uint8_t eNB_index);
/// Function to indicate success of contention resolution or RA procedure
void (*ra_succeeded)(module_id_t Mod_id,uint8_t CC_id, uint8_t eNB_index);
/// Function to indicate the transmission of msg1/rach to MAC
void (*Msg1_transmitted)(module_id_t Mod_id,uint8_t CC_id,frame_t frameP,uint8_t eNB_id);
/// Function to indicate Msg3 transmission/retransmission which initiates/reset Contention Resolution Timer
void (*Msg3_transmitted)(module_id_t Mod_id,uint8_t CC_id,frame_t frameP,uint8_t eNB_id);
/// Function to pass inter-cell measurement parameters to PHY (cell Ids)
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);
// PHY Helper Functions
/// RIV computation from PHY
uint16_t (*computeRIV)(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs);
/// Downlink TBS table lookup from PHY
uint32_t (*get_TBS_DL)(uint8_t mcs, uint16_t nb_rb);
/// Uplink TBS table lookup from PHY
uint32_t (*get_TBS_UL)(uint8_t mcs, uint16_t nb_rb);
/// Function to retrieve the HARQ round index for a particular UL/DLSCH and harq_pid
int (*get_ue_active_harq_pid)(module_id_t Mod_id, uint8_t CC_id,rnti_t rnti, int frame, uint8_t subframe, uint8_t *harq_pid, uint8_t *round, uint8_t ul_flag);
/// Function to retrieve number of CCE
uint16_t (*get_nCCE_max)(module_id_t Mod_id,uint8_t CC_id,int num_pdcch_symbols,int subframe);
int (*get_nCCE_offset)(int *CCE_table,
const unsigned char L,
const int nCCE,
const int common_dci,
const unsigned short rnti,
const unsigned char subframe);
/// Function to retrieve number of PRB in an rb_alloc
uint32_t (*get_nb_rb)(uint8_t ra_header, uint32_t rb_alloc, int n_rb_dl);
/// Function to convert VRB to PRB for distributed allocation
uint32_t (*get_prb)(int N_RB_DL,int odd_slot,int vrb,int Ngap);
/// Function to retrieve transmission mode for UE
uint8_t (*get_transmission_mode)(module_id_t Mod_id,uint8_t CC_id,rnti_t rnti);
/// Function to retrieve rb_alloc bitmap from dci rballoc field and VRB type
uint32_t (*get_rballoc)(vrb_t vrb_type, uint16_t rb_alloc_dci);
/// Function for UE MAC to retrieve current PHY connectivity mode (PRACH,RA_RESPONSE,PUSCH)
UE_MODE_t (*get_ue_mode)(module_id_t Mod_id, uint8_t CC_id,uint8_t eNB_index);
/// Function for UE MAC to retrieve measured Path Loss
int16_t (*get_PL)(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
/// Function for UE MAC to retrieve the rssi
uint32_t (*get_RSSI)(uint8_t Mod_id,uint8_t CC_id);
/// Function for UE MAC to retrieve the total gain
uint32_t (*get_rx_total_gain_dB)(uint8_t Mod_id,uint8_t CC_id);
/// Function for UE MAC to retrieve the number of adjustent cells
uint8_t (*get_n_adj_cells)(uint8_t Mod_id,uint8_t CC_id);
/// Function for UE MAC to retrieve RSRP/RSRQ measurements
uint32_t (*get_RSRP)(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
/// Function for UE MAC to retrieve RSRP/RSRQ measurements
uint32_t (*get_RSRQ)(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
/// Function for UE MAC to set the layer3 filtered RSRP/RSRQ measurements
uint8_t (*set_RSRP_filtered)(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rsrp);
/// Function for UE MAC to set the layer3 filtered RSRP/RSRQ measurements
uint8_t (*set_RSRQ_filtered)(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rsrp);
/// Function for UE/eNB MAC to retrieve number of PRACH in TDD
uint8_t (*get_num_prach_tdd)(LTE_DL_FRAME_PARMS *frame_parms);
/// Function for UE/eNB MAC to retrieve f_id of particular PRACH resource in TDD
uint8_t (*get_fid_prach_tdd)(LTE_DL_FRAME_PARMS *frame_parms,uint8_t tdd_map_index);
/// Function for eNB MAC to retrieve subframe direction
lte_subframe_t (*get_subframe_direction)(module_id_t Mod_id, uint8_t CC_id, uint8_t subframe);
// MAC Helper functions
/// Function for UE/PHY to compute PUSCH transmit power in power-control procedure (Po_NOMINAL_PUSCH parameter)
int8_t (*get_Po_NOMINAL_PUSCH)(module_id_t Mod_id,uint8_t CC_id);
/// Function for UE/PHY to compute PUSCH transmit power in power-control procedure (deltaP_rampup parameter)
int8_t (*get_deltaP_rampup)(module_id_t Mod_id,uint8_t CC_id);
/// Function for UE/PHY to compute PHR
int8_t (*get_PHR)(module_id_t Mod_id, uint8_t CC_id,uint8_t eNB_index);
/// Function for UE to process the timing advance command
void (*process_timing_advance)(module_id_t Mod_id,uint8_t CC_id, int16_t timing_advance);
/// Function for MAC to get the UE stats from the PHY
LTE_eNB_UE_stats* (*get_eNB_UE_stats)(module_id_t Mod_id, uint8_t CC_id, rnti_t rnti);
/// get the frame parameters from the PHY
LTE_DL_FRAME_PARMS* (*get_lte_frame_parms)(module_id_t Mod_id, uint8_t CC_id);
/// get the Multiuser mimo mode
MU_MIMO_mode* (*get_mu_mimo_mode) (module_id_t Mod_id, uint8_t CC_id, rnti_t rnti);
/// get the delta TF for Uplink Power Control Calculation
int16_t (*get_hundred_times_delta_TF) (module_id_t module_idP, uint8_t CC_id, rnti_t rnti, uint8_t harq_pid);
/// get target PUSCH received power
int16_t (*get_target_pusch_rx_power) (module_id_t module_idP, uint8_t CC_id);
/// get target PUSCH received power
int16_t (*get_target_pucch_rx_power) (module_id_t module_idP, uint8_t CC_id);
unsigned char is_cluster_head;
unsigned char is_primary_cluster_head;
unsigned char is_secondary_cluster_head;
unsigned char cluster_head_index;
/// PHY Frame Configuration
LTE_DL_FRAME_PARMS *frame_parms;
uint8_t (*get_prach_prb_offset)(LTE_DL_FRAME_PARMS *frame_parms, uint8_t tdd_mapindex, uint16_t Nf);
int (*is_prach_subframe)(LTE_DL_FRAME_PARMS *frame_parms,frame_t frame, uint8_t subframe);
/// ICIC algos
uint8_t (*get_SB_size)(uint8_t n_rb_dl);
///end ALU's algo
} MAC_xface;
#endif
/** @} */
......@@ -36,7 +36,7 @@
//typedef char bool;
#include <stdbool.h>
#include "omg_constants.h"
#ifdef STANDALONE
typedef struct {
char *name; /*!< \brief string name of item */
......
......@@ -37,6 +37,8 @@
//#include "PHY_INTERFACE/extern.h"
#include "../../../openair1/PHY/defs_eNB.h"
#include "../../../openair1/PHY/defs_common.h"
#include "../../../openair1/PHY/vars.h"
#include "../../../openair1/PHY/phy_vars.h"
PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t eNB_id,
......@@ -92,9 +94,7 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
LOG_I(PHY,"Allocating Transport Channel Buffer for ULSCH, UE %d\n", i);
PHY_vars_eNB->ulsch[1+i] = new_eNB_ulsch(MAX_TURBO_ITERATIONS,frame_parms->N_RB_UL, abstraction_flag);
//////////////// NB-IoT testing ////////////////////////////
PHY_vars_eNB->ulsch_NB_IoT[1+i] = new_eNB_ulsch_NB_IoT(MAX_TURBO_ITERATIONS,frame_parms->N_RB_UL, abstraction_flag);
//////////////////////////////////////////////////////////////
if (!PHY_vars_eNB->ulsch[1+i]) {
LOG_E(PHY,"Can't get eNB ulsch structures\n");
exit(-1);
......@@ -128,18 +128,13 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
// ULSCH for RA
PHY_vars_eNB->ulsch[0] = new_eNB_ulsch(MAX_TURBO_ITERATIONS, frame_parms->N_RB_UL, abstraction_flag);
//////////////// NB-IoT testing ////////////////////////////
PHY_vars_eNB->ulsch_NB_IoT[0] = new_eNB_ulsch_NB_IoT(MAX_TURBO_ITERATIONS, frame_parms->N_RB_UL, abstraction_flag);
////////////////////////////////////////////////////////////
if (!PHY_vars_eNB->ulsch[0]) {
LOG_E(PHY,"Can't get eNB ulsch structures\n");
exit(-1);
}
if (!PHY_vars_eNB->ulsch_NB_IoT[0]) {
LOG_E(PHY,"Can't get eNB ulsch structures\n");
exit(-1);
}
PHY_vars_eNB->dlsch_SI = new_eNB_dlsch(1,8,NSOFT,frame_parms->N_RB_DL, abstraction_flag, frame_parms);
LOG_D(PHY,"eNB %d : SI %p\n",eNB_id,PHY_vars_eNB->dlsch_SI);
PHY_vars_eNB->dlsch_ra = new_eNB_dlsch(1,8,NSOFT,frame_parms->N_RB_DL, abstraction_flag, frame_parms);
......@@ -147,26 +142,8 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
PHY_vars_eNB->dlsch_MCH = new_eNB_dlsch(1,8,NSOFT,frame_parms->N_RB_DL, 0, frame_parms);
LOG_D(PHY,"eNB %d : MCH %p\n",eNB_id,PHY_vars_eNB->dlsch_MCH);
///// NB-IoT ////////////
PHY_vars_eNB->ndlsch_SIB1 = new_eNB_dlsch_NB_IoT(1,frame_parms); // frame_parms is not used , to be removed is not used in futur
PHY_vars_eNB->ndlsch_SIB23 = new_eNB_dlsch_NB_IoT(1,frame_parms);
PHY_vars_eNB->ndlsch_RAR = new_eNB_dlsch_NB_IoT(1,frame_parms);
PHY_vars_eNB->npdcch_DCI = new_eNB_dlcch_NB_IoT(frame_parms);
PHY_vars_eNB->UL_INFO.nrach_ind.nrach_pdu_list = (nfapi_nrach_indication_pdu_t *)malloc16(sizeof(nfapi_nrach_indication_pdu_t));
PHY_vars_eNB->UL_INFO.crc_ind.crc_pdu_list = (nfapi_crc_indication_pdu_t *)malloc16(sizeof(nfapi_crc_indication_pdu_t));
PHY_vars_eNB->UL_INFO.RX_NPUSCH.rx_pdu_list = (nfapi_rx_indication_pdu_t *)malloc16(sizeof(nfapi_rx_indication_pdu_t));
PHY_vars_eNB->UL_INFO.RX_NPUSCH.rx_pdu_list[0].data = (unsigned char*)malloc(300);
PHY_vars_eNB->UL_INFO.nb_harq_ind.nb_harq_indication_body.nb_harq_pdu_list = (nfapi_nb_harq_indication_pdu_t*)malloc16(sizeof(nfapi_nb_harq_indication_pdu_t));
//nfapi_nb_harq_indication_t nb_harq_ind
PHY_vars_eNB->ndlsch_SIB1->rnti = 0xffff;
PHY_vars_eNB->ndlsch_SIB23->rnti = 0xffff;
PHY_vars_eNB->rx_total_gain_dB=130;
for(i=0; i<NUMBER_OF_UE_MAX; i++)
......@@ -242,6 +219,13 @@ PHY_VARS_eNB_NB_IoT* init_lte_eNB_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,
LOG_I(PHY,"Allocating Transport Channel Buffer for ULSCH, UE %d\n", i);
PHY_vars_eNB->ulsch[1+i] = new_eNB_ulsch(MAX_TURBO_ITERATIONS,frame_parms->N_RB_UL, abstraction_flag);
//////////////// NB-IoT testing ////////////////////////////
PHY_vars_eNB->ulsch_NB_IoT[1+i] = new_eNB_ulsch_NB_IoT(MAX_TURBO_ITERATIONS,frame_parms->N_RB_UL, abstraction_flag);
//////////////////////////////////////////////////////////////
//////////////// NB-IoT testing ////////////////////////////
PHY_vars_eNB->ulsch_NB_IoT[0] = new_eNB_ulsch_NB_IoT(MAX_TURBO_ITERATIONS, frame_parms->N_RB_UL, abstraction_flag);
////////////////////////////////////////////////////////////
if (!PHY_vars_eNB->ulsch[1+i]) {
LOG_E(PHY,"Can't get eNB ulsch structures\n");
exit(-1);
......@@ -290,7 +274,25 @@ PHY_VARS_eNB_NB_IoT* init_lte_eNB_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,
PHY_vars_eNB->dlsch_MCH = new_eNB_dlsch(1,8,NSOFT,frame_parms->N_RB_DL, 0, frame_parms);
LOG_D(PHY,"eNB %d : MCH %p\n",eNB_id,PHY_vars_eNB->dlsch_MCH);
*/
///// NB-IoT ////////////
PHY_vars_eNB->ndlsch_SIB1 = new_eNB_dlsch_NB_IoT(1,frame_parms); // frame_parms is not used , to be removed is not used in futur
PHY_vars_eNB->ndlsch_SIB23 = new_eNB_dlsch_NB_IoT(1,frame_parms);
PHY_vars_eNB->ndlsch_RAR = new_eNB_dlsch_NB_IoT(1,frame_parms);
PHY_vars_eNB->npdcch_DCI = new_eNB_dlcch_NB_IoT(frame_parms);
PHY_vars_eNB->UL_INFO.nrach_ind.nrach_pdu_list = (nfapi_nrach_indication_pdu_t *)malloc16(sizeof(nfapi_nrach_indication_pdu_t));
PHY_vars_eNB->UL_INFO.crc_ind.crc_pdu_list = (nfapi_crc_indication_pdu_t *)malloc16(sizeof(nfapi_crc_indication_pdu_t));
PHY_vars_eNB->UL_INFO.RX_NPUSCH.rx_pdu_list = (nfapi_rx_indication_pdu_t *)malloc16(sizeof(nfapi_rx_indication_pdu_t));
PHY_vars_eNB->UL_INFO.RX_NPUSCH.rx_pdu_list[0].data = (unsigned char*)malloc(300);
PHY_vars_eNB->UL_INFO.nb_harq_ind.nb_harq_indication_body.nb_harq_pdu_list = (nfapi_nb_harq_indication_pdu_t*)malloc16(sizeof(nfapi_nb_harq_indication_pdu_t));
//nfapi_nb_harq_indication_t nb_harq_ind
PHY_vars_eNB->ndlsch_SIB1->rnti = 0xffff;
PHY_vars_eNB->ndlsch_SIB23->rnti = 0xffff;
PHY_vars_eNB->rx_total_gain_dB=130;
/* for(i=0; i<NUMBER_OF_UE_MAX; i++)
......
......@@ -857,7 +857,7 @@ static void *process_stats_thread(void *param) {
void init_eNB_proc(int inst) {
/*int i=0;*/
int CC_id;
PHY_VARS_eNB *eNB;
//PHY_VARS_eNB *eNB;
// PHY_VARS_eNB_NB_IoT *eNB_NB_IoT;//Ann
eNBs_t *eNBs;//Ann
L1_proc_t *proc;
......@@ -867,14 +867,14 @@ void init_eNB_proc(int inst) {
pthread_attr_t *attr_prach_br=NULL;
#endif
LOG_I(PHY,"%s(inst:%d) RC.nb_CC[inst]:%d \n",__FUNCTION__,inst,RC.nb_CC[inst]);
eNBs->eNB_NB_IoT = RC.L1_NB_IoT[inst];//[CC_id];//Ann
eNBs->eNB_NB_IoT = RC.L1_NB_IoT[inst];//Ann
for (CC_id=0; CC_id<RC.nb_CC[inst]; CC_id++) {
eNBs->eNB = RC.eNB[inst][CC_id];
#ifndef OCP_FRAMEWORK
LOG_I(PHY,"Initializing eNB processes instance:%d CC_id %d \n",inst,CC_id);
#endif
proc = &eNB->proc;
proc = &eNBs->eNB->proc;
L1_proc = &proc->L1_proc;
L1_proc_tx = &proc->L1_proc_tx;
L1_proc->instance_cnt = -1;
......@@ -887,10 +887,10 @@ void init_eNB_proc(int inst) {
proc->CC_id = CC_id;
proc->first_rx =1;
proc->first_tx =1;
proc->RU_mask_tx = (1<<eNB->num_RU)-1;
proc->RU_mask_tx = (1<<eNBs->eNB->num_RU)-1;
memset((void*)proc->RU_mask,0,10*sizeof(proc->RU_mask[0]));
proc->RU_mask_prach =0;
pthread_mutex_init( &eNB->UL_INFO_mutex, NULL);
pthread_mutex_init( &eNBs->eNB->UL_INFO_mutex, NULL);
pthread_mutex_init( &L1_proc->mutex, NULL);
pthread_mutex_init( &L1_proc_tx->mutex, NULL);
pthread_cond_init( &L1_proc->cond, NULL);
......@@ -930,11 +930,11 @@ void init_eNB_proc(int inst) {
#endif
if(get_thread_worker_conf() == WORKER_ENABLE) {
init_te_thread(eNB);
init_td_thread(eNB);
init_te_thread(eNBs->eNB);
init_td_thread(eNBs->eNB);
}
LOG_I(PHY,"eNB->single_thread_flag:%d\n", eNB->single_thread_flag);
LOG_I(PHY,"eNBs->eNB->single_thread_flag:%d\n", eNBs->eNB->single_thread_flag);
if ((get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT) && NFAPI_MODE!=NFAPI_MODE_VNF) {
pthread_create( &L1_proc->pthread, attr0, L1_thread, proc );
......@@ -952,26 +952,26 @@ void init_eNB_proc(int inst) {
if (NFAPI_MODE!=NFAPI_MODE_VNF) {
pthread_create( &proc->pthread_prach, attr_prach, eNB_thread_prach, eNBs );
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
pthread_create( &proc->pthread_prach_br, attr_prach_br, eNB_thread_prach_br, eNB );
pthread_create( &proc->pthread_prach_br, attr_prach_br, eNB_thread_prach_br, eNBs->eNB );
#endif
}
AssertFatal(proc->instance_cnt_prach == -1,"instance_cnt_prach = %d\n",proc->instance_cnt_prach);
if (opp_enabled == 1) pthread_create(&proc->process_stats_thread,NULL,process_stats_thread,(void *)eNB);
if (opp_enabled == 1) pthread_create(&proc->process_stats_thread,NULL,process_stats_thread,(void *)eNBs->eNB);
}
//for multiple CCs: setup master and slaves
/*
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
eNB = PHY_vars_eNB_g[inst][CC_id];
eNBs->eNB = PHY_vars_eNB_g[inst][CC_id];
if (eNB->node_timing == synch_to_ext_device) { //master
eNB->proc.num_slaves = MAX_NUM_CCs-1;
eNB->proc.slave_proc = (L1_proc_t**)malloc(eNB->proc.num_slaves*sizeof(L1_proc_t*));
if (eNBs->eNB->node_timing == synch_to_ext_device) { //master
eNBs->eNB->proc.num_slaves = MAX_NUM_CCs-1;
eNBs->eNB->proc.slave_proc = (L1_proc_t**)malloc(eNBs->eNB->proc.num_slaves*sizeof(L1_proc_t*));
for (i=0; i< eNB->proc.num_slaves; i++) {
if (i < CC_id) eNB->proc.slave_proc[i] = &(PHY_vars_eNB_g[inst][i]->proc);
if (i >= CC_id) eNB->proc.slave_proc[i] = &(PHY_vars_eNB_g[inst][i+1]->proc);
for (i=0; i< eNBs->eNB->proc.num_slaves; i++) {
if (i < CC_id) eNBs->eNB->proc.slave_proc[i] = &(PHY_vars_eNB_g[inst][i]->proc);
if (i >= CC_id) eNBs->eNB->proc.slave_proc[i] = &(PHY_vars_eNB_g[inst][i+1]->proc);
}
}
}
......
......@@ -122,7 +122,7 @@ int UE_scan_carrier = 0;
runmode_t mode = normal_txrx;
FILE *input_fd=NULL;
static char UE_flag=0;
#if MAX_NUM_CCs == 1
rx_gain_t rx_gain_mode[MAX_NUM_CCs][4] = {{max_gain,max_gain,max_gain,max_gain}};
......@@ -152,7 +152,7 @@ char channels[128] = "0";
int rx_input_level_dBm;
int otg_enabled;
static int tx_max_power[MAX_NUM_CCs]; /* = {0,0}*/;
uint8_t exit_missed_slots=1;
uint64_t num_missed_slots=0; // counter for the number of missed slots
......@@ -541,11 +541,12 @@ static void wait_nfapi_init(char *thread_name) {
}
int main( int argc, char **argv ) {
int i,j,k,aa,re;
int i,j,k,re;
int CC_id;
int ru_id;
int node_type = ngran_eNB;
uint8_t beta_ACK=0,beta_RI=0,beta_CQI=2;
PHY_VARS_UE *UE[MAX_NUM_CCs];
if ( load_configmodule(argc,argv,0) == NULL) {
exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
......@@ -630,8 +631,126 @@ int main( int argc, char **argv ) {
} else {
printf("RC.nb_inst = 0, Initializing L1\n");
RCconfig_L1();
RCconfig_NbIoTL1();
}
// init the parameters
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
if (UE_flag==1) {
frame_parms[CC_id]->nb_antennas_tx = nb_antenna_tx;
frame_parms[CC_id]->nb_antennas_rx = nb_antenna_rx;
frame_parms[CC_id]->nb_antenna_ports_eNB = 1; //initial value overwritten by initial sync later
LOG_I(PHY,"Set nb_rx_antenna %d , nb_tx_antenna %d \n",frame_parms[CC_id]->nb_antennas_rx, frame_parms[CC_id]->nb_antennas_tx);
//#ifdef NB_IOT /////////////// for NB-IoT testing ///////////////////////////
frame_parms_NB_IoT[CC_id]->nb_antennas_tx = nb_antenna_tx;
frame_parms_NB_IoT[CC_id]->nb_antennas_rx = nb_antenna_rx;
frame_parms_NB_IoT[CC_id]->nb_antenna_ports_eNB = 1; //initial value overwritten by initial sync later
LOG_I(PHY,"[NB-IoT] Set nb_rx_antenna %d , nb_tx_antenna %d \n",frame_parms_NB_IoT[CC_id]->nb_antennas_rx, frame_parms_NB_IoT[CC_id]->nb_antennas_tx);
//#endif //////////////////////////// END //////////////////////////////////
}
//XXXX we need to modify it for NB-IoT????
init_ul_hopping(frame_parms[CC_id]);
init_frame_parms(frame_parms[CC_id],1);
// phy_init_top(frame_parms[CC_id]);
phy_init_lte_top(frame_parms[CC_id]);
// for testing
//XXXX we need to modify it for NB-IoT????
//init_ul_hopping(frame_parms[CC_id]);
/////////////////////////////////////////////////////// NB-IoT ////////////////////////////////////////////////////////
init_frame_parms_NB_IoT(frame_parms_NB_IoT[CC_id],1);
// phy_init_top(frame_parms[CC_id]);
phy_init_lte_top_NB_IoT(frame_parms_NB_IoT[CC_id]);
/////////////////////////////////////////////////////// END //////////////////////////////////////////////////////////
}
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
//init prach for openair1 test
// prach_fmt = get_prach_fmt(frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex, frame_parms->frame_type);
// N_ZC = (prach_fmt <4)?839:139;
}
if (UE_flag==1) {
NB_UE_INST=1;
NB_INST=1;
PHY_vars_UE_g = malloc(sizeof(PHY_VARS_UE**));
PHY_vars_UE_g[0] = malloc(sizeof(PHY_VARS_UE*)*MAX_NUM_CCs);
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
PHY_vars_UE_g[0][CC_id] = init_lte_UE(frame_parms[CC_id], 0,abstraction_flag);
UE[CC_id] = PHY_vars_UE_g[0][CC_id];
printf("PHY_vars_UE_g[0][%d] = %p\n",CC_id,UE[CC_id]);
if (phy_test==1)
UE[CC_id]->mac_enabled = 0;
else
UE[CC_id]->mac_enabled = 1;
if (UE[CC_id]->mac_enabled == 0) { //set default UL parameters for testing mode
for (i=0; i<NUMBER_OF_CONNECTED_eNB_MAX; i++) {
UE[CC_id]->pusch_config_dedicated[i].betaOffset_ACK_Index = beta_ACK;
UE[CC_id]->pusch_config_dedicated[i].betaOffset_RI_Index = beta_RI;
UE[CC_id]->pusch_config_dedicated[i].betaOffset_CQI_Index = beta_CQI;
UE[CC_id]->scheduling_request_config[i].sr_PUCCH_ResourceIndex = 0;
UE[CC_id]->scheduling_request_config[i].sr_ConfigIndex = 7+(0%3);
UE[CC_id]->scheduling_request_config[i].dsr_TransMax = sr_n4;
}
}
UE[CC_id]->UE_scan = UE_scan;
UE[CC_id]->UE_scan_carrier = UE_scan_carrier;
UE[CC_id]->mode = mode;
printf("UE[%d]->mode = %d\n",CC_id,mode);
compute_prach_seq(&UE[CC_id]->frame_parms.prach_config_common,
UE[CC_id]->frame_parms.frame_type,
UE[CC_id]->X_u);
if (UE[CC_id]->mac_enabled == 1)
{
UE[CC_id]->pdcch_vars[0][0]->crnti = 0x1234;
UE[CC_id]->pdcch_vars[1][0]->crnti = 0x1234;
}
else
{
UE[CC_id]->pdcch_vars[0][0]->crnti = 0x1235;
UE[CC_id]->pdcch_vars[1][0]->crnti = 0x1235;
}
UE[CC_id]->rx_total_gain_dB = (int)rx_gain[CC_id][0] + rx_gain_off;
UE[CC_id]->tx_power_max_dBm = tx_max_power[CC_id];
if (frame_parms[CC_id]->frame_type==FDD) {
UE[CC_id]->N_TA_offset = 0;
} else {
if (frame_parms[CC_id]->N_RB_DL == 100)
UE[CC_id]->N_TA_offset = 624;
else if (frame_parms[CC_id]->N_RB_DL == 50)
UE[CC_id]->N_TA_offset = 624/2;
else if (frame_parms[CC_id]->N_RB_DL == 25)
UE[CC_id]->N_TA_offset = 624/4;
}
}
// printf("tx_max_power = %d -> amp %d\n",tx_max_power,get_tx_amp(tx_max_poHwer,tx_max_power));
} else {
/////////////////////////////////////////////////// this is eNB /////////////////////////////////////////////////////////////
PHY_vars_eNB_g = malloc(sizeof(PHY_VARS_eNB**)); //global PHY_vars --> is a matrix
PHY_vars_eNB_g[0] = malloc(sizeof(PHY_VARS_eNB*));
......@@ -647,7 +766,7 @@ int main( int argc, char **argv ) {
PHY_vars_eNB_g[0][CC_id] = init_lte_eNB(frame_parms[CC_id],0,frame_parms[CC_id]->Nid_cell,node_function[CC_id],abstraction_flag);
// for NB-IoT testing
PHY_vars_eNB_NB_IoT_g[0] = init_lte_eNB_NB_IoT(frame_parms_NB_IoT,0,frame_parms_NB_IoT->Nid_cell,node_function_NB_IoT,abstraction_flag);
PHY_vars_eNB_NB_IoT_g[0][0] = init_lte_eNB_NB_IoT(frame_parms_NB_IoT[0],0,frame_parms_NB_IoT[0]->Nid_cell,node_function_NB_IoT[0],abstraction_flag);
//this is a complementary function for just initialize manage NB_ioT stuff inside the PHY_Vars
#ifdef NB_IOT
......@@ -687,18 +806,18 @@ int main( int argc, char **argv ) {
// for NB-IoT testing
if (phy_test==1) PHY_vars_eNB_NB_IoT_g[0]->mac_enabled = 0;
else PHY_vars_eNB_NB_IoT_g[0]->mac_enabled = 1;
if (phy_test==1) PHY_vars_eNB_NB_IoT_g[0][0]->mac_enabled = 0;
else PHY_vars_eNB_NB_IoT_g[0][0]->mac_enabled = 1;
if (PHY_vars_eNB_NB_IoT_g[0]->mac_enabled == 0) { //set default parameters for testing mode
if (PHY_vars_eNB_NB_IoT_g[0][0]->mac_enabled == 0) { //set default parameters for testing mode
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
PHY_vars_eNB_NB_IoT_g[0]->pusch_config_dedicated[i].betaOffset_ACK_Index = beta_ACK;
PHY_vars_eNB_NB_IoT_g[0]->pusch_config_dedicated[i].betaOffset_RI_Index = beta_RI;
PHY_vars_eNB_NB_IoT_g[0]->pusch_config_dedicated[i].betaOffset_CQI_Index = beta_CQI;
PHY_vars_eNB_NB_IoT_g[0][0]->pusch_config_dedicated[i].betaOffset_ACK_Index = beta_ACK;
PHY_vars_eNB_NB_IoT_g[0][0]->pusch_config_dedicated[i].betaOffset_RI_Index = beta_RI;
PHY_vars_eNB_NB_IoT_g[0][0]->pusch_config_dedicated[i].betaOffset_CQI_Index = beta_CQI;
PHY_vars_eNB_NB_IoT_g[0]->scheduling_request_config[i].sr_PUCCH_ResourceIndex = i;
PHY_vars_eNB_NB_IoT_g[0]->scheduling_request_config[i].sr_ConfigIndex = 7+(i%3);
PHY_vars_eNB_NB_IoT_g[0]->scheduling_request_config[i].dsr_TransMax = sr_n4;
PHY_vars_eNB_NB_IoT_g[0][0]->scheduling_request_config[i].sr_PUCCH_ResourceIndex = i;
PHY_vars_eNB_NB_IoT_g[0][0]->scheduling_request_config[i].sr_ConfigIndex = 7+(i%3);
PHY_vars_eNB_NB_IoT_g[0][0]->scheduling_request_config[i].dsr_TransMax = sr_n4;
}
}
......@@ -723,21 +842,28 @@ int main( int argc, char **argv ) {
// for NB-IoT testing
PHY_vars_eNB_NB_IoT_g[0]->rx_total_gain_dB = (int)rx_gain[CC_id][0];
PHY_vars_eNB_NB_IoT_g[0][0]->rx_total_gain_dB = (int)rx_gain[0][0];
if (frame_parms_NB_IoT[CC_id]->frame_type==FDD) {
PHY_vars_eNB_NB_IoT_g[0]->N_TA_offset = 0;
if (frame_parms_NB_IoT[0]->frame_type==FDD) {
PHY_vars_eNB_NB_IoT_g[0][0]->N_TA_offset = 0;
} else {
if (frame_parms_NB_IoT[CC_id]->N_RB_DL == 100)
PHY_vars_eNB_NB_IoT_g[0]->N_TA_offset = 624;
else if (frame_parms_NB_IoT[CC_id]->N_RB_DL == 50)
PHY_vars_eNB_NB_IoT_g[0]->N_TA_offset = 624/2;
else if (frame_parms_NB_IoT[CC_id]->N_RB_DL == 25)
PHY_vars_eNB_NB_IoT_g[0]->N_TA_offset = 624/4;
if (frame_parms_NB_IoT[0]->N_RB_DL == 100)
PHY_vars_eNB_NB_IoT_g[0][0]->N_TA_offset = 624;
else if (frame_parms_NB_IoT[0]->N_RB_DL == 50)
PHY_vars_eNB_NB_IoT_g[0][0]->N_TA_offset = 624/2;
else if (frame_parms_NB_IoT[0]->N_RB_DL == 25)
PHY_vars_eNB_NB_IoT_g[0][0]->N_TA_offset = 624/4;
}
}
NB_eNB_INST=1;
NB_INST=1;
}
if (RC.nb_inst > 0 && NODE_IS_CU(node_type)) {
protocol_ctxt_t ctxt;
ctxt.module_id = 0 ;
......
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