fixeria has uploaded this change for review.

View Change

flags: group BTS_INTERNAL_FLAG_* into an enum

Change-Id: I4c7d9f6dce61f7690b86c3973b13ddb63cdace04
---
M include/osmo-bts/bts.h
M src/common/vty.c
2 files changed, 30 insertions(+), 17 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/33/32333/1
diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h
index 6b5fe6f..0fff2a5 100644
--- a/include/osmo-bts/bts.h
+++ b/include/osmo-bts/bts.h
@@ -53,24 +53,28 @@
};
const char *btsvariant2str(enum gsm_bts_type_variant v);

-/* TODO: add a brief description of this flag */
-#define BTS_INTERNAL_FLAG_MS_PWR_CTRL_DSP (1 << 0)
-/* When this flag is set then the measurement data is included in
- * (PRIM_PH_DATA) and struct ph_tch_param (PRIM_TCH). Otherwise the
- * measurement data is passed using a separate MPH INFO MEAS IND.
- * (See also ticket: OS#2977) */
-#define BTS_INTERNAL_FLAG_MEAS_PAYLOAD_COMB (1 << 1)
-/* Whether the BTS model requires RadioCarrier MO to be in Enabled state
- * (OPSTARTed) before OPSTARTing the RadioChannel MOs. See OS#5157 */
-#define BTS_INTERNAL_FLAG_NM_RCHANNEL_DEPENDS_RCARRIER (1 << 2)
-/* Whether the BTS model reports interference measurements to L1SAP. */
-#define BTS_INTERNAL_FLAG_INTERF_MEAS (1 << 3)
+enum bts_impl_flag {
+ /* TODO: add a brief description of this flag */
+ BTS_INTERNAL_FLAG_MS_PWR_CTRL_DSP,
+ /* When this flag is set then the measurement data is included in
+ * (PRIM_PH_DATA) and struct ph_tch_param (PRIM_TCH). Otherwise the
+ * measurement data is passed using a separate MPH INFO MEAS IND.
+ * (See also ticket: OS#2977) */
+ BTS_INTERNAL_FLAG_MEAS_PAYLOAD_COMB,
+ /* Whether the BTS model requires RadioCarrier MO to be in Enabled state
+ * (OPSTARTed) before OPSTARTing the RadioChannel MOs. See OS#5157 */
+ BTS_INTERNAL_FLAG_NM_RCHANNEL_DEPENDS_RCARRIER,
+ /* Whether the BTS model reports interference measurements to L1SAP. */
+ BTS_INTERNAL_FLAG_INTERF_MEAS,
+
+ _BTS_INTERNAL_FLAG_NUM, /* must be at the end */
+};

/* BTS implementation flags (internal use, not exposed via OML) */
#define bts_internal_flag_get(bts, flag) \
- ((bts->flags & (typeof(bts->flags)) flag) != 0)
+ ((bts->flags & (typeof(bts->flags))(1 << flag)) != 0)
#define bts_internal_flag_set(bts, flag) \
- bts->flags |= (typeof(bts->flags)) flag
+ bts->flags |= (typeof(bts->flags))(1 << flag)

struct gprs_rlc_cfg {
uint16_t parameter[_NUM_RLC_PAR];
diff --git a/src/common/vty.c b/src/common/vty.c
index fd28828..92122ee 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -1228,10 +1228,10 @@

vty_out(vty, " BTS model specific (internal) flags:%s", VTY_NEWLINE);

- for (i = 0, no_features = true; i < sizeof(bts->flags) * 8; i++) {
- if (bts_internal_flag_get(bts, (1 << i))) {
+ for (i = 0, no_features = true; i < _BTS_INTERNAL_FLAG_NUM; i++) {
+ if (bts_internal_flag_get(bts, i)) {
vty_out(vty, " %03u ", i);
- vty_out(vty, "%-40s%s", get_value_string(bts_impl_flag_desc, (1 << i)), VTY_NEWLINE);
+ vty_out(vty, "%-40s%s", get_value_string(bts_impl_flag_desc, i), VTY_NEWLINE);
no_features = false;
}
}

To view, visit change 32333. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I4c7d9f6dce61f7690b86c3973b13ddb63cdace04
Gerrit-Change-Number: 32333
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de>
Gerrit-MessageType: newchange