dyn TS: split dyn_pdch_init() for new dyn type and rename
Init both TCH/F_PDCH and TCH/F_TCH/H_PDCH via dyn_ts_init(), which
refactors dyn_pdch_init().
Make dyn_ts_switchover_start from abis_rsl.c public in abis_rsl.h, so we can
start the initial switchover to PDCH from dyn_ts_init(); in abis_rsl.h include
gsm_utils.h for enum gsm_phys_chan_config.
Change-Id: I5c0b257ba8ff0e9c9a2268681a84b0681a778368
diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c
index 8af3b9b..b84a0b5 100644
--- a/openbsc/src/libbsc/abis_rsl.c
+++ b/openbsc/src/libbsc/abis_rsl.c
@@ -55,8 +55,6 @@
static int rsl_send_imm_assignment(struct gsm_lchan *lchan);
static void error_timeout_cb(void *data);
-static int dyn_ts_switchover_start(struct gsm_lchan *lchan,
- enum gsm_phys_chan_config to_pchan);
static int dyn_ts_switchover_continue(struct gsm_lchan *lchan);
static int dyn_ts_switchover_failed(struct gsm_lchan *lchan, int rc);
static void dyn_ts_switchover_complete(struct gsm_lchan *lchan);
@@ -2321,8 +2319,8 @@
return rc;
}
-static int dyn_ts_switchover_start(struct gsm_lchan *lchan,
- enum gsm_phys_chan_config to_pchan)
+int dyn_ts_switchover_start(struct gsm_lchan *lchan,
+ enum gsm_phys_chan_config to_pchan)
{
int ss;
struct gsm_bts_trx_ts *ts = lchan->ts;
diff --git a/openbsc/src/libbsc/bsc_dyn_pdch.c b/openbsc/src/libbsc/bsc_dyn_pdch.c
index 9d00bbc..456500a 100644
--- a/openbsc/src/libbsc/bsc_dyn_pdch.c
+++ b/openbsc/src/libbsc/bsc_dyn_pdch.c
@@ -23,17 +23,10 @@
#include <openbsc/gsm_data.h>
#include <openbsc/abis_rsl.h>
-void dyn_pdch_init(struct gsm_bts_trx_ts *ts)
+void tchf_pdch_ts_init(struct gsm_bts_trx_ts *ts)
{
int rc;
- /* Clear all dyn PDCH flags */
- ts->flags &= ~(TS_F_PDCH_PENDING_MASK | TS_F_PDCH_ACTIVE);
-
- /* Nothing to do if not a dynamic channel. */
- if (ts->pchan != GSM_PCHAN_TCH_F_PDCH)
- return;
-
if (ts->trx->bts->gprs.mode == BTS_GPRS_NONE) {
LOGP(DRSL, LOGL_NOTICE, "%s: GPRS mode is 'none':"
" not activating PDCH.\n",
@@ -49,3 +42,36 @@
LOGP(DRSL, LOGL_ERROR, "%s %s: PDCH ACT failed\n",
gsm_ts_name(ts), gsm_pchan_name(ts->pchan));
}
+
+void tchf_tchh_pdch_ts_init(struct gsm_bts_trx_ts *ts)
+{
+ if (ts->trx->bts->gprs.mode == BTS_GPRS_NONE) {
+ LOGP(DRSL, LOGL_NOTICE, "%s: GPRS mode is 'none':"
+ " not activating PDCH.\n",
+ gsm_ts_and_pchan_name(ts));
+ return;
+ }
+
+ dyn_ts_switchover_start(ts->lchan, GSM_PCHAN_PDCH);
+}
+
+void dyn_ts_init(struct gsm_bts_trx_ts *ts)
+{
+ /* Clear all TCH/F_PDCH flags */
+ ts->flags &= ~(TS_F_PDCH_PENDING_MASK | TS_F_PDCH_ACTIVE);
+
+ /* Clear TCH/F_TCH/H_PDCH state */
+ ts->dyn.pchan_is = ts->dyn.pchan_want = GSM_PCHAN_NONE;
+ ts->dyn.pending_chan_activ = NULL;
+
+ switch (ts->pchan) {
+ case GSM_PCHAN_TCH_F_PDCH:
+ tchf_pdch_ts_init(ts);
+ break;
+ case GSM_PCHAN_TCH_F_TCH_H_PDCH:
+ tchf_tchh_pdch_ts_init(ts);
+ break;
+ default:
+ break;
+ }
+}
diff --git a/openbsc/src/libbsc/bts_ipaccess_nanobts.c b/openbsc/src/libbsc/bts_ipaccess_nanobts.c
index 89d5256..a6c8e29 100644
--- a/openbsc/src/libbsc/bts_ipaccess_nanobts.c
+++ b/openbsc/src/libbsc/bts_ipaccess_nanobts.c
@@ -371,7 +371,7 @@
}
if (new_state->operational == NM_OPSTATE_ENABLED
&& new_state->availability == NM_AVSTATE_OK)
- dyn_pdch_init(ts);
+ dyn_ts_init(ts);
break;
case NM_OC_RADIO_CARRIER:
trx = obj;