[PATCH] osmocom-bb[master]: host/trxcon: forward Timing Advance value to transceiver

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Feb 22 15:33:27 UTC 2018


Review at  https://gerrit.osmocom.org/6793

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
---
M src/host/trxcon/l1ctl.c
M src/host/trxcon/trx_if.c
M src/host/trxcon/trx_if.h
3 files changed, 32 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/93/6793/1

diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c
index 6a9cdb3..aeb6c07 100644
--- a/src/host/trxcon/l1ctl.c
+++ b/src/host/trxcon/l1ctl.c
@@ -643,6 +643,7 @@
 {
 	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 @@
 	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)
diff --git a/src/host/trxcon/trx_if.c b/src/host/trxcon/trx_if.c
index c9bf6c8..6ee75d3 100644
--- a/src/host/trxcon/trx_if.c
+++ b/src/host/trxcon/trx_if.c
@@ -415,6 +415,32 @@
 		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)
 {
diff --git a/src/host/trxcon/trx_if.h b/src/host/trxcon/trx_if.h
index 02c9ff7..dd84315 100644
--- a/src/host/trxcon/trx_if.h
+++ b/src/host/trxcon/trx_if.h
@@ -63,6 +63,8 @@
 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);
 

-- 
To view, visit https://gerrit.osmocom.org/6793
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia8c0848827ab2b4cd7cf1efe128b28d5c06ec84e
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list