move ts_sublots() to gsm_data_shared.c, it will be used by osmo-bts

Change-Id: I8ba06d7dd6e0ceab3d8d18bb565354d6ed461f7e
This commit is contained in:
Neels Hofmeyr 2016-07-29 18:12:06 +02:00 committed by Harald Welte
parent 5486025b18
commit 76a0ad7fe9
4 changed files with 27 additions and 27 deletions

View File

@ -51,6 +51,4 @@ void network_chan_load(struct pchan_load *pl, struct gsm_network *net);
int trx_is_usable(struct gsm_bts_trx *trx);
uint8_t ts_subslots(struct gsm_bts_trx_ts *ts);
#endif /* _CHAN_ALLOC_H */

View File

@ -853,4 +853,6 @@ static inline uint8_t gsm_ts_tsc(const struct gsm_bts_trx_ts *ts)
struct gsm_lchan *rsl_lchan_lookup(struct gsm_bts_trx *trx, uint8_t chan_nr,
int *rc);
uint8_t ts_subslots(struct gsm_bts_trx_ts *ts);
#endif

View File

@ -72,31 +72,6 @@ int trx_is_usable(struct gsm_bts_trx *trx)
return 1;
}
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];
}
static struct gsm_lchan *
_lc_find_trx(struct gsm_bts_trx *trx, enum gsm_phys_chan_config pchan,
enum gsm_phys_chan_config dyn_as_pchan)

View File

@ -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];
}