aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-sysmo
diff options
context:
space:
mode:
Diffstat (limited to 'src/osmo-bts-sysmo')
-rw-r--r--src/osmo-bts-sysmo/misc/sysmobts_mgr.h6
-rw-r--r--src/osmo-bts-sysmo/misc/sysmobts_mgr_2050.c20
-rw-r--r--src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c26
-rw-r--r--src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c54
-rw-r--r--src/osmo-bts-sysmo/misc/sysmobts_misc.h1
5 files changed, 97 insertions, 10 deletions
diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr.h b/src/osmo-bts-sysmo/misc/sysmobts_mgr.h
index fde28e8a..0a32c281 100644
--- a/src/osmo-bts-sysmo/misc/sysmobts_mgr.h
+++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr.h
@@ -14,9 +14,8 @@ enum {
enum {
#if 0
TEMP_ACT_PWR_CONTRL = 0x1,
- TEMP_ACT_MASTER_OFF = 0x2,
- TEMP_ACT_SLAVE_OFF = 0x4,
#endif
+ TEMP_ACT_SLAVE_OFF = 0x4,
TEMP_ACT_PA_OFF = 0x8,
TEMP_ACT_BTS_SRV_OFF = 0x10,
};
@@ -25,9 +24,8 @@ enum {
enum {
#if 0
TEMP_ACT_NORM_PW_CONTRL = 0x1,
- TEMP_ACT_NORM_MASTER_ON = 0x2,
- TEMP_ACT_NORM_SLAVE_ON = 0x4,
#endif
+ TEMP_ACT_NORM_SLAVE_ON = 0x4,
TEMP_ACT_NORM_PA_ON = 0x8,
TEMP_ACT_NORM_BTS_SRV_ON= 0x10,
};
diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr_2050.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr_2050.c
index b4091e91..12961e3f 100644
--- a/src/osmo-bts-sysmo/misc/sysmobts_mgr_2050.c
+++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr_2050.c
@@ -335,6 +335,20 @@ int sbts2050_uc_set_pa_power(int on_off)
return sbts2050_uc_set_power(status.master_enabled, status.slave_enabled, on_off);
}
+
+int sbts2050_uc_set_slave_power(int on_off)
+{
+ struct sbts2050_power_status status;
+ if (sbts2050_uc_get_status(&status) != 0) {
+ LOGP(DTEMP, LOGL_ERROR, "Failed to read current power status.\n");
+ return -1;
+ }
+
+ return sbts2050_uc_set_power(
+ status.master_enabled,
+ on_off,
+ status.pa_enabled);
+}
#else
void sbts2050_uc_initialize(void)
{
@@ -361,4 +375,10 @@ int sbts2050_uc_set_pa_power(int on_off)
return -1;
}
+int sbts2050_uc_set_slave_power(int on_off)
+{
+ LOGP(DTEMP, LOGL_ERROR, "sysmoBTS2050 compiled without UC support.\n");
+ return -1;
+}
+
#endif
diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c
index 39b20dca..34af2abc 100644
--- a/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c
+++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c
@@ -93,6 +93,19 @@ static void handle_normal_actions(int actions)
}
}
+ if (actions & TEMP_ACT_NORM_SLAVE_ON) {
+ if (!is_sbts2050()) {
+ LOGP(DTEMP, LOGL_NOTICE,
+ "Slave on only possible on the sysmoBTS2050\n");
+ } else if (sbts2050_uc_set_slave_power(1) != 0) {
+ LOGP(DTEMP, LOGL_ERROR,
+ "Failed to switch on the slave BTS\n");
+ } else {
+ LOGP(DTEMP, LOGL_NOTICE,
+ "Switched on the slave as normal action.\n");
+ }
+ }
+
if (actions & TEMP_ACT_NORM_BTS_SRV_ON) {
LOGP(DTEMP, LOGL_NOTICE,
"Going to switch on the BTS service\n");
@@ -121,6 +134,19 @@ static void handle_actions(int actions)
}
}
+ if (actions & TEMP_ACT_SLAVE_OFF) {
+ if (!is_sbts2050()) {
+ LOGP(DTEMP, LOGL_NOTICE,
+ "Slave off only possible on the sysmoBTS2050\n");
+ } else if (sbts2050_uc_set_slave_power(0) != 0) {
+ LOGP(DTEMP, LOGL_ERROR,
+ "Failed to switch off the slave BTS\n");
+ } else {
+ LOGP(DTEMP, LOGL_NOTICE,
+ "Switched off the slave due temperature\n");
+ }
+ }
+
if (actions & TEMP_ACT_BTS_SRV_OFF) {
LOGP(DTEMP, LOGL_NOTICE,
"Going to switch off the BTS service\n");
diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c
index 9c7e7d30..7df3b050 100644
--- a/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c
+++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c
@@ -170,6 +170,8 @@ static void write_norm_action(struct vty *vty, const char *name, int actions)
(actions & TEMP_ACT_NORM_PA_ON) ? "" : "no ", VTY_NEWLINE);
vty_out(vty, " %sbts-service-on%s",
(actions & TEMP_ACT_NORM_BTS_SRV_ON) ? "" : "no ", VTY_NEWLINE);
+ vty_out(vty, " %sslave-on%s",
+ (actions & TEMP_ACT_NORM_SLAVE_ON) ? "" : "no ", VTY_NEWLINE);
}
static void write_action(struct vty *vty, const char *name, int actions)
@@ -189,6 +191,8 @@ static void write_action(struct vty *vty, const char *name, int actions)
(actions & TEMP_ACT_PA_OFF) ? "" : "no ", VTY_NEWLINE);
vty_out(vty, " %sbts-service-off%s",
(actions & TEMP_ACT_BTS_SRV_OFF) ? "" : "no ", VTY_NEWLINE);
+ vty_out(vty, " %sslave-off%s",
+ (actions & TEMP_ACT_SLAVE_OFF) ? "" : "no ", VTY_NEWLINE);
}
static int config_write_mgr(struct vty *vty)
@@ -296,6 +300,24 @@ DEFUN(cfg_no_action_bts_srv_on, cfg_no_action_bts_srv_on_cmd,
return CMD_SUCCESS;
}
+DEFUN(cfg_action_slave_on, cfg_action_slave_on_cmd,
+ "slave-on",
+ "Power-on secondary device on sysmoBTS2050\n")
+{
+ int *action = vty->index;
+ *action |= TEMP_ACT_NORM_SLAVE_ON;
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_no_action_slave_on, cfg_no_action_slave_on_cmd,
+ "no slave-on",
+ NO_STR "Power-on secondary device on sysmoBTS2050\n")
+{
+ int *action = vty->index;
+ *action &= ~TEMP_ACT_NORM_SLAVE_ON;
+ return CMD_SUCCESS;
+}
+
DEFUN(cfg_action_pa_off, cfg_action_pa_off_cmd,
"pa-off",
"Switch the Power Amplifier off\n")
@@ -332,6 +354,24 @@ DEFUN(cfg_no_action_bts_srv_off, cfg_no_action_bts_srv_off_cmd,
return CMD_SUCCESS;
}
+DEFUN(cfg_action_slave_off, cfg_action_slave_off_cmd,
+ "slave-off",
+ "Power-off secondary device on sysmoBTS2050\n")
+{
+ int *action = vty->index;
+ *action |= TEMP_ACT_SLAVE_OFF;
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_no_action_slave_off, cfg_no_action_slave_off_cmd,
+ "no slave-off",
+ NO_STR "Power-off secondary device on sysmoBTS2050\n")
+{
+ int *action = vty->index;
+ *action &= ~TEMP_ACT_SLAVE_OFF;
+ return CMD_SUCCESS;
+}
+
DEFUN(show_mgr, show_mgr_cmd, "show manager",
SHOW_STR "Display information about the manager")
{
@@ -394,6 +434,10 @@ static void register_normal_action(int act)
install_element(act, &cfg_no_action_pa_on_cmd);
install_element(act, &cfg_action_bts_srv_on_cmd);
install_element(act, &cfg_no_action_bts_srv_on_cmd);
+
+ /* these only work on the sysmobts 2050 */
+ install_element(act, &cfg_action_slave_on_cmd);
+ install_element(act, &cfg_no_action_slave_on_cmd);
}
static void register_action(int act)
@@ -401,17 +445,15 @@ static void register_action(int act)
#if 0
install_element(act, &cfg_action_pwr_contrl_cmd);
install_element(act, &cfg_no_action_pwr_contrl_cmd);
-
- /* these only work on the sysmobts 2050 */
- install_element(act, &cfg_action_master_off_cmd);
- install_element(act, &cfg_no_action_master_off_cmd);
- install_element(act, &cfg_action_slave_off_cmd);
- install_element(act, &cfg_no_action_slave_off_cmd);
#endif
install_element(act, &cfg_action_pa_off_cmd);
install_element(act, &cfg_no_action_pa_off_cmd);
install_element(act, &cfg_action_bts_srv_off_cmd);
install_element(act, &cfg_no_action_bts_srv_off_cmd);
+
+ /* these only work on the sysmobts 2050 */
+ install_element(act, &cfg_action_slave_off_cmd);
+ install_element(act, &cfg_no_action_slave_off_cmd);
}
int sysmobts_mgr_vty_init(void)
diff --git a/src/osmo-bts-sysmo/misc/sysmobts_misc.h b/src/osmo-bts-sysmo/misc/sysmobts_misc.h
index 8a6337e2..06166cf6 100644
--- a/src/osmo-bts-sysmo/misc/sysmobts_misc.h
+++ b/src/osmo-bts-sysmo/misc/sysmobts_misc.h
@@ -59,6 +59,7 @@ int sbts2050_uc_check_temp(int *temp_pa, int *temp_board);
int sbts2050_uc_set_power(int pmaster, int pslave, int ppa);
int sbts2050_uc_get_status(struct sbts2050_power_status *status);
int sbts2050_uc_set_pa_power(int on_off);
+int sbts2050_uc_set_slave_power(int on_off);
void sbts2050_uc_initialize();
#endif