aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-07-31 22:12:56 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-08-21 16:25:07 +0200
commit5e1363071f9e9951985ba1a21196c5548350fafc (patch)
tree5475f928da290d771a20276169a3786f14b3eda8
parent4059e29a29039759c60624f87e45d35d922d88d1 (diff)
sysmobts: Fix the power request result
We want to know which componets are enabled and the voltage and current used by the components.
-rw-r--r--src/osmo-bts-sysmo/misc/sysmobts_mgr_2050.c39
-rw-r--r--src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c23
-rw-r--r--src/osmo-bts-sysmo/misc/sysmobts_misc.h26
3 files changed, 63 insertions, 25 deletions
diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr_2050.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr_2050.c
index ce1aaf8..7de6895 100644
--- a/src/osmo-bts-sysmo/misc/sysmobts_mgr_2050.c
+++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr_2050.c
@@ -28,6 +28,7 @@
#include <errno.h>
#include <unistd.h>
+#include <string.h>
#ifdef BUILD_SBTS2050
#include <sysmocom/femtobts/sbts2050_header.h>
@@ -203,41 +204,43 @@ err:
/**********************************************************************
* Get power status function
*********************************************************************/
-int sbts2050_uc_get_status(enum sbts2050_status_rqt status)
+int sbts2050_uc_get_status(struct sbts2050_power_status *status)
{
struct msgb *msg;
const struct ucinfo info = {
.id = SBTS2050_PWR_STATUS,
};
rsppkt_t *response;
- int val_status;
+ memset(status, 0, sizeof(*status));
msg = sbts2050_ucinfo_get(&ucontrol0, &info);
if (msg == NULL) {
LOGP(DTEMP, LOGL_ERROR,
- "Error requesting power status: %d\n", status);
+ "Error requesting power status.\n");
return -1;
}
response = (rsppkt_t *)msg->data;
- switch (status) {
- case SBTS2050_STATUS_MASTER:
- val_status = response->rsp.pwrGetStatus.u1MasterEn;
- break;
- case SBTS2050_STATUS_SLAVE:
- val_status = response->rsp.pwrGetStatus.u1SlaveEn;
- break;
- case SBTS2050_STATUS_PA:
- val_status = response->rsp.pwrGetStatus.u1PwrAmpEn;
- break;
- default:
- msgb_free(msg);
- return -1;
- }
+ status->main_supply_current = response->rsp.pwrGetStatus.u8MainSupplyA / 64.f;
+
+ status->master_enabled = response->rsp.pwrGetStatus.u1MasterEn;
+ status->master_voltage = response->rsp.pwrGetStatus.u8MasterV / 32.f;
+ status->master_current = response->rsp.pwrGetStatus.u8MasterA / 64.f;;
+
+ status->slave_enabled = response->rsp.pwrGetStatus.u1SlaveEn;
+ status->slave_voltage = response->rsp.pwrGetStatus.u8SlaveV / 32.f;
+ status->slave_current = response->rsp.pwrGetStatus.u8SlaveA / 64.f;
+
+ status->pa_enabled = response->rsp.pwrGetStatus.u1PwrAmpEn;
+ status->pa_voltage = response->rsp.pwrGetStatus.u8PwrAmpV / 4.f;
+ status->pa_current = response->rsp.pwrGetStatus.u8PwrAmpA / 64.f;
+
+ status->pa_bias_voltage = response->rsp.pwrGetStatus.u8PwrAmpBiasV / 16.f;
+
msgb_free(msg);
- return val_status;
+ return 0;
}
/**********************************************************************
diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c
index 92e1073..1cabe44 100644
--- a/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c
+++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c
@@ -107,9 +107,32 @@ DEFUN(show_mgr, show_mgr_cmd, "show manager",
VTY_NEWLINE);
if (is_sbts2050_master()) {
int temp_pa, temp_board;
+ struct sbts2050_power_status status;
+
sbts2050_uc_check_temp(&temp_pa, &temp_board);
vty_out(vty, " sysmoBTS 2050 PA: %d Celcius%s", temp_pa, VTY_NEWLINE);
vty_out(vty, " sysmoBTS 2050 PA: %d CelciusC%s", temp_board, VTY_NEWLINE);
+
+ sbts2050_uc_get_status(&status);
+ vty_out(vty, "Power Status%s", VTY_NEWLINE);
+ vty_out(vty, " Main Supply :(ON) [(24.00)Vdc, %4.2f A]%s",
+ status.main_supply_current, VTY_NEWLINE);
+ vty_out(vty, " Master SF : %s [%6.2f Vdc, %4.2f A]%s",
+ status.master_enabled ? "ON " : "OFF",
+ status.master_voltage, status.master_current,
+ VTY_NEWLINE);
+ vty_out(vty, " Slave SF : %s [%6.2f Vdc, %4.2f A]%s",
+ status.slave_enabled ? "ON" : "OFF",
+ status.slave_voltage, status.slave_current,
+ VTY_NEWLINE);
+ vty_out(vty, " Power Amp : %s [%6.2f Vdc, %4.2f A]%s",
+ status.pa_enabled ? "ON" : "OFF",
+ status.pa_voltage, status.pa_current,
+ VTY_NEWLINE);
+ vty_out(vty, " PA Bias : %s [%6.2f Vdc, ---- A]%s",
+ status.pa_enabled ? "ON" : "OFF",
+ status.pa_bias_voltage,
+ VTY_NEWLINE);
}
return CMD_SUCCESS;
diff --git a/src/osmo-bts-sysmo/misc/sysmobts_misc.h b/src/osmo-bts-sysmo/misc/sysmobts_misc.h
index 238095d..9d1bb47 100644
--- a/src/osmo-bts-sysmo/misc/sysmobts_misc.h
+++ b/src/osmo-bts-sysmo/misc/sysmobts_misc.h
@@ -21,12 +21,6 @@ enum sysmobts_temp_type {
_NUM_TEMP_TYPES
};
-enum sbts2050_status_rqt {
- SBTS2050_STATUS_MASTER,
- SBTS2050_STATUS_SLAVE,
- SBTS2050_STATUS_PA
-};
-
int sysmobts_temp_get(enum sysmobts_temp_sensor sensor,
enum sysmobts_temp_type type);
@@ -47,9 +41,27 @@ int is_sbts2050(void);
int is_sbts2050_trx(int);
int is_sbts2050_master(void);
+struct sbts2050_power_status {
+ float main_supply_current;
+
+ int master_enabled;
+ float master_voltage;
+ float master_current;
+
+ int slave_enabled;
+ float slave_voltage;
+ float slave_current;
+
+ int pa_enabled;
+ float pa_voltage;
+ float pa_current;
+
+ float pa_bias_voltage;
+};
+
void sbts2050_uc_check_temp(int *temp_pa, int *temp_board);
void sbts2050_uc_set_power(int pmaster, int pslave, int ppa);
-int sbts2050_uc_get_status(enum sbts2050_status_rqt status);
+int sbts2050_uc_get_status(struct sbts2050_power_status *status);
void sbts2050_uc_initialize();
#endif