diff options
Diffstat (limited to 'src/osmo-bts-sysmo/misc')
-rw-r--r-- | src/osmo-bts-sysmo/misc/sysmobts_mgr.c | 2 | ||||
-rw-r--r-- | src/osmo-bts-sysmo/misc/sysmobts_mgr_2050.c | 25 | ||||
-rw-r--r-- | src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c | 20 | ||||
-rw-r--r-- | src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c | 22 | ||||
-rw-r--r-- | src/osmo-bts-sysmo/misc/sysmobts_misc.h | 3 |
5 files changed, 66 insertions, 6 deletions
diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr.c index 919bc520..484e08ff 100644 --- a/src/osmo-bts-sysmo/misc/sysmobts_mgr.c +++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr.c @@ -73,7 +73,7 @@ static struct sysmobts_mgr_instance manager = { .thresh_crit = 100, }, .action_warn = 0, - .action_crit = 0, + .action_crit = TEMP_ACT_PA_OFF, .state = STATE_NORMAL, }; diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr_2050.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr_2050.c index cdb78323..3064319f 100644 --- a/src/osmo-bts-sysmo/misc/sysmobts_mgr_2050.c +++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr_2050.c @@ -247,7 +247,7 @@ int sbts2050_uc_get_status(struct sbts2050_power_status *status) /********************************************************************** * Uc Power Switching handling *********************************************************************/ -void sbts2050_uc_set_power(int pmaster, int pslave, int ppa) +int sbts2050_uc_set_power(int pmaster, int pslave, int ppa) { struct msgb *msg; const struct ucinfo info = { @@ -261,7 +261,7 @@ void sbts2050_uc_set_power(int pmaster, int pslave, int ppa) if (msg == NULL) { LOGP(DTEMP, LOGL_ERROR, "Error switching off some unit.\n"); - return; + return -1; } LOGP(DTEMP, LOGL_DEBUG, "Switch off/on success:\n" @@ -273,6 +273,7 @@ void sbts2050_uc_set_power(int pmaster, int pslave, int ppa) ppa ? "ON" : "OFF"); msgb_free(msg); + return 0; } /********************************************************************** @@ -317,6 +318,20 @@ void sbts2050_uc_initialize(void) "Failed to open the serial interface\n"); return; } + + LOGP(DTEMP, LOGL_NOTICE, "Going to enable the PA.\n"); + sbts2050_uc_set_pa_power(1); +} + +int sbts2050_uc_set_pa_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, status.slave_enabled, on_off); } #else void sbts2050_uc_initialize(void) @@ -338,4 +353,10 @@ int sbts2050_uc_get_status(struct sbts2050_power_status *status) return -1; } +int sbts2050_uc_set_pa_power(int on_off) +{ + LOGP(DTEMP, LOGL_ERROR, "sysmoBTS2050 compiled without PA 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 d3a46283..dac226f5 100644 --- a/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c +++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c @@ -96,6 +96,26 @@ static void execute_warning_act(struct sysmobts_mgr_instance *manager) static void execute_critical_act(struct sysmobts_mgr_instance *manager) { LOGP(DTEMP, LOGL_NOTICE, "System has reached critical warning.\n"); + + /* switch off the PA */ + if (manager->action_crit & TEMP_ACT_PA_OFF) { + if (!is_sbts2050_master()) { + LOGP(DTEMP, LOGL_NOTICE, + "PA can only be switched-off on the master\n"); + } else if (sbts2050_uc_set_pa_power(0) != 0) { + LOGP(DTEMP, LOGL_ERROR, + "Failed to switch off the PA. Stop BTS?\n"); + } else { + LOGP(DTEMP, LOGL_NOTICE, + "Switched off the PA due temperature.\n"); + } + /* + * TODO: remember we switched off things so we could switch + * it back on. But we would need to make sure that the BTS + * will not transmit with full power at that time. This + * requires the control protocol. + */ + } } static void sysmobts_mgr_temp_handle(struct sysmobts_mgr_instance *manager, diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c index 4ed582b2..16373748 100644 --- a/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c +++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c @@ -167,9 +167,9 @@ static void write_action(struct vty *vty, const char *name, int actions) (actions & TEMP_ACT_MASTER_OFF) ? "" : "no ", VTY_NEWLINE); vty_out(vty, " %sslave-off%s", (actions & TEMP_ACT_MASTER_OFF) ? "" : "no ", VTY_NEWLINE); +#endif vty_out(vty, " %spa-off%s", (actions & TEMP_ACT_PA_OFF) ? "" : "no ", VTY_NEWLINE); -#endif } static int config_write_mgr(struct vty *vty) @@ -239,6 +239,24 @@ CFG_ACTION(warn, "Warning Actions\n", ACT_WARN_NODE, action_warn) CFG_ACTION(critical, "Critical Actions\n", ACT_CRIT_NODE, action_crit) #undef CFG_ACTION +DEFUN(cfg_action_pa_off, cfg_action_pa_off_cmd, + "pa-off", + "Switch the Power Amplifier off\n") +{ + int *action = vty->index; + *action |= TEMP_ACT_PA_OFF; + return CMD_SUCCESS; +} + +DEFUN(cfg_no_action_pa_off, cfg_no_action_pa_off_cmd, + "no pa-off", + NO_STR "Do not switch off the Power Amplifier\n") +{ + int *action = vty->index; + *action &= ~TEMP_ACT_PA_OFF; + return CMD_SUCCESS; +} + DEFUN(show_mgr, show_mgr_cmd, "show manager", SHOW_STR "Display information about the manager") { @@ -303,9 +321,9 @@ static void register_action(int act) 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); -#endif } 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 28b6e628..8a6337e2 100644 --- a/src/osmo-bts-sysmo/misc/sysmobts_misc.h +++ b/src/osmo-bts-sysmo/misc/sysmobts_misc.h @@ -56,8 +56,9 @@ struct sbts2050_power_status { }; int sbts2050_uc_check_temp(int *temp_pa, int *temp_board); -void sbts2050_uc_set_power(int pmaster, int pslave, int ppa); +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); void sbts2050_uc_initialize(); #endif |