From 680acae725b2b8dda2f239ff20073306fdfb3f6e Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Thu, 1 Mar 2018 19:13:05 +0100 Subject: features: move bts feature related functionality to libosmocore osmo-bsc and osmo-bts share enums and value strings to describe feature data that is exchanged via OML (manufacturer id) on startup. Also the functions to set and get the respecitive bits in the feature bitvectors are in osmo-bsc and osmo-bts. This is a code duplication and should be resolved. - add enum osmo_bts_features (replaces enum gsm_bts_features) - add osmo_bts_features_descs (replaces gsm_bts_features_descs) - add osmo_bts_set_feature (replaces gsm_btsmodel_set_feature) - add osmo_bts_has_feature (replaces gsm_btsmodel_has_feature) Change-Id: Id0c35aef11aa49aa40abe7deef1f9dbd12210776 --- include/Makefile.am | 1 + include/osmocom/gsm/bts_features.h | 43 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 include/osmocom/gsm/bts_features.h (limited to 'include') diff --git a/include/Makefile.am b/include/Makefile.am index 8b05f80b..f82012f3 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -67,6 +67,7 @@ nobase_include_HEADERS = \ osmocom/gsm/a5.h \ osmocom/gsm/abis_nm.h \ osmocom/gsm/apn.h \ + osmocom/gsm/bts_features.h \ osmocom/gsm/comp128.h \ osmocom/gsm/comp128v23.h \ osmocom/gsm/bitvec_gsm.h \ diff --git a/include/osmocom/gsm/bts_features.h b/include/osmocom/gsm/bts_features.h new file mode 100644 index 00000000..f9b0142f --- /dev/null +++ b/include/osmocom/gsm/bts_features.h @@ -0,0 +1,43 @@ +#pragma once + +#include +#include + +#define MAX_BTS_FEATURES 128 + +/* N. B: always add new features to the end of the list (right before _NUM_BTS_FEAT) to avoid breaking compatibility + with BTS compiled against earlier version of this header. Also make sure that the description strings + gsm_bts_features_descs[] in gsm_data.c are also updated accordingly! */ +enum osmo_bts_features { + BTS_FEAT_HSCSD, + BTS_FEAT_GPRS, + BTS_FEAT_EGPRS, + BTS_FEAT_ECSD, + BTS_FEAT_HOPPING, + BTS_FEAT_MULTI_TSC, + BTS_FEAT_OML_ALERTS, + BTS_FEAT_AGCH_PCH_PROP, + BTS_FEAT_CBCH, + BTS_FEAT_SPEECH_F_V1, + BTS_FEAT_SPEECH_H_V1, + BTS_FEAT_SPEECH_F_EFR, + BTS_FEAT_SPEECH_F_AMR, + BTS_FEAT_SPEECH_H_AMR, + _NUM_BTS_FEAT +}; + +extern const struct value_string osmo_bts_features_descs[]; + +const char *osmo_bts_feature_name(enum osmo_bts_features feature); + +inline int osmo_bts_set_feature(struct bitvec *features, enum osmo_bts_features feature) +{ + OSMO_ASSERT(_NUM_BTS_FEAT < MAX_BTS_FEATURES); + return bitvec_set_bit_pos(features, feature, 1); +} + +inline bool osmo_bts_has_feature(const struct bitvec *features, enum osmo_bts_features feature) +{ + OSMO_ASSERT(_NUM_BTS_FEAT < MAX_BTS_FEATURES); + return bitvec_get_bit_pos(features, feature); +} -- cgit v1.2.3