Commit Graph

23 Commits

Author SHA1 Message Date
Harald Welte fd6c211eab trxcon: Suppress POWERON to TRX if we're already powered on.
The existing logic unconditionally wants to send a POWERON command
on TRXC whenever L1CTL_FBSB_REQ is received.  That may cause some
problems when sending subsequent L1CTL_FBSB_REQ, e.g. due to signal loss.

Sending POWEROFF when transceiver is not powered on is normal though.
This can happen if trxcon is restarted while fake_trx was running.

The existing FSM state could unfortunately not been used, as it's a
mixture between the TRX connection state and the command/response state.

The current solution is just a work around. We definitely need to
introduce separate state machines for transceiver and its TRXC
interface.

Change-Id: I834e8897b95a2490811319697fc7cab6076db480
2019-05-31 22:35:31 +07:00
Vadim Yanitskiy 382736448e trxcon/trx_if: refactor trx_if_open()
The main changes are:

  - return pointer to the allocated trx_instance or NULL,
  - extend debug message with TRX address and base port,
  - accept the talloc context as 'tall_ctx' argument,
  - rename goto label 'error' to 'udp_error',
  - rename argument 'port' to 'base_port'.

Change-Id: I39b24afee2f09d6a6c500cfc26ac45f206589c5c
2019-01-17 11:03:48 +07:00
Vadim Yanitskiy db9198d236 trxcon/trx_if.c: add SETFH CTRL command support
The idea of SETFH command is to instruct transceiver to enable
frequency hopping mode using the following parameters:

  CMD SETFH <HSN> <MAIO> <CH1> <CH2> [... <CHN>]

Note: since the length of a CTRL command is limited to 128
symbols (BTW: why?), the amount of channels is also limited.

Change-Id: Id3d44e6a2796f1ce8523a49dedd5d484052a5c7f
2018-11-29 16:11:27 +00:00
Vadim Yanitskiy 5c94d87c62 trxcon/trx_if.c: drop unused SETPOWER and ADJPOWER
I am not sure we need the both control commands, as every burst
on DATA interface has a header that includes TX power.

Change-Id: Id14603e71df6dedb5a843bb3e20a320192dbca3d
2018-09-07 03:38:38 +07:00
Vadim Yanitskiy 93728f6ec8 trxcon: avoid arfcn / band_arfcn naming confusion
In the most cases an ARFCN value is stored together with some
flags (e.g. DL/UL flag, DCS flag), so it should be taken into
account e.g. when printing. Let's use the proper naming.

Change-Id: I0b7634c80986dbff9d0da421c6a044cd36c9fd01
2018-09-06 01:47:50 +07:00
Harald Welte 0d3030c764 trxcon: Fix '-i' to specify the "TRX IP address"
The command line help states '-i' is for 'TRX IP address', which is
the remote IP address at which the TRX is to be found.  Hoewever, it
was used as the local (bind) IP address of the socket used towards
the TRX.  This is my attempt at fixing this.  A more complete solution
probably allows to specify both local (bind) and remote (connect)
address, just to be clear.

Change-Id: If0252b15e9c7942687c6dc470951d777f7af651c
2018-03-01 14:42:25 +01:00
Vadim Yanitskiy 8ed6f42772 host/trxcon: forward Timing Advance value to transceiver
The time at which the phone is allowed to transmit a burst of
traffic within a timeslot must be adjusted accordingly to prevent
collisions with adjacent users. Timing Advance (TA) is the
variable controlling this adjustment. The TA value is normally
between 0 and 63, with each step representing an advance of
one bit period (approximately 3.69 microseconds).

As trxcon doesn't perform actual burst transmission, this value
needs to be forwarded to the transceiver, which will take care
about the timings.

Change-Id: Ia8c0848827ab2b4cd7cf1efe128b28d5c06ec84e
2017-12-05 01:16:44 +07:00
Vadim Yanitskiy 0d9680e88a host/trxcon/trx_if.c: get rid of useless commands
The 'SETMAXDLY' command is used on the BTS side to limit maximal
Time of Arrival for access bursts. As we don't receive RACH
bursts on the MS side, the command is useless.

The 'SETRXGAIN' command is used on the BTS side to set initial
receive gain value for TRX. On the MS side it's possible to set
that parameter via command-line options of TRX.

