aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-sysmo/misc/sysmobts_mgr_2050.c
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 /src/osmo-bts-sysmo/misc/sysmobts_mgr_2050.c
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.
Diffstat (limited to 'src/osmo-bts-sysmo/misc/sysmobts_mgr_2050.c')
-rw-r--r--src/osmo-bts-sysmo/misc/sysmobts_mgr_2050.c39
1 files changed, 21 insertions, 18 deletions
diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr_2050.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr_2050.c
index ce1aaf8c..7de68954 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;
}
/**********************************************************************