aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-01-29 20:57:17 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-02-05 23:03:21 +0100
commitcc4ada5bc4fdd1eb0b20ad2512312f20c253669b (patch)
tree22710555b7ad5389e4001412ccbae80745a56292
parent35f49065f59053364b73f4343103d463ed6ec058 (diff)
power: Make it possible to force a power levelsysmocom/0.3.0-dora
Use the standard RSL commands to order a logical channel to use a fixed power level. The code is not fully verified and there was a last minute change to invoke bts_model_adjst_ms_pwr. Conflicts: tests/stubs.c
-rw-r--r--src/common/rsl.c23
-rw-r--r--tests/stubs.c5
2 files changed, 28 insertions, 0 deletions
diff --git a/src/common/rsl.c b/src/common/rsl.c
index 5082f2a..5a2befd 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -1089,6 +1089,26 @@ static int rsl_rx_mode_modif(struct msgb *msg)
return rc;
}
+/* 8.4.15 MS POWER CONTROL */
+static int rsl_rx_ms_pwr_ctrl(struct msgb *msg)
+{
+ struct gsm_lchan *lchan = msg->lchan;
+ struct tlv_parsed tp;
+
+ rsl_tlv_parse(&tp, msgb_l3(msg), msgb_l3len(msg));
+ if (TLVP_PRESENT(&tp, RSL_IE_MS_POWER)) {
+ uint8_t pwr = *TLVP_VAL(&tp, RSL_IE_MS_POWER) & 0x1F;
+ lchan->ms_power_ctrl.fixed = 1;
+ lchan->ms_power_ctrl.current = pwr;
+
+ LOGP(DRSL, LOGL_NOTICE, "%s forcing power to %d\n",
+ gsm_lchan_name(lchan), lchan->ms_power_ctrl.current);
+ bts_model_adjst_ms_pwr(lchan);
+ }
+
+ return 0;
+}
+
/* 8.4.20 SACCH INFO MODify */
static int rsl_rx_sacch_inf_mod(struct msgb *msg)
{
@@ -1750,6 +1770,9 @@ static int rsl_rx_dchan(struct gsm_bts_trx *trx, struct msgb *msg)
case RSL_MT_MODE_MODIFY_REQ:
ret = rsl_rx_mode_modif(msg);
break;
+ case RSL_MT_MS_POWER_CONTROL:
+ ret = rsl_rx_ms_pwr_ctrl(msg);
+ break;
case RSL_MT_PHY_CONTEXT_REQ:
case RSL_MT_PREPROC_CONFIG:
case RSL_MT_RTD_REP:
diff --git a/tests/stubs.c b/tests/stubs.c
index 99961aa..260172c 100644
--- a/tests/stubs.c
+++ b/tests/stubs.c
@@ -51,3 +51,8 @@ uint32_t trx_get_hlayer1(struct gsm_bts_trx *trx)
int bts_model_oml_estab(struct gsm_bts *bts)
{ return 0; }
+
+
+
+int bts_model_adjst_ms_pwr(struct gsm_lchan *lchan)
+{ return 0; } \ No newline at end of file