[PATCH] osmocom-bb[master]: host/trxcon/scheduler: implement TSC selection

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:07 UTC 2018


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

host/trxcon/scheduler: implement TSC selection

Change-Id: I004cc71aafe0a26e5141a4b2ffa90063e961be31
---
M src/host/trxcon/l1ctl.c
M src/host/trxcon/sched_lchan_handlers.c
M src/host/trxcon/trx_if.h
3 files changed, 44 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/36/6736/1

diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c
index 64e9d65..12745e9 100644
--- a/src/host/trxcon/l1ctl.c
+++ b/src/host/trxcon/l1ctl.c
@@ -497,9 +497,8 @@
 		goto exit;
 	}
 
-	/* Update TSC (Training Sequence) */
-	/* FIXME: est_req->tsc is a number of TSC */
-	memset(l1l->trx->tsc, 0x00, 26);
+	/* Update TSC (Training Sequence Code) */
+	l1l->trx->tsc = est_req->tsc;
 
 	/* Determine channel config */
 	config = sched_trx_chan_nr2pchan_config(chan_nr);
diff --git a/src/host/trxcon/sched_lchan_handlers.c b/src/host/trxcon/sched_lchan_handlers.c
index 078c5fd..303ae81 100644
--- a/src/host/trxcon/sched_lchan_handlers.c
+++ b/src/host/trxcon/sched_lchan_handlers.c
@@ -48,6 +48,42 @@
 
 extern struct osmo_fsm_inst *trxcon_fsm;
 
+/* GSM 05.02 Chapter 5.2.3 Normal Burst (NB) */
+static const uint8_t nb_training_bits[8][26] = {
+	{
+		0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0,
+		0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1,
+	},
+	{
+		0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1,
+		1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1,
+	},
+	{
+		0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1,
+		0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0,
+	},
+	{
+		0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0,
+		1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0,
+	},
+	{
+		0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0,
+		1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1,
+	},
+	{
+		0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0,
+		0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0,
+	},
+	{
+		1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1,
+		0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1,
+	},
+	{
+		1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0,
+		0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0,
+	},
+};
+
 int rx_data_fn(struct trx_instance *trx, struct trx_ts *ts,
 	uint32_t fn, enum trx_lchan_type chan, uint8_t bid,
 	sbit_t *bits, uint16_t nbits, int8_t rssi, float toa)
@@ -174,6 +210,7 @@
 	ubit_t burst[GSM_BURST_LEN];
 	ubit_t *buffer, *offset;
 	uint8_t *mask, *l2;
+	const uint8_t *tsc;
 	int rc;
 
 	/* Find required channel state */
@@ -219,6 +256,9 @@
 	/* Update mask */
 	*mask |= (1 << bid);
 
+	/* Choose proper TSC */
+	tsc = nb_training_bits[trx->tsc];
+
 	/* If we are sending the last (4/4) burst */
 	if ((*mask & 0x0f) == 0x0f) {
 		/* Remove primitive from queue and free memory */
@@ -233,7 +273,7 @@
 	/* Compose a new burst */
 	memset(burst, 0, 3); /* TB */
 	memcpy(burst + 3, offset, 58); /* Payload 1/2 */
-	memcpy(burst + 61, trx->tsc, 26); /* TSC */
+	memcpy(burst + 61, tsc, 26); /* TSC */
 	memcpy(burst + 87, offset + 58, 58); /* Payload 2/2 */
 	memset(burst + 145, 0, 3); /* TB */
 
diff --git a/src/host/trxcon/trx_if.h b/src/host/trxcon/trx_if.h
index 9e3a32a..6367f45 100644
--- a/src/host/trxcon/trx_if.h
+++ b/src/host/trxcon/trx_if.h
@@ -32,8 +32,8 @@
 	uint16_t pm_arfcn_start;
 	uint16_t pm_arfcn_stop;
 	uint16_t band_arfcn;
-	uint8_t tsc[26];
 	uint8_t bsic;
+	uint8_t tsc;
 
 	/* Scheduler stuff */
 	struct trx_sched sched;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I004cc71aafe0a26e5141a4b2ffa90063e961be31
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