From 0d10f0e482cdd50acc916e75a8b3ba1beb94227c Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Thu, 16 Jun 2016 17:41:52 +0200 Subject: dyn PDCH: chan_nr_by_sapi(): handle TCH/F_PDCH according to ts->flags According to the PDCH Active flag, handle a TS as TCH/F or PDCH. Change-Id: I06ca26a99f052c6a2ae953fe355fd1196f66e501 --- src/osmo-bts-sysmo/l1_if.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c index 14de251e..0330308d 100644 --- a/src/osmo-bts-sysmo/l1_if.c +++ b/src/osmo-bts-sysmo/l1_if.c @@ -611,11 +611,23 @@ static int handle_mph_time_ind(struct femtol1_hdl *fl1, return l1sap_up(trx, &l1sap); } -static uint8_t chan_nr_by_sapi(enum gsm_phys_chan_config pchan, +static enum gsm_phys_chan_config pick_pchan(struct gsm_bts_trx_ts *ts) +{ + if (ts->pchan != GSM_PCHAN_TCH_F_PDCH) + return ts->pchan; + if (ts->flags & TS_F_PDCH_ACTIVE) + return GSM_PCHAN_PDCH; + return GSM_PCHAN_TCH_F; +} + +static uint8_t chan_nr_by_sapi(struct gsm_bts_trx_ts *ts, GsmL1_Sapi_t sapi, GsmL1_SubCh_t subCh, uint8_t u8Tn, uint32_t u32Fn) { uint8_t cbits = 0; + enum gsm_phys_chan_config pchan = pick_pchan(ts); + OSMO_ASSERT(pchan != GSM_PCHAN_TCH_F_PDCH); + switch (sapi) { case GsmL1_Sapi_Bcch: cbits = 0x10; @@ -724,7 +736,7 @@ static int handle_ph_readytosend_ind(struct femtol1_hdl *fl1, uint32_t fn; /* check if primitive should be handled by common part */ - chan_nr = chan_nr_by_sapi(trx->ts[rts_ind->u8Tn].pchan, rts_ind->sapi, + chan_nr = chan_nr_by_sapi(&trx->ts[rts_ind->u8Tn], rts_ind->sapi, rts_ind->subCh, rts_ind->u8Tn, rts_ind->u32Fn); if (chan_nr) { fn = rts_ind->u32Fn; @@ -848,7 +860,7 @@ static int handle_ph_data_ind(struct femtol1_hdl *fl1, GsmL1_PhDataInd_t *data_i uint32_t fn; int rc = 0; - chan_nr = chan_nr_by_sapi(trx->ts[data_ind->u8Tn].pchan, data_ind->sapi, + chan_nr = chan_nr_by_sapi(&trx->ts[data_ind->u8Tn], data_ind->sapi, data_ind->subCh, data_ind->u8Tn, data_ind->u32Fn); if (!chan_nr) { LOGP(DL1C, LOGL_ERROR, "PH-DATA-INDICATION for unknown sapi " -- cgit v1.2.3