summaryrefslogtreecommitdiffstats
path: root/openbsc/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@netfilter.org>2009-08-04 14:13:35 +0200
committerHarald Welte <laforge@netfilter.org>2009-08-04 14:13:35 +0200
commit4e55d6883b8e0eec853cd5abdf5dbe36142a9d0a (patch)
tree51943c7e1807b5c8e4f38a6ae8e5d2de358cb558 /openbsc/src
parent9e85b54799e25c857bce5861a8cc5046b2f5c6c9 (diff)
e1_config now supports up to three BTS
Each BTS gets its own E1 line data structure. They are meant to bind each to their own (virtual?) mISDN device. BTS0 uses TS01 (siganlling) and TS02/03 (TRX0), TS04/05(TRX1) BTS1 uses TS11 (siganlling) and TS12/13 (TRX0), TS14/15(TRX1) BTS2 uses TS21 (siganlling) and TS22/23 (TRX0), TS24/25(TRX1)
Diffstat (limited to 'openbsc/src')
-rw-r--r--openbsc/src/e1_config.c61
1 files changed, 39 insertions, 22 deletions
diff --git a/openbsc/src/e1_config.c b/openbsc/src/e1_config.c
index addc9fe50..d7b42686f 100644
--- a/openbsc/src/e1_config.c
+++ b/openbsc/src/e1_config.c
@@ -25,18 +25,35 @@ int e1_config(struct gsm_bts *bts, int cardnr, int release_l2)
struct e1inp_ts *sign_ts;
struct e1inp_sign_link *oml_link, *rsl_link;
struct gsm_bts_trx *trx = bts->c0;
+ int base_ts;
+
+ switch (bts->nr) {
+ case 0:
+ /* First BTS uses E1 TS 01,02,03,04,05 */
+ base_ts = 1 - 1;
+ break;
+ case 1:
+ /* Second BTS uses E1 TS 11,12,13,14,15 */
+ base_ts = 11 - 1;
+ break;
+ case 2:
+ /* Third BTS uses E1 TS 21,22,23,24,25 */
+ base_ts = 21 - 1;
+ default:
+ return -EINVAL;
+ }
line = talloc_zero(tall_bsc_ctx, struct e1inp_line);
if (!line)
return -ENOMEM;
/* create E1 timeslots for signalling and TRAU frames */
- e1inp_ts_config(&line->ts[1-1], line, E1INP_TS_TYPE_SIGN);
- e1inp_ts_config(&line->ts[2-1], line, E1INP_TS_TYPE_TRAU);
- e1inp_ts_config(&line->ts[3-1], line, E1INP_TS_TYPE_TRAU);
+ e1inp_ts_config(&line->ts[base_ts+1-1], line, E1INP_TS_TYPE_SIGN);
+ e1inp_ts_config(&line->ts[base_ts+2-1], line, E1INP_TS_TYPE_TRAU);
+ e1inp_ts_config(&line->ts[base_ts+3-1], line, E1INP_TS_TYPE_TRAU);
/* create signalling links for TS1 */
- sign_ts = &line->ts[1-1];
+ sign_ts = &line->ts[base_ts+1-1];
oml_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_OML,
trx, TEI_OML, SAPI_OML);
rsl_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_RSL,
@@ -47,40 +64,40 @@ int e1_config(struct gsm_bts *bts, int cardnr, int release_l2)
trx->rsl_link = rsl_link;
/* enable subchannel demuxer on TS2 */
- subch_demux_activate(&line->ts[2-1].trau.demux, 1);
- subch_demux_activate(&line->ts[2-1].trau.demux, 2);
- subch_demux_activate(&line->ts[2-1].trau.demux, 3);
+ subch_demux_activate(&line->ts[base_ts+2-1].trau.demux, 1);
+ subch_demux_activate(&line->ts[base_ts+2-1].trau.demux, 2);
+ subch_demux_activate(&line->ts[base_ts+2-1].trau.demux, 3);
/* enable subchannel demuxer on TS3 */
- subch_demux_activate(&line->ts[3-1].trau.demux, 0);
- subch_demux_activate(&line->ts[3-1].trau.demux, 1);
- subch_demux_activate(&line->ts[3-1].trau.demux, 2);
- subch_demux_activate(&line->ts[3-1].trau.demux, 3);
+ subch_demux_activate(&line->ts[base_ts+3-1].trau.demux, 0);
+ subch_demux_activate(&line->ts[base_ts+3-1].trau.demux, 1);
+ subch_demux_activate(&line->ts[base_ts+3-1].trau.demux, 2);
+ subch_demux_activate(&line->ts[base_ts+3-1].trau.demux, 3);
trx = gsm_bts_trx_num(bts, 1);
if (trx) {
/* create E1 timeslots for TRAU frames of TRX1 */
- e1inp_ts_config(&line->ts[4-1], line, E1INP_TS_TYPE_TRAU);
- e1inp_ts_config(&line->ts[5-1], line, E1INP_TS_TYPE_TRAU);
+ e1inp_ts_config(&line->ts[base_ts+4-1], line, E1INP_TS_TYPE_TRAU);
+ e1inp_ts_config(&line->ts[base_ts+5-1], line, E1INP_TS_TYPE_TRAU);
/* create RSL signalling link for TRX1 */
- sign_ts = &line->ts[1-1];
+ sign_ts = &line->ts[base_ts+1-1];
rsl_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_RSL,
trx, TEI_RSL+1, SAPI_RSL);
/* create back-links from trx */
trx->rsl_link = rsl_link;
/* enable subchannel demuxer on TS2 */
- subch_demux_activate(&line->ts[4-1].trau.demux, 0);
- subch_demux_activate(&line->ts[4-1].trau.demux, 1);
- subch_demux_activate(&line->ts[4-1].trau.demux, 2);
- subch_demux_activate(&line->ts[4-1].trau.demux, 3);
+ subch_demux_activate(&line->ts[base_ts+4-1].trau.demux, 0);
+ subch_demux_activate(&line->ts[base_ts+4-1].trau.demux, 1);
+ subch_demux_activate(&line->ts[base_ts+4-1].trau.demux, 2);
+ subch_demux_activate(&line->ts[base_ts+4-1].trau.demux, 3);
/* enable subchannel demuxer on TS3 */
- subch_demux_activate(&line->ts[5-1].trau.demux, 0);
- subch_demux_activate(&line->ts[5-1].trau.demux, 1);
- subch_demux_activate(&line->ts[5-1].trau.demux, 2);
- subch_demux_activate(&line->ts[5-1].trau.demux, 3);
+ subch_demux_activate(&line->ts[base_ts+5-1].trau.demux, 0);
+ subch_demux_activate(&line->ts[base_ts+5-1].trau.demux, 1);
+ subch_demux_activate(&line->ts[base_ts+5-1].trau.demux, 2);
+ subch_demux_activate(&line->ts[base_ts+5-1].trau.demux, 3);
}
return mi_setup(cardnr, line, release_l2);