aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2016-10-17 11:07:51 +0200
committerMax <msuraev@sysmocom.de>2016-10-18 08:08:25 +0000
commitebb483b69a5319e522ba5f713e9cb6f68a814a6a (patch)
treebb3d719da7872869671c14029d9e410a40b1dc4f
parentb0c1d21581f009e9509e0fd995c86d1785785c7a (diff)
Replace magic number with define
SDCCH occupy lchan 0..3 in combined configuration so for CCCH we've always used lchan[4] - replace it with CCCH_LCHAN define and add comment. Change-Id: Ic5d742c292d638f119c6b4672120c1950adeb7f0
-rw-r--r--include/osmo-bts/gsm_data.h3
-rw-r--r--src/common/l1sap.c2
-rw-r--r--src/common/oml.c2
-rw-r--r--src/osmo-bts-litecell15/oml.c5
-rw-r--r--src/osmo-bts-octphy/l1_oml.c5
-rw-r--r--src/osmo-bts-sysmo/oml.c5
-rw-r--r--src/osmo-bts-trx/l1_if.c8
7 files changed, 18 insertions, 12 deletions
diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h
index f1c96012..a2bb6416 100644
--- a/include/osmo-bts/gsm_data.h
+++ b/include/osmo-bts/gsm_data.h
@@ -8,6 +8,9 @@
#include <osmo-bts/paging.h>
#include <osmo-bts/tx_power.h>
+/* lchans 0..3 are SDCCH in combined channel configuration: */
+#define CCCH_LCHAN 4
+
#define GSM_FR_BITS 260
#define GSM_EFR_BITS 244
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index f3e620ee..59866a29 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -947,7 +947,7 @@ static int l1sap_ph_rach_ind(struct gsm_bts_trx *trx,
DEBUGP(DL1P, "Rx PH-RA.ind");
- lc = &trx->ts[0].lchan[4].lapdm_ch;
+ lc = &trx->ts[0].lchan[CCCH_LCHAN].lapdm_ch;
/* check for under/overflow / sign */
if (!check_acc_delay(rach_ind, btsb, &acc_delay)) {
diff --git a/src/common/oml.c b/src/common/oml.c
index 690a81d9..c4f3d7e4 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -727,7 +727,7 @@ int conf_lchans_as_pchan(struct gsm_bts_trx_ts *ts,
}
/* fallthrough */
case GSM_PCHAN_CCCH:
- lchan = &ts->lchan[4];
+ lchan = &ts->lchan[CCCH_LCHAN];
lchan->type = GSM_LCHAN_CCCH;
break;
case GSM_PCHAN_TCH_F:
diff --git a/src/osmo-bts-litecell15/oml.c b/src/osmo-bts-litecell15/oml.c
index 634c2368..689ba70c 100644
--- a/src/osmo-bts-litecell15/oml.c
+++ b/src/osmo-bts-litecell15/oml.c
@@ -287,8 +287,9 @@ static int opstart_compl(struct gsm_abis_mo *mo, struct msgb *l1_msg)
mo->obj_inst.ts_nr == 0) {
struct gsm_lchan *cbch = gsm_bts_get_cbch(mo->bts);
DEBUGP(DL1C, "====> trying to activate lchans of BCCH\n");
- mo->bts->c0->ts[0].lchan[4].rel_act_kind = LCHAN_REL_ACT_OML;
- lchan_activate(&mo->bts->c0->ts[0].lchan[4]);
+ mo->bts->c0->ts[0].lchan[CCCH_LCHAN].rel_act_kind =
+ LCHAN_REL_ACT_OML;
+ lchan_activate(&mo->bts->c0->ts[0].lchan[CCCH_LCHAN]);
if (cbch) {
cbch->rel_act_kind = LCHAN_REL_ACT_OML;
lchan_activate(cbch);
diff --git a/src/osmo-bts-octphy/l1_oml.c b/src/osmo-bts-octphy/l1_oml.c
index 74853bf7..db416bad 100644
--- a/src/osmo-bts-octphy/l1_oml.c
+++ b/src/osmo-bts-octphy/l1_oml.c
@@ -183,8 +183,9 @@ static int opstart_compl(struct gsm_abis_mo *mo)
if (mo->obj_class == NM_OC_CHANNEL && mo->obj_inst.trx_nr == 0 &&
mo->obj_inst.ts_nr == 0) {
struct gsm_lchan *cbch = gsm_bts_get_cbch(mo->bts);
- mo->bts->c0->ts[0].lchan[4].rel_act_kind = LCHAN_REL_ACT_OML;
- lchan_activate(&mo->bts->c0->ts[0].lchan[4]);
+ mo->bts->c0->ts[0].lchan[CCCH_LCHAN].rel_act_kind =
+ LCHAN_REL_ACT_OML;
+ lchan_activate(&mo->bts->c0->ts[0].lchan[CCCH_LCHAN]);
if (cbch) {
cbch->rel_act_kind = LCHAN_REL_ACT_OML;
lchan_activate(cbch);
diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c
index c1f1e0b2..ed02c745 100644
--- a/src/osmo-bts-sysmo/oml.c
+++ b/src/osmo-bts-sysmo/oml.c
@@ -286,8 +286,9 @@ static int opstart_compl(struct gsm_abis_mo *mo, struct msgb *l1_msg)
mo->obj_inst.ts_nr == 0) {
struct gsm_lchan *cbch = gsm_bts_get_cbch(mo->bts);
DEBUGP(DL1C, "====> trying to activate lchans of BCCH\n");
- mo->bts->c0->ts[0].lchan[4].rel_act_kind = LCHAN_REL_ACT_OML;
- lchan_activate(&mo->bts->c0->ts[0].lchan[4]);
+ mo->bts->c0->ts[0].lchan[CCCH_LCHAN].rel_act_kind =
+ LCHAN_REL_ACT_OML;
+ lchan_activate(&mo->bts->c0->ts[0].lchan[CCCH_LCHAN]);
if (cbch) {
cbch->rel_act_kind = LCHAN_REL_ACT_OML;
lchan_activate(cbch);
diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index b89a3594..4465f3b5 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -267,7 +267,7 @@ static int trx_init(struct gsm_bts_trx *trx)
}
if (trx == trx->bts->c0)
- lchan_init_lapdm(&trx->ts[0].lchan[4]);
+ lchan_init_lapdm(&trx->ts[0].lchan[CCCH_LCHAN]);
/* Set to Operational State: Enabled */
oml_mo_state_chg(&trx->mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK);
@@ -288,7 +288,7 @@ int bts_model_trx_close(struct gsm_bts_trx *trx)
/* deactivate lchan for CCCH */
if (pchan == GSM_PCHAN_CCCH || pchan == GSM_PCHAN_CCCH_SDCCH4) {
- lchan_set_state(&trx->ts[0].lchan[4], LCHAN_S_INACTIVE);
+ lchan_set_state(&trx->ts[0].lchan[CCCH_LCHAN], LCHAN_S_INACTIVE);
}
/* power off transceiver, if not already */
@@ -408,8 +408,8 @@ static uint8_t trx_set_ts_as_pchan(struct gsm_bts_trx_ts *ts,
/* activate lchan for CCCH */
if (pchan == GSM_PCHAN_CCCH || pchan == GSM_PCHAN_CCCH_SDCCH4) {
- ts->lchan[4].rel_act_kind = LCHAN_REL_ACT_OML;
- lchan_set_state(&ts->lchan[4], LCHAN_S_ACTIVE);
+ ts->lchan[CCCH_LCHAN].rel_act_kind = LCHAN_REL_ACT_OML;
+ lchan_set_state(&ts->lchan[CCCH_LCHAN], LCHAN_S_ACTIVE);
}
slottype = transceiver_chan_types[pchan];