Change in osmocom-bb[master]: trxcon: avoid arfcn / band_arfcn naming confusion

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
Wed Sep 5 19:23:20 UTC 2018


Vadim Yanitskiy has uploaded this change for review. ( https://gerrit.osmocom.org/10778


Change subject: trxcon: avoid arfcn / band_arfcn naming confusion
......................................................................

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
---
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(+), 32 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/78/10778/1

diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c
index 9d6871e..49d6a12 100644
--- a/src/host/trxcon/l1ctl.c
+++ b/src/host/trxcon/l1ctl.c
@@ -349,7 +349,7 @@
 
 static int l1ctl_rx_pm_req(struct l1ctl_link *l1l, struct msgb *msg)
 {
-	uint16_t arfcn_start, arfcn_stop;
+	uint16_t band_arfcn_start, band_arfcn_stop;
 	struct l1ctl_pm_req *pmr;
 	int rc = 0;
 
@@ -361,17 +361,17 @@
 		goto exit;
 	}
 
-	arfcn_start = ntohs(pmr->range.band_arfcn_from);
-	arfcn_stop  = ntohs(pmr->range.band_arfcn_to);
+	band_arfcn_start = ntohs(pmr->range.band_arfcn_from);
+	band_arfcn_stop  = ntohs(pmr->range.band_arfcn_to);
 
 	LOGP(DL1C, LOGL_NOTICE, "Received power measurement "
 		"request (%s: %d -> %d)\n",
-		gsm_band_name(gsm_arfcn2band(arfcn_start)),
-		arfcn_start &~ ARFCN_FLAG_MASK,
-		arfcn_stop &~ ARFCN_FLAG_MASK);
+		gsm_band_name(gsm_arfcn2band(band_arfcn_start)),
+		band_arfcn_start &~ ARFCN_FLAG_MASK,
+		band_arfcn_stop &~ ARFCN_FLAG_MASK);
 
 	/* Send measurement request to transceiver */
-	rc = trx_if_cmd_measure(l1l->trx, arfcn_start, arfcn_stop);
+	rc = trx_if_cmd_measure(l1l->trx, band_arfcn_start, band_arfcn_stop);
 
 exit:
 	msgb_free(msg);
diff --git a/src/host/trxcon/trx_if.c b/src/host/trxcon/trx_if.c
index cab5a9b..e08857c 100644
--- a/src/host/trxcon/trx_if.c
+++ b/src/host/trxcon/trx_if.c
@@ -310,28 +310,28 @@
  * RSP (RX/TX)TUNE <status> <kHz>
  */
 
-int trx_if_cmd_rxtune(struct trx_instance *trx, uint16_t arfcn)
+int trx_if_cmd_rxtune(struct trx_instance *trx, uint16_t band_arfcn)
 {
 	uint16_t freq10;
 
 	/* RX is downlink on MS side */
-	freq10 = gsm_arfcn2freq10(arfcn, 0);
+	freq10 = gsm_arfcn2freq10(band_arfcn, 0);
 	if (freq10 == 0xffff) {
-		LOGP(DTRX, LOGL_ERROR, "ARFCN %d not defined\n", arfcn);
+		LOGP(DTRX, LOGL_ERROR, "ARFCN %d not defined\n", band_arfcn);
 		return -ENOTSUP;
 	}
 
 	return trx_ctrl_cmd(trx, 1, "RXTUNE", "%d", freq10 * 100);
 }
 
