mirror of
https://gitlab.eurecom.fr/oai/openairinterface5g.git
synced 2026-07-21 00:20:30 +00:00
Compare commits
4 Commits
ue_calibra
...
fr2-meas
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd7a0646c8 | ||
|
|
4e5a230022 | ||
|
|
b261ebcd09 | ||
|
|
d202b550b4 |
@@ -104,6 +104,16 @@ char *uecap_file;
|
||||
|
||||
runmode_t mode = normal_txrx;
|
||||
|
||||
#if MAX_NUM_CCs == 1
|
||||
double tx_gain[MAX_NUM_CCs][4] = {{20,0,0,0}};
|
||||
double rx_gain[MAX_NUM_CCs][4] = {{110,0,0,0}};
|
||||
#else
|
||||
double tx_gain[MAX_NUM_CCs][4] = {{20,0,0,0},{20,0,0,0}};
|
||||
double rx_gain[MAX_NUM_CCs][4] = {{110,0,0,0},{20,0,0,0}};
|
||||
#endif
|
||||
|
||||
double rx_gain_off = 0.0;
|
||||
|
||||
static int tx_max_power[MAX_NUM_CCs]; /* = {0,0}*/;
|
||||
int chain_offset = 0;
|
||||
int emulate_rf = 0;
|
||||
|
||||
@@ -116,6 +116,8 @@ int oai_exit = 0;
|
||||
|
||||
static int tx_max_power[MAX_NUM_CCs] = {0};
|
||||
|
||||
double rx_gain_off = 0.0;
|
||||
|
||||
uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
||||
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||
uint64_t sidelink_frequency[MAX_NUM_CCs][4];
|
||||
@@ -209,7 +211,7 @@ void set_options(int CC_id, PHY_VARS_NR_UE *UE){
|
||||
NR_DL_FRAME_PARMS *fp = &UE->frame_parms;
|
||||
|
||||
// Set UE variables
|
||||
UE->rx_total_gain_dB = (int)nrUE_params.rx_gain;
|
||||
UE->rx_total_gain_dB = (int)nrUE_params.rx_gain + rx_gain_off;
|
||||
UE->tx_total_gain_dB = (int)nrUE_params.tx_gain;
|
||||
UE->tx_power_max_dBm = nrUE_params.tx_max_power;
|
||||
UE->rf_map.card = 0;
|
||||
@@ -284,7 +286,7 @@ void init_openair0()
|
||||
|
||||
nr_rf_card_config_freq(&openair0_cfg[card], ul_carrier, dl_carrier, freq_off);
|
||||
|
||||
nr_rf_card_config_gain(&openair0_cfg[card], 0);
|
||||
nr_rf_card_config_gain(&openair0_cfg[card], rx_gain_off);
|
||||
|
||||
openair0_cfg[card].configFilename = get_softmodem_params()->rf_config_file;
|
||||
|
||||
|
||||
@@ -490,6 +490,8 @@ void init_nr_transport(PHY_VARS_gNB *gNB)
|
||||
gNB->ulsch[i] = new_gNB_ulsch(gNB->max_ldpc_iterations, fp->N_RB_UL);
|
||||
}
|
||||
|
||||
gNB->rx_total_gain_dB=130;
|
||||
|
||||
//fp->pucch_config_common.deltaPUCCH_Shift = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB, int slot, int first_symb, int num_sy
|
||||
}
|
||||
n0_subband_tot_perPRB/=frame_parms->nb_antennas_rx;
|
||||
measurements->n0_subband_power_tot_dB[rb] = dB_fixed(n0_subband_tot_perPRB);
|
||||
measurements->n0_subband_power_tot_dBm[rb] = measurements->n0_subband_power_tot_dB[rb] - 130 /* was hardcoded in rx_total_gain_dB */ - dB_fixed(frame_parms->N_RB_UL);
|
||||
measurements->n0_subband_power_tot_dBm[rb] = measurements->n0_subband_power_tot_dB[rb] - gNB->rx_total_gain_dB - dB_fixed(frame_parms->N_RB_UL);
|
||||
LOG_D(NR_PHY,"n0_subband_power_tot_dB[%d] => %d, over %d symbols\n",rb,measurements->n0_subband_power_tot_dB[rb],nb_symb[rb]);
|
||||
n0_subband_tot += n0_subband_tot_perPRB;
|
||||
nb_rb++;
|
||||
|
||||
@@ -146,8 +146,9 @@ void nr_pdsch_ptrs_processing(PHY_VARS_NR_UE *ue,
|
||||
uint16_t rnti,
|
||||
NR_UE_DLSCH_t dlsch[2]);
|
||||
|
||||
int nr_sl_psbch_rsrp_measurements(PHY_VARS_NR_UE *ue,
|
||||
sl_nr_ue_phy_params_t *sl_phy_params,
|
||||
float_t get_nr_RSRP(module_id_t Mod_id,uint8_t CC_id,uint8_t gNB_index);
|
||||
|
||||
int nr_sl_psbch_rsrp_measurements(sl_nr_ue_phy_params_t *sl_phy_params,
|
||||
NR_DL_FRAME_PARMS *fp,
|
||||
c16_t rxdataF[][fp->samples_per_slot_wCP],
|
||||
bool use_SSS);
|
||||
|
||||
@@ -42,6 +42,38 @@
|
||||
#define k1 ((long long int) 1000)
|
||||
#define k2 ((long long int) (1024-k1))
|
||||
|
||||
//#define DEBUG_MEAS_RRC
|
||||
//#define DEBUG_MEAS_UE
|
||||
//#define DEBUG_RANK_EST
|
||||
|
||||
uint32_t get_nr_rx_total_gain_dB (module_id_t Mod_id,uint8_t CC_id)
|
||||
{
|
||||
|
||||
PHY_VARS_NR_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
|
||||
|
||||
if (ue)
|
||||
return ue->rx_total_gain_dB;
|
||||
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
|
||||
float_t get_nr_RSRP(module_id_t Mod_id,uint8_t CC_id,uint8_t gNB_index)
|
||||
{
|
||||
|
||||
AssertFatal(PHY_vars_UE_g!=NULL,"PHY_vars_UE_g is null\n");
|
||||
AssertFatal(PHY_vars_UE_g[Mod_id]!=NULL,"PHY_vars_UE_g[%d] is null\n",Mod_id);
|
||||
AssertFatal(PHY_vars_UE_g[Mod_id][CC_id]!=NULL,"PHY_vars_UE_g[%d][%d] is null\n",Mod_id,CC_id);
|
||||
|
||||
PHY_VARS_NR_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
|
||||
|
||||
if (ue)
|
||||
return (10*log10(ue->measurements.rsrp[gNB_index])-
|
||||
get_nr_rx_total_gain_dB(Mod_id,0) -
|
||||
10*log10(20*12));
|
||||
return -140.0;
|
||||
}
|
||||
|
||||
void nr_ue_measurements(PHY_VARS_NR_UE *ue,
|
||||
const UE_nr_rxtx_proc_t *proc,
|
||||
NR_UE_DLSCH_t *dlsch,
|
||||
@@ -125,7 +157,7 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue,
|
||||
ue->measurements.rx_power_avg_dB[gNB_id] = dB_fixed( ue->measurements.rx_power_avg[gNB_id]);
|
||||
ue->measurements.wideband_cqi_tot[gNB_id] = ue->measurements.rx_power_tot_dB[gNB_id] - ue->measurements.n0_power_tot_dB;
|
||||
ue->measurements.wideband_cqi_avg[gNB_id] = ue->measurements.rx_power_avg_dB[gNB_id] - dB_fixed(ue->measurements.n0_power_avg);
|
||||
ue->measurements.rx_rssi_dBm[gNB_id] = ue->measurements.rx_power_avg_dB[gNB_id] + 30 - SQ15_SQUARED_NORM_FACTOR_DB - (int)ue->rx_total_gain_dB - dB_fixed(ue->frame_parms.ofdm_symbol_size);
|
||||
ue->measurements.rx_rssi_dBm[gNB_id] = ue->measurements.rx_power_avg_dB[gNB_id] + 30 - SQ15_SQUARED_NORM_FACTOR_DB - ((int)openair0_cfg[0].rx_gain[0] - (int)openair0_cfg[0].rx_gain_offset[0]) - dB_fixed(ue->frame_parms.ofdm_symbol_size);
|
||||
|
||||
LOG_D(PHY, "[gNB %d] Slot %d, RSSI %d dB (%d dBm/RE), WBandCQI %d dB, rxPwrAvg %d, n0PwrAvg %d\n",
|
||||
gNB_id,
|
||||
@@ -207,7 +239,7 @@ void nr_ue_ssb_rsrp_measurements(PHY_VARS_NR_UE *ue,
|
||||
openair0_config_t *cfg0 = &openair0_cfg[0];
|
||||
|
||||
ue->measurements.ssb_rsrp_dBm[ssb_index] = rsrp_db_per_re + 30 - SQ15_SQUARED_NORM_FACTOR_DB
|
||||
- (int)ue->rx_total_gain_dB
|
||||
- ((int)cfg0->rx_gain[0] - (int)cfg0->rx_gain_offset[0])
|
||||
- dB_fixed(fp->ofdm_symbol_size);
|
||||
|
||||
LOG_D(PHY,
|
||||
@@ -234,7 +266,8 @@ void nr_ue_rrc_measurements(PHY_VARS_NR_UE *ue,
|
||||
const uint8_t k_length = 8;
|
||||
uint8_t l_sss = (ue->symbol_offset + 2) % ue->frame_parms.symbols_per_slot;
|
||||
unsigned int ssb_offset = ue->frame_parms.first_carrier_offset + ue->frame_parms.ssb_start_subcarrier;
|
||||
double rx_gain = ue->rx_total_gain_dB;
|
||||
double rx_gain = openair0_cfg[0].rx_gain[0];
|
||||
double rx_gain_offset = openair0_cfg[0].rx_gain_offset[0];
|
||||
|
||||
ue->measurements.n0_power_tot = 0;
|
||||
|
||||
@@ -282,7 +315,7 @@ void nr_ue_rrc_measurements(PHY_VARS_NR_UE *ue,
|
||||
#ifdef DEBUG_MEAS_RRC
|
||||
const int psd_awgn = -174;
|
||||
const int scs = 15000 * (1 << ue->frame_parms.numerology_index);
|
||||
const int nf_usrp = ue->measurements.n0_power_tot_dB + 3 + 30 - (int)rx_gain - SQ15_SQUARED_NORM_FACTOR_DB - (psd_awgn + dB_fixed(scs) + dB_fixed(ue->frame_parms.ofdm_symbol_size));
|
||||
const int nf_usrp = ue->measurements.n0_power_tot_dB + 3 + 30 - ((int)rx_gain - (int)rx_gain_offset) - SQ15_SQUARED_NORM_FACTOR_DB - (psd_awgn + dB_fixed(scs) + dB_fixed(ue->frame_parms.ofdm_symbol_size));
|
||||
LOG_D(PHY, "In [%s][slot:%d] NF USRP %d dB\n", __FUNCTION__, slot, nf_usrp);
|
||||
#endif
|
||||
|
||||
@@ -293,7 +326,7 @@ void nr_ue_rrc_measurements(PHY_VARS_NR_UE *ue,
|
||||
ue->measurements.n0_power_tot,
|
||||
ue->measurements.n0_power_tot_dB,
|
||||
ue->measurements.n0_power_tot_dB + 30 - SQ15_SQUARED_NORM_FACTOR_DB - dB_fixed(ue->frame_parms.ofdm_symbol_size)
|
||||
- (int)rx_gain);
|
||||
- ((int)rx_gain - (int)rx_gain_offset));
|
||||
}
|
||||
|
||||
// This function implements:
|
||||
@@ -303,8 +336,7 @@ void nr_ue_rrc_measurements(PHY_VARS_NR_UE *ue,
|
||||
// Measurement units:
|
||||
// - RSRP: W (dBW)
|
||||
// returns RXgain to be adjusted based on target rx power (50db) - received digital power in db/RE
|
||||
int nr_sl_psbch_rsrp_measurements(PHY_VARS_NR_UE *ue,
|
||||
sl_nr_ue_phy_params_t *sl_phy_params,
|
||||
int nr_sl_psbch_rsrp_measurements(sl_nr_ue_phy_params_t *sl_phy_params,
|
||||
NR_DL_FRAME_PARMS *fp,
|
||||
c16_t rxdataF[][fp->samples_per_slot_wCP],
|
||||
bool use_SSS)
|
||||
@@ -341,7 +373,7 @@ int nr_sl_psbch_rsrp_measurements(PHY_VARS_NR_UE *ue,
|
||||
|
||||
psbch_rx->rsrp_dB_per_RE = 10 * log10(rsrp / num_re);
|
||||
psbch_rx->rsrp_dBm_per_RE = psbch_rx->rsrp_dB_per_RE + 30 - SQ15_SQUARED_NORM_FACTOR_DB
|
||||
- (int)ue->rx_total_gain_dB
|
||||
- ((int)openair0_cfg[0].rx_gain[0] - (int)openair0_cfg[0].rx_gain_offset[0])
|
||||
- dB_fixed(fp->ofdm_symbol_size);
|
||||
|
||||
int adjust_rxgain = TARGET_RX_POWER - psbch_rx->rsrp_dB_per_RE;
|
||||
|
||||
@@ -242,7 +242,7 @@ static int nr_get_csi_rs_signal(const PHY_VARS_NR_UE *ue,
|
||||
|
||||
*rsrp = rsrp_sum/meas_count;
|
||||
*rsrp_dBm = dB_fixed(*rsrp) + 30 - SQ15_SQUARED_NORM_FACTOR_DB
|
||||
- (int)ue->rx_total_gain_dB - dB_fixed(ue->frame_parms.ofdm_symbol_size);
|
||||
- ((int)openair0_cfg[0].rx_gain[0] - (int)openair0_cfg[0].rx_gain_offset[0]) - dB_fixed(ue->frame_parms.ofdm_symbol_size);
|
||||
|
||||
#ifdef NR_CSIRS_DEBUG
|
||||
LOG_I(NR_PHY, "RSRP = %i (%i dBm)\n", *rsrp, *rsrp_dBm);
|
||||
|
||||
@@ -518,7 +518,7 @@ nr_initial_sync_t sl_nr_slss_search(PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc,
|
||||
sync_params->DFN,
|
||||
sync_params->slot_offset);
|
||||
|
||||
UE->adjust_rxgain = nr_sl_psbch_rsrp_measurements(UE, sl_ue, frame_parms, rxdataF, false);
|
||||
UE->adjust_rxgain = nr_sl_psbch_rsrp_measurements(sl_ue, frame_parms, rxdataF, false);
|
||||
|
||||
UE->init_sync_frame = sync_params->remaining_frames;
|
||||
result.rx_offset = sync_params->rx_offset;
|
||||
|
||||
@@ -64,10 +64,9 @@ void nr_rf_card_config_gain(openair0_config_t *openair0_cfg,
|
||||
if (tx_gain)
|
||||
openair0_cfg->tx_gain[i] = tx_gain;
|
||||
if (rx_gain)
|
||||
openair0_cfg->rx_gain[i] = rx_gain;
|
||||
openair0_cfg->rx_gain[i] = rx_gain - rx_gain_off;
|
||||
|
||||
openair0_cfg->autocal[i] = 1;
|
||||
openair0_cfg->rx_gain_offset[i] = rx_gain_off;
|
||||
|
||||
if (i < openair0_cfg->rx_num_channels) {
|
||||
LOG_I(PHY, "HW: Configuring channel %d (rf_chain %d): setting tx_gain %.0f, rx_gain %.0f\n",
|
||||
|
||||
@@ -424,6 +424,7 @@ typedef struct PHY_VARS_gNB_s {
|
||||
eth_params_t eth_params_n;
|
||||
/// Ethernet parameters for fronthaul interface
|
||||
eth_params_t eth_params;
|
||||
int rx_total_gain_dB;
|
||||
int (*nr_start_if)(struct RU_t_s *ru, struct PHY_VARS_gNB_s *gNB);
|
||||
nfapi_nr_config_request_scf_t gNB_config;
|
||||
NR_DL_FRAME_PARMS frame_parms;
|
||||
|
||||
@@ -227,7 +227,7 @@ int psbch_pscch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr
|
||||
sym = (sym == 0) ? 5 : sym + 1;
|
||||
}
|
||||
|
||||
ue->adjust_rxgain = nr_sl_psbch_rsrp_measurements(ue, sl_phy_params, fp, rxdataF, false);
|
||||
ue->adjust_rxgain = nr_sl_psbch_rsrp_measurements(sl_phy_params, fp, rxdataF, false);
|
||||
|
||||
LOG_D(NR_PHY, " ------ Decode SL-MIB: frame.slot %d.%d ------ \n", frame_rx % 1024, nr_slot_rx);
|
||||
|
||||
|
||||
@@ -36,6 +36,21 @@ bool read_mac_sm(void* data)
|
||||
mac->msg.tstamp = time_now_us();
|
||||
|
||||
NR_UEs_t *UE_info = &RC.nrmac[mod_id]->UE_info;
|
||||
|
||||
/*rrc_gNB_ue_context_t *ue_context_p;
|
||||
gNB_RRC_UE_t *ue2;
|
||||
RB_FOREACH(ue_context_p, rrc_nr_ue_tree_s, &RC.nrrrc[mod_id]->rrc_ue_head) {
|
||||
ue2 = &ue_context_p->ue_context; // get first UE context.
|
||||
//if (ue2)
|
||||
//break;
|
||||
if (ue2)
|
||||
printf("E2 = %d\n",ue2);
|
||||
}*/
|
||||
|
||||
|
||||
//printf("E2 rsrp = %d\n",RC.nrrrc[mod_id]->rsrp);
|
||||
|
||||
|
||||
size_t num_ues = 0;
|
||||
UE_iterator(UE_info->list, ue) {
|
||||
if (ue)
|
||||
@@ -91,7 +106,8 @@ bool read_mac_sm(void* data)
|
||||
rd->ul_bler = sched_ctrl->ul_bler_stats.bler;
|
||||
rd->dl_mcs2 = 0;
|
||||
rd->ul_mcs2 = 0;
|
||||
rd->phr = sched_ctrl->ph;
|
||||
rd->phr = RC.nrrrc[mod_id]->rsrp; //sched_ctrl->ph;
|
||||
|
||||
|
||||
const uint32_t bufferSize = sched_ctrl->estimated_ul_buffer - sched_ctrl->sched_ul_bytes;
|
||||
rd->bsr = bufferSize;
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#include "common/ran_context.h"
|
||||
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
#include "openair2/E2AP/flexric/src/util/time_now_us.h"
|
||||
#include "openair2/RRC/NR/nr_rrc_defs.h"
|
||||
|
||||
|
||||
|
||||
bool read_mac_sm(void*);
|
||||
|
||||
Submodule openair2/E2AP/flexric updated: beabdd072c...dfb32c345a
@@ -81,6 +81,7 @@
|
||||
#include "NR_UE-CapabilityRequestFilterNR.h"
|
||||
#include "NR_HandoverPreparationInformation.h"
|
||||
#include "NR_HandoverPreparationInformation-IEs.h"
|
||||
#include "NR_UECapabilityEnquiry-v1560-IEs.h"
|
||||
#include "common/utils/nr/nr_common.h"
|
||||
#if defined(NR_Rel16)
|
||||
#include "NR_SCS-SpecificCarrier.h"
|
||||
@@ -581,7 +582,7 @@ int do_NR_SA_UECapabilityEnquiry(uint8_t *const buffer, const uint8_t Transactio
|
||||
ue_capabilityrat_request->rat_Type = NR_RAT_Type_nr;
|
||||
|
||||
sa_band_infoNR = (NR_FreqBandInformationNR_t*)calloc(1,sizeof(NR_FreqBandInformationNR_t));
|
||||
sa_band_infoNR->bandNR = 78;
|
||||
sa_band_infoNR->bandNR = 77;
|
||||
sa_band_info = (NR_FreqBandInformation_t*)calloc(1,sizeof(NR_FreqBandInformation_t));
|
||||
sa_band_info->present = NR_FreqBandInformation_PR_bandInformationNR;
|
||||
sa_band_info->choice.bandInformationNR = sa_band_infoNR;
|
||||
@@ -589,6 +590,16 @@ int do_NR_SA_UECapabilityEnquiry(uint8_t *const buffer, const uint8_t Transactio
|
||||
sa_band_list = (NR_FreqBandList_t *)calloc(1, sizeof(NR_FreqBandList_t));
|
||||
asn1cSeqAdd(&sa_band_list->list, sa_band_info);
|
||||
|
||||
NR_FreqBandInformation_t *sa2_band_info;
|
||||
NR_FreqBandInformationNR_t *sa2_band_infoNR;
|
||||
sa2_band_infoNR = (NR_FreqBandInformationNR_t*)calloc(1,sizeof(NR_FreqBandInformationNR_t));
|
||||
sa2_band_infoNR->bandNR = 257;
|
||||
sa2_band_info = (NR_FreqBandInformation_t*)calloc(1,sizeof(NR_FreqBandInformation_t));
|
||||
sa2_band_info->present = NR_FreqBandInformation_PR_bandInformationNR;
|
||||
sa2_band_info->choice.bandInformationNR = sa2_band_infoNR;
|
||||
|
||||
asn1cSeqAdd(&sa_band_list->list, sa2_band_info);
|
||||
|
||||
sa_band_filter = (NR_UE_CapabilityRequestFilterNR_t*)calloc(1,sizeof(NR_UE_CapabilityRequestFilterNR_t));
|
||||
sa_band_filter->frequencyBandListFilter = sa_band_list;
|
||||
|
||||
@@ -607,6 +618,34 @@ int do_NR_SA_UECapabilityEnquiry(uint8_t *const buffer, const uint8_t Transactio
|
||||
asn1cSeqAdd(&dl_dcch_msg.message.choice.c1->choice.ueCapabilityEnquiry->criticalExtensions.choice.ueCapabilityEnquiry->ue_CapabilityRAT_RequestList.list,
|
||||
ue_capabilityrat_request);
|
||||
|
||||
/* NR-DC request */
|
||||
NR_UECapabilityEnquiry_v1560_IEs_t nr_dc_cap = { 0 };
|
||||
NR_UE_CapabilityRequestFilterCommon_t nr_dc_filter = { 0 };
|
||||
nr_dc_cap.capabilityRequestFilterCommon = &nr_dc_filter;
|
||||
nr_dc_filter.mrdc_Request = &(struct NR_UE_CapabilityRequestFilterCommon__mrdc_Request) {
|
||||
.omitEN_DC = NULL,
|
||||
.includeNR_DC = &(long){ NR_UE_CapabilityRequestFilterCommon__mrdc_Request__includeNR_DC_true },
|
||||
.includeNE_DC = NULL
|
||||
};
|
||||
|
||||
nr_dc_filter.ext2 = &(struct NR_UE_CapabilityRequestFilterCommon__ext2) {
|
||||
.requestedCellGrouping_r16 = &(struct NR_UE_CapabilityRequestFilterCommon__ext2__requestedCellGrouping_r16) {
|
||||
.list = { 0 }
|
||||
}
|
||||
};
|
||||
NR_CellGrouping_r16_t nr_dc_combination = { 0 };
|
||||
nr_dc_combination.mode_r16 = NR_CellGrouping_r16__mode_r16_async;
|
||||
NR_FreqBandIndicatorNR_t b77 = 77;
|
||||
NR_FreqBandIndicatorNR_t b257 = 257;
|
||||
asn1cSeqAdd(&nr_dc_combination.mcg_r16.list, &b77);
|
||||
asn1cSeqAdd(&nr_dc_combination.scg_r16.list, &b257);
|
||||
|
||||
asn1cSeqAdd(&nr_dc_filter.ext2->requestedCellGrouping_r16->list, &nr_dc_combination);
|
||||
|
||||
OCTET_STRING_t *nr_dc = calloc_or_fail(1, sizeof(*nr_dc));
|
||||
nr_dc->size = uper_encode_to_new_buffer(&asn_DEF_NR_UECapabilityEnquiry_v1560_IEs, NULL, &nr_dc_cap, (void **)&nr_dc->buf);
|
||||
|
||||
dl_dcch_msg.message.choice.c1->choice.ueCapabilityEnquiry->criticalExtensions.choice.ueCapabilityEnquiry->ue_CapabilityEnquiryExt = nr_dc;
|
||||
|
||||
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
|
||||
xer_fprint(stdout, &asn_DEF_NR_DL_DCCH_Message, (void *)&dl_dcch_msg);
|
||||
@@ -1354,6 +1393,114 @@ NR_MeasConfig_t *get_MeasConfig(const NR_MeasTiming_t *mt,
|
||||
asn1cSeqAdd(&mc->measIdToAddModList->list, measid);
|
||||
}
|
||||
|
||||
/* add FR2 measurement */
|
||||
{
|
||||
/* measObject */
|
||||
NR_MeasObjectToAddMod_t *mo1 = calloc(1, sizeof(*mo1));
|
||||
mo1->measObjectId = 2;
|
||||
mo1->measObject.present = NR_MeasObjectToAddMod__measObject_PR_measObjectNR;
|
||||
NR_MeasObjectNR_t *monr1 = calloc(1, sizeof(*monr1));
|
||||
asn1cCallocOne(monr1->ssbFrequency, 2090683);
|
||||
asn1cCallocOne(monr1->ssbSubcarrierSpacing, 3 /* 120KHz */);
|
||||
monr1->referenceSignalConfig.ssb_ConfigMobility = calloc(1, sizeof(*monr1->referenceSignalConfig.ssb_ConfigMobility));
|
||||
monr1->referenceSignalConfig.ssb_ConfigMobility->deriveSSB_IndexFromCell = true;
|
||||
monr1->absThreshSS_BlocksConsolidation = calloc(1, sizeof(*monr1->absThreshSS_BlocksConsolidation));
|
||||
asn1cCallocOne(monr1->absThreshSS_BlocksConsolidation->thresholdRSRP, 36);
|
||||
asn1cCallocOne(monr1->nrofSS_BlocksToAverage, 8);
|
||||
monr1->smtc1 = calloc(1, sizeof(*monr1->smtc1));
|
||||
monr1->smtc1->periodicityAndOffset = ssb_mtc->periodicityAndOffset;
|
||||
monr1->smtc1->periodicityAndOffset.choice.sf20 = 2;
|
||||
monr1->smtc1->duration = 1;
|
||||
monr1->quantityConfigIndex = 1;
|
||||
monr1->ext1 = calloc(1, sizeof(*monr1->ext1));
|
||||
asn1cCallocOne(monr1->ext1->freqBandIndicatorNR, 257);
|
||||
|
||||
#if 0
|
||||
if (neighbourConfiguration && measurementConfiguration->a3_event_list) {
|
||||
for (uint8_t nCell = 0; nCell < neighbourConfiguration->size; nCell++) {
|
||||
const nr_neighbour_gnb_configuration_t *neighbourCell =
|
||||
(const nr_neighbour_gnb_configuration_t *)seq_arr_at(neighbourConfiguration, nCell);
|
||||
if (!neighbourCell->isIntraFrequencyNeighbour)
|
||||
continue;
|
||||
|
||||
if (monr1->cellsToAddModList == NULL) {
|
||||
monr1->cellsToAddModList = calloc(1, sizeof(*monr1->cellsToAddModList));
|
||||
}
|
||||
|
||||
NR_CellsToAddMod_t *cell = calloc(1, sizeof(*cell));
|
||||
cell->physCellId = neighbourCell->physicalCellId;
|
||||
ASN_SEQUENCE_ADD(&monr1->cellsToAddModList->list, cell);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
mo1->measObject.choice.measObjectNR = monr1;
|
||||
asn1cSeqAdd(&mc->measObjectToAddModList->list, mo1);
|
||||
|
||||
/* measReportConfig */
|
||||
#if 0
|
||||
/* periodic measurement (does not seem to work, UE reports similar values to b77 master cell, plus there is no fr2 cell running) */
|
||||
NR_ReportConfigToAddMod_t *rc = calloc(1, sizeof(*rc));
|
||||
rc->reportConfigId = 3;
|
||||
rc->reportConfig.present = NR_ReportConfigToAddMod__reportConfig_PR_reportConfigNR;
|
||||
|
||||
NR_PeriodicalReportConfig_t *prc = calloc(1, sizeof(*prc));
|
||||
prc->rsType = NR_NR_RS_Type_ssb;
|
||||
prc->reportInterval = NR_ReportInterval_ms1024;
|
||||
prc->reportAmount = NR_PeriodicalReportConfig__reportAmount_infinity;
|
||||
prc->reportQuantityCell.rsrp = true;
|
||||
prc->reportQuantityCell.rsrq = true;
|
||||
prc->reportQuantityCell.sinr = true;
|
||||
prc->reportQuantityRS_Indexes = calloc(1, sizeof(*prc->reportQuantityRS_Indexes));
|
||||
prc->reportQuantityRS_Indexes->rsrp = true;
|
||||
prc->reportQuantityRS_Indexes->rsrq = true;
|
||||
prc->reportQuantityRS_Indexes->sinr = true;
|
||||
asn1cCallocOne(prc->maxNrofRS_IndexesToReport, 4);
|
||||
prc->maxReportCells = 4;
|
||||
prc->includeBeamMeasurements = 1;
|
||||
|
||||
NR_ReportConfigNR_t *rcnr = calloc(1, sizeof(*rcnr));
|
||||
rcnr->reportType.present = NR_ReportConfigNR__reportType_PR_periodical;
|
||||
rcnr->reportType.choice.periodical = prc;
|
||||
|
||||
rc->reportConfig.choice.reportConfigNR = rcnr;
|
||||
asn1cSeqAdd(&mc->reportConfigToAddModList->list, rc);
|
||||
#endif
|
||||
/* A4 event */
|
||||
NR_ReportConfigToAddMod_t *rc_A4 = calloc(1, sizeof(*rc_A4));
|
||||
rc_A4->reportConfigId = 3;
|
||||
rc_A4->reportConfig.present = NR_ReportConfigToAddMod__reportConfig_PR_reportConfigNR;
|
||||
NR_EventTriggerConfig_t *etrc_A4 = calloc(1, sizeof(*etrc_A4));
|
||||
etrc_A4->eventId.present = NR_EventTriggerConfig__eventId_PR_eventA4;
|
||||
etrc_A4->eventId.choice.eventA4 = calloc(1, sizeof(*etrc_A4->eventId.choice.eventA4));
|
||||
etrc_A4->eventId.choice.eventA4->a4_Threshold.present = NR_MeasTriggerQuantity_PR_rsrp;
|
||||
etrc_A4->eventId.choice.eventA4->a4_Threshold.choice.rsrp = 20;
|
||||
etrc_A4->eventId.choice.eventA4->reportOnLeave = true;
|
||||
etrc_A4->eventId.choice.eventA4->hysteresis = 0;
|
||||
etrc_A4->eventId.choice.eventA4->timeToTrigger = 1; // ms40
|
||||
etrc_A4->rsType = NR_NR_RS_Type_ssb;
|
||||
etrc_A4->reportInterval = NR_ReportInterval_ms120; //NR_ReportInterval_ms1024;
|
||||
etrc_A4->reportAmount = NR_EventTriggerConfig__reportAmount_infinity;
|
||||
etrc_A4->reportQuantityCell.rsrp = true;
|
||||
etrc_A4->reportQuantityCell.rsrq = true;
|
||||
etrc_A4->reportQuantityCell.sinr = true;
|
||||
asn1cCallocOne(etrc_A4->maxNrofRS_IndexesToReport, 4);
|
||||
etrc_A4->maxReportCells = 4;
|
||||
etrc_A4->includeBeamMeasurements = false;
|
||||
NR_ReportConfigNR_t *rcnr_A4 = calloc(1, sizeof(*rcnr_A4));
|
||||
rcnr_A4->reportType.present = NR_ReportConfigNR__reportType_PR_eventTriggered;
|
||||
rcnr_A4->reportType.choice.eventTriggered = etrc_A4;
|
||||
rc_A4->reportConfig.choice.reportConfigNR = rcnr_A4;
|
||||
asn1cSeqAdd(&mc->reportConfigToAddModList->list, rc_A4);
|
||||
|
||||
/* measId */
|
||||
NR_MeasIdToAddMod_t *measid = calloc(1, sizeof(NR_MeasIdToAddMod_t));
|
||||
measid->measId = 3;
|
||||
measid->reportConfigId = 3;
|
||||
measid->measObjectId = 2;
|
||||
asn1cSeqAdd(&mc->measIdToAddModList->list, measid);
|
||||
}
|
||||
|
||||
mc->quantityConfig = calloc(1, sizeof(*mc->quantityConfig));
|
||||
mc->quantityConfig->quantityConfigNR_List = calloc(1, sizeof(*mc->quantityConfig->quantityConfigNR_List));
|
||||
NR_QuantityConfigNR_t *qcnr = calloc(1, sizeof(*qcnr));
|
||||
|
||||
@@ -255,6 +255,8 @@ typedef struct gNB_RRC_UE_s {
|
||||
/* Nas Pdu */
|
||||
ngap_pdu_t nas_pdu;
|
||||
|
||||
int rsrp; // tmp for GNW
|
||||
|
||||
} gNB_RRC_UE_t;
|
||||
|
||||
typedef struct rrc_gNB_ue_context_s {
|
||||
@@ -402,6 +404,8 @@ typedef struct gNB_RRC_INST_s {
|
||||
RB_HEAD(rrc_cuup_tree, nr_rrc_cuup_container_t) cuups; // CU-UPs, indexed by assoc_id
|
||||
size_t num_cuups;
|
||||
|
||||
int rsrp;
|
||||
|
||||
} gNB_RRC_INST;
|
||||
|
||||
#define UE_LOG_FMT "(cellID %lx, UE ID %d RNTI %04x)"
|
||||
|
||||
@@ -1373,6 +1373,14 @@ static void rrc_gNB_process_MeasurementReport(gNB_RRC_UE_t *UE, NR_MeasurementRe
|
||||
NR_MeasurementReport_IEs_t *measurementReport_IEs = measurementReport->criticalExtensions.choice.measurementReport;
|
||||
const NR_MeasId_t measId = measurementReport_IEs->measResults.measId;
|
||||
|
||||
LOG_I(NR_RRC, "receive measurement ID %ld\n", measId);
|
||||
if (measId == 3) {
|
||||
//xer_fprint(stdout, &asn_DEF_NR_MeasurementReport, (void *)measurementReport);
|
||||
if (measurementReport->criticalExtensions.choice.measurementReport->measResults.measResultNeighCells)
|
||||
RC.nrrrc[0]->rsrp = *measurementReport->criticalExtensions.choice.measurementReport->measResults.measResultNeighCells->choice.measResultListNR->list.array[0]->measResult.cellResults.resultsSSB_Cell->rsrp - 156;
|
||||
|
||||
}
|
||||
|
||||
NR_MeasIdToAddMod_t *meas_id_s = NULL;
|
||||
for (int meas_idx = 0; meas_idx < meas_config->measIdToAddModList->list.count; meas_idx++) {
|
||||
if (measId == meas_config->measIdToAddModList->list.array[meas_idx]->measId) {
|
||||
|
||||
@@ -242,14 +242,17 @@ typedef struct openair0_config {
|
||||
//! index: [0..rx_num_channels[ !!! see lte-ue.c:427 FIXME iterates over rx_num_channels
|
||||
double tx_freq[8];
|
||||
double tune_offset;
|
||||
//! \brief memory
|
||||
//! \brief Pointer to Calibration table for RX gains
|
||||
rx_gain_calib_table_t *rx_gain_calib_table;
|
||||
//! mode for rxgain (ExpressMIMO2)
|
||||
rx_gain_t rxg_mode[8];
|
||||
//! \brief Gain for RX in dB.
|
||||
//! index: [0..rx_num_channels]
|
||||
double rx_gain[8]; // power we give to the radio
|
||||
double rx_gain[8];
|
||||
//! \brief Gain offset (for calibration) in dB
|
||||
//! index: [0..rx_num_channels]
|
||||
double rx_gain_offset[8]; // additional offset
|
||||
double rx_gain_offset[8];
|
||||
//! gain for TX in dB
|
||||
double tx_gain[8];
|
||||
//! RX bandwidth in Hz
|
||||
|
||||
@@ -892,6 +892,118 @@ int trx_usrp_stop(openair0_device *device) {
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*! \brief USRPB210 RX calibration table */
|
||||
rx_gain_calib_table_t calib_table_b210[] = {
|
||||
{3500000000.0,44.0},
|
||||
{2660000000.0,49.0},
|
||||
{2300000000.0,50.0},
|
||||
{1880000000.0,53.0},
|
||||
{816000000.0,58.0},
|
||||
{-1,0}
|
||||
};
|
||||
|
||||
/*! \brief USRPB210 RX calibration table */
|
||||
rx_gain_calib_table_t calib_table_b210_38[] = {
|
||||
{3500000000.0,44.0},
|
||||
{2660000000.0,49.8},
|
||||
{2300000000.0,51.0},
|
||||
{1880000000.0,53.0},
|
||||
{816000000.0,57.0},
|
||||
{-1,0}
|
||||
};
|
||||
|
||||
/*! \brief USRPx310 RX calibration table */
|
||||
rx_gain_calib_table_t calib_table_x310[] = {
|
||||
{3500000000.0,77.0},
|
||||
{2660000000.0,81.0},
|
||||
{2300000000.0,81.0},
|
||||
{1880000000.0,82.0},
|
||||
{816000000.0,85.0},
|
||||
{-1,0}
|
||||
};
|
||||
|
||||
/*! \brief USRPn3xf RX calibration table */
|
||||
rx_gain_calib_table_t calib_table_n310[] = {
|
||||
{3500000000.0,0.0},
|
||||
{2660000000.0,0.0},
|
||||
{2300000000.0,0.0},
|
||||
{1880000000.0,0.0},
|
||||
{816000000.0, 0.0},
|
||||
{-1,0}
|
||||
};
|
||||
|
||||
/*! \brief Empty RX calibration table */
|
||||
rx_gain_calib_table_t calib_table_none[] = {
|
||||
{3500000000.0,0.0},
|
||||
{2660000000.0,0.0},
|
||||
{2300000000.0,0.0},
|
||||
{1880000000.0,0.0},
|
||||
{816000000.0, 0.0},
|
||||
{-1,0}
|
||||
};
|
||||
|
||||
|
||||
/*! \brief Set RX gain offset
|
||||
* \param openair0_cfg RF frontend parameters set by application
|
||||
* \param chain_index RF chain to apply settings to
|
||||
* \returns 0 in success
|
||||
*/
|
||||
void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index,int bw_gain_adjust) {
|
||||
int i=0;
|
||||
// loop through calibration table to find best adjustment factor for RX frequency
|
||||
double min_diff = 6e9,diff,gain_adj=0.0;
|
||||
|
||||
if (bw_gain_adjust==1) {
|
||||
switch ((int)openair0_cfg[0].sample_rate) {
|
||||
case 46080000:
|
||||
break;
|
||||
|
||||
case 30720000:
|
||||
break;
|
||||
|
||||
case 23040000:
|
||||
gain_adj=1.25;
|
||||
break;
|
||||
|
||||
case 15360000:
|
||||
gain_adj=3.0;
|
||||
break;
|
||||
|
||||
case 7680000:
|
||||
gain_adj=6.0;
|
||||
break;
|
||||
|
||||
case 3840000:
|
||||
gain_adj=9.0;
|
||||
break;
|
||||
|
||||
case 1920000:
|
||||
gain_adj=12.0;
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_E(HW,"unknown sampling rate %d\n",(int)openair0_cfg[0].sample_rate);
|
||||
//exit(-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
while (openair0_cfg->rx_gain_calib_table[i].freq>0) {
|
||||
diff = fabs(openair0_cfg->rx_freq[chain_index] - openair0_cfg->rx_gain_calib_table[i].freq);
|
||||
LOG_I(HW,"cal %d: freq %f, offset %f, diff %f\n",
|
||||
i,
|
||||
openair0_cfg->rx_gain_calib_table[i].freq,
|
||||
openair0_cfg->rx_gain_calib_table[i].offset,diff);
|
||||
|
||||
if (min_diff > diff) {
|
||||
min_diff = diff;
|
||||
openair0_cfg->rx_gain_offset[chain_index] = openair0_cfg->rx_gain_calib_table[i].offset+gain_adj;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
/*! \brief print the USRP statistics
|
||||
* \param device the hardware to use
|
||||
* \returns 0 on success
|
||||
@@ -961,6 +1073,7 @@ extern "C" {
|
||||
//uhd::set_thread_priority_safe(1.0);
|
||||
// Initialize USRP device
|
||||
int vers=0,subvers=0,subsubvers=0;
|
||||
int bw_gain_adjust=0;
|
||||
|
||||
if (device->openair0_cfg->recplay_mode == RECPLAY_RECORDMODE) {
|
||||
std::cerr << "USRP device initialized in subframes record mode" << std::endl;
|
||||
@@ -1121,6 +1234,22 @@ extern "C" {
|
||||
}
|
||||
}
|
||||
|
||||
if (device->type==USRP_X300_DEV) {
|
||||
openair0_cfg[0].rx_gain_calib_table = calib_table_x310;
|
||||
std::cerr << "-- Using calibration table: calib_table_x310" << std::endl;
|
||||
}
|
||||
|
||||
if (device->type==USRP_N300_DEV) {
|
||||
openair0_cfg[0].rx_gain_calib_table = calib_table_n310;
|
||||
std::cerr << "-- Using calibration table: calib_table_n310" << std::endl;
|
||||
}
|
||||
|
||||
if (device->type == USRP_X400_DEV) {
|
||||
openair0_cfg[0].rx_gain_calib_table = calib_table_none;
|
||||
std::cerr << "-- Using calibration table: calib_table_none" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
if (device->type==USRP_N300_DEV || device->type==USRP_X300_DEV || device->type==USRP_X400_DEV) {
|
||||
LOG_I(HW,"%s() sample_rate:%u\n", __FUNCTION__, (int)openair0_cfg[0].sample_rate);
|
||||
|
||||
@@ -1216,6 +1345,16 @@ extern "C" {
|
||||
}
|
||||
|
||||
if (device->type == USRP_B200_DEV) {
|
||||
if ((vers == 3) && (subvers == 9) && (subsubvers>=2)) {
|
||||
openair0_cfg[0].rx_gain_calib_table = calib_table_b210;
|
||||
bw_gain_adjust=0;
|
||||
std::cerr << "-- Using calibration table: calib_table_b210" << std::endl; // Bell Labs info
|
||||
} else {
|
||||
openair0_cfg[0].rx_gain_calib_table = calib_table_b210_38;
|
||||
bw_gain_adjust=1;
|
||||
std::cerr << "-- Using calibration table: calib_table_b210_38" << std::endl; // Bell Labs info
|
||||
}
|
||||
|
||||
switch ((int)openair0_cfg[0].sample_rate) {
|
||||
case 46080000:
|
||||
s->usrp->set_master_clock_rate(46.08e6);
|
||||
@@ -1296,6 +1435,7 @@ extern "C" {
|
||||
s->usrp->set_rx_rate(cfg->sample_rate, i + choffset);
|
||||
uhd::tune_request_t rx_tune_req(cfg->rx_freq[i], cfg->tune_offset);
|
||||
s->usrp->set_rx_freq(rx_tune_req, i+choffset);
|
||||
set_rx_gain_offset(cfg, i, bw_gain_adjust);
|
||||
::uhd::gain_range_t gain_range = s->usrp->get_rx_gain_range(i+choffset);
|
||||
// limit to maximum gain
|
||||
double gain = cfg->rx_gain[i] - cfg->rx_gain_offset[i];
|
||||
|
||||
Reference in New Issue
Block a user