diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2016-07-29 18:12:06 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2016-08-27 01:23:49 +0000 |
commit | 76a0ad7fe93fce9bea56be5610b3bffbb8822887 (patch) | |
tree | 5ec7ba1e026373d653ddfbb9135cf717b874ce64 /openbsc/src/libcommon/gsm_data_shared.c | |
parent | 5486025b182ae595d0ede7d32d0ce0db11748e19 (diff) |
move ts_sublots() to gsm_data_shared.c, it will be used by osmo-bts
Change-Id: I8ba06d7dd6e0ceab3d8d18bb565354d6ed461f7e
Diffstat (limited to 'openbsc/src/libcommon/gsm_data_shared.c')
-rw-r--r-- | openbsc/src/libcommon/gsm_data_shared.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/openbsc/src/libcommon/gsm_data_shared.c b/openbsc/src/libcommon/gsm_data_shared.c index 2488c3afd..c8c9e0423 100644 --- a/openbsc/src/libcommon/gsm_data_shared.c +++ b/openbsc/src/libcommon/gsm_data_shared.c @@ -708,3 +708,28 @@ struct gsm_lchan *rsl_lchan_lookup(struct gsm_bts_trx *trx, uint8_t chan_nr, return &ts->lchan[lch_idx]; } + +static const uint8_t subslots_per_pchan[] = { + [GSM_PCHAN_NONE] = 0, + [GSM_PCHAN_CCCH] = 0, + [GSM_PCHAN_CCCH_SDCCH4] = 4, + [GSM_PCHAN_TCH_F] = 1, + [GSM_PCHAN_TCH_H] = 2, + [GSM_PCHAN_SDCCH8_SACCH8C] = 8, + [GSM_PCHAN_TCH_F_PDCH] = 1, + [GSM_PCHAN_CCCH_SDCCH4_CBCH] = 4, + [GSM_PCHAN_SDCCH8_SACCH8C_CBCH] = 8, + /* + * GSM_PCHAN_TCH_F_TCH_H_PDCH should not be part of this, those TS are + * handled according to their ts->dyn state. + */ +}; + +/*! According to ts->pchan and possibly ts->dyn_pchan, return the number of + * logical channels available in the timeslot. */ +uint8_t ts_subslots(struct gsm_bts_trx_ts *ts) +{ + if (ts->pchan == GSM_PCHAN_TCH_F_TCH_H_PDCH) + return subslots_per_pchan[ts->dyn.pchan_is]; + return subslots_per_pchan[ts->pchan]; +} |