-int trx_if_cmd_txtune(struct trx_instance *trx, uint16_t arfcn)
+int trx_if_cmd_txtune(struct trx_instance *trx, uint16_t band_arfcn)
 {
 	uint16_t freq10;
 
 	/* TX is uplink on MS side */
-	freq10 = gsm_arfcn2freq10(arfcn, 1);
+	freq10 = gsm_arfcn2freq10(band_arfcn, 1);
 	if (freq10 == 0xffff) {
-		LOGP(DTRX, LOGL_ERROR, "ARFCN %d not defined\n", arfcn);
+		LOGP(DTRX, LOGL_ERROR, "ARFCN %d not defined\n", band_arfcn);
 		return -ENOTSUP;
 	}
 
@@ -351,18 +351,18 @@
  */
 
 int trx_if_cmd_measure(struct trx_instance *trx,
-	uint16_t arfcn_start, uint16_t arfcn_stop)
+	uint16_t band_arfcn_start, uint16_t band_arfcn_stop)
 {
 	uint16_t freq10;
 
 	/* Update ARFCN range for measurement */
-	trx->pm_arfcn_start = arfcn_start;
-	trx->pm_arfcn_stop = arfcn_stop;
+	trx->pm_band_arfcn_start = band_arfcn_start;
+	trx->pm_band_arfcn_stop = band_arfcn_stop;
 
 	/* Calculate a frequency for current ARFCN (DL) */
-	freq10 = gsm_arfcn2freq10(arfcn_start, 0);
+	freq10 = gsm_arfcn2freq10(band_arfcn_start, 0);
 	if (freq10 == 0xffff) {
-		LOGP(DTRX, LOGL_ERROR, "ARFCN %d not defined\n", arfcn_start);
+		LOGP(DTRX, LOGL_ERROR, "ARFCN %d not defined\n", band_arfcn_start);
 		return -ENOTSUP;
 	}
 
@@ -372,7 +372,7 @@
 static void trx_if_measure_rsp_cb(struct trx_instance *trx, char *resp)
 {
 	unsigned int freq10;
-	uint16_t arfcn;
+	uint16_t band_arfcn;
 	int dbm;
 
 	/* Parse freq. and power level */
@@ -380,22 +380,22 @@
 	freq10 /= 100;
 
 	/* Check received ARFCN against expected */
-	arfcn = gsm_freq102arfcn((uint16_t) freq10, 0);
-	if (arfcn != trx->pm_arfcn_start) {
+	band_arfcn = gsm_freq102arfcn((uint16_t) freq10, 0);
+	if (band_arfcn != trx->pm_band_arfcn_start) {
 		LOGP(DTRX, LOGL_ERROR, "Power measurement error: "
 			"response ARFCN=%u doesn't match expected ARFCN=%u\n",
-			arfcn &~ ARFCN_FLAG_MASK,
-			trx->pm_arfcn_start &~ ARFCN_FLAG_MASK);
+			band_arfcn &~ ARFCN_FLAG_MASK,
+			trx->pm_band_arfcn_start &~ ARFCN_FLAG_MASK);
 		return;
 	}
 
 	/* Send L1CTL_PM_CONF */
-	l1ctl_tx_pm_conf(trx->l1l, arfcn, dbm,
-		arfcn == trx->pm_arfcn_stop);
+	l1ctl_tx_pm_conf(trx->l1l, band_arfcn, dbm,
+		band_arfcn == trx->pm_band_arfcn_stop);
 
 	/* Schedule a next measurement */
-	if (arfcn != trx->pm_arfcn_stop)
-		trx_if_cmd_measure(trx, ++arfcn, trx->pm_arfcn_stop);
+	if (band_arfcn != trx->pm_band_arfcn_stop)
+		trx_if_cmd_measure(trx, ++band_arfcn, trx->pm_band_arfcn_stop);
 }
 
 /*
diff --git a/src/host/trxcon/trx_if.h b/src/host/trxcon/trx_if.h
index 6080dce..ed6bd3f 100644
--- a/src/host/trxcon/trx_if.h
+++ b/src/host/trxcon/trx_if.h
@@ -28,8 +28,8 @@
 	uint32_t prev_state;
 
 	/* GSM L1 specific */
-	uint16_t pm_arfcn_start;
-	uint16_t pm_arfcn_stop;
+	uint16_t pm_band_arfcn_start;
+	uint16_t pm_band_arfcn_stop;
 	uint16_t band_arfcn;
 	uint8_t tx_power;
 	uint8_t bsic;
@@ -66,13 +66,13 @@
 
 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);
+int trx_if_cmd_rxtune(struct trx_instance *trx, uint16_t band_arfcn);
+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_measure(struct trx_instance *trx,
-	uint16_t arfcn_start, uint16_t arfcn_stop);
+	uint16_t band_arfcn_start, uint16_t band_arfcn_stop);
 
 int trx_if_tx_burst(struct trx_instance *trx, uint8_t tn, uint32_t fn,
 	uint8_t pwr, const ubit_t *bits);

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

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0b7634c80986dbff9d0da421c6a044cd36c9fd01
Gerrit-Change-Number: 10778
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180905/d405b227/attachment.htm>


More information about the gerrit-log mailing list