aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2016-07-27 16:09:43 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2016-07-28 17:58:05 +0200
commit45d3bbfb443e9a8c9d6590c073cfac2bfef257eb (patch)
tree1fe5cb3c604a688862eb3d200a6c7f1be129684a /src
parent576071d6ca2ffa266b3a6e0858b00205827fa10a (diff)
dyn PDCH: trx l1_if.c: factor out trx_set_ts_as_pchan() from trx_set_ts()
To be able to set a specific pchan type for dynamic channels, have the trx_set_ts_as_pchan() function with an explicit pchan argument instead of using ts->pchan. Keep trx_set_ts() as a thin wrapper to use ts->pchan directly. Change-Id: I9eeef05d2a6763f86a5b89ee7c3b4211f6736e4d
Diffstat (limited to 'src')
-rw-r--r--src/osmo-bts-trx/l1_if.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index 49bcdbb8..21627ebd 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -374,13 +374,13 @@ static uint8_t trx_set_trx(struct gsm_bts_trx *trx)
}
/* set ts attributes */
-static uint8_t trx_set_ts(struct gsm_bts_trx_ts *ts)
+static uint8_t trx_set_ts_as_pchan(struct gsm_bts_trx_ts *ts,
+ enum gsm_phys_chan_config pchan)
{
struct phy_instance *pinst = trx_phy_instance(ts->trx);
struct trx_l1h *l1h = pinst->u.osmotrx.hdl;
uint8_t tn = ts->nr;
uint16_t tsc = ts->tsc;
- enum gsm_phys_chan_config pchan = ts->pchan;
uint8_t slottype;
int rc;
@@ -398,7 +398,9 @@ static uint8_t trx_set_ts(struct gsm_bts_trx_ts *ts)
if (!(l1h->config.slotmask & (1 << tn)))
return NM_NACK_RES_NOTAVAIL;
- /* set physical channel */
+ /* set physical channel. For dynamic TCH/F_PDCH, the caller should have
+ * decided on a more specific PCHAN type already. */
+ OSMO_ASSERT(pchan != GSM_PCHAN_TCH_F_PDCH);
rc = trx_sched_set_pchan(&l1h->l1s, tn, pchan);
if (rc)
return NM_NACK_RES_NOTAVAIL;
@@ -422,6 +424,21 @@ static uint8_t trx_set_ts(struct gsm_bts_trx_ts *ts)
return 0;
}
+static uint8_t trx_set_ts(struct gsm_bts_trx_ts *ts)
+{
+ enum gsm_phys_chan_config pchan = ts->pchan;
+
+ /* For dynamic TCH/F_PDCH, pick the pchan type that should currently be
+ * active according to TS flags. This should only be called during
+ * init, PDCH transitions will call trx_set_ts_as_pchan() directly. */
+ OSMO_ASSERT((ts->flags & TS_F_PDCH_PENDING_MASK) == 0);
+ if (pchan == GSM_PCHAN_TCH_F_PDCH)
+ pchan = (ts->flags & TS_F_PDCH_ACTIVE)? GSM_PCHAN_PDCH
+ : GSM_PCHAN_TCH_F;
+
+ return trx_set_ts_as_pchan(ts, pchan);
+}
+
/*
* primitive handling