2011-02-11 17:36:18 +00:00
|
|
|
/* 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>
|
2011-02-12 11:33:06 +00:00
|
|
|
#include <openbsc/abis_om2000.h>
|
2011-02-11 17:36:18 +00:00
|
|
|
#include <openbsc/e1_input.h>
|
|
|
|
#include <openbsc/signal.h>
|
|
|
|
|
2011-02-12 11:33:06 +00:00
|
|
|
#include "input/lapd.h"
|
2011-02-11 17:36:18 +00:00
|
|
|
|
2011-02-13 09:40:58 +00:00
|
|
|
#define SABM_INTERVAL 0, 300000
|
|
|
|
|
2011-02-11 17:36:18 +00:00
|
|
|
static struct gsm_bts_model model_rbs2k = {
|
|
|
|
.type = GSM_BTS_TYPE_RBS2000,
|
2011-02-12 11:33:06 +00:00
|
|
|
.name = "rbs2000",
|
|
|
|
.oml_rcvmsg = &abis_om2k_rcvmsg,
|
2011-02-11 17:36:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static void bootstrap_om_rbs2k(struct gsm_bts *bts)
|
|
|
|
{
|
|
|
|
LOGP(DNM, LOGL_NOTICE, "bootstrapping OML for BTS %u\n", bts->nr);
|
2011-02-12 12:44:14 +00:00
|
|
|
abis_om2k_tx_start_req(bts, &om2k_mo_cf);
|
2011-02-11 17:36:18 +00:00
|
|
|
/* 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);
|
|
|
|
|
2011-02-11 18:04:44 +00:00
|
|
|
/* FIXME: we need one per bts (or rather: per signalling TS, not one global! */
|
2011-02-11 17:36:18 +00:00
|
|
|
struct timer_list sabm_timer = {
|
|
|
|
.cb = &sabm_timer_cb,
|
|
|
|
};
|
|
|
|
|
|
|
|
static void sabm_timer_cb(void *_line)
|
|
|
|
{
|
|
|
|
struct e1inp_ts *e1i_ts = _line;
|
|
|
|
|
2011-02-11 18:04:44 +00:00
|
|
|
/* FIXME: use the TEI that was configured via vty */
|
2011-02-11 17:59:31 +00:00
|
|
|
lapd_send_sabm(e1i_ts->driver.dahdi.lapd, 62, 62);
|
2011-02-11 17:36:18 +00:00
|
|
|
|
2011-02-13 09:40:58 +00:00
|
|
|
bsc_schedule_timer(&sabm_timer, SABM_INTERVAL);
|
2011-02-11 17:36:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 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:
|
2011-02-11 18:04:44 +00:00
|
|
|
if (isd->trx->bts->type == GSM_BTS_TYPE_RBS2000) {
|
|
|
|
/* FIXME: only disable the timer that belong sto this timeslot */
|
|
|
|
bsc_del_timer(&sabm_timer);
|
2011-02-11 17:36:18 +00:00
|
|
|
bootstrap_om_rbs2k(isd->trx->bts);
|
2011-02-11 18:04:44 +00:00
|
|
|
}
|
2011-02-11 17:36:18 +00:00
|
|
|
break;
|
|
|
|
}
|
2011-02-11 17:59:31 +00:00
|
|
|
break;
|
2011-02-11 17:36:18 +00:00
|
|
|
case S_INP_LINE_INIT:
|
|
|
|
/* Right now Ericsson RBS are only supported on DAHDI */
|
|
|
|
if (strcasecmp(isd->line->driver->name, "DAHDI"))
|
|
|
|
break;
|
2011-02-11 18:04:44 +00:00
|
|
|
/* FIXME: properly determine the OML signalling timeslot,
|
|
|
|
* or rather: all signalling timeslots and start one timer each */
|
2011-02-11 17:36:18 +00:00
|
|
|
sabm_timer.data = &isd->line->ts[1-1];
|
2011-02-13 09:40:58 +00:00
|
|
|
bsc_schedule_timer(&sabm_timer, SABM_INTERVAL);
|
2011-02-11 17:36:18 +00:00
|
|
|
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);
|
|
|
|
}
|