aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/bts.c
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2018-02-21 16:58:08 +0100
committerHarald Welte <laforge@gnumonks.org>2018-02-22 07:58:26 +0000
commita4bca115557feb0268e6cfda30238ded16328ae6 (patch)
tree48fa63300f099eab9ce11263558de5ecef876165 /src/common/bts.c
parentb93748a1707fa4e20c3a8c3a241dd9e3fb03ea87 (diff)
bts: use feature list instead of speech codec table
osmo-bts has a table of pchan/channel mode combinations for every bts. This table models the codec capabilitys of the BTS hardware. However, having the speech codec apabilities modeled inside the BTS feature list would be much more comfortable and since the feature list is communicated back to the BSC we would get the codec capabilities inside the BSC domain as well. - remove the pchan/channel mode tables - set speech codec variants for each BTS type - fix bts_supports_cm so that it queries the feature list Change-Id: I977dc729ba856631245aedf76afd48eac92166f7
Diffstat (limited to 'src/common/bts.c')
-rw-r--r--src/common/bts.c59
1 files changed, 36 insertions, 23 deletions
diff --git a/src/common/bts.c b/src/common/bts.c
index 31afba41..7849d616 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -676,32 +676,45 @@ struct gsm_time *get_time(struct gsm_bts *bts)
return &btsb->gsm_time;
}
-int bts_supports_cm(struct gsm_bts_role_bts *bts,
- enum gsm_phys_chan_config pchan, enum gsm48_chan_mode cm)
+int bts_supports_cm(struct gsm_bts *bts, enum gsm_phys_chan_config pchan,
+ enum gsm48_chan_mode cm)
{
- const struct bts_cm *supported;
- int i;
-
- supported = bts->support.cm;
-
- /* Check if we got a list with supported codec, if not, no list has
- * been configured yet for that BTS. In that case we will just skip
- * and accept any combination */
- if (supported == NULL)
- return 1;
-
- for (i = 0;; i++) {
- /* If we manage to find the given combination in the list,
- * we know that the pchan/cm combination is supported */
- if (supported[i].pchan == pchan && supported[i].cm == cm)
- return 1;
-
- /* When we hit the terminator, we know that the given
- * pchan/cm combination is not supported because it
- * is not in the list. */
- if (supported[i].pchan == _GSM_PCHAN_MAX)
+ enum gsm_bts_features feature = _NUM_BTS_FEAT;
+
+ /* Before the requested pchan/cm combination can be checked, we need to
+ * convert it to a feature identifier we can check */
+ if (pchan == GSM_PCHAN_TCH_F) {
+ switch(cm) {
+ case GSM48_CMODE_SPEECH_V1:
+ feature = BTS_FEAT_SPEECH_F_V1;
+ break;
+ case GSM48_CMODE_SPEECH_EFR:
+ feature = BTS_FEAT_SPEECH_F_EFR;
+ break;
+ case GSM48_CMODE_SPEECH_AMR:
+ feature = BTS_FEAT_SPEECH_F_AMR;
+ break;
+ default:
+ /* Invalid speech codec type => Not supported! */
return 0;
+ }
+ } else if (pchan == GSM_PCHAN_TCH_H) {
+ switch(cm) {
+ case GSM48_CMODE_SPEECH_V1:
+ feature = BTS_FEAT_SPEECH_H_V1;
+ break;
+ case GSM48_CMODE_SPEECH_AMR:
+ feature = BTS_FEAT_SPEECH_H_AMR;
+ break;
+ default:
+ /* Invalid speech codec type => Not supported! */
+ return 0;
+ }
}
+ /* Check if the feature is supported by this BTS */
+ if (gsm_bts_has_feature(bts, feature))
+ return 1;
+
return 0;
}