aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-trx/trx_vty.c
blob: fb75a4e5d613eb25bfbc13707de2a1aeee03feea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
/* VTY interface for sysmoBTS */

/* (C) 2013 by Andreas Eversberg <jolly@eversberg.eu>
 *
 * All Rights Reserved
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <stdint.h>
#include <ctype.h>
#include <inttypes.h>

#include <arpa/inet.h>

#include <osmocom/core/msgb.h>
#include <osmocom/core/talloc.h>
#include <osmocom/core/select.h>
#include <osmocom/core/bits.h>
#include <osmocom/core/socket.h>

#include <osmocom/vty/vty.h>
#include <osmocom/vty/command.h>
#include <osmocom/vty/misc.h>

#include <osmo-bts/gsm_data.h>
#include <osmo-bts/logging.h>
#include <osmo-bts/vty.h>
#include <osmo-bts/scheduler.h>
#include <osmo-bts/bts.h>

#include "l1_if.h"
#include "trx_if.h"
#include "loops.h"

#define OSMOTRX_STR	"OsmoTRX Transceiver configuration\n"

static struct gsm_bts *vty_bts;

DEFUN(show_transceiver, show_transceiver_cmd, "show transceiver",
	SHOW_STR "Display information about transceivers\n")
{
	struct gsm_bts *bts = vty_bts;
	struct gsm_bts_trx *trx;
	struct trx_l1h *l1h;

	llist_for_each_entry(trx, &bts->trx_list, list) {
		struct phy_instance *pinst = trx_phy_instance(trx);
		struct phy_link *plink = pinst->phy_link;
		char *sname = osmo_sock_get_name(NULL, plink->u.osmotrx.trx_ofd_clk.fd);
		l1h = pinst->u.osmotrx.hdl;
		vty_out(vty, "TRX %d %s%s", trx->nr, sname, VTY_NEWLINE);
		talloc_free(sname);
		vty_out(vty, " %s%s",
			trx_if_powered(l1h) ? "poweron":"poweroff",
			VTY_NEWLINE);
		vty_out(vty, "phy link state: %s%s",
			phy_link_state_name(phy_link_state_get(plink)), VTY_NEWLINE);
		if (l1h->config.arfcn_valid)
			vty_out(vty, " arfcn  : %d%s%s",
				(l1h->config.arfcn & ~ARFCN_PCS),
				(l1h->config.arfcn & ARFCN_PCS) ? " (PCS)" : "",
				VTY_NEWLINE);
		else
			vty_out(vty, " arfcn  : undefined%s", VTY_NEWLINE);
		if (l1h->config.tsc_valid)
			vty_out(vty, " tsc    : %d%s", l1h->config.tsc,
				VTY_NEWLINE);
		else
			vty_out(vty, " tsc    : undefined%s", VTY_NEWLINE);
		if (l1h->config.bsic_valid)
			vty_out(vty, " bsic   : %d%s", l1h->config.bsic,
				VTY_NEWLINE);
		else
			vty_out(vty, " bisc   : undefined%s", VTY_NEWLINE);
	}

	return CMD_SUCCESS;
}


static void show_phy_inst_single(struct vty *vty, struct phy_instance *pinst)
{
	uint8_t tn;
	struct trx_l1h *l1h = pinst->u.osmotrx.hdl;
	struct gsm_bts_trx *trx = pinst->trx;

	vty_out(vty, "PHY Instance %s%s",
		phy_instance_name(pinst), VTY_NEWLINE);

	if (l1h->config.rxgain_valid)
		vty_out(vty, " rx-gain        : %d dB%s",
			l1h->config.rxgain, VTY_NEWLINE);
	else
		vty_out(vty, " rx-gain        : undefined%s", VTY_NEWLINE);
	vty_out(vty, " tx-attenuation : %d dB%s",
		(get_p_max_out_mdBm(trx) - get_p_actual_mdBm(trx, trx->power_params.p_total_tgt_mdBm))/1000,
		VTY_NEWLINE);
	if (l1h->config.maxdly_valid)
		vty_out(vty, " maxdly : %d%s", l1h->config.maxdly,
			VTY_NEWLINE);
	else
		vty_out(vty, " maxdly : undefined%s", VTY_NEWLINE);
	if (l1h->config.maxdlynb_valid)
		vty_out(vty, " maxdlynb : %d%s", l1h->config.maxdlynb,
			VTY_NEWLINE);
	else
		vty_out(vty, " maxdlynb : undefined%s", VTY_NEWLINE);
	for (tn = 0; tn < TRX_NR_TS; tn++) {
		if (!((1 << tn) & l1h->config.slotmask))
			vty_out(vty, " slot #%d: unsupported%s", tn,
				VTY_NEWLINE);
		else if (l1h->config.slottype_valid[tn])
			vty_out(vty, " slot #%d: type %d%s", tn,
				l1h->config.slottype[tn],
				VTY_NEWLINE);
		else
			vty_out(vty, " slot #%d: undefined%s", tn,
				VTY_NEWLINE);
	}
}

static void show_phy_single(struct vty *vty, struct phy_link *plink)
{
	struct phy_instance *pinst;

	vty_out(vty, "PHY %u%s", plink->num, VTY_NEWLINE);

	llist_for_each_entry(pinst, &plink->instances, list)
		show_phy_inst_single(vty, pinst);
}

DEFUN(show_phy, show_phy_cmd, "show phy",
	SHOW_STR  "Display information about the available PHYs")
{
	int i;

	for (i = 0; i < 255; i++) {
		struct phy_link *plink = phy_link_by_num(i);
		if (!plink)
			break;
		show_phy_single(vty, plink);
	}

	return CMD_SUCCESS;
}

DEFUN(cfg_trx_nominal_power, cfg_trx_nominal_power_cmd,
	"nominal-tx-power <-10-100>",
	"Manually set (force) the nominal transmit output power in dBm\n"
	"Nominal transmit output power level in dBm\n")
{
	struct gsm_bts_trx *trx = vty->index;
	struct phy_instance *pinst = trx_phy_instance(trx);
	struct trx_l1h *l1h = pinst->u.osmotrx.hdl;
	int val = atoi(argv[0]);

	l1if_trx_set_nominal_power(trx, val);
	l1h->config.nominal_power_set_by_vty = true;

	return CMD_SUCCESS;
}

DEFUN(cfg_trx_no_nominal_power, cfg_trx_no_nominal_power_cmd,
	"no nominal-tx-power",
	NO_STR
	"Manually set (force) the nominal transmit output power; ask the TRX instead (default)\n")
{
	struct gsm_bts_trx *trx = vty->index;
	struct phy_instance *pinst = trx_phy_instance(trx);
	struct trx_l1h *l1h = pinst->u.osmotrx.hdl;

	l1h->config.nominal_power_set_by_vty = false;

	return CMD_SUCCESS;
}

DEFUN_DEPRECATED(cfg_phy_ms_power_loop, cfg_phy_ms_power_loop_cmd,
	"osmotrx ms-power-loop <-127-127>", OSMOTRX_STR
	"Enable MS power control loop\nTarget RSSI value (transceiver specific, "
	"should be 6dB or more above noise floor)\n")
{
	vty_out (vty, "'osmotrx ms-power-loop' is deprecated, use 'uplink-power-target' instead%s", VTY_NEWLINE);

	vty_bts->ul_power_target = atoi(argv[0]);

	return CMD_SUCCESS;
}

DEFUN_DEPRECATED(cfg_phy_no_ms_power_loop, cfg_phy_no_ms_power_loop_cmd,
	"no osmotrx ms-power-loop",
	NO_STR OSMOTRX_STR "Disable MS power control loop\n")
{
	vty_out (vty, "'no osmotrx ms-power-loop' is deprecated, use of BTS control loop is managed by BSC%s", VTY_NEWLINE);

	return CMD_SUCCESS;
}

DEFUN_DEPRECATED(cfg_phy_timing_advance_loop, cfg_phy_timing_advance_loop_cmd,
	"osmotrx timing-advance-loop", OSMOTRX_STR
	"Enable timing advance control loop\n")
{
	vty_out (vty, "'osmotrx timing-advance-loop' is deprecated, ta control is now active by default%s", VTY_NEWLINE);

	return CMD_SUCCESS;
}
DEFUN_DEPRECATED(cfg_phy_no_timing_advance_loop, cfg_phy_no_timing_advance_loop_cmd,
	"no osmotrx timing-advance-loop",
	NO_STR OSMOTRX_STR "Disable timing advance control loop\n")
{
	vty_out (vty, "'no osmotrx timing-advance-loop' is deprecated, ta control is now active by default%s", VTY_NEWLINE);

	return CMD_SUCCESS;
}

DEFUN(cfg_phyinst_maxdly, cfg_phyinst_maxdly_cmd,
	"osmotrx maxdly <0-31>",
	OSMOTRX_STR
	"Set the maximum acceptable delay of an Access Burst (in GSM symbols)."
	" Access Burst is the first burst a mobile transmits in order to establish"
	" a connection and it is used to estimate Timing Advance (TA) which is"
	" then applied to Normal Bursts to compensate for signal delay due to"
	" distance. So changing this setting effectively changes maximum range of"
	" the cell, because if we receive an Access Burst with a delay higher than"
	" this value, it will be ignored and connection is dropped.\n"
	"GSM symbols (approx. 1.1km per symbol)\n")
{
	struct phy_instance *pinst = vty->index;
	struct trx_l1h *l1h = pinst->u.osmotrx.hdl;

	l1h->config.maxdly = atoi(argv[0]);
	l1h->config.maxdly_valid = 1;
	l1h->config.maxdly_sent = 0;
	l1if_provision_transceiver_trx(l1h);

	return CMD_SUCCESS;
}


DEFUN(cfg_phyinst_maxdlynb, cfg_phyinst_maxdlynb_cmd,
	"osmotrx maxdlynb <0-31>",
	OSMOTRX_STR
	"Set the maximum acceptable delay of a Normal Burst (in GSM symbols)."
	" USE FOR TESTING ONLY, DON'T CHANGE IN PRODUCTION USE!"
	" During normal operation, Normal Bursts delay are controlled by a Timing"
	" Advance control loop and thus Normal Bursts arrive to a BTS with no more"
	" than a couple GSM symbols, which is already taken into account in osmo-trx."
	" So changing this setting will have no effect in production installations"
	" except increasing osmo-trx CPU load. This setting is only useful when"
	" testing with a transmitter which can't precisely synchronize to the BTS"
	" downlink signal, like e.g. R&S CMD57.\n"
	"GSM symbols (approx. 1.1km per symbol)\n")
{
	struct phy_instance *pinst = vty->index;
	struct trx_l1h *l1h = pinst->u.osmotrx.hdl;

	l1h->config.maxdlynb = atoi(argv[0]);
	l1h->config.maxdlynb_valid = 1;
	l1h->config.maxdlynb_sent = 0;
	l1if_provision_transceiver_trx(l1h);

	return CMD_SUCCESS;
}

DEFUN(cfg_phyinst_slotmask, cfg_phyinst_slotmask_cmd,
	"slotmask (1|0) (1|0) (1|0) (1|0) (1|0) (1|0) (1|0) (1|0)",
	"Set the supported slots\n"
	"TS0 supported\nTS0 unsupported\nTS1 supported\nTS1 unsupported\n"
	"TS2 supported\nTS2 unsupported\nTS3 supported\nTS3 unsupported\n"
	"TS4 supported\nTS4 unsupported\nTS5 supported\nTS5 unsupported\n"
	"TS6 supported\nTS6 unsupported\nTS7 supported\nTS7 unsupported\n")
{
	struct phy_instance *pinst = vty->index;
	struct trx_l1h *l1h = pinst->u.osmotrx.hdl;
	uint8_t tn;

	l1h->config.slotmask = 0;
	for (tn = 0; tn < TRX_NR_TS; tn++)
		if (argv[tn][0] == '1')
			l1h->config.slotmask |= (1 << tn);

	return CMD_SUCCESS;
}

DEFUN_DEPRECATED(cfg_phyinst_power_on, cfg_phyinst_power_on_cmd,
	"osmotrx power (on|off)",
	OSMOTRX_STR
	"Change TRX state\n"
	"Turn it ON or OFF\n")
{
	struct phy_instance *pinst = vty->index;
	struct trx_l1h *l1h = pinst->u.osmotrx.hdl;

	vty_out (vty, "'osmotrx power' is deprecated, use OML's standard "
		      "Administrative State instead to control each TRX "
		      "('rf_locked' VTY cmd in osmo-bsc)%s", VTY_NEWLINE);

	if (strcmp(argv[0], "on"))
		vty_out(vty, "OFF: %d%s", trx_if_cmd_poweroff(l1h, NULL), VTY_NEWLINE);
	else {
		vty_out(vty, "ON: %d%s", trx_if_cmd_poweron(l1h, NULL), VTY_NEWLINE);
	}

	return CMD_SUCCESS;
}

DEFUN(cfg_phy_fn_advance, cfg_phy_fn_advance_cmd,
	"osmotrx fn-advance <0-30>",
	OSMOTRX_STR
	"Set the number of frames to be transmitted to transceiver in advance "
	"of current FN\n"
	"Advance in frames\n")
{
	struct phy_link *plink = vty->index;

	plink->u.osmotrx.clock_advance = atoi(argv[0]);

	return CMD_SUCCESS;
}

DEFUN(cfg_phy_rts_advance, cfg_phy_rts_advance_cmd,
	"osmotrx rts-advance <0-30>",
	OSMOTRX_STR
	"Set the number of frames to be requested (PCU) in advance of current "
	"FN. Do not change this, unless you have a good reason!\n"
	"Advance in frames\n")
{
	struct phy_link *plink = vty->index;

	plink->u.osmotrx.rts_advance = atoi(argv[0]);

	return CMD_SUCCESS;
}

DEFUN(cfg_phyinst_rxgain, cfg_phyinst_rxgain_cmd,
	"osmotrx rx-gain <0-50>",
	OSMOTRX_STR
	"Set the receiver gain in dB\n"
	"Gain in dB\n")
{
	struct phy_instance *pinst = vty->index;
	struct trx_l1h *l1h = pinst->u.osmotrx.hdl;

	l1h->config.rxgain = atoi(argv[0]);
	l1h->config.rxgain_valid = 1;
	l1h->config.rxgain_sent = 0;
	l1if_provision_transceiver_trx(l1h);

	return CMD_SUCCESS;
}

DEFUN(cfg_phyinst_tx_atten, cfg_phyinst_tx_atten_cmd,
	"osmotrx tx-attenuation (oml|<0-50>)",
	OSMOTRX_STR
	"Set the transmitter attenuation\n"
	"Use NM_ATT_RF_MAXPOWR_R (max power reduction) from BSC via OML (default)\n"
	"Fixed attenuation in dB, overriding OML (default)\n")
{
	struct phy_instance *pinst = vty->index;
	struct trx_l1h *l1h = pinst->u.osmotrx.hdl;

	if (strcmp(argv[0], "oml") == 0)
		l1h->config.forced_max_power_red = -1;
	else
		l1h->config.forced_max_power_red = atoi(argv[0]);

	return CMD_SUCCESS;
}

DEFUN(cfg_phyinst_no_rxgain, cfg_phyinst_no_rxgain_cmd,
	"no osmotrx rx-gain",
	NO_STR OSMOTRX_STR "Unset the receiver gain in dB\n")
{
	struct phy_instance *pinst = vty->index;
	struct trx_l1h *l1h = pinst->u.osmotrx.hdl;

	l1h->config.rxgain_valid = 0;

	return CMD_SUCCESS;
}

DEFUN(cfg_phyinst_no_maxdly, cfg_phyinst_no_maxdly_cmd,
	"no osmotrx maxdly",
	NO_STR OSMOTRX_STR
	"Unset the maximum delay of GSM symbols\n")
{
	struct phy_instance *pinst = vty->index;
	struct trx_l1h *l1h = pinst->u.osmotrx.hdl;

	l1h->config.maxdly_valid = 0;

	return CMD_SUCCESS;
}

DEFUN(cfg_phyinst_no_maxdlynb, cfg_phyinst_no_maxdlynb_cmd,
	"no osmotrx maxdlynb",
	NO_STR OSMOTRX_STR
	"Unset the maximum delay of GSM symbols\n")
{
	struct phy_instance *pinst = vty->index;
	struct trx_l1h *l1h = pinst->u.osmotrx.hdl;

	l1h->config.maxdlynb_valid = 0;

	return CMD_SUCCESS;
}

DEFUN(cfg_phy_transc_ip, cfg_phy_transc_ip_cmd,
	"osmotrx ip HOST",
	OSMOTRX_STR
	"Set local and remote IP address\n"
	"IP address (for both OsmoBtsTrx and OsmoTRX)\n")
{
	struct phy_link *plink = vty->index;

	osmo_talloc_replace_string(plink, &plink->u.osmotrx.local_ip, argv[0]);
	osmo_talloc_replace_string(plink, &plink->u.osmotrx.remote_ip, argv[0]);

	return CMD_SUCCESS;
}

DEFUN(cfg_phy_osmotrx_ip, cfg_phy_osmotrx_ip_cmd,
	"osmotrx ip (local|remote) A.B.C.D",
	OSMOTRX_STR
	"Set IP address\n" "Local IP address (BTS)\n"
	"Remote IP address (OsmoTRX)\n" "IP address\n")
{
	struct phy_link *plink = vty->index;

	if (!strcmp(argv[0], "local"))
		osmo_talloc_replace_string(plink, &plink->u.osmotrx.local_ip, argv[1]);
	else if (!strcmp(argv[0], "remote"))
		osmo_talloc_replace_string(plink, &plink->u.osmotrx.remote_ip, argv[1]);
	else
		return CMD_WARNING;

	return CMD_SUCCESS;
}

DEFUN(cfg_phy_base_port, cfg_phy_base_port_cmd,
	"osmotrx base-port (local|remote) <0-65535>",
	OSMOTRX_STR "Set base UDP port number\n" "Local UDP port\n"
	"Remote UDP port\n" "UDP base port number\n")
{
	struct phy_link *plink = vty->index;

	if (!strcmp(argv[0], "local"))
		plink->u.osmotrx.base_port_local = atoi(argv[1]);
	else
		plink->u.osmotrx.base_port_remote = atoi(argv[1]);

	return CMD_SUCCESS;
}

DEFUN(cfg_phy_setbsic, cfg_phy_setbsic_cmd,
	"osmotrx legacy-setbsic", OSMOTRX_STR
	"Use SETBSIC to configure transceiver (use ONLY with OpenBTS Transceiver!)\n")
{
	struct phy_link *plink = vty->index;
	plink->u.osmotrx.use_legacy_setbsic = true;

	vty_out(vty, "%% You have enabled SETBSIC, which is not supported by OsmoTRX "
		"but only useful if you want to interface with legacy OpenBTS Transceivers%s",
		VTY_NEWLINE);

	return CMD_SUCCESS;
}

DEFUN(cfg_phy_no_setbsic, cfg_phy_no_setbsic_cmd,
	"no osmotrx legacy-setbsic",
	NO_STR OSMOTRX_STR "Disable Legacy SETBSIC to configure transceiver\n")
{
	struct phy_link *plink = vty->index;
	plink->u.osmotrx.use_legacy_setbsic = false;

	return CMD_SUCCESS;
}

DEFUN(cfg_phy_trxd_max_version, cfg_phy_trxd_max_version_cmd,
	"osmotrx trxd-max-version (latest|<0-15>)", OSMOTRX_STR
	"Set maximum TRXD format version to negotiate with TRX\n"
	"Use latest supported TRXD format version (default)\n"
	"Maximum TRXD format version number\n")
{
	struct phy_link *plink = vty->index;

	int max_ver;
	if (strcmp(argv[0], "latest") == 0)
		max_ver = TRX_DATA_FORMAT_VER;
	else
		max_ver = atoi(argv[0]);
	if (max_ver > TRX_DATA_FORMAT_VER) {
		vty_out(vty, "%% Format version %d is not supported, maximum supported is %d%s",
			max_ver, TRX_DATA_FORMAT_VER, VTY_NEWLINE);
		return CMD_WARNING;
	}
	plink->u.osmotrx.trxd_hdr_ver_max = max_ver;

	return CMD_SUCCESS;
}

void bts_model_config_write_phy(struct vty *vty, struct phy_link *plink)
{
	if (plink->u.osmotrx.local_ip)
		vty_out(vty, " osmotrx ip local %s%s",
			plink->u.osmotrx.local_ip, VTY_NEWLINE);
	if (plink->u.osmotrx.remote_ip)
		vty_out(vty, " osmotrx ip remote %s%s",
			plink->u.osmotrx.remote_ip, VTY_NEWLINE);

	if (plink->u.osmotrx.base_port_local)
		vty_out(vty, " osmotrx base-port local %"PRIu16"%s",
			plink->u.osmotrx.base_port_local, VTY_NEWLINE);
	if (plink->u.osmotrx.base_port_remote)
		vty_out(vty, " osmotrx base-port remote %"PRIu16"%s",
			plink->u.osmotrx.base_port_remote, VTY_NEWLINE);

	vty_out(vty, " osmotrx fn-advance %d%s",
		plink->u.osmotrx.clock_advance, VTY_NEWLINE);
	vty_out(vty, " osmotrx rts-advance %d%s",
		plink->u.osmotrx.rts_advance, VTY_NEWLINE);

	if (plink->u.osmotrx.use_legacy_setbsic)
		vty_out(vty, " osmotrx legacy-setbsic%s", VTY_NEWLINE);

	if (plink->u.osmotrx.trxd_hdr_ver_max != TRX_DATA_FORMAT_VER)
		vty_out(vty, " osmotrx trxd-max-version %d%s", plink->u.osmotrx.trxd_hdr_ver_max, VTY_NEWLINE);
}

void bts_model_config_write_phy_inst(struct vty *vty, struct phy_instance *pinst)
{
	struct trx_l1h *l1h = pinst->u.osmotrx.hdl;

	if (l1h->config.rxgain_valid)
		vty_out(vty, "  osmotrx rx-gain %d%s",
			l1h->config.rxgain, VTY_NEWLINE);
	if (l1h->config.forced_max_power_red == -1)
		vty_out(vty, "  osmotrx tx-attenuation oml%s", VTY_NEWLINE);
	else
		vty_out(vty, "  osmotrx tx-attenuation %d%s",
			l1h->config.forced_max_power_red, VTY_NEWLINE);
	if (l1h->config.maxdly_valid)
		vty_out(vty, "  osmotrx maxdly %d%s", l1h->config.maxdly, VTY_NEWLINE);
	if (l1h->config.maxdlynb_valid)
		vty_out(vty, "  osmotrx maxdlynb %d%s", l1h->config.maxdlynb, VTY_NEWLINE);
	if (l1h->config.slotmask != 0xff)
		vty_out(vty, "  slotmask %d %d %d %d %d %d %d %d%s",
			l1h->config.slotmask & 1,
			(l1h->config.slotmask >> 1) & 1,
			(l1h->config.slotmask >> 2) & 1,
			(l1h->config.slotmask >> 3) & 1,
			(l1h->config.slotmask >> 4) & 1,
			(l1h->config.slotmask >> 5) & 1,
			(l1h->config.slotmask >> 6) & 1,
			l1h->config.slotmask >> 7,
			VTY_NEWLINE);
}

void bts_model_config_write_bts(struct vty *vty, struct gsm_bts *bts)
{
}

void bts_model_config_write_trx(struct vty *vty, struct gsm_bts_trx *trx)
{
	struct phy_instance *pinst = trx_phy_instance(trx);
	struct trx_l1h *l1h = pinst->u.osmotrx.hdl;

	if (l1h->config.nominal_power_set_by_vty)
		vty_out(vty, "  nominal-tx-power %d%s", trx->nominal_power,
			VTY_NEWLINE);
}

int bts_model_vty_init(struct gsm_bts *bts)
{
	vty_bts = bts;

	install_element_ve(&show_transceiver_cmd);
	install_element_ve(&show_phy_cmd);

	install_element(TRX_NODE, &cfg_trx_nominal_power_cmd);
	install_element(TRX_NODE, &cfg_trx_no_nominal_power_cmd);

	install_element(PHY_NODE, &cfg_phy_ms_power_loop_cmd);
	install_element(PHY_NODE, &cfg_phy_no_ms_power_loop_cmd);
	install_element(PHY_NODE, &cfg_phy_timing_advance_loop_cmd);
	install_element(PHY_NODE, &cfg_phy_no_timing_advance_loop_cmd);
	install_element(PHY_NODE, &cfg_phy_base_port_cmd);
	install_element(PHY_NODE, &cfg_phy_fn_advance_cmd);
	install_element(PHY_NODE, &cfg_phy_rts_advance_cmd);
	install_element(PHY_NODE, &cfg_phy_transc_ip_cmd);
	install_element(PHY_NODE, &cfg_phy_osmotrx_ip_cmd);
	install_element(PHY_NODE, &cfg_phy_setbsic_cmd);
	install_element(PHY_NODE, &cfg_phy_no_setbsic_cmd);
	install_element(PHY_NODE, &cfg_phy_trxd_max_version_cmd);

	install_element(PHY_INST_NODE, &cfg_phyinst_rxgain_cmd);
	install_element(PHY_INST_NODE, &cfg_phyinst_tx_atten_cmd);
	install_element(PHY_INST_NODE, &cfg_phyinst_no_rxgain_cmd);
	install_element(PHY_INST_NODE, &cfg_phyinst_slotmask_cmd);
	install_element(PHY_INST_NODE, &cfg_phyinst_power_on_cmd);
	install_element(PHY_INST_NODE, &cfg_phyinst_maxdly_cmd);
	install_element(PHY_INST_NODE, &cfg_phyinst_no_maxdly_cmd);
	install_element(PHY_INST_NODE, &cfg_phyinst_maxdlynb_cmd);
	install_element(PHY_INST_NODE, &cfg_phyinst_no_maxdlynb_cmd);

	return 0;
}

int bts_model_ctrl_cmds_install(struct gsm_bts *bts)
{
	return 0;
}