Commit 38225b97 authored by francescomani's avatar francescomani

improvements in FAPI interface for measurements

parent 456d35d8
......@@ -59,8 +59,8 @@ typedef enum {
typedef struct {
uint32_t gNB_index;
uint16_t Nid_cell;
uint8_t meas_type; // (0) SS, (1) CSI
uint8_t is_neighboring_cell; // (0) false, (1) true
nfapi_nr_meas_type_e meas_type;
bool is_neighboring_cell;
uint8_t rsrp_dBm;
uint8_t rank_indicator;
uint8_t i1;
......
......@@ -314,6 +314,11 @@ typedef enum {
NFAPI_NR_PDSCH_MAPPING_TYPE_B
} nfapi_nr_pdsch_mapping_type_e;
typedef enum {
NFAPI_NR_CSI_MEAS,
NFAPI_NR_SS_MEAS
} nfapi_nr_meas_type_e;
typedef enum {
NFAPI_NR_PDSCH_RBG_CONFIG_TYPE1=0,
NFAPI_NR_PDSCH_RBG_CONFIG_TYPE2
......
......@@ -237,9 +237,9 @@ void nr_ue_ssb_rsrp_measurements(PHY_VARS_NR_UE *ue,
// Send SS measurements to MAC
fapi_nr_l1_measurements_t l1_measurements;
l1_measurements.gNB_index = proc->gNB_id;
l1_measurements.meas_type = 0;
l1_measurements.meas_type = NFAPI_NR_SS_MEAS;
l1_measurements.Nid_cell = ue->frame_parms.Nid_cell;
l1_measurements.is_neighboring_cell = 0;
l1_measurements.is_neighboring_cell = false;
if (ue->measurements.ssb_rsrp_dBm[ssb_index] < -140) {
l1_measurements.rsrp_dBm = 16;
} else if (ue->measurements.ssb_rsrp_dBm[ssb_index] > -44) {
......@@ -424,9 +424,9 @@ void *nr_ue_meas_neighboring_cell(void *param)
// Send SS measurements to MAC
fapi_nr_l1_measurements_t l1_measurements;
l1_measurements.gNB_index = proc->gNB_id;
l1_measurements.meas_type = 0;
l1_measurements.meas_type = NFAPI_NR_SS_MEAS;
l1_measurements.Nid_cell = nr_neighboring_cell->Nid_cell;
l1_measurements.is_neighboring_cell = 1;
l1_measurements.is_neighboring_cell = true;
if (neighboring_cell_info->ssb_rsrp_dBm < -140) {
l1_measurements.rsrp_dBm = 16;
} else if (neighboring_cell_info->ssb_rsrp_dBm > -44) {
......
......@@ -1023,9 +1023,9 @@ void nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue,
// Send CSI measurements to MAC
fapi_nr_l1_measurements_t l1_measurements;
l1_measurements.gNB_index = gNB_id;
l1_measurements.meas_type = 1;
l1_measurements.meas_type = NFAPI_NR_CSI_MEAS;
l1_measurements.Nid_cell = frame_parms->Nid_cell;
l1_measurements.is_neighboring_cell = 0;
l1_measurements.is_neighboring_cell = false;
if (rsrp_dBm < -140) {
l1_measurements.rsrp_dBm = 16;
} else if (rsrp_dBm > -44) {
......
......@@ -137,8 +137,8 @@ typedef struct NRRrcMacMeasDataInd_s {
uint8_t gnb_index;
uint8_t rsrp_dBm;
uint16_t Nid_cell;
uint8_t meas_type; // (0) SS, (1) CSI
uint8_t is_neighboring_cell; // (0) false, (1) true
bool is_csi_meas;
bool is_neighboring_cell;
} NRRrcMacMeasDataInd;
typedef struct RrcMacBcchMbmsDataReq_s {
......
......@@ -1272,10 +1272,11 @@ int8_t nr_ue_process_l1_measurements(NR_UE_MAC_INST_t *mac, frame_t frame, int s
{
LOG_D(NR_MAC, "(%d.%d) Received CSI-RS measurements\n", frame, slot);
memcpy(&mac->l1_measurements, l1_measurements, sizeof(*l1_measurements));
bool csi_meas = l1_measurements->meas_type == NFAPI_NR_CSI_MEAS;
nr_mac_rrc_meas_ind_ue(mac->ue_id,
l1_measurements->gNB_index,
l1_measurements->Nid_cell,
l1_measurements->meas_type,
csi_meas,
l1_measurements->is_neighboring_cell,
l1_measurements->rsrp_dBm);
return 0;
......
......@@ -39,12 +39,12 @@
typedef uint32_t channel_t;
int8_t nr_mac_rrc_meas_ind_ue(module_id_t module_id, uint32_t gNB_index, uint16_t Nid_cell, uint8_t meas_type, uint8_t is_neighboring_cell, uint8_t rsrp_dBm)
int8_t nr_mac_rrc_meas_ind_ue(module_id_t module_id, uint32_t gNB_index, uint16_t Nid_cell, bool csi_meas, bool is_neighboring_cell, uint8_t rsrp_dBm)
{
MessageDef *message_p = itti_alloc_new_message(TASK_MAC_UE, 0, NR_RRC_MAC_MEAS_DATA_IND);
NR_RRC_MAC_MEAS_DATA_IND(message_p).gnb_index = gNB_index;
NR_RRC_MAC_MEAS_DATA_IND(message_p).Nid_cell = Nid_cell;
NR_RRC_MAC_MEAS_DATA_IND(message_p).meas_type = meas_type;
NR_RRC_MAC_MEAS_DATA_IND(message_p).is_csi_meas = csi_meas;
NR_RRC_MAC_MEAS_DATA_IND(message_p).is_neighboring_cell = is_neighboring_cell;
NR_RRC_MAC_MEAS_DATA_IND(message_p).rsrp_dBm = rsrp_dBm;
itti_send_msg_to_task(TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE(module_id), message_p);
......
......@@ -1389,21 +1389,21 @@ static int nr_rrc_ue_decode_dcch(NR_UE_RRC_INST_t *rrc,
return 0;
}
void nr_ue_meas_filtering(NR_UE_RRC_INST_t *rrc, uint8_t is_neighboring_cell, uint16_t Nid_cell, uint8_t meas_type, int rsrp_dBm)
void nr_ue_meas_filtering(NR_UE_RRC_INST_t *rrc, bool is_neighboring_cell, uint16_t Nid_cell, bool csi_meas, int rsrp_dBm)
{
l3_measurements_t *l3_measurements = &rrc->l3_measurements;
meas_t *meas_cell = NULL;
if (is_neighboring_cell == 0) {
meas_cell = &l3_measurements->active_cell;
} else {
if (is_neighboring_cell) {
meas_cell = &l3_measurements->neighboring_cell[0];
} else {
meas_cell = &l3_measurements->active_cell;
}
meas_cell->Nid_cell = Nid_cell;
double a = l3_measurements->filter_coeff_rsrp;
if (meas_type == 0) {
if (!csi_meas) {
if (meas_cell->ss_rsrp_dBm_initialized == true) {
meas_cell->ss_rsrp_dBm = (1.0 - a) * meas_cell->ss_rsrp_dBm + a * rsrp_dBm;
} else {
......@@ -1582,15 +1582,15 @@ void *rrc_nrue(void *notUsed)
case NR_RRC_MAC_MEAS_DATA_IND:
LOG_D(NR_RRC, "[%s][Nid_cell %i] Received %s measurements: RSRP = %i (dBm)\n",
NR_RRC_MAC_MEAS_DATA_IND(msg_p).is_neighboring_cell == 0 ? "Active cell" : "Neighboring cell",
NR_RRC_MAC_MEAS_DATA_IND(msg_p).is_neighboring_cell? "Neighboring cell" : "Active cell",
NR_RRC_MAC_MEAS_DATA_IND(msg_p).Nid_cell,
NR_RRC_MAC_MEAS_DATA_IND(msg_p).meas_type == 0 ? "SS" : "CSI",
NR_RRC_MAC_MEAS_DATA_IND(msg_p).is_csi_meas ? "CSI meas" : "SSB meas",
NR_RRC_MAC_MEAS_DATA_IND(msg_p).rsrp_dBm - 157);
nr_ue_meas_filtering(rrc,
NR_RRC_MAC_MEAS_DATA_IND(msg_p).is_neighboring_cell,
NR_RRC_MAC_MEAS_DATA_IND(msg_p).Nid_cell,
NR_RRC_MAC_MEAS_DATA_IND(msg_p).meas_type,
NR_RRC_MAC_MEAS_DATA_IND(msg_p).is_csi_meas,
NR_RRC_MAC_MEAS_DATA_IND(msg_p).rsrp_dBm - 157);
nr_ue_ckeck_meas_report(rrc, NR_RRC_MAC_MEAS_DATA_IND(msg_p).gnb_index);
......
......@@ -64,10 +64,10 @@ void nr_rrc_cellgroup_configuration(rrcPerNB_t *rrcNB, NR_UE_RRC_INST_t *rrc, NR
\param module_id module id
\param gNB_index gNB index
\param Nid_cell Nid_cell
\param meas_type (0) SS, (1) CSI
\param meas_type
\param is_neighboring_cell (0) false, (1) true
\param rsrp_dBm reference signal received power*/
int8_t nr_mac_rrc_meas_ind_ue(module_id_t module_id, uint32_t gNB_index, uint16_t Nid_cell, uint8_t meas_type, uint8_t is_neighboring_cell, uint8_t rsrp_dBm);
int8_t nr_mac_rrc_meas_ind_ue(module_id_t module_id, uint32_t gNB_index, uint16_t Nid_cell, bool csi_meas, bool is_neighboring_cell, uint8_t rsrp_dBm);
/**\brief interface between MAC and RRC thru SRB0 (RLC TM/no PDCP)
\param module_id module id
......
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