Harald Welte | 9af6ddf | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 1 | /* OpenBSC E1 Input code */ |
| 2 | |
| 3 | /* (C) 2008-2010 by Harald Welte <laforge@gnumonks.org> |
| 4 | * All Rights Reserved |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU Affero General Public License as published by |
| 8 | * the Free Software Foundation; either version 3 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU Affero General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Affero General Public License |
| 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | * |
| 19 | */ |
| 20 | |
Harald Welte | 1fa60c8 | 2009-02-09 18:13:26 +0000 | [diff] [blame] | 21 | #include <string.h> |
| 22 | #include <errno.h> |
Max | d1f70ed | 2017-09-21 16:15:32 +0200 | [diff] [blame^] | 23 | #include <time.h> |
Harald Welte | 25de991 | 2009-04-30 15:53:07 +0000 | [diff] [blame] | 24 | #include <netinet/in.h> |
| 25 | |
Neels Hofmeyr | c016479 | 2017-09-04 15:15:32 +0200 | [diff] [blame] | 26 | #include <osmocom/bsc/gsm_data.h> |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 27 | #include <osmocom/abis/e1_input.h> |
| 28 | #include <osmocom/abis/trau_frame.h> |
Neels Hofmeyr | c016479 | 2017-09-04 15:15:32 +0200 | [diff] [blame] | 29 | #include <osmocom/bsc/trau_mux.h> |
| 30 | #include <osmocom/bsc/misdn.h> |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 31 | #include <osmocom/abis/ipaccess.h> |
Pablo Neira Ayuso | 136f453 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 32 | #include <osmocom/core/talloc.h> |
Neels Hofmeyr | c016479 | 2017-09-04 15:15:32 +0200 | [diff] [blame] | 33 | #include <osmocom/bsc/debug.h> |
| 34 | #include <osmocom/bsc/abis_rsl.h> |
Harald Welte | 1fa60c8 | 2009-02-09 18:13:26 +0000 | [diff] [blame] | 35 | |
| 36 | #define SAPI_L2ML 0 |
| 37 | #define SAPI_OML 62 |
| 38 | #define SAPI_RSL 0 /* 63 ? */ |
| 39 | |
Neels Hofmeyr | 57e8a1f | 2016-09-25 15:18:39 +0200 | [diff] [blame] | 40 | /* The e1_reconfig_*() functions below take the configuration present in the |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 41 | * bts/trx/ts data structures and ensure the E1 configuration reflects the |
| 42 | * timeslot/subslot/TEI configuration */ |
Harald Welte | 1fa60c8 | 2009-02-09 18:13:26 +0000 | [diff] [blame] | 43 | |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 44 | int e1_reconfig_ts(struct gsm_bts_trx_ts *ts) |
| 45 | { |
| 46 | struct gsm_e1_subslot *e1_link = &ts->e1_link; |
| 47 | struct e1inp_line *line; |
| 48 | struct e1inp_ts *e1_ts; |
| 49 | |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 50 | DEBUGP(DLMI, "e1_reconfig_ts(%u,%u,%u)\n", ts->trx->bts->nr, ts->trx->nr, ts->nr); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 51 | |
Harald Welte | 889f16e | 2011-02-05 15:41:24 +0100 | [diff] [blame] | 52 | if (!e1_link->e1_ts) { |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 53 | LOGP(DLINP, LOGL_ERROR, "TS (%u/%u/%u) without E1 timeslot?\n", |
Harald Welte | 889f16e | 2011-02-05 15:41:24 +0100 | [diff] [blame] | 54 | ts->nr, ts->trx->nr, ts->trx->bts->nr); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 55 | return 0; |
Harald Welte | 889f16e | 2011-02-05 15:41:24 +0100 | [diff] [blame] | 56 | } |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 57 | |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 58 | line = e1inp_line_find(e1_link->e1_nr); |
Harald Welte | 889f16e | 2011-02-05 15:41:24 +0100 | [diff] [blame] | 59 | if (!line) { |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 60 | LOGP(DLINP, LOGL_ERROR, "TS (%u/%u/%u) referring to " |
Harald Welte | 889f16e | 2011-02-05 15:41:24 +0100 | [diff] [blame] | 61 | "non-existing E1 line %u\n", ts->nr, ts->trx->nr, |
| 62 | ts->trx->bts->nr, e1_link->e1_nr); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 63 | return -ENOMEM; |
Harald Welte | 889f16e | 2011-02-05 15:41:24 +0100 | [diff] [blame] | 64 | } |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 65 | |
Neels Hofmeyr | 255dbfe | 2016-09-25 15:07:01 +0200 | [diff] [blame] | 66 | if (ts_is_tch(ts)) { |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 67 | e1_ts = &line->ts[e1_link->e1_ts-1]; |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 68 | e1inp_ts_config_trau(e1_ts, line, subch_cb); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 69 | subch_demux_activate(&e1_ts->trau.demux, e1_link->e1_ts_ss); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 70 | } |
| 71 | |
| 72 | return 0; |
| 73 | } |
| 74 | |
| 75 | int e1_reconfig_trx(struct gsm_bts_trx *trx) |
| 76 | { |
| 77 | struct gsm_e1_subslot *e1_link = &trx->rsl_e1_link; |
| 78 | struct e1inp_ts *sign_ts; |
| 79 | struct e1inp_line *line; |
| 80 | struct e1inp_sign_link *rsl_link; |
| 81 | int i; |
| 82 | |
Harald Welte | 889f16e | 2011-02-05 15:41:24 +0100 | [diff] [blame] | 83 | if (!e1_link->e1_ts) { |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 84 | LOGP(DLINP, LOGL_ERROR, "TRX (%u/%u) RSL link without " |
Harald Welte | 889f16e | 2011-02-05 15:41:24 +0100 | [diff] [blame] | 85 | "timeslot?\n", trx->bts->nr, trx->nr); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 86 | return -EINVAL; |
Harald Welte | 889f16e | 2011-02-05 15:41:24 +0100 | [diff] [blame] | 87 | } |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 88 | |
| 89 | /* RSL Link */ |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 90 | line = e1inp_line_find(e1_link->e1_nr); |
Harald Welte | 889f16e | 2011-02-05 15:41:24 +0100 | [diff] [blame] | 91 | if (!line) { |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 92 | LOGP(DLINP, LOGL_ERROR, "TRX (%u/%u) RSL link referring " |
Harald Welte | 889f16e | 2011-02-05 15:41:24 +0100 | [diff] [blame] | 93 | "to non-existing E1 line %u\n", trx->bts->nr, |
| 94 | trx->nr, e1_link->e1_nr); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 95 | return -ENOMEM; |
Harald Welte | 889f16e | 2011-02-05 15:41:24 +0100 | [diff] [blame] | 96 | } |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 97 | sign_ts = &line->ts[e1_link->e1_ts-1]; |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 98 | e1inp_ts_config_sign(sign_ts, line); |
Harald Welte | 15ccc77 | 2011-02-13 19:36:18 +0100 | [diff] [blame] | 99 | /* Ericsson RBS have a per-TRX OML link in parallel to RSL */ |
Harald Welte | c834b70 | 2011-02-13 15:41:09 +0100 | [diff] [blame] | 100 | if (trx->bts->type == GSM_BTS_TYPE_RBS2000) { |
Harald Welte | 15ccc77 | 2011-02-13 19:36:18 +0100 | [diff] [blame] | 101 | struct e1inp_sign_link *oml_link; |
| 102 | oml_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_OML, trx, |
| 103 | trx->rsl_tei, SAPI_OML); |
| 104 | if (!oml_link) { |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 105 | LOGP(DLINP, LOGL_ERROR, "TRX (%u/%u) OML link creation " |
Harald Welte | 15ccc77 | 2011-02-13 19:36:18 +0100 | [diff] [blame] | 106 | "failed\n", trx->bts->nr, trx->nr); |
| 107 | return -ENOMEM; |
| 108 | } |
| 109 | if (trx->oml_link) |
| 110 | e1inp_sign_link_destroy(trx->oml_link); |
| 111 | trx->oml_link = oml_link; |
Harald Welte | c834b70 | 2011-02-13 15:41:09 +0100 | [diff] [blame] | 112 | } |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 113 | rsl_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_RSL, |
| 114 | trx, trx->rsl_tei, SAPI_RSL); |
Harald Welte | 889f16e | 2011-02-05 15:41:24 +0100 | [diff] [blame] | 115 | if (!rsl_link) { |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 116 | LOGP(DLINP, LOGL_ERROR, "TRX (%u/%u) RSL link creation " |
Harald Welte | 889f16e | 2011-02-05 15:41:24 +0100 | [diff] [blame] | 117 | "failed\n", trx->bts->nr, trx->nr); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 118 | return -ENOMEM; |
Harald Welte | 889f16e | 2011-02-05 15:41:24 +0100 | [diff] [blame] | 119 | } |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 120 | if (trx->rsl_link) |
| 121 | e1inp_sign_link_destroy(trx->rsl_link); |
| 122 | trx->rsl_link = rsl_link; |
| 123 | |
| 124 | for (i = 0; i < TRX_NR_TS; i++) |
| 125 | e1_reconfig_ts(&trx->ts[i]); |
| 126 | |
| 127 | return 0; |
| 128 | } |
| 129 | |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 130 | /* this is the generic callback for all ISDN-based BTS. */ |
| 131 | static int bts_isdn_sign_link(struct msgb *msg) |
| 132 | { |
| 133 | int ret = -EINVAL; |
| 134 | struct e1inp_sign_link *link = msg->dst; |
| 135 | struct gsm_bts *bts; |
| 136 | |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 137 | switch (link->type) { |
| 138 | case E1INP_SIGN_OML: |
| 139 | bts = link->trx->bts; |
| 140 | ret = bts->model->oml_rcvmsg(msg); |
| 141 | break; |
| 142 | case E1INP_SIGN_RSL: |
| 143 | ret = abis_rsl_rcvmsg(msg); |
| 144 | break; |
| 145 | default: |
| 146 | LOGP(DLMI, LOGL_ERROR, "unknown link type %u\n", link->type); |
| 147 | break; |
| 148 | } |
| 149 | return ret; |
| 150 | } |
| 151 | |
| 152 | struct e1inp_line_ops bts_isdn_e1inp_line_ops = { |
| 153 | .sign_link = bts_isdn_sign_link, |
| 154 | }; |
| 155 | |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 156 | int e1_reconfig_bts(struct gsm_bts *bts) |
| 157 | { |
| 158 | struct gsm_e1_subslot *e1_link = &bts->oml_e1_link; |
| 159 | struct e1inp_ts *sign_ts; |
| 160 | struct e1inp_line *line; |
| 161 | struct e1inp_sign_link *oml_link; |
| 162 | struct gsm_bts_trx *trx; |
Max | d1f70ed | 2017-09-21 16:15:32 +0200 | [diff] [blame^] | 163 | struct timespec tp; |
| 164 | int rc; |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 165 | |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 166 | DEBUGP(DLMI, "e1_reconfig_bts(%u)\n", bts->nr); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 167 | |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 168 | line = e1inp_line_find(e1_link->e1_nr); |
| 169 | if (!line) { |
| 170 | LOGP(DLINP, LOGL_ERROR, "BTS %u OML link referring to " |
| 171 | "non-existing E1 line %u\n", bts->nr, e1_link->e1_nr); |
| 172 | return -ENOMEM; |
| 173 | } |
| 174 | |
| 175 | if (!bts->model->e1line_bind_ops) { |
| 176 | LOGP(DLINP, LOGL_ERROR, "no callback to bind E1 line operations\n"); |
| 177 | return -EINVAL; |
| 178 | } |
| 179 | if (!line->ops) |
| 180 | bts->model->e1line_bind_ops(line); |
| 181 | |
| 182 | /* skip signal link initialization, this is done later for these BTS. */ |
| 183 | if (bts->type == GSM_BTS_TYPE_NANOBTS || |
Max | f9685c1 | 2017-03-23 12:01:07 +0100 | [diff] [blame] | 184 | bts->type == GSM_BTS_TYPE_OSMOBTS) |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 185 | return e1inp_line_update(line); |
| 186 | |
| 187 | /* OML link */ |
Harald Welte | 889f16e | 2011-02-05 15:41:24 +0100 | [diff] [blame] | 188 | if (!e1_link->e1_ts) { |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 189 | LOGP(DLINP, LOGL_ERROR, "BTS %u OML link without timeslot?\n", |
Harald Welte | 889f16e | 2011-02-05 15:41:24 +0100 | [diff] [blame] | 190 | bts->nr); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 191 | return -EINVAL; |
Harald Welte | 889f16e | 2011-02-05 15:41:24 +0100 | [diff] [blame] | 192 | } |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 193 | |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 194 | sign_ts = &line->ts[e1_link->e1_ts-1]; |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 195 | e1inp_ts_config_sign(sign_ts, line); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 196 | oml_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_OML, |
| 197 | bts->c0, bts->oml_tei, SAPI_OML); |
Harald Welte | 889f16e | 2011-02-05 15:41:24 +0100 | [diff] [blame] | 198 | if (!oml_link) { |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 199 | LOGP(DLINP, LOGL_ERROR, "BTS %u OML link creation failed\n", |
Harald Welte | 889f16e | 2011-02-05 15:41:24 +0100 | [diff] [blame] | 200 | bts->nr); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 201 | return -ENOMEM; |
Harald Welte | 889f16e | 2011-02-05 15:41:24 +0100 | [diff] [blame] | 202 | } |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 203 | if (bts->oml_link) |
| 204 | e1inp_sign_link_destroy(bts->oml_link); |
| 205 | bts->oml_link = oml_link; |
Max | d1f70ed | 2017-09-21 16:15:32 +0200 | [diff] [blame^] | 206 | rc = clock_gettime(CLOCK_MONOTONIC, &tp); |
| 207 | bts->uptime = (rc < 0) ? 0 : tp.tv_sec; /* we don't need sub-second precision for uptime */ |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 208 | |
| 209 | llist_for_each_entry(trx, &bts->trx_list, list) |
| 210 | e1_reconfig_trx(trx); |
| 211 | |
| 212 | /* notify E1 input something has changed */ |
| 213 | return e1inp_line_update(line); |
| 214 | } |
| 215 | |
| 216 | #if 0 |
Harald Welte | 1fa60c8 | 2009-02-09 18:13:26 +0000 | [diff] [blame] | 217 | /* do some compiled-in configuration for our BTS/E1 setup */ |
Holger Freyther | b5c00f5 | 2009-04-22 22:08:07 +0000 | [diff] [blame] | 218 | int e1_config(struct gsm_bts *bts, int cardnr, int release_l2) |
Harald Welte | 1fa60c8 | 2009-02-09 18:13:26 +0000 | [diff] [blame] | 219 | { |
| 220 | struct e1inp_line *line; |
| 221 | struct e1inp_ts *sign_ts; |
| 222 | struct e1inp_sign_link *oml_link, *rsl_link; |
Harald Welte | 67b4c30 | 2009-07-29 16:42:16 +0200 | [diff] [blame] | 223 | struct gsm_bts_trx *trx = bts->c0; |
Harald Welte | 4e55d68 | 2009-08-04 14:13:35 +0200 | [diff] [blame] | 224 | int base_ts; |
| 225 | |
| 226 | switch (bts->nr) { |
| 227 | case 0: |
| 228 | /* First BTS uses E1 TS 01,02,03,04,05 */ |
Harald Welte | 63589be | 2009-08-06 17:38:10 +0200 | [diff] [blame] | 229 | base_ts = HARDCODED_BTS0_TS - 1; |
Harald Welte | 4e55d68 | 2009-08-04 14:13:35 +0200 | [diff] [blame] | 230 | break; |
| 231 | case 1: |
Harald Welte | 63589be | 2009-08-06 17:38:10 +0200 | [diff] [blame] | 232 | /* Second BTS uses E1 TS 06,07,08,09,10 */ |
| 233 | base_ts = HARDCODED_BTS1_TS - 1; |
Harald Welte | 4e55d68 | 2009-08-04 14:13:35 +0200 | [diff] [blame] | 234 | break; |
| 235 | case 2: |
Harald Welte | 63589be | 2009-08-06 17:38:10 +0200 | [diff] [blame] | 236 | /* Third BTS uses E1 TS 11,12,13,14,15 */ |
| 237 | base_ts = HARDCODED_BTS2_TS - 1; |
Harald Welte | 4e55d68 | 2009-08-04 14:13:35 +0200 | [diff] [blame] | 238 | default: |
| 239 | return -EINVAL; |
| 240 | } |
Harald Welte | 1fa60c8 | 2009-02-09 18:13:26 +0000 | [diff] [blame] | 241 | |
Harald Welte | 470ec29 | 2009-06-26 20:25:23 +0200 | [diff] [blame] | 242 | line = talloc_zero(tall_bsc_ctx, struct e1inp_line); |
Harald Welte | 1fa60c8 | 2009-02-09 18:13:26 +0000 | [diff] [blame] | 243 | if (!line) |
| 244 | return -ENOMEM; |
Harald Welte | 1fa60c8 | 2009-02-09 18:13:26 +0000 | [diff] [blame] | 245 | |
| 246 | /* create E1 timeslots for signalling and TRAU frames */ |
Harald Welte | 4e55d68 | 2009-08-04 14:13:35 +0200 | [diff] [blame] | 247 | e1inp_ts_config(&line->ts[base_ts+1-1], line, E1INP_TS_TYPE_SIGN); |
| 248 | e1inp_ts_config(&line->ts[base_ts+2-1], line, E1INP_TS_TYPE_TRAU); |
| 249 | e1inp_ts_config(&line->ts[base_ts+3-1], line, E1INP_TS_TYPE_TRAU); |
Harald Welte | 1fa60c8 | 2009-02-09 18:13:26 +0000 | [diff] [blame] | 250 | |
| 251 | /* create signalling links for TS1 */ |
Harald Welte | 4e55d68 | 2009-08-04 14:13:35 +0200 | [diff] [blame] | 252 | sign_ts = &line->ts[base_ts+1-1]; |
Harald Welte | 1fa60c8 | 2009-02-09 18:13:26 +0000 | [diff] [blame] | 253 | oml_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_OML, |
Harald Welte | 67b4c30 | 2009-07-29 16:42:16 +0200 | [diff] [blame] | 254 | trx, TEI_OML, SAPI_OML); |
Harald Welte | 1fa60c8 | 2009-02-09 18:13:26 +0000 | [diff] [blame] | 255 | rsl_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_RSL, |
Harald Welte | 67b4c30 | 2009-07-29 16:42:16 +0200 | [diff] [blame] | 256 | trx, TEI_RSL, SAPI_RSL); |
Harald Welte | 1fa60c8 | 2009-02-09 18:13:26 +0000 | [diff] [blame] | 257 | |
| 258 | /* create back-links from bts/trx */ |
| 259 | bts->oml_link = oml_link; |
Harald Welte | 67b4c30 | 2009-07-29 16:42:16 +0200 | [diff] [blame] | 260 | trx->rsl_link = rsl_link; |
Harald Welte | 1fa60c8 | 2009-02-09 18:13:26 +0000 | [diff] [blame] | 261 | |
Harald Welte | 11fa29c | 2009-02-19 17:24:39 +0000 | [diff] [blame] | 262 | /* enable subchannel demuxer on TS2 */ |
Harald Welte | 4e55d68 | 2009-08-04 14:13:35 +0200 | [diff] [blame] | 263 | subch_demux_activate(&line->ts[base_ts+2-1].trau.demux, 1); |
| 264 | subch_demux_activate(&line->ts[base_ts+2-1].trau.demux, 2); |
| 265 | subch_demux_activate(&line->ts[base_ts+2-1].trau.demux, 3); |
Harald Welte | 93d3f37 | 2009-02-18 03:27:14 +0000 | [diff] [blame] | 266 | |
Harald Welte | 11fa29c | 2009-02-19 17:24:39 +0000 | [diff] [blame] | 267 | /* enable subchannel demuxer on TS3 */ |
Harald Welte | 4e55d68 | 2009-08-04 14:13:35 +0200 | [diff] [blame] | 268 | subch_demux_activate(&line->ts[base_ts+3-1].trau.demux, 0); |
| 269 | subch_demux_activate(&line->ts[base_ts+3-1].trau.demux, 1); |
| 270 | subch_demux_activate(&line->ts[base_ts+3-1].trau.demux, 2); |
| 271 | subch_demux_activate(&line->ts[base_ts+3-1].trau.demux, 3); |
Harald Welte | 11fa29c | 2009-02-19 17:24:39 +0000 | [diff] [blame] | 272 | |
Harald Welte | 67b4c30 | 2009-07-29 16:42:16 +0200 | [diff] [blame] | 273 | trx = gsm_bts_trx_num(bts, 1); |
| 274 | if (trx) { |
| 275 | /* create E1 timeslots for TRAU frames of TRX1 */ |
Harald Welte | 4e55d68 | 2009-08-04 14:13:35 +0200 | [diff] [blame] | 276 | e1inp_ts_config(&line->ts[base_ts+4-1], line, E1INP_TS_TYPE_TRAU); |
| 277 | e1inp_ts_config(&line->ts[base_ts+5-1], line, E1INP_TS_TYPE_TRAU); |
Harald Welte | 1fa60c8 | 2009-02-09 18:13:26 +0000 | [diff] [blame] | 278 | |
Harald Welte | 67b4c30 | 2009-07-29 16:42:16 +0200 | [diff] [blame] | 279 | /* create RSL signalling link for TRX1 */ |
Harald Welte | 4e55d68 | 2009-08-04 14:13:35 +0200 | [diff] [blame] | 280 | sign_ts = &line->ts[base_ts+1-1]; |
Harald Welte | 67b4c30 | 2009-07-29 16:42:16 +0200 | [diff] [blame] | 281 | rsl_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_RSL, |
| 282 | trx, TEI_RSL+1, SAPI_RSL); |
| 283 | /* create back-links from trx */ |
| 284 | trx->rsl_link = rsl_link; |
| 285 | |
| 286 | /* enable subchannel demuxer on TS2 */ |
Harald Welte | 4e55d68 | 2009-08-04 14:13:35 +0200 | [diff] [blame] | 287 | subch_demux_activate(&line->ts[base_ts+4-1].trau.demux, 0); |
| 288 | subch_demux_activate(&line->ts[base_ts+4-1].trau.demux, 1); |
| 289 | subch_demux_activate(&line->ts[base_ts+4-1].trau.demux, 2); |
| 290 | subch_demux_activate(&line->ts[base_ts+4-1].trau.demux, 3); |
Harald Welte | 67b4c30 | 2009-07-29 16:42:16 +0200 | [diff] [blame] | 291 | |
| 292 | /* enable subchannel demuxer on TS3 */ |
Harald Welte | 4e55d68 | 2009-08-04 14:13:35 +0200 | [diff] [blame] | 293 | subch_demux_activate(&line->ts[base_ts+5-1].trau.demux, 0); |
| 294 | subch_demux_activate(&line->ts[base_ts+5-1].trau.demux, 1); |
| 295 | subch_demux_activate(&line->ts[base_ts+5-1].trau.demux, 2); |
| 296 | subch_demux_activate(&line->ts[base_ts+5-1].trau.demux, 3); |
Harald Welte | 67b4c30 | 2009-07-29 16:42:16 +0200 | [diff] [blame] | 297 | } |
Harald Welte | 1fa60c8 | 2009-02-09 18:13:26 +0000 | [diff] [blame] | 298 | |
Holger Freyther | b5c00f5 | 2009-04-22 22:08:07 +0000 | [diff] [blame] | 299 | return mi_setup(cardnr, line, release_l2); |
Harald Welte | 1fa60c8 | 2009-02-09 18:13:26 +0000 | [diff] [blame] | 300 | } |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 301 | #endif |