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
This commit is contained in:
Vadim Yanitskiy 2017-12-04 23:49:29 +07:00
parent 0d9680e88a
commit 8ed6f42772
3 changed files with 32 additions and 1 deletions

View File

@ -643,6 +643,7 @@ static int l1ctl_rx_param_req(struct l1ctl_link *l1l, struct msgb *msg)
{
struct l1ctl_par_req *par_req;
struct l1ctl_info_ul *ul;
int rc = 0;
ul = (struct l1ctl_info_ul *) msg->l1h;
par_req = (struct l1ctl_par_req *) ul->payload;
@ -650,11 +651,13 @@ static int l1ctl_rx_param_req(struct l1ctl_link *l1l, struct msgb *msg)
LOGP(DL1C, LOGL_NOTICE, "Received L1CTL_PARAM_REQ "
"(ta=%d, tx_power=%u)\n", par_req->ta, par_req->tx_power);
rc |= trx_if_cmd_setta(l1l->trx, par_req->ta);
l1l->trx->ta = par_req->ta;
l1l->trx->tx_power = par_req->tx_power;
msgb_free(msg);
return 0;
return rc;
}
static int l1ctl_rx_tch_mode_req(struct l1ctl_link *l1l, struct msgb *msg)

View File

@ -415,6 +415,32 @@ static void trx_if_measure_rsp_cb(struct trx_instance *trx, char *resp)
trx_if_cmd_measure(trx, ++arfcn, trx->pm_arfcn_stop);
}
/*
* Timing Advance control
*
* SETTA instructs the transceiver to transmit bursts in
* advance calculated from requested TA value. This value is
* normally between 0 and 63, with each step representing
* an advance of one bit period (about 3.69 microseconds).
* CMD SETTA <0-63>
* RSP SETTA <status> <TA>
*/
int trx_if_cmd_setta(struct trx_instance *trx, int8_t ta)
{
/* Do nothing, if requested TA value matches the current */
if (trx->ta == ta)
return 0;
/* Make sure that TA value is in valid range */
if (ta < 0 || ta > 63) {
LOGP(DTRX, LOGL_ERROR, "TA value %d is out of allowed range\n", ta);
return -ENOTSUP;
}
return trx_ctrl_cmd(trx, 0, "SETTA", "%d", ta);
}
/* Get response from CTRL socket */
static int trx_ctrl_read_cb(struct osmo_fd *ofd, unsigned int what)
{

View File

@ -63,6 +63,8 @@ int trx_if_cmd_echo(struct trx_instance *trx);
int trx_if_cmd_setpower(struct trx_instance *trx, int db);
int trx_if_cmd_adjpower(struct trx_instance *trx, int db);
int trx_if_cmd_setta(struct trx_instance *trx, int8_t ta);
int trx_if_cmd_rxtune(struct trx_instance *trx, uint16_t arfcn);
int trx_if_cmd_txtune(struct trx_instance *trx, uint16_t arfcn);