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/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;
+	}
+}