summaryrefslogtreecommitdiffstats
path: root/src/host/trxcon/trx_if.c
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2017-12-04 23:49:29 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2017-12-05 01:16:44 +0700
commit8ed6f42772f3002bfa1b8ef8772b138e8cddd443 (patch)
tree46cd564902e988e01fd4d28a1397449d9d2ab5a4 /src/host/trxcon/trx_if.c
parent0d9680e88ae4aabe54fea89e21f2a5fc14f6d8d6 (diff)
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
Diffstat (limited to 'src/host/trxcon/trx_if.c')
-rw-r--r--src/host/trxcon/trx_if.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/host/trxcon/trx_if.c b/src/host/trxcon/trx_if.c
index c9bf6c87..6ee75d3e 100644
--- a/src/host/trxcon/trx_if.c
+++ b/src/host/trxcon/trx_if.c
@@ -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)
{