diff options
author | Philipp Maier <pmaier@sysmocom.de> | 2020-01-15 11:01:24 +0100 |
---|---|---|
committer | laforge <laforge@osmocom.org> | 2020-01-20 14:33:49 +0000 |
commit | a0403d3769d3027639e35874c09808ce5c0ba860 (patch) | |
tree | 2cce8edf58ad8fd11864475886b5028d4d0e1570 /src/osmo-bts-trx/loops.c | |
parent | e7d835ca8c704f7cd256702a31a15b79824e21a4 (diff) |
ta_control: move timing advance code from osmo-bts-trx to common
The timing advance controller that is implemented in loops.c of
osmo-bts-trx only works for osmo-bts-trx and not for any of the phy
based bts. Lets move the timing advance controller into the common part
and make it available for every bts. Also lets add a unit-test.
Change-Id: If7ddf74db3abc9b9872abe620a0aeebe3327e70a
Related: SYS#4567
Diffstat (limited to 'src/osmo-bts-trx/loops.c')
-rw-r--r-- | src/osmo-bts-trx/loops.c | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/src/osmo-bts-trx/loops.c b/src/osmo-bts-trx/loops.c index eb25f64e..823c2d7d 100644 --- a/src/osmo-bts-trx/loops.c +++ b/src/osmo-bts-trx/loops.c @@ -35,63 +35,6 @@ #include "l1_if.h" #include "loops.h" -/* - * Timing Advance loop - */ - -/* 90% of one bit duration in 1/256 symbols: 256*0.9 */ -#define TOA256_9OPERCENT 230 - -void ta_val(struct gsm_lchan *lchan, struct l1sched_chan_state *chan_state, int16_t toa256) -{ - /* check if the current L1 header acks to the current ordered TA */ - if (lchan->meas.l1_info[1] != lchan->rqd_ta) - return; - - /* sum measurement */ - chan_state->meas.toa256_sum += toa256; - if (++(chan_state->meas.toa_num) < 16) - return; - - /* complete set */ - toa256 = chan_state->meas.toa256_sum / chan_state->meas.toa_num; - - /* check for change of TOA */ - if (toa256 < -TOA256_9OPERCENT && lchan->rqd_ta > 0) { - LOGPLCHAN(lchan, DLOOP, LOGL_INFO, "TOA is too early (%d), now lowering TA from %d to %d\n", - toa256, lchan->rqd_ta, lchan->rqd_ta - 1); - lchan->rqd_ta--; - } else if (toa256 > TOA256_9OPERCENT && lchan->rqd_ta < 63) { - LOGPLCHAN(lchan, DLOOP, LOGL_INFO, "TOA is too late (%d), now raising TA from %d to %d\n", - toa256, lchan->rqd_ta, lchan->rqd_ta + 1); - lchan->rqd_ta++; - } else - LOGPLCHAN(lchan, DLOOP, LOGL_INFO, "TOA is correct (%d), keeping current TA of %d\n", - toa256, lchan->rqd_ta); - - chan_state->meas.toa_num = 0; - chan_state->meas.toa256_sum = 0; -} - -/*! Process a SACCH event as input to the MS power control and TA loop. Function - * is called once every uplink SACCH block is received. - * \param l1t L1 TRX instance on which we operate - * \param chan_nr RSL channel number on which we operate - * \param chan_state L1 scheduler channel state of the channel on which we operate - * \param[in] rssi Receive Signal Strength Indication - * \param[in] toa256 Time of Arrival in 1/256 symbol periods */ -void trx_loop_sacch_input(struct l1sched_trx *l1t, uint8_t chan_nr, - struct l1sched_chan_state *chan_state, int16_t toa256) -{ - struct gsm_lchan *lchan = &l1t->trx->ts[L1SAP_CHAN2TS(chan_nr)] - .lchan[l1sap_chan2ss(chan_nr)]; - struct phy_instance *pinst = trx_phy_instance(l1t->trx); - - /* if TA loop is enabled, handle it */ - if (pinst->phy_link->u.osmotrx.trx_ta_loop) - ta_val(lchan, chan_state, toa256); -} - void trx_loop_amr_input(struct l1sched_trx *l1t, uint8_t chan_nr, struct l1sched_chan_state *chan_state, int n_errors, int n_bits_total) |