diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2018-05-05 19:54:00 +0200 |
---|---|---|
committer | Neels Hofmeyr <neels@hofmeyr.de> | 2018-05-05 20:35:58 +0200 |
commit | 6bdbf6727335a91c6ed7b680259c8db1e3529063 (patch) | |
tree | 819b201aeeb6c38c87af7d82c6a3363cc8e95ec5 /src | |
parent | c0b7193baeafe7baf646334869495cb15e16c0a6 (diff) |
cosmetic: dyn TS: clarify chan_nr composition
In gsm_lchan2chan_nr(), use a switch to reflect both dyn TS kinds and enrich
with comments. Move GSM_PCHAN_TCH_F_PDCH out of gsm_pchan2chan_nr(), which is
now back to pure standard PCHAN values.
Rationale: it's easier to figure out what is going on and why.
Change-Id: I6a31b44220d97c9173c52d3567a1382541710d10
Diffstat (limited to 'src')
-rw-r--r-- | src/common/gsm_data_shared.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/common/gsm_data_shared.c b/src/common/gsm_data_shared.c index 553c09bb..328b57e2 100644 --- a/src/common/gsm_data_shared.c +++ b/src/common/gsm_data_shared.c @@ -597,9 +597,11 @@ uint8_t gsm_pchan2chan_nr(enum gsm_phys_chan_config pchan, { uint8_t cbits, chan_nr; + OSMO_ASSERT(pchan != GSM_PCHAN_TCH_F_TCH_H_PDCH); + OSMO_ASSERT(pchan != GSM_PCHAN_TCH_F_PDCH); + switch (pchan) { case GSM_PCHAN_TCH_F: - case GSM_PCHAN_TCH_F_PDCH: OSMO_ASSERT(lchan_nr == 0); cbits = 0x01; break; @@ -652,11 +654,19 @@ uint8_t gsm_pchan2chan_nr(enum gsm_phys_chan_config pchan, uint8_t gsm_lchan2chan_nr(const struct gsm_lchan *lchan) { - enum gsm_phys_chan_config pchan = lchan->ts->pchan; - if (pchan == GSM_PCHAN_TCH_F_TCH_H_PDCH) + switch (lchan->ts->pchan) { + case GSM_PCHAN_TCH_F_TCH_H_PDCH: + /* Return chan_nr reflecting the current TS pchan, either a standard TCH kind, or the + * nonstandard value reflecting PDCH for Osmocom style dyn TS. */ return gsm_lchan_as_pchan2chan_nr(lchan, lchan->ts->dyn.pchan_is); - return gsm_pchan2chan_nr(lchan->ts->pchan, lchan->ts->nr, lchan->nr); + case GSM_PCHAN_TCH_F_PDCH: + /* For ip.access style dyn TS, we always want to use the chan_nr as if it was TCH/F. + * We're using custom PDCH ACT and DEACT messages that use the usual chan_nr values. */ + return gsm_lchan_as_pchan2chan_nr(lchan, GSM_PCHAN_TCH_F); + default: + return gsm_pchan2chan_nr(lchan->ts->pchan, lchan->ts->nr, lchan->nr); + } } uint8_t gsm_lchan_as_pchan2chan_nr(const struct gsm_lchan *lchan, |