summaryrefslogtreecommitdiffstats
path: root/src/target/firmware/layer1/tpu_window.c
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2010-09-23 21:05:18 +0200
committerHarald Welte <laforge@gnumonks.org>2019-05-23 13:03:36 +0200
commitfea9d9e0562d37afeb8f41a799620407667d0e8d (patch)
treecd0c95c95f0bd1a7590299a360b8ebaf82232502 /src/target/firmware/layer1/tpu_window.c
parent66e41a35c9c960273336a8edd8b167e61eb643b8 (diff)
[WIP] Change TPU offset on TS change or sync change
When TPU offset must be changed (assignment to different timeslot or handover to a different cell), all tasks will be disabled until new TPU offset has been applied. Currently scheduled tasks are finished before the new TPU offset is applied. On change of TPU offset, the TPU's interrupt may skip one frame when changing backwards in time. Also it may generate two interrupts when changing significantly forward in time. This is compensated by changing the GSM time. Change-Id: If858484a9cf497e0f6e8d84593ab3637c2668869
Diffstat (limited to 'src/target/firmware/layer1/tpu_window.c')
-rw-r--r--src/target/firmware/layer1/tpu_window.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/target/firmware/layer1/tpu_window.c b/src/target/firmware/layer1/tpu_window.c
index f4e76c16..abdad956 100644
--- a/src/target/firmware/layer1/tpu_window.c
+++ b/src/target/firmware/layer1/tpu_window.c
@@ -67,30 +67,26 @@ static const uint16_t tx_burst_duration[_NUM_L1_TXWIN] = {
[L1_TXWIN_AB] = L1_TX_AB_DURATION_Q,
};
-
static int _win_setup(__unused uint8_t p1, __unused uint8_t p2, __unused uint16_t p3)
{
- uint8_t tn;
-
- rfch_get_params(&l1s.next_time, NULL, NULL, &tn);
-
- l1s.tpu_offset = (5000 + l1s.tpu_offset + l1s.tpu_offset_correction) % 5000;
+ l1s.tpu_offset = (l1s.tpu_offset + l1s.tpu_offset_correction
+ + l1s.tpu_offset_shift + L1_TDMA_LENGTH_Q
+ + L1_TDMA_LENGTH_Q) % L1_TDMA_LENGTH_Q;
+ l1s.tpu_offset_changed = l1s.tpu_offset_correction
+ + l1s.tpu_offset_shift;
l1s.tpu_offset_correction = 0;
+ l1s.tpu_offset_shift = 0;
tpu_enq_at(4740);
- tpu_enq_sync((5000 + l1s.tpu_offset + (L1_BURST_LENGTH_Q * tn)) % 5000);
+ tpu_enq_sync(l1s.tpu_offset);
return 0;
}
static int _win_cleanup(__unused uint8_t p1, __unused uint8_t p2, __unused uint16_t p3)
{
- uint8_t tn;
-
- rfch_get_params(&l1s.next_time, NULL, NULL, &tn);
-
/* restore offset */
- tpu_enq_offset((5000 + l1s.tpu_offset + (L1_BURST_LENGTH_Q * tn)) % 5000);
+ tpu_enq_offset(l1s.tpu_offset);
return 0;
}