summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2017-07-16 16:52:57 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2017-11-19 17:35:07 +0700
commitf21f7036e8f60419c43c8da875098d93059f5c3a (patch)
treed32cc8af4231a46ac22b21015814b9be2ee1cb95 /src
parent538bea917b858b3c368adc2a59e070b7ae54c418 (diff)
host/trxcon/scheduler: implement TSC selection
Diffstat (limited to 'src')
-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 64e9d650..12745e97 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 078c5fde..303ae818 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 9e3a32a2..6367f459 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;