Change-Id: I3e61b4b48193004cdcb241cefabb44c12db93120
2017-12-04 23:59:55 +07:00
Vadim Yanitskiy c045bc4fbe host/trxcon/scheduler: simplify timeslot management
As we know the count of timeslots per GSM TDMA frame, it would
be better to have an array of pointers to trx_ts instances instead
of linux list, which is more usable for lists with unknown length.

Change-Id: I9510a5cddde22950ceb8422e0990d59f05ed4d60
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 6c3ce20d75 host/trxcon/l1ctl.c: handle L1CTL_PARAM_REQ
Change-Id: I5c23520dc0f19147b41ad2e13681bf0a62e9facd
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 17481e2b88 host/trxcon/trx_if.c: get rid of CLCK interface
Local clock counter can be corrected using frame number values,
obtained from burst header on DATA interface.

Change-Id: I5a813e3dc1b960831343b8ecb80718291f20e80d
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy f21f7036e8 host/trxcon/scheduler: implement TSC selection
Change-Id: I004cc71aafe0a26e5141a4b2ffa90063e961be31
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 824bfa299d host/trxcon/l1ctl.c: handle L1CTL_DM_{EST,REL}_REQ
Change-Id: Ifdf229a6dd3c73ede313d2bfe384032e3887cc3a
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 794deea3ec host/trxcon/trx_if.c: add power measurement command
Change-Id: Ib947b60248cafad4edeb7e49c2bd3a1f81696239
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 59c98b14ac host/trxcon/scheduler: store BSIC in trx_instance
We need to know BSIC value, before sending RACH requests.
So, let's store it in trx_instance and update as soon as
the first SCH burst is received after L1CTL_FBSB_REQ.

Change-Id: I49574c3661f79f3b4941db6c651baebab2665c1b
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 417183b78e host/trxcon/trx_if.c: expose the trx_if_tx_burst()
Change-Id: Iebd644879e2e9067a94cb638b4ec5b75f806923f
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 705fedceeb host/trxcon: bind L1CTL link with TRX and vice versa
Change-Id: I575f8699bf06fd5e86f7935c6ab3216db5a26ec5
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 62328cb088 host/trxcon: store arfcn and band in trx_instance
Change-Id: I95414ff1033d77f11e231178b7721b70bc45e6df
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 8baa369b23 host/trxcon/scheduler: implement management functions
This change introduces some new functions to configure
TDMA scheduler. They can be grouped as follows:

  - Scheduler management functions
    - sched_trx_init()
    - sched_trx_reset()
    - sched_trx_shutdown()

  - Timeslot management functions
    - sched_trx_add_ts()
    - sched_trx_find_ts()
    - sched_trx_del_ts()
    - sched_trx_reset_ts()
    - sched_trx_configure_ts()

  - Logical channel management functions
    - sched_trx_activate_lchan()
    - sched_trx_deactivate_lchan()
    - sched_trx_find_lchan()

Change-Id: I6d0f437a68f0eb4e22bf635bf899b08673571085
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 789040f914 host/trxcon/trx_if.c: handle clock indications
Change-Id: I333c1c44578eb62c52d2d059b798dd5feae3e444
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 423aeefc40 host/trxcon: integrate osmo-fsm framework
This change introduces the following state machines:

  - trxcon_app_fsm - main application state machine.

    This state machine handles different events, raised
    from program modules (such as trx_if.c or l1ctl.c).

  - l1ctl_link_fsm - L1CTL server state machine.

  - trx_interface_fsm - TRX interface state machine.

The program modules (such as trx_if.c or l1ctl.c) should be as
much independent from each other as possible. In other words,
one module should not call methods from another, e.g. L1CTL
handlers are not able to send any command to transceiver directly.

Instead of that, they should use shared event set to notify the
main state machine about something. Depending on current state
and received event, main state machine 'decides' what to do. This
approach would allow to easily reuse the source code almost 'as is'
anywhere outside the project.

Change-Id: I7ee6fc891abe5f775f5b7ebbf093181a97950dea
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 83a9c9ef50 host/trxcon/trx_if.c: add ECHO command
This command should be used to check transceiver availability.

Change-Id: I6af2d5e413ff7ab751cb34e1659742b0f59b6cca
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 48f2cb4b3b host/trxcon: initial release of transceiver interface
This is the second side of the 'OsmocomBB <-> SDR' bridge.
Most of source code taken from the OsmoBTS project.

Change-Id: I96fa3ada05d010f31af419a4950fd8ae2b62ef34
2017-11-19 17:35:07 +07:00