aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2009-02-14 15:41:08 +0000
committerHarald Welte <laforge@gnumonks.org>2009-02-14 15:41:08 +0000
commit22af0db588861522370d54d0e830feaf2c8b547e (patch)
treeeb78db8f1a9d919ef9af89a32625701f86f227aa
parent923a3bdbe5a879c5efa5b5922c7e5874046d1a85 (diff)
* add comments for SET BTS ATTR and SET RADIO CARRIER ATTR
* use OPSTART on objects whose operational state is Disabled
-rw-r--r--include/openbsc/abis_nm.h2
-rw-r--r--src/abis_nm.c58
2 files changed, 56 insertions, 4 deletions
diff --git a/include/openbsc/abis_nm.h b/include/openbsc/abis_nm.h
index 3472a09f5..e8837f0b8 100644
--- a/include/openbsc/abis_nm.h
+++ b/include/openbsc/abis_nm.h
@@ -449,6 +449,8 @@ int abis_nm_conn_terr_sign(struct gsm_bts_trx *trx,
int abis_nm_conn_terr_traf(struct gsm_bts_trx_ts *ts,
u_int8_t e1_port, u_int8_t e1_timeslot,
u_int8_t e1_subslot);
+int abis_nm_set_bts_attr(struct gsm_bts *bts, u_int8_t *attr, int attr_len);
+int abis_nm_set_radio_attr(struct gsm_bts_trx *trx, u_int8_t *attr, int attr_len);
int abis_nm_set_channel_attr(struct gsm_bts_trx_ts *ts, u_int8_t chan_comb);
int abis_nm_sw_act_req_ack(struct gsm_bts *bts, u_int8_t obj_class, u_int8_t i1,
u_int8_t i2, u_int8_t i3, u_int8_t *attr, int att_len);
diff --git a/src/abis_nm.c b/src/abis_nm.c
index c670dcbe4..749263651 100644
--- a/src/abis_nm.c
+++ b/src/abis_nm.c
@@ -199,24 +199,35 @@ static const char *opstate_name(u_int8_t os)
}
}
-
static int abis_nm_rx_statechg_rep(struct msgb *mb)
{
struct abis_om_fom_hdr *foh = msgb_l3(mb);
u_int8_t *data = &foh->data[0];
+ struct gsm_bts *bts = mb->trx->bts;
+ u_int8_t op_state = 0;
DEBUGP(DNM, "STATE CHG: OC=%s(%02x) INST=(%02x,%02x,%02x) ",
obj_class_name(foh->obj_class), foh->obj_class,
foh->obj_inst.bts_nr, foh->obj_inst.trx_nr,
foh->obj_inst.ts_nr);
- if (*data++ == NM_ATT_OPER_STATE)
- DEBUGPC(DNM, "OP_STATE=%s ", opstate_name(*data++));
+ if (*data++ == NM_ATT_OPER_STATE) {
+ u_int8_t op_state = *data++;
+ DEBUGPC(DNM, "OP_STATE=%s ", opstate_name(op_state));
+
+ }
if (*data++ == NM_ATT_AVAIL_STATUS) {
u_int8_t att_len = *data++;
while (att_len--)
DEBUGPC(DNM, "AVAIL=%02x ", *data++);
}
DEBUGPC(DNM, "\n");
+ if (op_state == 1) {
+ /* try to enable objects that are disabled */
+ abis_nm_opstart(bts, foh->obj_class,
+ foh->obj_inst.bts_nr,
+ foh->obj_inst.trx_nr,
+ foh->obj_inst.ts_nr);
+ }
return 0;
}
@@ -924,6 +935,42 @@ int abis_nm_disc_terr_traf(struct abis_nm_h *h, struct abis_om_obj_inst *inst,
}
#endif
+/* Chapter 8.6.1 */
+int abis_nm_set_bts_attr(struct gsm_bts *bts, u_int8_t *attr, int attr_len)
+{
+ struct abis_om_hdr *oh;
+ struct msgb *msg = nm_msgb_alloc();
+ u_int8_t *cur;
+
+ DEBUGP(DNM, "Set BTS Attr (bts=%d)\n", bts->nr);
+
+ oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
+ fill_om_fom_hdr(oh, attr_len, NM_MT_SET_BTS_ATTR, NM_OC_BTS, bts->nr, 0xff, 0xff);
+ cur = msgb_put(msg, attr_len);
+ memcpy(cur, attr, attr_len);
+
+ return abis_nm_sendmsg(bts, msg);
+}
+
+/* Chapter 8.6.2 */
+int abis_nm_set_radio_attr(struct gsm_bts_trx *trx, u_int8_t *attr, int attr_len)
+{
+ struct abis_om_hdr *oh;
+ struct msgb *msg = nm_msgb_alloc();
+ u_int8_t *cur;
+
+ DEBUGP(DNM, "Set TRX Attr (bts=%d,trx=%d)\n", trx->bts->nr, trx->nr);
+
+ oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
+ fill_om_fom_hdr(oh, attr_len, NM_MT_SET_RADIO_ATTR, NM_OC_RADIO_CARRIER,
+ trx->bts->nr, trx->nr, 0xff);
+ cur = msgb_put(msg, attr_len);
+ memcpy(cur, attr, attr_len);
+
+ return abis_nm_sendmsg(trx->bts, msg);
+}
+
+/* Chapter 8.6.3 */
int abis_nm_set_channel_attr(struct gsm_bts_trx_ts *ts, u_int8_t chan_comb)
{
struct gsm_bts *bts = ts->trx->bts;
@@ -933,6 +980,8 @@ int abis_nm_set_channel_attr(struct gsm_bts_trx_ts *ts, u_int8_t chan_comb)
struct msgb *msg = nm_msgb_alloc();
u_int8_t len = 4 + 2 + 2 + 2 + 2 +3;
+ DEBUGP(DNM, "Set Chan Attr (bts=%d,trx=%d,ts=%d)\n", bts->nr, ts->trx->nr, ts->nr);
+
oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
fill_om_fom_hdr(oh, len, NM_MT_SET_CHAN_ATTR,
NM_OC_BASEB_TRANSC, bts->bts_nr,
@@ -998,6 +1047,8 @@ int abis_nm_opstart(struct gsm_bts *bts, u_int8_t obj_class, u_int8_t i0, u_int8
struct abis_om_hdr *oh;
struct msgb *msg = nm_msgb_alloc();
+ DEBUGP(DNM, "Sending OPSTART obj_class=0x%02x obj_inst=(0x%02x, 0x%02x, 0x%02x)\n",
+ obj_class, i0, i1, i2);
oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
fill_om_fom_hdr(oh, 0, NM_MT_OPSTART, obj_class, i0, i1, i2);
@@ -1027,7 +1078,6 @@ int abis_nm_event_reports(struct gsm_bts *bts, int on)
return __simple_cmd(bts, NM_MT_REST_EVENT_REP);
}
-
/* Siemens (or BS-11) specific commands */
int abis_nm_bs11_bsc_disconnect(struct gsm_bts *bts, int reconnect)