projects
/
osmocom-bb.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b5abcb6
)
[WIP] Ugly hack to compensate lost time on TS change (high TS -> low TS)
author
Sylvain Munaut
<tnt@246tNt.com>
Thu, 23 Sep 2010 19:05:18 +0000
(21:05 +0200)
committer
Sylvain Munaut
<tnt@246tNt.com>
Mon, 17 Jan 2011 17:25:35 +0000
(18:25 +0100)
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
src/target/firmware/layer1/sync.c
patch
|
blob
|
history
diff --git
a/src/target/firmware/layer1/sync.c
b/src/target/firmware/layer1/sync.c
index
3397dc0
..
150205f
100644
(file)
--- a/
src/target/firmware/layer1/sync.c
+++ b/
src/target/firmware/layer1/sync.c
@@
-189,6
+189,7
@@
static int last_timestamp;
static inline void check_lost_frame(void)
{
static inline void check_lost_frame(void)
{
+ static int last_ts = -1;
int diff, timestamp = hwtimer_read(1);
if (last_timestamp < timestamp)
int diff, timestamp = hwtimer_read(1);
if (last_timestamp < timestamp)
@@
-196,6
+197,22
@@
static inline void check_lost_frame(void)
diff = last_timestamp - timestamp;
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: %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);
+ // }
+ }
+ last_ts = l1s.dedicated.tn;
+ }
+
/* allow for a bit of jitter */
if (diff < TIMER_TICKS_PER_TDMA - TIMER_TICK_JITTER ||
diff > TIMER_TICKS_PER_TDMA + TIMER_TICK_JITTER)
/* allow for a bit of jitter */
if (diff < TIMER_TICKS_PER_TDMA - TIMER_TICK_JITTER ||
diff > TIMER_TICKS_PER_TDMA + TIMER_TICK_JITTER)