Change in osmocom-bb[master]: trxcon/trx_if.c: add SETFH CTRL command support

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/.

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Thu Nov 29 16:11:27 UTC 2018


Vadim Yanitskiy has submitted this change and it was merged. ( https://gerrit.osmocom.org/10827 )

Change subject: trxcon/trx_if.c: add SETFH CTRL command support
......................................................................

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
---
M src/host/trxcon/trx_if.c
M src/host/trxcon/trx_if.h
2 files changed, 46 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/host/trxcon/trx_if.c b/src/host/trxcon/trx_if.c
index b8bbace..982fb40 100644
--- a/src/host/trxcon/trx_if.c
+++ b/src/host/trxcon/trx_if.c
@@ -391,6 +391,50 @@
 	return trx_ctrl_cmd(trx, 0, "SETTA", "%d", ta);
 }
 
+/*
+ * Frequency Hopping parameters indication
+ *
+ * SETFH instructs transceiver to enable frequency
+ * hopping mode using the given parameters.
+ * CMD SETFH <HSN> <MAIO> <CH1> <CH2> [... <CHN>]
+ */
+
+int trx_if_cmd_setfh(struct trx_instance *trx, uint8_t hsn,
+	uint8_t maio, uint16_t *ma, size_t ma_len)
+{
+	char ma_buf[100];
+	char *ptr;
+	int i, rc;
+
+	/* No channels, WTF?!? */
+	if (!ma_len)
+		return -EINVAL;
+
+	/**
+	 * Compose a sequence of channels (mobile allocation)
+	 * FIXME: the length of a CTRL command is limited to 128 symbols,
+	 * so we may have some problems if there are many channels...
+	 */
+	for (i = 0, ptr = ma_buf; i < ma_len; i++) {
+		/* Append a channel */
+		rc = snprintf(ptr, ma_buf + sizeof(ma_buf) - ptr, "%u ", ma[i]);
+		if (rc < 0)
+			return rc;
+
+		/* Move pointer */
+		ptr += rc;
+
+		/* Prevent buffer overflow */
+		if (ptr >= (ma_buf + 100))
+			return -EIO;
+	}
+
+	/* Overwrite the last space */
+	*(ptr - 1) = '\0';
+
+	return trx_ctrl_cmd(trx, 1, "SETFH", "%u %u %s", hsn, maio, ma_buf);
+}
+
 /* 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 be0d41a..d551252 100644
--- a/src/host/trxcon/trx_if.h
+++ b/src/host/trxcon/trx_if.h
@@ -67,6 +67,8 @@
 int trx_if_cmd_txtune(struct trx_instance *trx, uint16_t band_arfcn);
 
 int trx_if_cmd_setslot(struct trx_instance *trx, uint8_t tn, uint8_t type);
+int trx_if_cmd_setfh(struct trx_instance *trx, uint8_t hsn,
+	uint8_t maio, uint16_t *ma, size_t ma_len);
 
 int trx_if_cmd_measure(struct trx_instance *trx,
 	uint16_t band_arfcn_start, uint16_t band_arfcn_stop);

-- 
To view, visit https://gerrit.osmocom.org/10827
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Id3d44e6a2796f1ce8523a49dedd5d484052a5c7f
Gerrit-Change-Number: 10827
Gerrit-PatchSet: 2
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181129/99989cd2/attachment.htm>


More information about the gerrit-log mailing list