blob: 44f935857bab5e5dc1baa3b9b72281784a9ed7a3 [file] [log] [blame]
Harald Welte39315c42010-01-10 18:01:52 +01001/* Siemens BS-11 specific code */
2
3/* (C) 2009-2010 by Harald Welte <laforge@gnumonks.org>
4 *
5 * All Rights Reserved
6 *
7 * This program is free software; you can redistribute it and/or modify
Harald Welte9af6ddf2011-01-01 15:25:50 +01008 * it under the terms of the GNU Affero General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
Harald Welte39315c42010-01-10 18:01:52 +010010 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Harald Welte9af6ddf2011-01-01 15:25:50 +010015 * GNU Affero General Public License for more details.
Harald Welte39315c42010-01-10 18:01:52 +010016 *
Harald Welte9af6ddf2011-01-01 15:25:50 +010017 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
Harald Welte39315c42010-01-10 18:01:52 +010019 *
20 */
21
Harald Welte39315c42010-01-10 18:01:52 +010022
Pablo Neira Ayuso136f4532011-03-22 16:47:59 +010023#include <osmocom/gsm/tlv.h>
Harald Weltef338a032011-01-14 15:55:42 +010024
25#include <openbsc/debug.h>
26#include <openbsc/gsm_data.h>
Harald Welte39315c42010-01-10 18:01:52 +010027#include <openbsc/abis_nm.h>
Harald Weltef338a032011-01-14 15:55:42 +010028#include <openbsc/e1_input.h>
29#include <openbsc/signal.h>
Harald Welte39315c42010-01-10 18:01:52 +010030
31static struct gsm_bts_model model_bs11 = {
32 .type = GSM_BTS_TYPE_BS11,
Harald Welte09cefee2011-02-12 12:29:21 +010033 .name = "bs11",
34 .oml_rcvmsg = &abis_nm_rcvmsg,
Harald Welte39315c42010-01-10 18:01:52 +010035 .nm_att_tlvdef = {
36 .def = {
37 [NM_ATT_AVAIL_STATUS] = { TLV_TYPE_TLV },
38 /* BS11 specifics */
39 [NM_ATT_BS11_ESN_FW_CODE_NO] = { TLV_TYPE_TLV },
40 [NM_ATT_BS11_ESN_HW_CODE_NO] = { TLV_TYPE_TLV },
41 [NM_ATT_BS11_ESN_PCB_SERIAL] = { TLV_TYPE_TLV },
42 [NM_ATT_BS11_BOOT_SW_VERS] = { TLV_TYPE_TLV },
43 [0xd5] = { TLV_TYPE_TLV },
44 [0xa8] = { TLV_TYPE_TLV },
45 [NM_ATT_BS11_PASSWORD] = { TLV_TYPE_TLV },
46 [NM_ATT_BS11_TXPWR] = { TLV_TYPE_TLV },
47 [NM_ATT_BS11_RSSI_OFFS] = { TLV_TYPE_TLV },
48 [NM_ATT_BS11_LINE_CFG] = { TLV_TYPE_TV },
49 [NM_ATT_BS11_L1_PROT_TYPE] = { TLV_TYPE_TV },
50 [NM_ATT_BS11_BIT_ERR_THESH] = { TLV_TYPE_FIXED, 2 },
51 [NM_ATT_BS11_DIVERSITY] = { TLV_TYPE_TLV },
52 [NM_ATT_BS11_LMT_LOGON_SESSION]={ TLV_TYPE_TLV },
53 [NM_ATT_BS11_LMT_LOGIN_TIME] = { TLV_TYPE_TLV },
54 [NM_ATT_BS11_LMT_USER_ACC_LEV] ={ TLV_TYPE_TLV },
55 [NM_ATT_BS11_LMT_USER_NAME] = { TLV_TYPE_TLV },
56 [NM_ATT_BS11_BTS_STATE] = { TLV_TYPE_TLV },
57 [NM_ATT_BS11_E1_STATE] = { TLV_TYPE_TLV },
58 [NM_ATT_BS11_PLL_MODE] = { TLV_TYPE_TLV },
59 [NM_ATT_BS11_PLL] = { TLV_TYPE_TLV },
60 [NM_ATT_BS11_CCLK_ACCURACY] = { TLV_TYPE_TV },
61 [NM_ATT_BS11_CCLK_TYPE] = { TLV_TYPE_TV },
62 [0x95] = { TLV_TYPE_FIXED, 2 },
63 },
64 },
65};
66
Harald Weltef338a032011-01-14 15:55:42 +010067/* The following definitions are for OM and NM packets that we cannot yet
68 * generate by code but we just pass on */
69
70// BTS Site Manager, SET ATTRIBUTES
71
72/*
73 Object Class: BTS Site Manager
74 Instance 1: FF
75 Instance 2: FF
76 Instance 3: FF
77SET ATTRIBUTES
78 sAbisExternalTime: 2007/09/08 14:36:11
79 omLAPDRelTimer: 30sec
80 shortLAPDIntTimer: 5sec
81 emergencyTimer1: 10 minutes
82 emergencyTimer2: 0 minutes
83*/
84
85unsigned char msg_1[] =
86{
87 NM_MT_BS11_SET_ATTR, NM_OC_SITE_MANAGER, 0xFF, 0xFF, 0xFF,
88 NM_ATT_BS11_ABIS_EXT_TIME, 0x07,
89 0xD7, 0x09, 0x08, 0x0E, 0x24, 0x0B, 0xCE,
90 0x02,
91 0x00, 0x1E,
92 NM_ATT_BS11_SH_LAPD_INT_TIMER,
93 0x01, 0x05,
94 0x42, 0x02, 0x00, 0x0A,
95 0x44, 0x02, 0x00, 0x00
96};
97
98// BTS, SET BTS ATTRIBUTES
99
100/*
101 Object Class: BTS
102 BTS relat. Number: 0
103 Instance 2: FF
104 Instance 3: FF
105SET BTS ATTRIBUTES
106 bsIdentityCode / BSIC:
107 PLMN_colour_code: 7h
108 BS_colour_code: 7h
109 BTS Air Timer T3105: 4 ,unit 10 ms
110 btsIsHopping: FALSE
111 periodCCCHLoadIndication: 1sec
112 thresholdCCCHLoadIndication: 0%
113 cellAllocationNumber: 00h = GSM 900
114 enableInterferenceClass: 00h = Disabled
115 fACCHQual: 6 (FACCH stealing flags minus 1)
116 intaveParameter: 31 SACCH multiframes
117 interferenceLevelBoundaries:
118 Interference Boundary 1: 0Ah
119 Interference Boundary 2: 0Fh
120 Interference Boundary 3: 14h
121 Interference Boundary 4: 19h
122 Interference Boundary 5: 1Eh
123 mSTxPwrMax: 11
124 GSM range: 2=39dBm, 15=13dBm, stepsize 2 dBm
125 DCS1800 range: 0=30dBm, 15=0dBm, stepsize 2 dBm
126 PCS1900 range: 0=30dBm, 15=0dBm, stepsize 2 dBm
127 30=33dBm, 31=32dBm
128 ny1:
129 Maximum number of repetitions for PHYSICAL INFORMATION message (GSM 04.08): 20
130 powerOutputThresholds:
131 Out Power Fault Threshold: -10 dB
132 Red Out Power Threshold: - 6 dB
133 Excessive Out Power Threshold: 5 dB
134 rACHBusyThreshold: -127 dBm
135 rACHLoadAveragingSlots: 250 ,number of RACH burst periods
136 rfResourceIndicationPeriod: 125 SACCH multiframes
137 T200:
138 SDCCH: 044 in 5 ms
139 FACCH/Full rate: 031 in 5 ms
140 FACCH/Half rate: 041 in 5 ms
141 SACCH with TCH SAPI0: 090 in 10 ms
142 SACCH with SDCCH: 090 in 10 ms
143 SDCCH with SAPI3: 090 in 5 ms
144 SACCH with TCH SAPI3: 135 in 10 ms
145 tSync: 9000 units of 10 msec
146 tTrau: 9000 units of 10 msec
147 enableUmLoopTest: 00h = disabled
148 enableExcessiveDistance: 00h = Disabled
149 excessiveDistance: 64km
150 hoppingMode: 00h = baseband hopping
151 cellType: 00h = Standard Cell
152 BCCH ARFCN / bCCHFrequency: 1
153*/
154
155static unsigned char bs11_attr_bts[] =
156{
157 NM_ATT_BSIC, HARDCODED_BSIC,
158 NM_ATT_BTS_AIR_TIMER, 0x04,
159 NM_ATT_BS11_BTSLS_HOPPING, 0x00,
160 NM_ATT_CCCH_L_I_P, 0x01,
161 NM_ATT_CCCH_L_T, 0x00,
162 NM_ATT_BS11_CELL_ALLOC_NR, NM_BS11_CANR_GSM,
163 NM_ATT_BS11_ENA_INTERF_CLASS, 0x01,
164 NM_ATT_BS11_FACCH_QUAL, 0x06,
165 /* interference avg. period in numbers of SACCH multifr */
166 NM_ATT_INTAVE_PARAM, 0x1F,
167 NM_ATT_INTERF_BOUND, 0x0A, 0x0F, 0x14, 0x19, 0x1E, 0x7B,
168 NM_ATT_CCCH_L_T, 0x23,
169 NM_ATT_GSM_TIME, 0x28, 0x00,
170 NM_ATT_ADM_STATE, 0x03,
171 NM_ATT_RACH_B_THRESH, 0x7F,
172 NM_ATT_LDAVG_SLOTS, 0x00, 0xFA,
173 NM_ATT_BS11_RF_RES_IND_PER, 0x7D,
174 NM_ATT_T200, 0x2C, 0x1F, 0x29, 0x5A, 0x5A, 0x5A, 0x87,
175 NM_ATT_BS11_TSYNC, 0x23, 0x28,
176 NM_ATT_BS11_TTRAU, 0x23, 0x28,
177 NM_ATT_TEST_DUR, 0x01, 0x00,
178 NM_ATT_OUTST_ALARM, 0x01, 0x00,
179 NM_ATT_BS11_EXCESSIVE_DISTANCE, 0x01, 0x40,
180 NM_ATT_BS11_HOPPING_MODE, 0x01, 0x00,
181 NM_ATT_BS11_PLL, 0x01, 0x00,
182 NM_ATT_BCCH_ARFCN, 0x00, HARDCODED_ARFCN/*0x01*/,
183};
184
185// Handover Recognition, SET ATTRIBUTES
186
187/*
188Illegal Contents GSM Formatted O&M Msg
189 Object Class: Handover Recognition
190 BTS relat. Number: 0
191 Instance 2: FF
192 Instance 3: FF
193SET ATTRIBUTES
194 enableDelayPowerBudgetHO: 00h = Disabled
195 enableDistanceHO: 00h = Disabled
196 enableInternalInterCellHandover: 00h = Disabled
197 enableInternalIntraCellHandover: 00h = Disabled
198 enablePowerBudgetHO: 00h = Disabled
199 enableRXLEVHO: 00h = Disabled
200 enableRXQUALHO: 00h = Disabled
201 hoAveragingDistance: 8 SACCH multiframes
202 hoAveragingLev:
203 A_LEV_HO: 8 SACCH multiframes
204 W_LEV_HO: 1 SACCH multiframes
205 hoAveragingPowerBudget: 16 SACCH multiframes
206 hoAveragingQual:
207 A_QUAL_HO: 8 SACCH multiframes
208 W_QUAL_HO: 2 SACCH multiframes
209 hoLowerThresholdLevDL: (10 - 110) dBm
210 hoLowerThresholdLevUL: (5 - 110) dBm
211 hoLowerThresholdQualDL: 06h = 6.4% < BER < 12.8%
212 hoLowerThresholdQualUL: 06h = 6.4% < BER < 12.8%
213 hoThresholdLevDLintra : (20 - 110) dBm
214 hoThresholdLevULintra: (20 - 110) dBm
215 hoThresholdMsRangeMax: 20 km
216 nCell: 06h
217 timerHORequest: 3 ,unit 2 SACCH multiframes
218*/
219
220unsigned char msg_3[] =
221{
222 NM_MT_BS11_SET_ATTR, NM_OC_BS11_HANDOVER, 0x00, 0xFF, 0xFF,
223 0xD0, 0x00, /* enableDelayPowerBudgetHO */
224 0x64, 0x00, /* enableDistanceHO */
225 0x67, 0x00, /* enableInternalInterCellHandover */
226 0x68, 0x00, /* enableInternalInterCellHandover */
227 0x6A, 0x00, /* enablePowerBudgetHO */
228 0x6C, 0x00, /* enableRXLEVHO */
229 0x6D, 0x00, /* enableRXQUALHO */
230 0x6F, 0x08, /* hoAveragingDistance */
231 0x70, 0x08, 0x01, /* hoAveragingLev */
232 0x71, 0x10, 0x10, 0x10,
233 0x72, 0x08, 0x02, /* hoAveragingQual */
234 0x73, 0x0A, /* hoLowerThresholdLevDL */
235 0x74, 0x05, /* hoLowerThresholdLevUL */
236 0x75, 0x06, /* hoLowerThresholdQualDL */
237 0x76, 0x06, /* hoLowerThresholdQualUL */
238 0x78, 0x14, /* hoThresholdLevDLintra */
239 0x79, 0x14, /* hoThresholdLevULintra */
240 0x7A, 0x14, /* hoThresholdMsRangeMax */
241 0x7D, 0x06, /* nCell */
242 NM_ATT_BS11_TIMER_HO_REQUEST, 0x03,
243 0x20, 0x01, 0x00,
244 0x45, 0x01, 0x00,
245 0x48, 0x01, 0x00,
246 0x5A, 0x01, 0x00,
247 0x5B, 0x01, 0x05,
248 0x5E, 0x01, 0x1A,
249 0x5F, 0x01, 0x20,
250 0x9D, 0x01, 0x00,
251 0x47, 0x01, 0x00,
252 0x5C, 0x01, 0x64,
253 0x5D, 0x01, 0x1E,
254 0x97, 0x01, 0x20,
255 0xF7, 0x01, 0x3C,
256};
257
258// Power Control, SET ATTRIBUTES
259
260/*
261 Object Class: Power Control
262 BTS relat. Number: 0
263 Instance 2: FF
264 Instance 3: FF
265SET ATTRIBUTES
266 enableMsPowerControl: 00h = Disabled
267 enablePowerControlRLFW: 00h = Disabled
268 pcAveragingLev:
269 A_LEV_PC: 4 SACCH multiframes
270 W_LEV_PC: 1 SACCH multiframes
271 pcAveragingQual:
272 A_QUAL_PC: 4 SACCH multiframes
273 W_QUAL_PC: 2 SACCH multiframes
274 pcLowerThresholdLevDL: 0Fh
275 pcLowerThresholdLevUL: 0Ah
276 pcLowerThresholdQualDL: 05h = 3.2% < BER < 6.4%
277 pcLowerThresholdQualUL: 05h = 3.2% < BER < 6.4%
278 pcRLFThreshold: 0Ch
279 pcUpperThresholdLevDL: 14h
280 pcUpperThresholdLevUL: 0Fh
281 pcUpperThresholdQualDL: 04h = 1.6% < BER < 3.2%
282 pcUpperThresholdQualUL: 04h = 1.6% < BER < 3.2%
283 powerConfirm: 2 ,unit 2 SACCH multiframes
284 powerControlInterval: 2 ,unit 2 SACCH multiframes
285 powerIncrStepSize: 02h = 4 dB
286 powerRedStepSize: 01h = 2 dB
287 radioLinkTimeoutBs: 64 SACCH multiframes
288 enableBSPowerControl: 00h = disabled
289*/
290
291unsigned char msg_4[] =
292{
293 NM_MT_BS11_SET_ATTR, NM_OC_BS11_PWR_CTRL, 0x00, 0xFF, 0xFF,
294 NM_ATT_BS11_ENA_MS_PWR_CTRL, 0x00,
295 NM_ATT_BS11_ENA_PWR_CTRL_RLFW, 0x00,
296 0x7E, 0x04, 0x01, /* pcAveragingLev */
297 0x7F, 0x04, 0x02, /* pcAveragingQual */
298 0x80, 0x0F, /* pcLowerThresholdLevDL */
299 0x81, 0x0A, /* pcLowerThresholdLevUL */
300 0x82, 0x05, /* pcLowerThresholdQualDL */
301 0x83, 0x05, /* pcLowerThresholdQualUL */
302 0x84, 0x0C, /* pcRLFThreshold */
303 0x85, 0x14, /* pcUpperThresholdLevDL */
304 0x86, 0x0F, /* pcUpperThresholdLevUL */
305 0x87, 0x04, /* pcUpperThresholdQualDL */
306 0x88, 0x04, /* pcUpperThresholdQualUL */
307 0x89, 0x02, /* powerConfirm */
308 0x8A, 0x02, /* powerConfirmInterval */
309 0x8B, 0x02, /* powerIncrStepSize */
310 0x8C, 0x01, /* powerRedStepSize */
311 0x8D, 0x40, /* radioLinkTimeoutBs */
312 0x65, 0x01, 0x00 // set to 0x01 to enable BSPowerControl
313};
314
315
316// Transceiver, SET TRX ATTRIBUTES (TRX 0)
317
318/*
319 Object Class: Transceiver
320 BTS relat. Number: 0
321 Tranceiver number: 0
322 Instance 3: FF
323SET TRX ATTRIBUTES
324 aRFCNList (HEX): 0001
325 txPwrMaxReduction: 00h = 30dB
326 radioMeasGran: 254 SACCH multiframes
327 radioMeasRep: 01h = enabled
328 memberOfEmergencyConfig: 01h = TRUE
329 trxArea: 00h = TRX doesn't belong to a concentric cell
330*/
331
332static unsigned char bs11_attr_radio[] =
333{
334 NM_ATT_ARFCN_LIST, 0x01, 0x00, HARDCODED_ARFCN /*0x01*/,
335 NM_ATT_RF_MAXPOWR_R, 0x00,
336 NM_ATT_BS11_RADIO_MEAS_GRAN, 0x01, 0x05,
337 NM_ATT_BS11_RADIO_MEAS_REP, 0x01, 0x01,
338 NM_ATT_BS11_EMRG_CFG_MEMBER, 0x01, 0x01,
339 NM_ATT_BS11_TRX_AREA, 0x01, 0x00,
340};
341
342/*
343 * Patch the various SYSTEM INFORMATION tables to update
344 * the LAI
345 */
346static void patch_nm_tables(struct gsm_bts *bts)
347{
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200348 uint8_t arfcn_low = bts->c0->arfcn & 0xff;
349 uint8_t arfcn_high = (bts->c0->arfcn >> 8) & 0x0f;
Harald Weltef338a032011-01-14 15:55:42 +0100350
351 /* patch ARFCN into BTS Attributes */
352 bs11_attr_bts[69] &= 0xf0;
353 bs11_attr_bts[69] |= arfcn_high;
354 bs11_attr_bts[70] = arfcn_low;
355
356 /* patch ARFCN into TRX Attributes */
357 bs11_attr_radio[2] &= 0xf0;
358 bs11_attr_radio[2] |= arfcn_high;
359 bs11_attr_radio[3] = arfcn_low;
360
361 /* patch the RACH attributes */
362 if (bts->rach_b_thresh != -1)
363 bs11_attr_bts[33] = bts->rach_b_thresh & 0xff;
364
365 if (bts->rach_ldavg_slots != -1) {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200366 uint8_t avg_high = bts->rach_ldavg_slots & 0xff;
367 uint8_t avg_low = (bts->rach_ldavg_slots >> 8) & 0x0f;
Harald Weltef338a032011-01-14 15:55:42 +0100368
369 bs11_attr_bts[35] = avg_high;
370 bs11_attr_bts[36] = avg_low;
371 }
372
373 /* patch BSIC */
374 bs11_attr_bts[1] = bts->bsic;
375
376 /* patch the power reduction */
377 bs11_attr_radio[5] = bts->c0->max_power_red / 2;
378}
379
380
381static void nm_reconfig_ts(struct gsm_bts_trx_ts *ts)
382{
383 enum abis_nm_chan_comb ccomb = abis_nm_chcomb4pchan(ts->pchan);
384 struct gsm_e1_subslot *e1l = &ts->e1_link;
385
386 abis_nm_set_channel_attr(ts, ccomb);
387
388 if (is_ipaccess_bts(ts->trx->bts))
389 return;
390
391 switch (ts->pchan) {
392 case GSM_PCHAN_TCH_F:
393 case GSM_PCHAN_TCH_H:
394 abis_nm_conn_terr_traf(ts, e1l->e1_nr, e1l->e1_ts,
395 e1l->e1_ts_ss);
396 break;
397 default:
398 break;
399 }
400}
401
402static void nm_reconfig_trx(struct gsm_bts_trx *trx)
403{
404 struct gsm_e1_subslot *e1l = &trx->rsl_e1_link;
405 int i;
406
407 patch_nm_tables(trx->bts);
408
409 switch (trx->bts->type) {
410 case GSM_BTS_TYPE_BS11:
411 /* FIXME: discover this by fetching an attribute */
412#if 0
413 trx->nominal_power = 15; /* 15dBm == 30mW PA configuration */
414#else
415 trx->nominal_power = 24; /* 24dBm == 250mW PA configuration */
416#endif
417 abis_nm_conn_terr_sign(trx, e1l->e1_nr, e1l->e1_ts,
418 e1l->e1_ts_ss);
419 abis_nm_establish_tei(trx->bts, trx->nr, e1l->e1_nr,
420 e1l->e1_ts, e1l->e1_ts_ss, trx->rsl_tei);
421
422 /* Set Radio Attributes */
423 if (trx == trx->bts->c0)
424 abis_nm_set_radio_attr(trx, bs11_attr_radio,
425 sizeof(bs11_attr_radio));
426 else {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200427 uint8_t trx1_attr_radio[sizeof(bs11_attr_radio)];
428 uint8_t arfcn_low = trx->arfcn & 0xff;
429 uint8_t arfcn_high = (trx->arfcn >> 8) & 0x0f;
Harald Weltef338a032011-01-14 15:55:42 +0100430 memcpy(trx1_attr_radio, bs11_attr_radio,
431 sizeof(trx1_attr_radio));
432
433 /* patch ARFCN into TRX Attributes */
434 trx1_attr_radio[2] &= 0xf0;
435 trx1_attr_radio[2] |= arfcn_high;
436 trx1_attr_radio[3] = arfcn_low;
437
438 abis_nm_set_radio_attr(trx, trx1_attr_radio,
439 sizeof(trx1_attr_radio));
440 }
441 break;
442 case GSM_BTS_TYPE_NANOBTS:
443 switch (trx->bts->band) {
444 case GSM_BAND_850:
445 case GSM_BAND_900:
446 trx->nominal_power = 20;
447 break;
448 case GSM_BAND_1800:
449 case GSM_BAND_1900:
450 trx->nominal_power = 23;
451 break;
452 default:
453 LOGP(DNM, LOGL_ERROR, "Unsupported nanoBTS GSM band %s\n",
454 gsm_band_name(trx->bts->band));
455 break;
456 }
457 break;
458 default:
459 break;
460 }
461
462 for (i = 0; i < TRX_NR_TS; i++)
463 nm_reconfig_ts(&trx->ts[i]);
464}
465
466static void nm_reconfig_bts(struct gsm_bts *bts)
467{
468 struct gsm_bts_trx *trx;
469
470 switch (bts->type) {
471 case GSM_BTS_TYPE_BS11:
472 patch_nm_tables(bts);
473 abis_nm_raw_msg(bts, sizeof(msg_1), msg_1); /* set BTS SiteMgr attr*/
474 abis_nm_set_bts_attr(bts, bs11_attr_bts, sizeof(bs11_attr_bts));
475 abis_nm_raw_msg(bts, sizeof(msg_3), msg_3); /* set BTS handover attr */
476 abis_nm_raw_msg(bts, sizeof(msg_4), msg_4); /* set BTS power control attr */
477 break;
478 default:
479 break;
480 }
481
482 llist_for_each_entry(trx, &bts->trx_list, list)
483 nm_reconfig_trx(trx);
484}
485
486
487static void bootstrap_om_bs11(struct gsm_bts *bts)
488{
489 LOGP(DNM, LOGL_NOTICE, "bootstrapping OML for BTS %u\n", bts->nr);
490
491 /* stop sending event reports */
492 abis_nm_event_reports(bts, 0);
493
494 /* begin DB transmission */
495 abis_nm_bs11_db_transmission(bts, 1);
496
497 /* end DB transmission */
498 abis_nm_bs11_db_transmission(bts, 0);
499
500 /* Reset BTS Site manager resource */
501 abis_nm_bs11_reset_resource(bts);
502
503 /* begin DB transmission */
504 abis_nm_bs11_db_transmission(bts, 1);
505
506 /* reconfigure BTS with all TRX and all TS */
507 nm_reconfig_bts(bts);
508
509 /* end DB transmission */
510 abis_nm_bs11_db_transmission(bts, 0);
511
512 /* Reset BTS Site manager resource */
513 abis_nm_bs11_reset_resource(bts);
514
515 /* restart sending event reports */
516 abis_nm_event_reports(bts, 1);
517}
518
519static int shutdown_om(struct gsm_bts *bts)
520{
521 /* stop sending event reports */
522 abis_nm_event_reports(bts, 0);
523
524 /* begin DB transmission */
525 abis_nm_bs11_db_transmission(bts, 1);
526
527 /* end DB transmission */
528 abis_nm_bs11_db_transmission(bts, 0);
529
530 /* Reset BTS Site manager resource */
531 abis_nm_bs11_reset_resource(bts);
532
533 return 0;
534}
535
536/* Callback function to be called every time we receive a signal from INPUT */
537static int gbl_sig_cb(unsigned int subsys, unsigned int signal,
538 void *handler_data, void *signal_data)
539{
540 struct gsm_bts *bts;
541
542 if (subsys != SS_GLOBAL)
543 return 0;
544
545 switch (signal) {
546 case S_GLOBAL_BTS_CLOSE_OM:
547 bts = signal_data;
548 if (bts->type == GSM_BTS_TYPE_BS11)
549 shutdown_om(signal_data);
550 break;
551 }
552
553 return 0;
554}
555
556/* Callback function to be called every time we receive a signal from INPUT */
557static int inp_sig_cb(unsigned int subsys, unsigned int signal,
558 void *handler_data, void *signal_data)
559{
560 struct input_signal_data *isd = signal_data;
561
562 if (subsys != SS_INPUT)
563 return 0;
564
565 switch (signal) {
566 case S_INP_TEI_UP:
567 switch (isd->link_type) {
568 case E1INP_SIGN_OML:
569 if (isd->trx->bts->type == GSM_BTS_TYPE_BS11)
570 bootstrap_om_bs11(isd->trx->bts);
571 break;
572 }
573 }
574
575 return 0;
576}
577
Harald Welte39315c42010-01-10 18:01:52 +0100578int bts_model_bs11_init(void)
579{
Holger Hans Peter Freytherc8bf3c12010-06-21 18:11:37 +0800580 model_bs11.features.data = &model_bs11._features_data[0];
Harald Weltef3d8e922010-06-14 22:44:42 +0200581 model_bs11.features.data_len = sizeof(model_bs11._features_data);
582
583 gsm_btsmodel_set_feature(&model_bs11, BTS_FEAT_HOPPING);
584 gsm_btsmodel_set_feature(&model_bs11, BTS_FEAT_HSCSD);
585
Pablo Neira Ayusobbc5b992011-05-06 12:12:31 +0200586 osmo_signal_register_handler(SS_INPUT, inp_sig_cb, NULL);
587 osmo_signal_register_handler(SS_GLOBAL, gbl_sig_cb, NULL);
Harald Weltef338a032011-01-14 15:55:42 +0100588
Harald Welte39315c42010-01-10 18:01:52 +0100589 return gsm_bts_model_register(&model_bs11);
590}