diff options
author | Harald Welte <laforge@gnumonks.org> | 2011-02-11 18:36:18 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2011-02-13 15:49:24 +0100 |
commit | db44f6012dbb603281707c961d02f8b35e653eb6 (patch) | |
tree | 25193dde1281d752d459e646538347141f3ef3e6 | |
parent | 09cefee4db4e5dcec3adf75788690189f856b2e6 (diff) |
[RBS2000] Initial attempt at Ericsson RBS2000 support
-rw-r--r-- | openbsc/include/openbsc/gsm_data.h | 1 | ||||
-rw-r--r-- | openbsc/src/Makefile.am | 2 | ||||
-rw-r--r-- | openbsc/src/bts_ericsson_rbs2000.c | 126 | ||||
-rw-r--r-- | openbsc/src/gsm_data.c | 1 |
4 files changed, 129 insertions, 1 deletions
diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index e308ca4d7..a98302777 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -421,6 +421,7 @@ enum gsm_bts_type { GSM_BTS_TYPE_UNKNOWN, GSM_BTS_TYPE_BS11, GSM_BTS_TYPE_NANOBTS, + GSM_BTS_TYPE_RBS2000, }; struct gsm_bts_model { diff --git a/openbsc/src/Makefile.am b/openbsc/src/Makefile.am index 3f2140669..cd99b79c7 100644 --- a/openbsc/src/Makefile.am +++ b/openbsc/src/Makefile.am @@ -23,7 +23,7 @@ libbsc_a_SOURCES = abis_rsl.c abis_nm.c gsm_data.c gsm_04_08_utils.c \ e1_config.c e1_input.c e1_input_vty.c \ input/misdn.c input/ipaccess.c input/dahdi.c input/lapd.c \ handover_logic.c talloc_ctx.c system_information.c rest_octets.c \ - bts_siemens_bs11.c bts_ipaccess_nanobts.c mncc_upqueue.c \ + bts_siemens_bs11.c bts_ipaccess_nanobts.c bts_ericsson_rbs2000.c mncc_upqueue.c \ bts_unknown.c bsc_version.c bsc_api.c bsc_vty.c meas_rep.c gsm_04_80.c libmsc_a_SOURCES = gsm_subscriber.c db.c \ diff --git a/openbsc/src/bts_ericsson_rbs2000.c b/openbsc/src/bts_ericsson_rbs2000.c new file mode 100644 index 000000000..a0b5d970e --- /dev/null +++ b/openbsc/src/bts_ericsson_rbs2000.c @@ -0,0 +1,126 @@ +/* Ericsson RBS-2xxx specific code */ + +/* (C) 2011 by Harald Welte <laforge@gnumonks.org> + * + * 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 <http://www.gnu.org/licenses/>. + * + */ + +#include <sys/types.h> + +#include <osmocore/tlv.h> + +#include <openbsc/debug.h> +#include <openbsc/gsm_data.h> +#include <openbsc/abis_nm.h> +#include <openbsc/e1_input.h> +#include <openbsc/signal.h> + + +static struct gsm_bts_model model_rbs2k = { + .type = GSM_BTS_TYPE_RBS2000, +}; + +static void bootstrap_om_rbs2k(struct gsm_bts *bts) +{ + LOGP(DNM, LOGL_NOTICE, "bootstrapping OML for BTS %u\n", bts->nr); + /* FIXME */ +} + +static int shutdown_om(struct gsm_bts *bts) +{ + /* FIXME */ + return 0; +} + +/* Callback function to be called every time we receive a signal from INPUT */ +static int gbl_sig_cb(unsigned int subsys, unsigned int signal, + void *handler_data, void *signal_data) +{ + struct gsm_bts *bts; + + if (subsys != SS_GLOBAL) + return 0; + + switch (signal) { + case S_GLOBAL_BTS_CLOSE_OM: + bts = signal_data; + if (bts->type == GSM_BTS_TYPE_RBS2000) + shutdown_om(signal_data); + break; + } + + return 0; +} + +static void sabm_timer_cb(void *_line); + +/* FIXME: we need one per bts, not one global! */ +struct timer_list sabm_timer = { + .cb = &sabm_timer_cb, +}; + +static void sabm_timer_cb(void *_line) +{ + struct e1inp_ts *e1i_ts = _line; + + lapd_transmit_sabm(e1i_ts->driver.dahdi.lapd, 62, 62); + + bsc_schedule_timer(&sabm_timer, 0, 50); +} + +/* Callback function to be called every time we receive a signal from INPUT */ +static int inp_sig_cb(unsigned int subsys, unsigned int signal, + void *handler_data, void *signal_data) +{ + struct input_signal_data *isd = signal_data; + + if (subsys != SS_INPUT) + return 0; + + switch (signal) { + case S_INP_TEI_UP: + switch (isd->link_type) { + case E1INP_SIGN_OML: + if (isd->trx->bts->type == GSM_BTS_TYPE_BS11) + bootstrap_om_rbs2k(isd->trx->bts); + break; + } + case S_INP_LINE_INIT: + /* Right now Ericsson RBS are only supported on DAHDI */ + if (strcasecmp(isd->line->driver->name, "DAHDI")) + break; + sabm_timer.data = &isd->line->ts[1-1]; + bsc_schedule_timer(&sabm_timer, 0, 50); + break; + } + + return 0; +} + +int bts_model_rbs2k_init(void) +{ + model_rbs2k.features.data = &model_rbs2k._features_data[0]; + model_rbs2k.features.data_len = sizeof(model_rbs2k._features_data); + + gsm_btsmodel_set_feature(&model_rbs2k, BTS_FEAT_HOPPING); + gsm_btsmodel_set_feature(&model_rbs2k, BTS_FEAT_HSCSD); + + register_signal_handler(SS_INPUT, inp_sig_cb, NULL); + register_signal_handler(SS_GLOBAL, gbl_sig_cb, NULL); + + return gsm_bts_model_register(&model_rbs2k); +} diff --git a/openbsc/src/gsm_data.c b/openbsc/src/gsm_data.c index 5ae525899..29fa16eb1 100644 --- a/openbsc/src/gsm_data.c +++ b/openbsc/src/gsm_data.c @@ -412,6 +412,7 @@ static const struct value_string bts_types[] = { { GSM_BTS_TYPE_UNKNOWN, "unknown" }, { GSM_BTS_TYPE_BS11, "bs11" }, { GSM_BTS_TYPE_NANOBTS, "nanobts" }, + { GSM_BTS_TYPE_RBS2000, "rbs2000" }, { 0, NULL } }; |