blob: 22461a6bfd26f4d9dced34449df8bbf0cd0c8eb7 [file] [log] [blame]
Philipp Maier680acae2018-03-01 19:13:05 +01001#pragma once
2
3#include <osmocom/core/utils.h>
4#include <osmocom/core/bitvec.h>
5
6#define MAX_BTS_FEATURES 128
7
8/* N. B: always add new features to the end of the list (right before _NUM_BTS_FEAT) to avoid breaking compatibility
9 with BTS compiled against earlier version of this header. Also make sure that the description strings
10 gsm_bts_features_descs[] in gsm_data.c are also updated accordingly! */
11enum osmo_bts_features {
12 BTS_FEAT_HSCSD,
13 BTS_FEAT_GPRS,
14 BTS_FEAT_EGPRS,
15 BTS_FEAT_ECSD,
16 BTS_FEAT_HOPPING,
17 BTS_FEAT_MULTI_TSC,
18 BTS_FEAT_OML_ALERTS,
19 BTS_FEAT_AGCH_PCH_PROP,
20 BTS_FEAT_CBCH,
21 BTS_FEAT_SPEECH_F_V1,
22 BTS_FEAT_SPEECH_H_V1,
23 BTS_FEAT_SPEECH_F_EFR,
24 BTS_FEAT_SPEECH_F_AMR,
25 BTS_FEAT_SPEECH_H_AMR,
Harald Welte994df262019-09-03 16:52:09 +020026 BTS_FEAT_ETWS_PN,
Harald Welte17933342020-06-21 15:32:41 +020027 BTS_FEAT_PAGING_COORDINATION, /* BTS hands CS paging to PCU/PACCH */
Philipp Maier680acae2018-03-01 19:13:05 +010028 _NUM_BTS_FEAT
29};
30
31extern const struct value_string osmo_bts_features_descs[];
32
33const char *osmo_bts_feature_name(enum osmo_bts_features feature);
34
Philipp Maierbf86d712018-03-05 13:26:44 +010035static inline int osmo_bts_set_feature(struct bitvec *features, enum osmo_bts_features feature)
Philipp Maier680acae2018-03-01 19:13:05 +010036{
37 OSMO_ASSERT(_NUM_BTS_FEAT < MAX_BTS_FEATURES);
38 return bitvec_set_bit_pos(features, feature, 1);
39}
40
Vadim Yanitskiy383b3bf2020-05-31 16:03:30 +070041static inline int osmo_bts_unset_feature(struct bitvec *features, enum osmo_bts_features feature)
42{
43 OSMO_ASSERT(_NUM_BTS_FEAT < MAX_BTS_FEATURES);
44 return bitvec_set_bit_pos(features, feature, 0);
45}
46
Philipp Maierbf86d712018-03-05 13:26:44 +010047static inline bool osmo_bts_has_feature(const struct bitvec *features, enum osmo_bts_features feature)
Philipp Maier680acae2018-03-01 19:13:05 +010048{
49 OSMO_ASSERT(_NUM_BTS_FEAT < MAX_BTS_FEATURES);
Vadim Yanitskiyf8e153d2020-05-31 16:06:36 +070050 return bitvec_get_bit_pos(features, feature) == ONE;
Philipp Maier680acae2018-03-01 19:13:05 +010051}