OAI UE: add shared RSRP Table 10.1.6.1-1 mapping helper and adopt it RRC UE

- Add to common/utils/nr/nr_common remove from NR_MAC_UE/nr_ue_procedures.c
- Adopt in asn1_msg.c for MeasurementReport: this solves the following assert:

Assertion (enc_rval.encoded > 0) failed!
In do_nrMeasurementReport_SA() /oai-ran/openair2/RRC/NR/MESSAGES/asn1_msg.c:898
ASN1 message encoding failed (MeasResultServMOList, 18446744073709551615)!

Motivation: unify RSRP-to-index mapping across layers and fix NR RRC MeasurementReport
encoding failures due to out-of-range values by reusing the validated mapping.

Note NR_RSRP-Range.c constraint:
	{ APC_CONSTRAINED,	 7,  7,  0,  127 }	/* (0..127) */
This commit is contained in:
Guido Casati
2025-10-13 16:52:59 +02:00
parent 92bc0aee0e
commit edc53ac9dd
6 changed files with 21 additions and 17 deletions
+11
View File
@@ -152,6 +152,17 @@ void reverse_bits_u8(uint8_t const* in, size_t sz, uint8_t* out)
#endif
}
/** @brief 3GPP TS 38.133 Table 10.1.6.1-1 mapping from dBm to RSRP index */
uint8_t get_rsrp_index(int rsrp_dBm)
{
int index = rsrp_dBm + 157;
if (rsrp_dBm > -44)
index = 113;
if (rsrp_dBm < -140)
index = 16;
return (uint8_t)index;
}
// Reverse bits implementation based on http://graphics.stanford.edu/~seander/bithacks.html
uint64_t reverse_bits(uint64_t in, int n_bits)
{
+3
View File
@@ -186,6 +186,9 @@ typedef struct meas_s {
val_init_t csi_rsrp_dBm;
} meas_t;
/** @brief Returns NR RSRP index per 3GPP TS 38.133 Table 10.1.6.1-1 */
uint8_t get_rsrp_index(int rsrp_dBm);
/**
* @brief To start a timer
* @param timer Timer to be started