summaryrefslogtreecommitdiffstats
path: root/openbsc/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2009-06-20 18:44:35 +0200
committerHarald Welte <laforge@gnumonks.org>2009-06-22 01:43:12 +0200
commitc8fb714aa8f53efe57464601833c613625d2c3dd (patch)
tree59448a1be7c1616849498a45a745883c0b9eaa40 /openbsc/src
parentfa457b1c00d7f462d180cf7ca7e9b2b179b3dfcb (diff)
Add parsing of 'L1 information' IE of MEASUREMENT RESULT
Diffstat (limited to 'openbsc/src')
-rw-r--r--openbsc/src/abis_rsl.c45
1 files changed, 43 insertions, 2 deletions
diff --git a/openbsc/src/abis_rsl.c b/openbsc/src/abis_rsl.c
index 5c1967d38..b8990c7ee 100644
--- a/openbsc/src/abis_rsl.c
+++ b/openbsc/src/abis_rsl.c
@@ -418,6 +418,41 @@ static int ms_pwr_ctl_lvl(struct gsm_bts *bts, unsigned int dbm)
return -EINVAL;
}
+static int ms_pwr_dbm(enum gsm_band band, u_int8_t lvl)
+{
+ lvl &= 0x1f;
+
+ switch (band) {
+ case GSM_BAND_400:
+ case GSM_BAND_900:
+ case GSM_BAND_850:
+ if (lvl < 2)
+ return 39;
+ else if (lvl < 20)
+ return 39 - ((lvl - 2) * 2) ;
+ else
+ return 5;
+ break;
+ case GSM_BAND_1800:
+ if (lvl < 16)
+ return 30 - (lvl * 2);
+ else if (lvl < 29)
+ return 0;
+ else
+ return 36 - ((lvl - 29) * 2);
+ break;
+ case GSM_BAND_1900:
+ if (lvl < 16)
+ return 30 - (lvl * 2);
+ else if (lvl < 30)
+ return -EINVAL;
+ else
+ return 33 - (lvl - 30);
+ break;
+ }
+ return -EINVAL;
+}
+
int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan, unsigned int fpc, int dbm)
{
struct abis_rsl_dchan_hdr *dh;
@@ -809,8 +844,14 @@ static int rsl_rx_meas_res(struct msgb *msg)
if (TLVP_PRESENT(&tp, RSL_IE_MS_TIMING_OFFSET))
DEBUGPC(DRSL, "MS_TO=%d ",
*TLVP_VAL(&tp, RSL_IE_MS_TIMING_OFFSET));
- if (TLVP_PRESENT(&tp, RSL_IE_L1_INFO))
- DEBUGPC(DRSL, "L1 ");
+ if (TLVP_PRESENT(&tp, RSL_IE_L1_INFO)) {
+ u_int8_t *val = TLVP_VAL(&tp, RSL_IE_L1_INFO);
+ u_int8_t pwr_lvl = val[0] >> 3;
+ DEBUGPC(DRSL, "L1_MS_PWR=%ddBm ",
+ ms_pwr_dbm(msg->trx->bts->band, pwr_lvl));
+ DEBUGPC(DRSL, "L1_FPC=%u ", val[0] & 0x04 ? 1 : 0);
+ DEBUGPC(DRSL, "L1_TA=%u ", val[1]);
+ }
if (TLVP_PRESENT(&tp, RSL_IE_L3_INFO)) {
DEBUGPC(DRSL, "L3\n");
msg->l3h = TLVP_VAL(&tp, RSL_IE_L3_INFO);