summaryrefslogtreecommitdiffstats
path: root/src/target/firmware/layer1/sync.c
diff options
context:
space:
mode:
authorMuhammad Awais Aslam <mawais.aslam985@gmail.com>2017-12-19 15:57:20 +0500
committerVadim Yanitskiy <axilirator@gmail.com>2019-05-10 18:18:35 +0700
commit8f56258867ed321f8aee59f8cd0fb6a1f36090c9 (patch)
tree1816ba7e84b323ff391a94c86fc083553249de9c /src/target/firmware/layer1/sync.c
parent0f5f76f65149f82b00ffba40794c59add7bedc88 (diff)
WIP/HACK: bsic decoding of neighbour cells in dedicated mode and partially success in synchronized handovermawais/ho
Diffstat (limited to 'src/target/firmware/layer1/sync.c')
-rw-r--r--src/target/firmware/layer1/sync.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/target/firmware/layer1/sync.c b/src/target/firmware/layer1/sync.c
index 36f42975..6c39f51e 100644
--- a/src/target/firmware/layer1/sync.c
+++ b/src/target/firmware/layer1/sync.c
@@ -187,6 +187,8 @@ void l1s_reset_hw(void)
static int last_timestamp;
+static int last_ts;
+
static inline void check_lost_frame(void)
{
int diff, timestamp = hwtimer_read(1);
@@ -195,6 +197,26 @@ static inline void check_lost_frame(void)
last_timestamp += (4*TIMER_TICKS_PER_TDMA);
diff = last_timestamp - timestamp;
+
+ /* TS change compensation */
+ if (l1s.dedicated.type) {
+ if (l1s.dedicated.tn < last_ts) {
+ int ediff = ((8 - last_ts + l1s.dedicated.tn) * TIMER_TICKS_PER_TDMA) >> 3;
+ printf("TS Chg back: %d -> %d | %d %d\n",
+ last_ts, l1s.dedicated.tn, diff, ediff);
+
+ // if (((ediff - 2) < diff) && ((ediff + 2) > diff)) {
+ puts("ADV !\n");
+ l1s.current_time = l1s.next_time;
+ l1s_time_inc(&l1s.next_time, 1);
+ // }
+ } else if (l1s.dedicated.tn > last_ts)
+ printf("TS Chg forth: %d -> %d | %d\n",
+ last_ts, l1s.dedicated.tn, diff);
+ last_ts = l1s.dedicated.tn;
+ }
+// } else
+// last_ts = 0;
/* allow for a bit of jitter */
if (diff < TIMER_TICKS_PER_TDMA - TIMER_TICK_JITTER ||
@@ -367,6 +389,7 @@ void l1s_reset(void)
/* Leave dedicated mode */
l1s.dedicated.type = GSM_DCHAN_NONE;
+ last_ts = 0;
/* reset scheduler and hardware */
sched_gsmtime_reset();
@@ -382,10 +405,20 @@ void l1s_init(void)
{
unsigned int i;
+ for (i = 0; i < 64; i++) {
+ l1s.tpu_offsets_arfcn[i] = 0;
+ l1s.tpu_offsets[i] = 0;
+ l1s.nb_freq_diff[i] = 0;
+ l1s.nb_sb_freq_diff[i] = 0;
+ l1s.nb_sb_snr[i] = 0;
+ l1s.nb_frame_diff[i] = 0;
+ }
+
for (i = 0; i < ARRAY_SIZE(l1s.tx_queue); i++)
INIT_LLIST_HEAD(&l1s.tx_queue[i]);
l1s.tx_meas = NULL;
+
sched_gsmtime_init();
/* register FRAME interrupt as FIQ so it can interrupt normal IRQs */