Philipp Maier | 680acae | 2018-03-01 19:13:05 +0100 | [diff] [blame] | 1 | #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 |
Pau Espin Pedrol | 5f2b8e5 | 2021-01-29 17:04:14 +0100 | [diff] [blame] | 10 | osmo_bts_features_descs[] in gsm_data.c are also updated accordingly! */ |
Philipp Maier | 680acae | 2018-03-01 19:13:05 +0100 | [diff] [blame] | 11 | enum 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 Welte | 994df26 | 2019-09-03 16:52:09 +0200 | [diff] [blame] | 26 | BTS_FEAT_ETWS_PN, |
Harald Welte | 1793334 | 2020-06-21 15:32:41 +0200 | [diff] [blame] | 27 | BTS_FEAT_PAGING_COORDINATION, /* BTS hands CS paging to PCU/PACCH */ |
Alexander Couzens | 03a4213 | 2020-06-07 22:53:31 +0200 | [diff] [blame] | 28 | BTS_FEAT_IPV6_NSVC, |
Philipp Maier | aa71846 | 2020-11-15 14:08:01 +0100 | [diff] [blame] | 29 | BTS_FEAT_ACCH_REP, |
Pau Espin Pedrol | 3e3f377 | 2021-01-29 17:12:14 +0100 | [diff] [blame] | 30 | BTS_FEAT_CCN, /* Is CCN supported by the cell? TS 44.060 sec 8.8.2 */ |
Neels Hofmeyr | 158bc79 | 2021-03-27 17:14:57 +0100 | [diff] [blame] | 31 | BTS_FEAT_VAMOS, /* Is the BTS VAMOS capable? */ |
Pau Espin Pedrol | 42bb125 | 2021-05-31 17:11:45 +0200 | [diff] [blame] | 32 | BTS_FEAT_ABIS_OSMO_PCU, /* BTS supports forwarding data to PCUIF over IPA OML multiplex */ |
Vadim Yanitskiy | 1c2a329 | 2021-06-25 19:34:38 +0200 | [diff] [blame] | 33 | BTS_FEAT_BCCH_POWER_RED, |
Pau Espin Pedrol | d9825c0 | 2021-06-29 11:54:30 +0200 | [diff] [blame] | 34 | BTS_FEAT_DYN_TS_SDCCH8, /* Osmo Dynamic TS supports configured as SDCCH8 */ |
Philipp Maier | 58f76d8 | 2021-08-30 17:53:36 +0200 | [diff] [blame] | 35 | BTS_FEAT_ACCH_TEMP_OVP, /* FACCH/SACCH Temporary overpower */ |
Philipp Maier | 680acae | 2018-03-01 19:13:05 +0100 | [diff] [blame] | 36 | _NUM_BTS_FEAT |
| 37 | }; |
| 38 | |
| 39 | extern const struct value_string osmo_bts_features_descs[]; |
| 40 | |
Neels Hofmeyr | 524b4f8 | 2021-04-08 21:12:55 +0200 | [diff] [blame] | 41 | static inline const char *osmo_bts_features_desc(enum osmo_bts_features val) |
| 42 | { return get_value_string(osmo_bts_features_descs, val); } |
| 43 | |
| 44 | const char *osmo_bts_feature_name(enum osmo_bts_features feature) |
| 45 | OSMO_DEPRECATED("Use osmo_bts_features_desc() instead"); |
Philipp Maier | 680acae | 2018-03-01 19:13:05 +0100 | [diff] [blame] | 46 | |
Neels Hofmeyr | 47c7b4f | 2021-04-02 23:20:09 +0200 | [diff] [blame] | 47 | extern const struct value_string osmo_bts_features_names[]; |
| 48 | |
| 49 | static inline const char *osmo_bts_features_name(enum osmo_bts_features val) |
| 50 | { return get_value_string(osmo_bts_features_names, val); } |
| 51 | |
Philipp Maier | bf86d71 | 2018-03-05 13:26:44 +0100 | [diff] [blame] | 52 | static inline int osmo_bts_set_feature(struct bitvec *features, enum osmo_bts_features feature) |
Philipp Maier | 680acae | 2018-03-01 19:13:05 +0100 | [diff] [blame] | 53 | { |
| 54 | OSMO_ASSERT(_NUM_BTS_FEAT < MAX_BTS_FEATURES); |
| 55 | return bitvec_set_bit_pos(features, feature, 1); |
| 56 | } |
| 57 | |
Vadim Yanitskiy | 383b3bf | 2020-05-31 16:03:30 +0700 | [diff] [blame] | 58 | static inline int osmo_bts_unset_feature(struct bitvec *features, enum osmo_bts_features feature) |
| 59 | { |
| 60 | OSMO_ASSERT(_NUM_BTS_FEAT < MAX_BTS_FEATURES); |
| 61 | return bitvec_set_bit_pos(features, feature, 0); |
| 62 | } |
| 63 | |
Philipp Maier | bf86d71 | 2018-03-05 13:26:44 +0100 | [diff] [blame] | 64 | static inline bool osmo_bts_has_feature(const struct bitvec *features, enum osmo_bts_features feature) |
Philipp Maier | 680acae | 2018-03-01 19:13:05 +0100 | [diff] [blame] | 65 | { |
| 66 | OSMO_ASSERT(_NUM_BTS_FEAT < MAX_BTS_FEATURES); |
Vadim Yanitskiy | f8e153d | 2020-05-31 16:06:36 +0700 | [diff] [blame] | 67 | return bitvec_get_bit_pos(features, feature) == ONE; |
Philipp Maier | 680acae | 2018-03-01 19:13:05 +0100 | [diff] [blame] | 68 | } |