From c5e75f3e6a5d0dd482d4f5d17da80043fb02e181 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Sat, 23 Jul 2016 17:17:34 +0200 Subject: dyn TS: Rename bsc_dyn_pdch.c to bsc_dyn_ts.c It's no longer just for IPAC style TCH/F_PDCH, but also contains code for TCH/F_TCH/H_PDCH, so pick a more general name. Change-Id: Ic19db81eca03fd72738839ee3686b6b4c8b6b437 --- openbsc/src/libbsc/Makefile.am | 2 +- openbsc/src/libbsc/bsc_dyn_pdch.c | 77 --------------------------------------- openbsc/src/libbsc/bsc_dyn_ts.c | 77 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 78 deletions(-) delete mode 100644 openbsc/src/libbsc/bsc_dyn_pdch.c create mode 100644 openbsc/src/libbsc/bsc_dyn_ts.c (limited to 'openbsc/src') diff --git a/openbsc/src/libbsc/Makefile.am b/openbsc/src/libbsc/Makefile.am index 48880d965..fd8de0e33 100644 --- a/openbsc/src/libbsc/Makefile.am +++ b/openbsc/src/libbsc/Makefile.am @@ -24,5 +24,5 @@ libbsc_a_SOURCES = abis_nm.c abis_nm_vty.c \ arfcn_range_encode.c bsc_ctrl_commands.c \ bsc_ctrl_lookup.c \ net_init.c \ - bsc_dyn_pdch.c + bsc_dyn_ts.c diff --git a/openbsc/src/libbsc/bsc_dyn_pdch.c b/openbsc/src/libbsc/bsc_dyn_pdch.c deleted file mode 100644 index 456500a89..000000000 --- a/openbsc/src/libbsc/bsc_dyn_pdch.c +++ /dev/null @@ -1,77 +0,0 @@ -/* Dynamic PDCH initialisation implementation shared across NM and RSL */ - -/* (C) 2016 by sysmocom s.f.m.c. GmbH - * All Rights Reserved - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ - -#include -#include -#include -#include - -void tchf_pdch_ts_init(struct gsm_bts_trx_ts *ts) -{ - int rc; - - 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; - } - - LOGP(DRSL, LOGL_DEBUG, "%s: trying to PDCH ACT\n", - gsm_ts_and_pchan_name(ts)); - - rc = rsl_ipacc_pdch_activate(ts, 1); - if (rc != 0) - 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/bsc_dyn_ts.c b/openbsc/src/libbsc/bsc_dyn_ts.c new file mode 100644 index 000000000..456500a89 --- /dev/null +++ b/openbsc/src/libbsc/bsc_dyn_ts.c @@ -0,0 +1,77 @@ +/* Dynamic PDCH initialisation implementation shared across NM and RSL */ + +/* (C) 2016 by sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +#include +#include +#include +#include + +void tchf_pdch_ts_init(struct gsm_bts_trx_ts *ts) +{ + int rc; + + 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; + } + + LOGP(DRSL, LOGL_DEBUG, "%s: trying to PDCH ACT\n", + gsm_ts_and_pchan_name(ts)); + + rc = rsl_ipacc_pdch_activate(ts, 1); + if (rc != 0) + 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; + } +} -- cgit v1.2.3