diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gsm/gsm48.c | 21 | ||||
-rw-r--r-- | src/gsm/libosmogsm.map | 1 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/gsm/gsm48.c b/src/gsm/gsm48.c index 2d6deb56..17b0829d 100644 --- a/src/gsm/gsm48.c +++ b/src/gsm/gsm48.c @@ -1390,4 +1390,25 @@ int osmo_gsm48_classmark_supports_a5(const struct osmo_gsm48_classmark *cm, uint } } +/*! Decode power class from Classmark1/2 RF power capability field. + * \param[in] rf_power_cap The RF power capability field (3 bits). + * \param[in] band the band of the arfcn from where the classmark was received + * \return the MS power class on success, negative on error. + */ +int8_t osmo_gsm48_rfpowercap2powerclass(enum gsm_band band, uint8_t rf_power_cap) +{ + switch (band) { + case GSM_BAND_1800: + case GSM_BAND_1900: + if (rf_power_cap > 2) + return -1; + return rf_power_cap + 1; + default: + if (rf_power_cap > 4) + return -1; + return rf_power_cap + 1; + } +} + + /*! @} */ diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index 724fe5b1..a0e3b324 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -646,6 +646,7 @@ osmo_gsm48_classmark_a5_name; osmo_gsm48_classmark_a5_name_buf; osmo_gsm48_classmark_a5_name_c; osmo_gsm48_classmark_update; +osmo_gsm48_rfpowercap2powerclass; cbsp_msg_type_names; cbsp_iei_names; |