summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2018-10-04 04:58:56 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2018-11-21 11:03:10 +0700
commit6168f6a49968eb4eece5637b04c35b32e3bc8112 (patch)
tree5e710cb2a7e252ddcfd7d0c04e4c8bfc0c71eb8c /src
parentb5ae0ce8773bc5b18afa58f9876cc34fb5665d72 (diff)
layer23/l23sap.c: add Osmocom specific cbits for CBCH
CBCH logical channel is a bit similar to FACCH as there is no way to indicate that it's exactly CBCH and not just a regular SDCCH. There is nothing about CBCH stated in GSM 08.58, Chapter 9.3.1. This change introduces Osmocom specific extensions for that. Change-Id: I35e454c825481e6a390485ee042e384b31a08bf4
Diffstat (limited to 'src')
-rw-r--r--src/host/layer23/src/common/l23sap.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/host/layer23/src/common/l23sap.c b/src/host/layer23/src/common/l23sap.c
index 4560d236..fde55142 100644
--- a/src/host/layer23/src/common/l23sap.c
+++ b/src/host/layer23/src/common/l23sap.c
@@ -49,6 +49,30 @@
extern struct gsmtap_inst *gsmtap_inst;
+/* Decoder for Osmocom specific chan_nr / link_id values (e.g. CBCH) */
+static int l23sap_dec_chan_nr_ext(uint8_t chan_nr, uint8_t link_id,
+ uint8_t *chan_type, uint8_t *chan_ts, uint8_t *chan_ss,
+ uint8_t *gsmtap_chan_type)
+{
+ uint8_t cbits = (chan_nr >> 3);
+
+ if ((cbits & 0x1f) == 0x18) {
+ *chan_type = GSMTAP_CHANNEL_SDCCH4;
+ *chan_ss = 2;
+ if (gsmtap_chan_type)
+ *gsmtap_chan_type = GSMTAP_CHANNEL_CBCH51;
+ } else if ((cbits & 0x1f) == 0x19) {
+ *chan_type = GSMTAP_CHANNEL_SDCCH8;
+ if (gsmtap_chan_type)
+ *gsmtap_chan_type = GSMTAP_CHANNEL_CBCH51;
+ } else {
+ return -ENODEV;
+ }
+
+ *chan_ts = chan_nr & 0x07;
+ return 0;
+}
+
/* Safe wrapper around rsl_dec_chan_nr() */
static int l23sap_dec_chan_nr(uint8_t chan_nr, uint8_t link_id,
uint8_t *chan_type, uint8_t *chan_ts, uint8_t *chan_ss,
@@ -56,6 +80,13 @@ static int l23sap_dec_chan_nr(uint8_t chan_nr, uint8_t link_id,
{
int rc;
+ /* Attempt to decode Osmocom specific extensions */
+ rc = l23sap_dec_chan_nr_ext(chan_nr, link_id,
+ chan_type, chan_ts, chan_ss, gsmtap_chan_type);
+ if (!rc) /* Successful decoding */
+ return 0;
+
+ /* Attempt to decode according to the specs */
rc = rsl_dec_chan_nr(chan_nr, chan_type, chan_ss, chan_ts);
if (rc) {
LOGP(DL23SAP, LOGL_ERROR, "Failed to decode logical channel "