summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2017-07-16 16:52:57 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2017-10-23 22:05:49 +0330
commit5e4011dfa7a217efb350b6e8e9ce1b0345ba19f4 (patch)
tree6a8230621426bdf8302cc7cc29cf6371b7ff0f3e
parent00a448c5e8c83efc8d3d7794bf6b15f03d5f9f8a (diff)
host/trxcon/scheduler: implement TSC selection
-rw-r--r--src/host/trxcon/l1ctl.c5
-rw-r--r--src/host/trxcon/sched_lchan_handlers.c42
-rw-r--r--src/host/trxcon/trx_if.h2
3 files changed, 44 insertions, 5 deletions
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 @@ static int l1ctl_rx_dm_est_req(struct l1ctl_link *l1l, struct msgb *msg)
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 @@ int tx_data_fn(struct trx_instance *trx, struct trx_ts *ts,
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 @@ send_burst:
/* 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 @@ send_burst:
/* 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 @@ struct trx_instance {
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;