aboutsummaryrefslogtreecommitdiffstats
path: root/common/chapters/trx_if.adoc
blob: b684b7b0ce4c2094c3be15e70ae2f66f9a28cdb5 (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
[[trx_if]]
== TRX Manager UDP socket interface

This is the protocol used between `osmo-trx` and `osmo-bts-trx`.

Each TRX Manager UDP socket interface represents a single ARFCN. Each of these
per-ARFCN interfaces is a pair of UDP sockets, one for control and one for data.
Given a base port B (5700), the master clock interface is at port P=B. The
TRX-side control interface for C(N) is on  port P=B+2N+1 and the data interface
is on an odd numbered port P=B+2N+2. The corresponding core-side interface for
every socket is at P+100. For any given build, the number of ARFCN interfaces
can be fixed.

[[trx_if_clock_ind]]
=== Indications on the Master Clock Interface

The master clock interface is output only (from the radio).
Messages are "indications".

CLOCK gives the current value of the transceiver clock to be used by the core.
This message is sent whenever a trasmission packet arrives that is too late or
too early.  The clock value is NOT the current transceiver time.  It is a time
setting the the core should use to give better packet arrival times.
----
IND CLOCK <totalFrames>
----

[[trx_if_control]]
=== Commands on the Per-ARFCN Control Interface

The per-ARFCN control interface uses a command-reponse protocol. Commands are
NULL-terminated ASCII strings, one per UDP socket. Each command has a
corresponding response.

Every command is of the form:
----
CMD <cmdtype> [params]
----

The `<cmdtype>` is the actual command.
Parameters are optional depending on the commands type.
Every response is of the form:
----
RSP <cmdtype> <status> [result]
----
The `<status>` is 0 for success and a non-zero error code for failure.
Successful responses may include results, depending on the command type.


==== Power Control

`POWEROFF` shuts off transmitter power and stops the demodulator.
----
CMD POWEROFF
RSP POWEROFF <status>
----

`POWERON` starts the transmitter and starts the demodulator.  Initial power
level is very low. This command fails if the transmitter and receiver are not
yet tuned. This command fails if the transmit or receive frequency creates a
conflict with another ARFCN that is already running. If the transceiver is
already on, it response with success to this command.
----
CMD POWERON
RSP POWERON <status>
----

`SETPOWER` sets output power in dB wrt full scale.
This command fails if the transmitter and receiver are not running.
----
CMD SETPOWER <dB>
RSP SETPOWER <status> <dB>
----

`ADJPOWER` adjusts power by the given dB step.  Response returns resulting power
level wrt full scale. This command fails if the transmitter and receiver are not
running.
----
CMD ADJPOWER <dBStep>
RSP ADJPOWER <status> <dBLevel>
----

==== Tuning Control

`RXTUNE` tunes the receiver to a given frequency in kHz. This command fails if the
receiver is already running. (To re-tune you stop the radio, re-tune, and
restart.) This command fails if the transmit or receive frequency creates a
conflict with another ARFCN that is already running.
----
CMD RXTUNE <kHz>
RSP RXTUNE <status> <kHz>
----

`TXTUNE` tunes the transmitter to a given frequency in kHz. This command fails if
the transmitter is already running. (To re-tune you stop the radio, re-tune, and
restart.) This command fails if the transmit or receive frequency creates a
conflict with another ARFCN that is already running.
----
CMD TXTUNE <kHz>
RSP TXTUNE <status> <kHz>
----

==== Timeslot Control

`SETSLOT` sets the format of the uplink timeslots in the ARFCN.
The `<timeslot>` indicates the timeslot of interest.
The `<chantype>` indicates the type of channel that occupies the timeslot.
A chantype of zero indicates the timeslot is off.
----
CMD SETSLOT <timeslot> <chantype>
RSP SETSLOT <status> <timeslot> <chantype>
----

=== Messages on the per-ARFCN Data Interface

Messages on the data interface carry one radio burst per UDP message.

==== Received Data Burst

[packetdiag]
----
{
	colwidth = 32
	node_height = 40

	0:	T
	1-4:	FN
	5:	A
	6-7:	C
	8-155:	Payload
}
----

* _T_: timeslot index
* _FN_: GSM frame number, big endian
* _A_: RSSI in -dBm
* _C_: correlator timing offset in 1/256 symbol steps, 2's-comp, big endian
* _Payload_: 148 bytes soft symbol estimates, 0 -> definite "0", 255 -> definite "1"

==== Transmit Data Burst

[packetdiag]
----
{
	colwidth = 32
	node_height = 40

	0:	T
	1-4:	FN
	5:	A
	6-153:	Payload
}
----

* _T_: timeslot index
* _FN_ GSM frame number, big endian
* _A_: transmit level wrt ARFCN max, -dB (attenuation)
* _Payload_: 148 bytes output symbol values, 0 & 1