summaryrefslogtreecommitdiffstats
path: root/src/gsm
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2019-10-31 13:35:22 +0100
committerpespin <pespin@sysmocom.de>2019-11-03 23:21:06 +0000
commitb99f4ca2d8517d99cdf8aa183dbfda7b233bb781 (patch)
treeb12807696a4f5056473f7561e544aa004183c6ef /src/gsm
parent2ceb758ba4a845898fbff11bd4942751078b8ee7 (diff)
gsm_04_08.h: Introduce API osmo_gsm48_rfpowercap2powerclass()
Related: OS#4244 Change-Id: I32e9cc1c2397b44f0d48db2acdf782a821365b63
Diffstat (limited to 'src/gsm')
-rw-r--r--src/gsm/gsm48.c21
-rw-r--r--src/gsm/libosmogsm.map1
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;