aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-sysmo/main.c
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2013-11-04 18:13:52 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-11-05 15:51:19 +0100
commit5b69ec3e720d21753101c9a0e1a38d0926ba3854 (patch)
tree5b07ab53e6858ad895cc8041f3beae007647746a /src/osmo-bts-sysmo/main.c
parent08571b158835df3db09cc94686a8fe62d1845cc9 (diff)
sysmobts: Use status flags instead of direct LED access
Currently the LEDs are being accessed directly from within the l1_if.c file. So the handling of rf mute and activate/deactivate both access LED_RF_ACTIVE directly. This may lead to an inconsistent LED status. This patch replaces these calls to sysmobts_led_set() by an abstract equivalent bts_update_status(), that uses a set of independant status ids. The associated values can than be combined into a visible LED status. Currently LED_RF_ACTIVE is on iff BTS_STATUS_RF_ACTIVE is set and BTS_STATUS_RF_MUTE is not set. Sponsored-by: On-Waves ehf
Diffstat (limited to 'src/osmo-bts-sysmo/main.c')
-rw-r--r--src/osmo-bts-sysmo/main.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/osmo-bts-sysmo/main.c b/src/osmo-bts-sysmo/main.c
index 5a7c8122..046326be 100644
--- a/src/osmo-bts-sysmo/main.c
+++ b/src/osmo-bts-sysmo/main.c
@@ -51,6 +51,7 @@
#include "utils.h"
#include "eeprom.h"
#include "l1_if.h"
+#include "hw_misc.h"
/* FIXME: read from real hardware */
const uint8_t abis_mac[6] = { 0,1,2,3,4,5 };
@@ -122,6 +123,30 @@ void clk_cal_use_eeprom(struct gsm_bts *bts)
"Read clock calibration(%d) from EEPROM.\n", hdl->clk_cal);
}
+void bts_update_status(enum bts_global_status which, int on)
+{
+ static uint64_t states = 0;
+ uint64_t old_states = states;
+ int led_rf_active_on;
+
+ if (on)
+ states |= (1ULL << which);
+ else
+ states &= ~(1ULL << which);
+
+ led_rf_active_on =
+ (states & (1ULL << BTS_STATUS_RF_ACTIVE)) &&
+ !(states & (1ULL << BTS_STATUS_RF_MUTE));
+
+ LOGP(DL1C, LOGL_INFO,
+ "Set global status #%d to %d (%04llx -> %04llx), LEDs: ACT %d\n",
+ which, on,
+ (long long)old_states, (long long)states,
+ led_rf_active_on);
+
+ sysmobts_led_set(LED_RF_ACTIVE, led_rf_active_on);
+}
+
static void print_help()
{
printf( "Some useful options:\n"